Index: akeLists.txt
===================================================================
--- /CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,210 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
-project(ariba CXX)
-
-# Version
-set(ariba_VERSION_MAJOR 0)
-set(ariba_VERSION_MINOR 8)
-set(ariba_VERSION_PATCH 99)
-set(ariba_VERSION ${ariba_VERSION_MAJOR}.${ariba_VERSION_MINOR}.${ariba_VERSION_PATCH})
-
-message(STATUS "Configuring ariba version ${ariba_VERSION}")
-
-list(APPEND CMAKE_MODULE_PATH "${ariba_SOURCE_DIR}/CMakeModules")
-
-
-# Add build type: Profiling
-SET( CMAKE_CXX_FLAGS_PROFILING "-O2 -g -pg" CACHE STRING
-    "Flags used by the C++ compiler during profiling builds."
-    FORCE )
-SET( CMAKE_C_FLAGS_PROFILING "-O2 -g -pg" CACHE STRING
-    "Flags used by the C compiler during profiling builds."
-    FORCE )
-SET( CMAKE_EXE_LINKER_FLAGS_PROFILING
-    "" CACHE STRING
-    "Flags used for linking binaries during profiling builds."
-    FORCE )
-SET( CMAKE_SHARED_LINKER_FLAGS_PROFILING
-    "" CACHE STRING
-    "Flags used by the shared libraries linker during profiling builds."
-    FORCE )
-MARK_AS_ADVANCED(
-    CMAKE_CXX_FLAGS_PROFILING
-    CMAKE_C_FLAGS_PROFILING
-    CMAKE_EXE_LINKER_FLAGS_PROFILING
-    CMAKE_SHARED_LINKER_FLAGS_PROFILING )
-
-# set default build type
-IF(NOT CMAKE_BUILD_TYPE)
-   SET(CMAKE_BUILD_TYPE Release
-       CACHE STRING "Choose the type of build : None Debug Release RelWithDebInfo MinSizeRel Profiling."
-       FORCE)
-ENDIF(NOT CMAKE_BUILD_TYPE)
-message(STATUS "Current build type is: ${CMAKE_BUILD_TYPE}")
-
-## Provide some choices for CMAKE_BUILD_TYPE
-set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
-    "" Release Debug RelWithDebInfo MinSizeRel Profiling)
-
-
-
-# Explicitly add BUILD_SHARED_LIBS to the user interface and default to on
-option(BUILD_SHARED_LIBS "Whether to build libraries shared or static" ON)
-mark_as_advanced(BUILD_SHARED_LIBS)
-
-
-
-# Option to produce statically linked binaries
-option(BUILD_STATIC_BINS
-    "Whether to link executables statically.
-If selected overrrides BUILD_SHARED_LIBS.
-This option has to be set BEFORE the initial creation of the CMake cache
-(this is only possible by using the non-interactive command line interface
-`cmake ../ -DBUILD_STATIC_BINS=ON`)
-Otherwise the library paths will not be rediscovered."
-    OFF
-    )
-
-if(DEFINED BUILD_STATIC_BINS_PREVIOUS_VALUE AND
-        ((BUILD_STATIC_BINS_PREVIOUS_VALUE AND NOT BUILD_STATIC_BINS) OR
-        (NOT BUILD_STATIC_BINS_PREVIOUS_VALUE AND BUILD_STATIC_BINS)))
-    message(FATAL_ERROR
-        "You can't set BUILD_STATIC_BINS to a different value after the "
-        "CMake cache has been built because then the library paths will not "
-        "be rediscovered. "
-        "Setting this before cache creation is only possible by using the "
-        "non-interactive command line interface: "
-        "`cmake ../ -DBUILD_STATIC_BINS=ON`"
-        )
-endif()
-set(BUILD_STATIC_BINS_PREVIOUS_VALUE "${BUILD_STATIC_BINS}" CACHE INTERNAL
-    "Internal value to detect whether the BUILD_STATIC_BINS has been previously
-    set to a different value"
-    )
-
-if(BUILD_STATIC_BINS)
-    set(BUILD_SHARED_LIBS OFF)
-    set(Boost_USE_STATIC_LIBS ON)
-    set(Boost_USE_STATIC_RUNTIME ON)
-    # Give priority to .a files (or equivalent)
-    set(CMAKE_FIND_LIBRARY_SUFFIXES 
-            ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES})
-endif(BUILD_STATIC_BINS)
-# End of option to produce statically linked binaries
-
-
-add_subdirectory(source)
-add_subdirectory(sample)
-add_subdirectory(docu)
-
-
-# enable unit testing (in general, see the "tests/" subdirectory for the actual tests)
-enable_testing()
-
-## Google Test Framework (Unit testing)
-add_subdirectory(gtest-1.7.0)
-
-# Tests (for ariba code)
-add_subdirectory(tests)
-
-
-# Install package information
-install(EXPORT ariba-targets
-    DESTINATION lib/ariba
-    COMPONENT Development
-    )
-
-configure_file(
-    pkg/ariba-config.cmake.in
-    pkg/ariba-config.cmake
-    @ONLY
-    )
-
-configure_file(
-    pkg/ariba-config-local.cmake.in
-    ariba-config.cmake
-    @ONLY
-    )
-
-configure_file(
-    pkg/ariba-config-version.cmake.in
-    ariba-config-version.cmake
-    @ONLY
-    )
-
-install(
-    FILES
-        "${ariba_BINARY_DIR}/pkg/ariba-config.cmake"
-        "${ariba_BINARY_DIR}/ariba-config-version.cmake"
-    DESTINATION lib/ariba
-    COMPONENT Development
-    )
-
-
-
-# Packaging
-set(CPACK_PACKAGE_VERSION_MAJOR
-    "${ariba_VERSION_MAJOR}"
-    )
-set(CPACK_PACKAGE_VERSION_MINOR
-    "${ariba_VERSION_MINOR}"
-    )
-set(CPACK_PACKAGE_VERSION_PATCH
-    "${ariba_VERSION_PATCH}"
-    )
-
-set(CPACK_SYSTEM_NAME
-    "${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}"
-    )
-
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
-    "Ariba P2P library"
-    )
-#TODO: set(CPACK_PACKAGE_DESCRIPTION_FILE)
-#TODO: set(CPACK_RESOURCE_FILE_README)
-#TODO: set(CPACK_RESOURCE_FILE_WELCOME)
-
-set(CPACK_PACKAGE_VENDOR
-    "Institute of Telematics, UniversitÃ€t Karlsruhe (TH)"
-    )
-
-set(CPACK_SOURCE_PACKAGE_FILE_NAME "ariba-${ariba_VERSION}")
-
-include(CPack)
Index: ackSourceConfig.cmake.in
===================================================================
--- /CPackSourceConfig.cmake.in	(revision 12775)
+++ 	(revision )
@@ -1,70 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-# Load "defaults"
-@_CPACK_OTHER_VARIABLES_@
-
-
-########################
-# Ignore certain paths #
-########################
-
-MACRO(regex_escape_string _OUT _IN)
-    # Escape special regex metacharacters with a backslash
-    string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" ${_OUT} "${_IN}")
-ENDMACRO()
-
-regex_escape_string(ariba_SOURCE_DIR_REGEX "@ariba_SOURCE_DIR@")
-
-# Paths in the main source dir to ignore
-set(ignore_paths
-    "build" # Ignore build directories when packing the tarballs
-            # intentionally also matches build-foo/
-    "\\.cproject$"
-    "\\.project$"
-    )
-
-foreach(ignore_path ${ignore_paths})
-    list(APPEND CPACK_SOURCE_IGNORE_FILES
-        "^${ariba_SOURCE_DIR_REGEX}/${ignore_path}"
-        )
-    
-    list(APPEND CPACK_IGNORE_FILES
-        "^${ariba_SOURCE_DIR_REGEX}/${ignore_path}"
-        )
-endforeach(ignore_path ${ignore_paths})
Index: /INSTALL
===================================================================
--- /INSTALL	(revision 12775)
+++ /INSTALL	(revision 2378)
@@ -1,172 +1,1 @@
-Please see the latest Installation instructions on http://ariba-underlay.org/
-here: http://ariba-underlay.org/trac/spovnet-base/wiki/BaseInstall
-
-Please see also http://spovnet.de/ for further information
-about Ariba and its application.
-
-
-Prerequisites
-=============
-ariba depends on libraries that may not be installed on your system:
-
-    * Boost (version >=1.42)
-    * GMP
-    * CMake (version >=2.8)
-
-and optionally on
-
-    * Log4Cxx (version >= 0.10.0) for more sophisticated logging
-    * Avahi for more efficient bootstrapping in local networks
-    * LibBluetooth/Bluez for bluetooth support
-    * Doxygen to build the documentation
-
-Furthermore, you need default development tools - that are most likely already
-installed on your system - such as gcc/g++, libtool, liblt-dev ...
-
-
-Quick Install
-=============
-
-ariba currently builds on Linux systems. Our reference platform is Ubuntu 8.04
-with the g++ compiler version 4.1. However, latest Ubuntu releases should work 
-too.
-
-Download the latest ariba package from the the download site
-http://ariba-underlay.org/downloads:
-
-Extract the archive and change into the project directory:
-> tar xfz ./ariba-x.x.x.tar.gz
-> cd ariba-x.x.x
-
-Alternatively, you could try to use the latest development code from our SVN
-trunk (attention: the code on trunk might break from time to time):
-> svn co https://svn.tm.kit.edu/SpoVNet-KA/entwicklung/ariba/trunk ariba-trunk
-> cd ariba-trunk
-
-Now create a directory to build ariba in:
-> mkdir build
-> cd build
-
-Next the makefiles have to be generated and the source compiled:
-> cmake ..
-> make
-
-HINT: you may use 
-> make -j 2 
-for a dual processor/core system to speed up the compilation,
-make -j 4 if you have quad-core respectively, and so on. If 
-the compilation stops, try make without the -j option again.
-
-And finally ariba will be installed into the system:
-> make install
-
-
-Custom Build Options
-====================
-The build may be customized in various ways by setting CMake options. This can
-be done by giving them as arguments on the command line:
-> cmake .. -DOPTION=value
-
-by using the CMake GUI which lets you set the variables graphically:
-> cmake-gui ..
-
-or running cmake in interactive mode:
-> cmake -i ..
-
-The last two ways also give an overview which options exist.
-
-Important options:
-
-CMAKE_INSTALL_PREFIX - Where to install the compiled files. The default on Unix
-                       platforms is /usr/local/. If you for example don't want
-                       or can't install system wide, you can specify a directory
-                       you have control over. The files will be installed to
-                       "${prefix}/include/", "${prefix}/lib/" and so on.
-
-CMAKE_BUILD_TYPE     - One of "", "Release", "Debug", "RelWithDebInfo" or
-                       "MinSizeRel". This influences the build in various ways
-                       (which compiler optimizations are turned on, whether
-                       debug symbols are included, what warnings to show etc.).
-
-ENABLE_{AVAHI,BLUETOOTH,LOG4CXX}
-                     - If set to OFF or 0 (ON is the default) it disables the
-                       support of the feature even if the corresponding library
-                       (see above) was detected to be present.
-
-<library>_INCLUDE_DIR - Where the directory containing the header files for
-                       <library> is located. If the library is installed in the
-                       usual system paths CMake should be able to automatically
-                       find the right location. If the library is located
-                       elsewhere (e.g. because you compiled it yourself in your
-                       home directory) then you may need to set this variable
-                       manually.
-
-<library>_LIBRARY    - Where the library file (aka the .so, .a or .dll file) for
-                       <library> is located. If the library is installed in the
-                       usual system paths CMake should be able to automatically
-                       find the right location. If the library is located
-                       elsewhere (e.g. because you compiled it yourself in your
-                       home directory) then you may need to set this variable
-                       manually.
-
-DOCUMENTATION_GENERATE_GRAPHICS
-                     - Whether the documentation should include graphics such as
-                       inheritance and include graphs (OFF by default). This
-                       might take a long time and consume a lot of space.
-
-CMAKE_{C,CXX}_COMPILER - Which C/C++ compiler to use
-CMAKE_{C,CXX}_FLAGS  - Which additional flags to give to the compiler (e.g. -pg
-                       for profiling support)
-
-
-Building the Documentation
-==========================
-To build the documentation once you can build the "docu" target:
-> make docu
-
-If you want to build the documentation on every build you can enable the
-ALWAYS_BUILD_DOCUMENTATION option in CMake.
-
-
-Running the PingPong Sample
-===========================
-The PingPong binary pingpong is installed in "${prefix}/lib/ariba/" or found
-directly in the build tree at "sample/pingpong/pingpong". It has one parameter,
-a configuration file. You can find sample configuration files in the
-"etc/pingpong" folder. If no configuration file is given, the node will randomly
-select its NodeID but will not find other nodes. This is because bootstrap
-modules are selected in the configuration file.
-> ./sample/pingpong/pingpong ../etc/pingpong/settings_node1.cnf
-
-When running the pingpong application it will output a large number of log
-messages and the initiator will wait for other nodes to join. You can start them
-using the configuration files settings_node1.cnf and settings_node2.cnf. You may
-need to adjust the configurations files: currently both node1 and node2 try to
-join the initiator on the local machine. This will only work if you start all
-instances on a local machine.
-
-Once the PingPong sample is running and the nodes have connected, each node will
-send out ping messages to every node he knows in the overlay structure every
-5 seconds. You can now e.g. test mobility of ariba and change the IP address of
-a node, or switch from LAN connection to WLAN. The links established by the
-PingPong sample through ariba are mobility invariant and automatically repaired.
-
-
-Cross-Compiling for Maemo
-=========================
-Ariba runs on Nokia Maemo 4 (tested) and probably Maemo 5. We have tested ariba
-on an N810 device. Cross-Compiling is done using Scratchbox. Use the
-preassembled Scratchbox version provided by Nokia which will install and
-configure the complete Scratchbox system automatically.
-
-If you compile for Maemo you have to set the HAVE_MAEMO option in CMake.
-
-Internally there are a number of special cases where handling on Maemo is
-different from normal Linux. If you require special handling, do the following
-in your code:
-
-#include "ariba/config.h"
-...
-#ifdef HAVE_MAEMO
- // special Maemo handling
-#endif
+link /usr/share/automake-1.10/INSTALL
Index: /Makefile.am
===================================================================
--- /Makefile.am	(revision 2378)
+++ /Makefile.am	(revision 2378)
@@ -0,0 +1,3 @@
+ACLOCAL_AMFLAGS = -I m4
+EXTRA_DIST = etc/* INSTALL LICENSE README bootstrap
+SUBDIRS    = docu source sample
Index: /README
===================================================================
--- /README	(revision 12775)
+++ /README	(revision 2378)
@@ -1,29 +1,1 @@
-This is the Ariba Underlay Abstraction software package
-bringing you seamless connectivity that "Just Works":
-
-- it greatly simplifies programming of networked applications
-- provides a per-application networking context and connectivity
-- abstracts network heterogeneity and mobility away
-- requires no infrastructure support
-- is fully self organzing
-
-Please see also the Spontaneous Virtual Networs project
-web site http://spovnet.de/ for further information
-about Ariba and its application.
-
-Documentation 
--------------
-http://ariba-underlay.org/wiki/BaseGuide
-
-Installation
-------------
-Please see file INSTALL
-or
-consult the latest Installation instructions on http://ariba-underlay.org/
-here: http://ariba-underlay.org/trac/spovnet-base/wiki/BaseInstall
-
-Contact
--------
-Check the web site for latest info, but you can also try to
-- directly contact us through info[at]ariba-underlay[dot]org
-- join the SpoVNet Google Groups here SpoVNet Google Groups 
+see http://www.tm.uka.de/ariba
Index: /bootstrap
===================================================================
--- /bootstrap	(revision 2378)
+++ /bootstrap	(revision 2378)
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+aclocal \
+&& libtoolize --force \
+&& automake -a --foreign --add-missing \
+&& autoreconf
Index: /bootstrap_libs
===================================================================
--- /bootstrap_libs	(revision 2378)
+++ /bootstrap_libs	(revision 2378)
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+cd lib
+
+echo "SPOVNET: preparing ..."
+rm -rf ./boost*
+rm -rf ./gmp*
+rm -rf ./log*
+
+echo "SPOVNET: downloading libraries needed by SpoVNet ..."
+wget http://www.tm.uka.de/~mayer/spovnet/spovnet_libs_v2.tar.gz
+
+echo "SPOVNET: unpacking libraries ..."
+tar xfz ./spovnet_libs_v2.tar.gz
+rm ./spovnet_libs_v2.tar.gz
+
+echo "SPOVNET: start building libraries ..."
+
+echo "SPOVNET: building boost ..."
+cd boost_1_35_0
+mkdir build
+./configure --prefix=$PWD/build --with-libraries=thread,serialization,filesystem,system
+make -j2
+make install
+cd build/lib
+ln ./libboost_thread-*-1_35.so.1.35.0 ./libboost_thread.so
+ln ./libboost_serialization-*-1_35.so.1.35.0 ./libboost_serialization.so
+ln ./libboost_filesystem-*-1_35.so.1.35.0 ./libboost_filesystem.so
+ln ./libboost_system-*-1_35.so.1.35.0 ./libboost_system.so
+cd ..
+cd ..
+cd ..
+echo "SPOVNET: building boost done!"
+
+echo "SPOVNET: building gmp ..."
+cd gmp_4_2_2
+mkdir build
+./configure --prefix=$PWD/build 
+make -j2
+make install
+cd ..
+echo "SPOVNET: building gmp done!"
+
+echo "SPOVNET: building log4cxx ..."
+cd log4cxx_0_10_0
+mkdir build
+./configure --prefix=$PWD/build 
+make -j2
+make install
+cd ..
+echo "SPOVNET: building log4cxx done!"
+
+echo "Built all libraries needed by SpoVNet!";
+cd ..
Index: /bootstrap_libs_path
===================================================================
--- /bootstrap_libs_path	(revision 2378)
+++ /bootstrap_libs_path	(revision 2378)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:'"$PWD/lib/boost_1_35_0/build/lib:$PWD/lib/gmp_4_2_2/build/lib:$PWD/lib/log4cxx_0_10_0/build/lib" >> ~/.bashrc
Index: /configure.ac
===================================================================
--- /configure.ac	(revision 2378)
+++ /configure.ac	(revision 2378)
@@ -0,0 +1,47 @@
+AC_INIT([ariba], [0.1.0], [http://www.ariba-underlay.org])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+AC_CONFIG_SRCDIR([source/ariba/interface/UnderlayAbstraction.cpp])
+AC_CONFIG_MACRO_DIR([m4])
+
+AC_ARG_ENABLE(debug, [  --enable-debug	Enable debug options], enable_debug=$enableval, enable_debug=no)
+AM_CONDITIONAL(DEBUG, test "$enable_debug" = yes)
+
+AC_ARG_ENABLE(profiling, [  --enable-profiling	Enable profiling], enable_profiling=$enableval, enable_profiling=no)
+AM_CONDITIONAL(PROFILING, test "$enable_profiling" = yes)
+
+AC_ARG_ENABLE(simulation, [  --enable-simulation	Enable simulation mode], enable_simulation=$enableval, enable_simulation=no)
+AM_CONDITIONAL(OMNET, test "$enable_simulation" = yes)
+
+AC_ARG_ENABLE(doxygen, [  --enable-doxygen	Enable doxygen documentation ], enable_doxygen=$enableval, enable_doxygen=no)
+AM_CONDITIONAL(DOXYGEN, test "$enable_doxygen" = yes)
+
+AC_PROG_LIBTOOL
+AC_PROG_CXX
+AC_PROG_CC
+AC_PROG_INSTALL
+
+AC_LANG(C++)
+
+dnl Check for doxygen and features
+AX_PROG_DOXYGEN
+
+dnl Check for libraries
+AX_GMP
+AX_LOG4CXX
+
+dnl Check for boost
+BOOST_REQUIRE([1.35])
+BOOST_THREADS
+BOOST_SYSTEM
+BOOST_FOREACH
+
+AC_CONFIG_FILES([
+Makefile
+source/Makefile
+source/ariba/Makefile
+sample/Makefile
+sample/tidy_pingpong/Makefile
+docu/Makefile
+docu/doxygen/Makefile
+])
+AC_OUTPUT
Index: cu/CMakeLists.txt
===================================================================
--- /docu/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,39 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_subdirectory(doxygen)
Index: /docu/Makefile.am
===================================================================
--- /docu/Makefile.am	(revision 2378)
+++ /docu/Makefile.am	(revision 2378)
@@ -0,0 +1,1 @@
+SUBDIRS = doxygen
Index: cu/doxygen/CMakeLists.txt
===================================================================
--- /docu/doxygen/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,104 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-option(DOCUMENTATION_GENERATE_GRAPHICS
-    "Whether graphics should be generated for the documentation. 
-This might take a long time and quite some amount of space"
-    OFF
-    )
-
-if(NOT DOCUMENTATION_GENERATE_GRAPHICS)
-    set(DOXYGEN_SKIP_DOT TRUE)
-endif(NOT DOCUMENTATION_GENERATE_GRAPHICS)
-
-find_package(Doxygen)
-
-if(DOXYGEN_FOUND)
-    # Generate the Doxyfile
-    configure_file(
-        Doxyfile.in
-        Doxyfile
-        @ONLY
-        )
-    
-    file(GLOB_RECURSE doxygen_SOURCES
-        "${ariba_SOURCE_DIR}/source/*.c"
-        "${ariba_SOURCE_DIR}/source/*.cc"
-        "${ariba_SOURCE_DIR}/source/*.cxx"
-        "${ariba_SOURCE_DIR}/source/*.cpp"
-        "${ariba_SOURCE_DIR}/source/*.c++"
-        "${ariba_SOURCE_DIR}/source/*.h"
-        "${ariba_SOURCE_DIR}/source/*.hh"
-        "${ariba_SOURCE_DIR}/source/*.hxx"
-        "${ariba_SOURCE_DIR}/source/*.hpp"
-        "${ariba_SOURCE_DIR}/source/*.h++"
-        )
-    
-    add_custom_command(
-        OUTPUT html/index.html
-        COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
-        MAIN_DEPENDENCY "${ariba_SOURCE_DIR}/source/ariba/ariba.h"
-        DEPENDS
-            ${doxygen_SOURCES}
-            "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile"
-        COMMENT "Building Doxygen documentation"
-        )
-    
-    
-    option(ALWAYS_BUILD_DOCUMENTATION
-        "Always build the documentation when compiling the project? If OFF the
-documentation is only built when building the target 'docu'"
-        OFF)
-    if(ALWAYS_BUILD_DOCUMENTATION)
-        set(BUILD_DOCU_ALL "ALL")
-    endif()
-    
-    add_custom_target(docu ${BUILD_DOCU_ALL}
-        DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/index.html"
-            
-        )
-    
-    
-    install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/"
-        DESTINATION share/doc/libariba-doc/html
-        COMPONENT Documentation
-        OPTIONAL
-        )
-    
-    set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES html)
-endif(DOXYGEN_FOUND)
Index: /docu/doxygen/Doxyfile
===================================================================
--- /docu/doxygen/Doxyfile	(revision 2378)
+++ /docu/doxygen/Doxyfile	(revision 2378)
@@ -0,0 +1,258 @@
+# Doxyfile 1.5.5
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING      = UTF-8
+PROJECT_NAME           = Ariba
+PROJECT_NUMBER         = 0.1.0
+OUTPUT_DIRECTORY       = ./
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = YES
+STRIP_FROM_PATH        = /home/mayer/SpoVNet/development-ka/spovnet/trunk/source
+STRIP_FROM_INC_PATH    = /home/mayer/SpoVNet/development-ka/spovnet/trunk/source
+SHORT_NAMES            = YES
+JAVADOC_AUTOBRIEF      = NO
+QT_AUTOBRIEF           = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+SEPARATE_MEMBER_PAGES  = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = NO
+OPTIMIZE_OUTPUT_JAVA   = NO
+OPTIMIZE_FOR_FORTRAN   = NO
+OPTIMIZE_OUTPUT_VHDL   = NO
+BUILTIN_STL_SUPPORT    = NO
+CPP_CLI_SUPPORT        = NO
+SIP_SUPPORT            = NO
+DISTRIBUTE_GROUP_DOC   = NO
+SUBGROUPING            = YES
+TYPEDEF_HIDES_STRUCT   = NO
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+EXTRACT_LOCAL_CLASSES  = YES
+EXTRACT_LOCAL_METHODS  = NO
+EXTRACT_ANON_NSPACES   = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = NO
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_GROUP_NAMES       = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = NO
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = ../../source
+INPUT_ENCODING         = UTF-8
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++
+RECURSIVE              = YES
+EXCLUDE                = /home/mayer/SpoVNet/development-ka/spovnet/trunk/source/ariba/communication/modules/transport/protlib
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXCLUDE_SYMBOLS        = 
+EXAMPLE_PATH           = /home/mayer/SpoVNet/development-ka/spovnet/trunk/sample
+EXAMPLE_PATTERNS       = *
+EXAMPLE_RECURSIVE      = YES
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = YES
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS              = NO
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+GENERATE_DOCSET        = NO
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+HTML_DYNAMIC_SECTIONS  = NO
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = NO
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = YES
+USE_PDFLATEX           = YES
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = NO
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = NO
+MSCGEN_PATH            = 
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = YES
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+CALLER_GRAPH           = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+DOT_GRAPH_MAX_NODES    = 50
+MAX_DOT_GRAPH_DEPTH    = 1000
+DOT_TRANSPARENT        = YES
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
Index: cu/doxygen/Doxyfile.in
===================================================================
--- /docu/doxygen/Doxyfile.in	(revision 12775)
+++ 	(revision )
@@ -1,1803 +1,0 @@
-# Doxyfile 1.7.6.1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project.
-#
-# All text after a hash (#) is considered a comment and will be ignored.
-# The format is:
-#       TAG = value [value, ...]
-# For lists items can also be appended using:
-#       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ").
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING      = UTF-8
-
-# The PROJECT_NAME tag is a single word (or sequence of words) that should
-# identify the project. Note that if you do not use Doxywizard you need
-# to put quotes around the project name if it contains spaces.
-
-PROJECT_NAME           = ariba
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER         = @ariba_VERSION@
-
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer
-# a quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF          =
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is
-# included in the documentation. The maximum height of the logo should not
-# exceed 55 pixels and the maximum width should not exceed 200 pixels.
-# Doxygen will copy the logo to the output directory.
-
-PROJECT_LOGO           =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY       = ./
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS         = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE        = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC      = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF           = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF       = "The $name class" \
-                         "The $name widget" \
-                         "The $name file" \
-                         is \
-                         provides \
-                         specifies \
-                         contains \
-                         represents \
-                         a \
-                         an \
-                         the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC    = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB  = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES        = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH        = "@ariba_BINARY_DIR@/source" \
-                         "@ariba_SOURCE_DIR@/source"
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH    = "@ariba_BINARY_DIR@/source" \
-                         "@ariba_SOURCE_DIR@/source"
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful if your file system
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES            = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF      = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF           = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS           = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES  = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE               = 8
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES                =
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding
-# "class=itcl::class" will allow you to use the command class in the
-# itcl::class meaning.
-
-TCL_SUBST              =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C  = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA   = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN   = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL   = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this
-# tag. The format is ext=language, where ext is a file extension, and language
-# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
-# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
-# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
-# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
-# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING      =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also makes the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT    = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT        = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT            = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT   = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC   = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING            = YES
-
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
-# unions are shown inside the group in which they are included (e.g. using
-# @ingroup) instead of on a separate page (for HTML and Man pages) or
-# section (for LaTeX and RTF).
-
-INLINE_GROUPED_CLASSES = NO
-
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
-# unions with only public data fields will be shown inline in the documentation
-# of the scope in which they are defined (i.e. file, namespace, or group
-# documentation), provided this scope is documented. If set to NO (the default),
-# structs, classes, and unions are shown on a separate page (for HTML and Man
-# pages) or section (for LaTeX and RTF).
-
-INLINE_SIMPLE_STRUCTS  = NO
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT   = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penalty.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will roughly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols.
-
-SYMBOL_CACHE_SIZE      = 0
-
-# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
-# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
-# their name and scope. Since this can be an expensive process and often the
-# same symbol appear multiple times in the code, doxygen keeps a cache of
-# pre-resolved symbols. If the cache is too small doxygen will become slower.
-# If the cache is too large, memory is wasted. The cache size is given by this
-# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols.
-
-LOOKUP_CACHE_SIZE      = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL            = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE        = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC         = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES  = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS  = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespaces are hidden.
-
-EXTRACT_ANON_NSPACES   = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS     = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES     = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS  = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS      = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS          = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES       = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES       = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES     = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
-# will list include files with double quotes in the documentation
-# rather than with sharp brackets.
-
-FORCE_LOCAL_INCLUDES   = NO
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO            = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS       = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS        = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
-# will sort the (brief and detailed) documentation of class members so that
-# constructors and destructors are listed first. If set to NO (the default)
-# the constructors will appear in the respective orders defined by
-# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
-# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
-# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES       = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME     = NO
-
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
-# do proper type resolution of all parameters of a function it will reject a
-# match between the prototype and the implementation of a member function even
-# if there is only one candidate or it is obvious which candidate to choose
-# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
-# will still accept a match between prototype and implementation in such cases.
-
-STRICT_PROTO_MATCHING  = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST      = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST      = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST       = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS       =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or macro consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and macros in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES  = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES        = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES       = NO
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES             = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES        = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER    =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. The create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option.
-# You can optionally specify a file name after the option, if omitted
-# DoxygenLayout.xml will be used as the name of the layout file.
-
-LAYOUT_FILE            =
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files
-# containing the references data. This must be a list of .bib files. The
-# .bib extension is automatically appended if omitted. Using this command
-# requires the bibtex tool to be installed. See also
-# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
-# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
-# feature you need bibtex and perl available in the search path.
-
-CITE_BIB_FILES         =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET                  = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS               = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED   = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR      = YES
-
-# The WARN_NO_PARAMDOC option can be enabled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC       = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT            = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE           =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT                  = "@ariba_BINARY_DIR@/source" \
-                         "@ariba_SOURCE_DIR@/source"
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING         = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
-# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
-# *.f90 *.f *.for *.vhd *.vhdl
-
-FILE_PATTERNS          = *.c \
-                         *.cc \
-                         *.cxx \
-                         *.cpp \
-                         *.c++ \
-                         *.h \
-                         *.hh \
-                         *.hxx \
-                         *.hpp \
-                         *.h++
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE              = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-# Note that relative paths are relative to the directory from which doxygen is
-# run.
-
-EXCLUDE                =
-
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
-# directories that are symbolic links (a Unix file system feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS       = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS       =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS        =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH           = "@ariba_SOURCE_DIR@/sample"
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS       =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE      = YES
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH             =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER           =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty or if
-# non of the patterns match the file name, INPUT_FILTER is applied.
-
-FILTER_PATTERNS        =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES    = NO
-
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
-# and it is also possible to disable source filtering for a specific pattern
-# using *.ext= (so without naming a filter). This option only has effect when
-# FILTER_SOURCE_FILES is enabled.
-
-FILTER_SOURCE_PATTERNS =
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER         = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES         = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS    = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION    = YES
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS              = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS       = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX     = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX    = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX          =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML          = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT            = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION    = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header. Note that when using a custom header you are responsible
-#  for the proper inclusion of any scripts and style sheets that doxygen
-# needs, which is dependent on the configuration options used.
-# It is advised to generate a default header using "doxygen -w html
-# header.html footer.html stylesheet.css YourConfigFile" and then modify
-# that header. Note that the header is subject to change so you typically
-# have to redo this when upgrading to a newer version of doxygen or when
-# changing the value of configuration settings such as GENERATE_TREEVIEW!
-
-HTML_HEADER            =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER            =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# style sheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET        =
-
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that
-# the files will be copied as-is; there are no commands or markers available.
-
-HTML_EXTRA_FILES       =
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
-# Doxygen will adjust the colors in the style sheet and background images
-# according to this color. Hue is specified as an angle on a colorwheel,
-# see http://en.wikipedia.org/wiki/Hue for more information.
-# For instance the value 0 represents red, 60 is yellow, 120 is green,
-# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
-# The allowed range is 0 to 359.
-
-HTML_COLORSTYLE_HUE    = 220
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
-# the colors in the HTML output. For a value of 0 the output will use
-# grayscales only. A value of 255 will produce the most vivid colors.
-
-HTML_COLORSTYLE_SAT    = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
-# the luminance component of the colors in the HTML output. Values below
-# 100 gradually make the output lighter, whereas values above 100 make
-# the output darker. The value divided by 100 is the actual gamma applied,
-# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
-# and 100 does not change the gamma.
-
-HTML_COLORSTYLE_GAMMA  = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting
-# this to NO can help when comparing the output of multiple runs.
-
-HTML_TIMESTAMP         = YES
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS     = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS  = NO
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
-
-GENERATE_DOCSET        = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME        = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID       = org.doxygen.Project
-
-# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
-# the documentation publisher. This should be a reverse domain-name style
-# string, e.g. com.mycompany.MyDocSet.documentation.
-
-DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
-
-# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
-
-DOCSET_PUBLISHER_NAME  = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP      = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE               =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION           =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI           = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING     =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC             = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND             = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
-# that can be used as input for Qt's qhelpgenerator to generate a
-# Qt Compressed Help (.qch) of the generated HTML documentation.
-
-GENERATE_QHP           = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE               =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE          = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER     = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
-# add. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME   =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
-# Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS  =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
-# Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS  =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION           =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
-#  will be generated, which together with the HTML files, form an Eclipse help
-# plugin. To install this plugin and make it available under the help contents
-# menu in Eclipse, the contents of the directory containing the HTML and XML
-# files needs to be copied into the plugins directory of eclipse. The name of
-# the directory within the plugins directory should be the same as
-# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
-# the help appears.
-
-GENERATE_ECLIPSEHELP   = NO
-
-# A unique identifier for the eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have
-# this name.
-
-ECLIPSE_DOC_ID         = org.doxygen.Project
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
-# at top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it. Since the tabs have the same information as the
-# navigation tree you can set this option to NO if you already set
-# GENERATE_TREEVIEW to YES.
-
-DISABLE_INDEX          = NO
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to YES, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
-# Windows users are probably better off using the HTML help feature.
-# Since the tree basically has the same information as the tab index you
-# could consider to set DISABLE_INDEX to NO when enabling this option.
-
-GENERATE_TREEVIEW      = NO
-
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
-# (range [0,1..20]) that doxygen will group on one line in the generated HTML
-# documentation. Note that a value of 0 will completely suppress the enum
-# values from appearing in the overview section.
-
-ENUM_VALUES_PER_LINE   = 4
-
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES       = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH         = 250
-
-# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
-# links to external symbols imported via tag files in a separate window.
-
-EXT_LINKS_IN_WINDOW    = NO
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE       = 10
-
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are
-# not supported properly for IE 6.0, but are supported on all modern browsers.
-# Note that when changing this option you need to delete any form_*.png files
-# in the HTML output before the changes have effect.
-
-FORMULA_TRANSPARENT    = YES
-
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
-# (see http://www.mathjax.org) which uses client side Javascript for the
-# rendering instead of using prerendered bitmaps. Use this if you do not
-# have LaTeX installed or if you want to formulas look prettier in the HTML
-# output. When enabled you also need to install MathJax separately and
-# configure the path to it using the MATHJAX_RELPATH option.
-
-USE_MATHJAX            = NO
-
-# When MathJax is enabled you need to specify the location relative to the
-# HTML output directory using the MATHJAX_RELPATH option. The destination
-# directory should contain the MathJax.js script. For instance, if the mathjax
-# directory is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to the
-# mathjax.org site, so you can quickly see the result without installing
-# MathJax, but it is strongly recommended to install a local copy of MathJax
-# before deployment.
-
-MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
-
-# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
-# names that should be enabled during MathJax rendering.
-
-MATHJAX_EXTENSIONS     =
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box
-# for the HTML output. The underlying search engine uses javascript
-# and DHTML and should work on any modern browser. Note that when using
-# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
-# (GENERATE_DOCSET) there is already a search function so this one should
-# typically be disabled. For large projects the javascript based search engine
-# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
-
-SEARCHENGINE           = NO
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a PHP enabled web server instead of at the web client
-# using Javascript. Doxygen will generate the search PHP script and index
-# file to put on the web server. The advantage of the server
-# based approach is that it scales better to large projects and allows
-# full text search. The disadvantages are that it is more difficult to setup
-# and does not have live searching capabilities.
-
-SERVER_BASED_SEARCH    = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX         = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT           = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-# Note that when enabling USE_PDFLATEX this option is only used for
-# generating bitmaps for formulas in the HTML output, but not in the
-# Makefile that is written to the output directory.
-
-LATEX_CMD_NAME         = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME     = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX          = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE             = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES         =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER           =
-
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
-# the generated latex document. The footer should contain everything after
-# the last chapter. If it is left blank doxygen will generate a
-# standard footer. Notice: only use this tag if you know what you are doing!
-
-LATEX_FOOTER           =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS         = YES
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX           = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE        = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES     = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include
-# source code with syntax highlighting in the LaTeX output.
-# Note that which sources are shown also depends on other settings
-# such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE      = NO
-
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
-# http://en.wikipedia.org/wiki/BibTeX for more info.
-
-LATEX_BIB_STYLE        = plain
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF           = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT             = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF            = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS         = NO
-
-# Load style sheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE    =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE    =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN           = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT             = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION          = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS              = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML           = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT             = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA             =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD                =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING     = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF   = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD       = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX          = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY         = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING   = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION        = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF     = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# pointed to by INCLUDE_PATH will be searched when a #include is found.
-
-SEARCH_INCLUDES        = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH           =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS  =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED             =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition that
-# overrules the definition found in the source code.
-
-EXPAND_AS_DEFINED      =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all references to function-like macros
-# that are alone on a line, have an all uppercase name, and do not end with a
-# semicolon, because these will confuse the parser if not removed.
-
-SKIP_FUNCTION_MACROS   = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES               =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE       =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS           = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS        = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH              = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option also works with HAVE_DOT disabled, but it is recommended to
-# install and use dot, since it yields more powerful graphs.
-
-CLASS_DIAGRAMS         = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH            =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS   = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT               = @DOXYGEN_DOT_FOUND@
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
-# allowed to run in parallel. When set to 0 (the default) doxygen will
-# base this on the number of processors available in the system. You can set it
-# explicitly to a value larger than 0 to get control over the balance
-# between CPU load and processing speed.
-
-DOT_NUM_THREADS        = 0
-
-# By default doxygen will use the Helvetica font for all dot files that
-# doxygen generates. When you want a differently looking font you can specify
-# the font name using DOT_FONTNAME. You need to make sure dot is able to find
-# the font, which can be done by putting it in a standard location or by setting
-# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
-# directory containing the font.
-
-DOT_FONTNAME           = Helvetica
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE           = 10
-
-# By default doxygen will tell dot to use the Helvetica font.
-# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
-# set the path where dot can find it.
-
-DOT_FONTPATH           =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH            = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH    = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS           = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK               = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS     = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH          = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH      = YES
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH             = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH           = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will generate a graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY    = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH        = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are svg, png, jpg, or gif.
-# If left blank png will be used. If you choose svg you need to set
-# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
-# visible in IE 9+ (other browsers do not have this requirement).
-
-DOT_IMAGE_FORMAT       = png
-
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
-# enable generation of interactive SVG images that allow zooming and panning.
-# Note that this requires a modern browser other than Internet Explorer.
-# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
-# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
-# visible. Older versions of IE do not have SVG support.
-
-INTERACTIVE_SVG        = NO
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH               = "@DOXYGEN_DOT_PATH@"
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS           =
-
-# The MSCFILE_DIRS tag can be used to specify one or more directories that
-# contain msc files that are included in the documentation (see the
-# \mscfile command).
-
-MSCFILE_DIRS           =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES    = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH    = 1000
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT        = YES
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS      = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND        = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP            = YES
Index: /docu/doxygen/Makefile.am
===================================================================
--- /docu/doxygen/Makefile.am	(revision 2378)
+++ /docu/doxygen/Makefile.am	(revision 2378)
@@ -0,0 +1,4 @@
+if DOXYGEN
+html-local:
+	$(DOXYGEN_PROG) Doxyfile
+endif
Index: /etc/pingpongconfig/settings_initiator.cnf
===================================================================
--- /etc/pingpongconfig/settings_initiator.cnf	(revision 2378)
+++ /etc/pingpongconfig/settings_initiator.cnf	(revision 2378)
@@ -0,0 +1,9 @@
+GENERAL_Initiator = true
+
+BASE_nodeid = 1
+BASE_bootstrapIP = 127.0.0.1:5002
+BASE_port = 5002
+
+# Demo
+#DEMO_OvlVisIP = 127.0.0.1
+#DEMO_OvlVisPort = 3500
Index: /etc/pingpongconfig/settings_node1.cnf
===================================================================
--- /etc/pingpongconfig/settings_node1.cnf	(revision 2378)
+++ /etc/pingpongconfig/settings_node1.cnf	(revision 2378)
@@ -0,0 +1,9 @@
+GENERAL_Initiator = false
+
+BASE_nodeid = 2
+BASE_bootstrapIP = 127.0.0.1:5002
+BASE_port = 5003
+
+# Demo
+#DEMO_OvlVisIP = 127.0.0.1
+#DEMO_OvlVisPort = 3500
Index: /etc/pingpongconfig/settings_node2.cnf
===================================================================
--- /etc/pingpongconfig/settings_node2.cnf	(revision 2378)
+++ /etc/pingpongconfig/settings_node2.cnf	(revision 2378)
@@ -0,0 +1,9 @@
+GENERAL_Initiator = false
+
+BASE_nodeid = 3
+BASE_bootstrapIP = 127.0.0.1:5002
+BASE_port = 5010
+
+# Demo
+#DEMO_OvlVisIP = 127.0.0.1
+#DEMO_OvlVisPort = 3500
Index: /m4/ax_gmp.m4
===================================================================
--- /m4/ax_gmp.m4	(revision 2378)
+++ /m4/ax_gmp.m4	(revision 2378)
@@ -0,0 +1,20 @@
+# SYNOPSIS
+#
+#   AX_GMP()
+#
+# DESCRIPTION
+#
+#   Test for the Gnu Multiple Precision library
+#
+# LAST MODIFICATION
+#
+#   2008-12-11
+
+AC_DEFUN([AX_GMP],
+[
+  AC_CHECK_HEADERS(gmp.h,,
+    [AC_MSG_ERROR([GNU Multiple Precision headers not found (GMP, http://gmplib.org)])])
+    
+  AC_CHECK_LIB([gmp],[__gmpz_init],,
+    [AC_MSG_ERROR([GNU Multiple Precision library not found (GMP, http://gmplib.org)])])
+])
Index: /m4/ax_log4cxx.m4
===================================================================
--- /m4/ax_log4cxx.m4	(revision 2378)
+++ /m4/ax_log4cxx.m4	(revision 2378)
@@ -0,0 +1,51 @@
+# SYNOPSIS
+#
+#   AX_LOG4CXX()
+#
+# DESCRIPTION
+#
+#   Check installation of Apache C++ logging library log4cxx, version
+#   0.10.0 or greater.
+#   
+#
+# LAST MODIFICATION
+#
+#   2008-12-11
+
+AC_DEFUN([AX_LOG4CXX],
+[
+  AC_LANG_PUSH([C++])
+
+  AC_CHECK_HEADERS([[log4cxx/logger.h]],,
+    [AC_MSG_ERROR([Could not find log4cxx headers (http://logging.apache.org/log4cxx/index.html)])
+  ])
+
+  AC_MSG_CHECKING([log4cxx library files (version >=0.10.0)])
+
+  dnl Save old $LIBS to eventually restore it.
+  ax_log4cxx_save_libs="$LIBS"
+  LIBS="$LIBS -llog4cxx"
+  
+  AC_LINK_IFELSE([AC_LANG_PROGRAM(
+    [[
+#include <log4cxx/logger.h>
+#include <log4cxx/basicconfigurator.h>
+    ]], [
+    log4cxx::BasicConfigurator::configure();
+    log4cxx::LoggerPtr logger = log4cxx::Logger::getRootLogger();
+    logger->setLevel(log4cxx::Level::getDebug());
+    LOG4CXX_INFO(logger, "Simple message text.");])],
+    dnl Success
+    AC_MSG_RESULT(yes)
+    [LIBS="-llog4cxx $LIBS"]
+    AC_DEFINE(HAVE_LIBLOG4CXX, [1], "Define to 1 if you have log4cxx library installed")
+    , dnl failed
+    AC_MSG_RESULT(no)
+    AC_MSG_FAILURE([[Could not find log4cxx library.
+Version 0.10.0 or greater is required.
+(http://logging.apache.org/log4cxx/index.html)]])
+    dnl restore old lib state
+    LIBS="$ax_log4cxx_save_libs")
+    
+  AC_LANG_POP
+])
Index: /m4/ax_prog_doxygen.m4
===================================================================
--- /m4/ax_prog_doxygen.m4	(revision 2378)
+++ /m4/ax_prog_doxygen.m4	(revision 2378)
@@ -0,0 +1,36 @@
+# SYNOPSIS
+#
+#   AX_PROG_DOXYGEN()
+#
+# DESCRIPTION
+#
+#   Test for the Doxygen
+#
+#   --enable-doxygen option enable or disable generation of the
+#   documentation, when available.
+#
+# LAST MODIFICATION
+#
+#   2008-12-11
+
+AC_DEFUN([AX_PROG_DOXYGEN],
+[
+AC_ARG_VAR([DOXYGEN_PROG],[Doxygen program])
+
+AC_ARG_ENABLE([doxygen],
+  AS_HELP_STRING([--enable-doxygen], [Turn on doxygen documentation generation.]))
+
+AM_CONDITIONAL([DOXYGEN], [test "x${enable_doxygen}" = "xyes"])
+
+if test "${enable_doxygen}" = "yes"; then
+   dnl Check for existance of doxygen
+   AC_CHECK_PROG([DOXYGEN_PROG],
+     [doxygen],
+     doxygen,
+     no)
+fi
+
+if test "$DOXYGEN_PROG" = "no"; then
+   AC_MSG_ERROR([Doxygen was not found. Check for installation or configure with --disable-doxygen])
+fi
+])
Index: /m4/boost.m4
===================================================================
--- /m4/boost.m4	(revision 2378)
+++ /m4/boost.m4	(revision 2378)
@@ -0,0 +1,889 @@
+# boost.m4: Locate Boost headers and libraries for autoconf-based projects.
+# Copyright (C) 2007  Benoit Sigoure <tsuna@lrde.epita.fr>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Additional permission under section 7 of the GNU General Public
+# License, version 3 ("GPLv3"):
+#
+# If you convey this file as part of a work that contains a
+# configuration script generated by Autoconf, you may do so under
+# terms of your choice.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# serial 8
+# Original sources can be found at http://repo.or.cz/w/boost.m4.git
+# You can fetch the latest version of the script by doing:
+#   wget 'http://repo.or.cz/w/boost.m4.git?a=blob_plain;f=build-aux/boost.m4;hb=HEAD' -O boost.m4
+
+# ------ #
+# README #
+# ------ #
+
+# This file provides several macros to use the various Boost libraries.
+# The first macro is BOOST_REQUIRE.  It will simply check if it's possible to
+# find the Boost headers of a given (optional) minimum version and it will
+# define BOOST_CPPFLAGS accordingly.  It will add an option --with-boost to
+# your configure so that users can specify non standard locations.
+# For more README and documentation, go to http://repo.or.cz/w/boost.m4.git
+# Note: THESE MACROS ASSUME THAT YOU USE LIBTOOL.  If you don't, don't worry,
+# simply read the README, it will show you what to do step by step.
+
+m4_pattern_forbid([^_?BOOST_])
+
+# BOOST_REQUIRE([VERSION])
+# ------------------------
+# Look for Boost.  If version is given, it must either be a literal of the form
+# "X.Y.Z" where X, Y and Z are integers (the ".Z" part being optional) or a
+# variable "$var".
+# Defines the value BOOST_CPPFLAGS.  This macro only checks for headers with
+# the required version, it does not check for any of the Boost libraries.
+# FIXME: Add a 2nd optional argument so that it's not fatal if Boost isn't found
+# and add an AC_DEFINE to tell whether HAVE_BOOST.
+AC_DEFUN([BOOST_REQUIRE],
+[dnl First find out what kind of argument we have.
+dnl If we have an empty argument, there is no constraint on the version of
+dnl Boost to use.  If it's a literal version number, we can split it in M4 (so
+dnl the resulting configure script will be smaller/faster).  Otherwise we do
+dnl the splitting at runtime.
+m4_bmatch([$1],
+  [^ *$], [m4_pushdef([BOOST_VERSION_REQ], [])dnl
+           boost_version_major=0
+           boost_version_minor=0
+           boost_version_subminor=0
+],
+  [^[0-9]+\([-._][0-9]+\)*$],
+    [m4_pushdef([BOOST_VERSION_REQ], [ version >= $1])dnl
+     boost_version_major=m4_bregexp([$1], [^\([0-9]+\)], [\1])
+     boost_version_minor=m4_bregexp([$1], [^[0-9]+[-._]\([0-9]+\)], [\1])
+     boost_version_subminor=m4_bregexp([$1], [^[0-9]+[-._][0-9]+[-._]\([0-9]+\)], [\1])
+],
+  [^\$[a-zA-Z_]+$],
+    [m4_pushdef([BOOST_VERSION_REQ], [])dnl
+     boost_version_major=`expr "X$1" : 'X\([[^-._]]*\)'`
+     boost_version_minor=`expr "X$1" : 'X[[0-9]]*[[-._]]\([[^-._]]*\)'`
+     boost_version_subminor=`expr "X$1" : 'X[[0-9]]*[[-._]][[0-9]]*[[-._]]\([[0-9]]*\)'`
+     case $boost_version_major:$boost_version_minor in #(
+       *: | :* | *[[^0-9]]*:* | *:*[[^0-9]]*)
+         AC_MSG_ERROR([[Invalid argument for REQUIRE_BOOST: `$1']])
+         ;;
+     esac
+],
+  [m4_fatal(Invalid argument: `$1')]
+)dnl
+AC_ARG_WITH([boost],
+   [AS_HELP_STRING([--with-boost=DIR],
+                   [prefix of Boost]BOOST_VERSION_REQ[ @<:@guess@:>@])])dnl
+AC_SUBST([DISTCHECK_CONFIGURE_FLAGS],
+         ["$DISTCHECK_CONFIGURE_FLAGS '--with-boost=$with_boost'"])
+  AC_CACHE_CHECK([for Boost headers[]BOOST_VERSION_REQ],
+    [boost_cv_inc_path],
+    [boost_cv_inc_path=no
+AC_LANG_PUSH([C++])dnl
+    boost_subminor_chk=
+    test x"$boost_version_subminor" != x \
+      && boost_subminor_chk="|| (B_V_MAJ == $boost_version_major \
+&& B_V_MIN == $boost_version_minor \
+&& B_V_SUB < $boost_version_subminor)"
+    for boost_dir in "$with_boost/include" '' \
+             /opt/local/include /usr/local/include /opt/include /usr/include \
+             "$with_boost" C:/Boost/include
+    do
+    # Without --layout=system, Boost (or at least some versions) installs
+    # itself in <prefix>/include/boost-<version>.  This inner loop helps to
+    # find headers in such directories.
+    # I didn't indent this loop on purpose (to avoid over-indented code)
+    for boost_inc in "$boost_dir" "$boost_dir"/boost-*
+    do
+      # $boost_inc can often be a symlink, so keep -e here.
+      test -e "$boost_inc" || continue
+      # Ensure that version.hpp exists: we're going to read it.  Moreover,
+      # Boost could be reachable thanks to the default include path so we can
+      # mistakenly accept a wrong include path without this check.
+      test -e "$boost_inc/boost/version.hpp" || continue
+      boost_save_CPPFLAGS=$CPPFLAGS
+      test x"$boost_inc" != x && CPPFLAGS="$CPPFLAGS -I$boost_inc"
+m4_pattern_allow([^BOOST_VERSION$])dnl
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/version.hpp>
+#ifndef BOOST_VERSION
+# error BOOST_VERSION is not defined
+#endif
+#define B_V_MAJ (BOOST_VERSION / 100000)
+#define B_V_MIN (BOOST_VERSION / 100 % 1000)
+#define B_V_SUB (BOOST_VERSION % 100)
+#if (B_V_MAJ < $boost_version_major) \
+   || (B_V_MAJ == $boost_version_major \
+       && B_V_MIN < $boost_version_minor) $boost_subminor_chk
+# error Boost headers version < $1
+#endif
+]])], [boost_cv_inc_path=yes], [boost_cv_version=no])
+      CPPFLAGS=$boost_save_CPPFLAGS
+      if test x"$boost_cv_inc_path" = xyes; then
+        if test x"$boost_inc" != x; then
+          boost_cv_inc_path=$boost_inc
+        fi
+        break 2
+      fi
+    done
+    done
+AC_LANG_POP([C++])dnl
+    ])
+    case $boost_cv_inc_path in #(
+      no)
+        AC_MSG_ERROR([Could not find Boost headers[]BOOST_VERSION_REQ])
+        ;;#(
+      yes)
+        BOOST_CPPFLAGS=
+        ;;#(
+      *)
+        BOOST_CPPFLAGS="-I$boost_cv_inc_path"
+        ;;
+    esac
+AC_SUBST([BOOST_CPPFLAGS])dnl
+  AC_CACHE_CHECK([for Boost's header version],
+    [boost_cv_lib_version],
+    [m4_pattern_allow([^BOOST_LIB_VERSION$])dnl
+    boost_cv_lib_version=unknown
+    boost_sed_version='/^.*BOOST_LIB_VERSION.*"\([[^"]]*\)".*$/!d;s//\1/'
+    boost_version_hpp="$boost_inc/boost/version.hpp"
+    test -e "$boost_version_hpp" \
+      && boost_cv_lib_version=`sed "$boost_sed_version" "$boost_version_hpp"`
+    ])
+    # e.g. "134" for 1_34_1 or "135" for 1_35
+    boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'`
+    case $boost_major_version in
+      '' | *[[^0-9]]*)
+        AC_MSG_ERROR([Invalid value: boost_major_version=$boost_major_version])
+        ;;
+    esac
+m4_popdef([BOOST_VERSION_REQ])dnl
+])# BOOST_REQUIRE
+
+
+# BOOST_FIND_HEADER([HEADER-NAME], [ACTION-IF-NOT-FOUND], [ACTION-IF-FOUND])
+# --------------------------------------------------------------------------
+# Wrapper around AC_CHECK_HEADER for Boost headers.  Useful to check for
+# some parts of the Boost library which are only made of headers and don't
+# require linking (such as Boost.Foreach).
+#
+# Default ACTION-IF-NOT-FOUND: Fail with a fatal error.
+#
+# Default ACTION-IF-FOUND: define the preprocessor symbol HAVE_<HEADER-NAME> in
+# case of success # (where HEADER-NAME is written LIKE_THIS, e.g.,
+# HAVE_BOOST_FOREACH_HPP).
+AC_DEFUN([BOOST_FIND_HEADER],
+[AC_REQUIRE([BOOST_REQUIRE])dnl
+AC_LANG_PUSH([C++])dnl
+boost_save_CPPFLAGS=$CPPFLAGS
+CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+AC_CHECK_HEADER([$1],
+  [m4_default([$3], [AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1],
+                               [Define to 1 if you have <$1>])])],
+  [m4_default([$2], [AC_MSG_ERROR([cannot find $1])])])
+CPPFLAGS=$boost_save_CPPFLAGS
+AC_LANG_POP([C++])dnl
+])# BOOST_FIND_HEADER
+
+
+# BOOST_FIND_LIB([LIB-NAME], [PREFERRED-RT-OPT], [HEADER-NAME], [CXX-TEST],
+#                [CXX-PROLOGUE])
+# -------------------------------------------------------------------------
+# Look for the Boost library LIB-NAME (e.g., LIB-NAME = `thread', for
+# libboost_thread).  Check that HEADER-NAME works and check that
+# libboost_LIB-NAME can link with the code CXX-TEST.  The optional argument
+# CXX-PROLOGUE can be used to include some C++ code before the `main'
+# function.
+#
+# Invokes BOOST_FIND_HEADER([HEADER-NAME]) (see above).
+#
+# Boost libraries typically come compiled with several flavors (with different
+# runtime options) so PREFERRED-RT-OPT is the preferred suffix.  A suffix is one
+# or more of the following letters: sgdpn (in that order).  s = static
+# runtime, d = debug build, g = debug/diagnostic runtime, p = STLPort build,
+# n = (unsure) STLPort build without iostreams from STLPort (it looks like `n'
+# must always be used along with `p').  Additionally, PREFERRED-RT-OPT can
+# start with `mt-' to indicate that there is a preference for multi-thread
+# builds.  Some sample values for PREFERRED-RT-OPT: (nothing), mt, d, mt-d, gdp
+# ...  If you want to make sure you have a specific version of Boost
+# (eg, >= 1.33) you *must* invoke BOOST_REQUIRE before this macro.
+AC_DEFUN([BOOST_FIND_LIB],
+[AC_REQUIRE([_BOOST_FIND_COMPILER_TAG])dnl
+AC_REQUIRE([BOOST_REQUIRE])dnl
+AC_REQUIRE([_BOOST_GUESS_WHETHER_TO_USE_MT])dnl
+AC_LANG_PUSH([C++])dnl
+AS_VAR_PUSHDEF([Boost_lib], [boost_cv_lib_$1])dnl
+AS_VAR_PUSHDEF([Boost_lib_LDFLAGS], [boost_cv_lib_$1_LDFLAGS])dnl
+AS_VAR_PUSHDEF([Boost_lib_LIBS], [boost_cv_lib_$1_LIBS])dnl
+BOOST_FIND_HEADER([$3])
+boost_save_CPPFLAGS=$CPPFLAGS
+CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+# Now let's try to find the library.  The algorithm is as follows: first look
+# for a given library name according to the user's PREFERRED-RT-OPT.  For each
+# library name, we prefer to use the ones that carry the tag (toolset name).
+# Each library is searched through the various standard paths were Boost is
+# usually installed.  If we can't find the standard variants, we try to
+# enforce -mt (for instance on MacOSX, libboost_threads.dylib doesn't exist
+# but there's -obviously- libboost_threads-mt.dylib).
+AC_CACHE_CHECK([for the Boost $1 library], [Boost_lib],
+  [Boost_lib=no
+  case "$2" in #(
+    mt | mt-) boost_mt=-mt; boost_rtopt=;; #(
+    mt* | mt-*) boost_mt=-mt; boost_rtopt=`expr "X$2" : 'Xmt-*\(.*\)'`;; #(
+    *) boost_mt=; boost_rtopt=$2;;
+  esac
+  # Find the proper debug variant depending on what we've been asked to find.
+  case $boost_rtopt in #(
+    *d*) boost_rt_d=$boost_rtopt;; #(
+    *[[sgpn]]*) # Insert the `d' at the right place (in between `sg' and `pn')
+      boost_rt_d=`echo "$boost_rtopt" | sed 's/\(s*g*\)\(p*n*\)/\1\2/'`;; #(
+    *) boost_rt_d='-d';;
+  esac
+  # If the PREFERRED-RT-OPT are not empty, prepend a `-'.
+  test -n "$boost_rtopt" && boost_rtopt="-$boost_rtopt"
+  $boost_guess_use_mt && boost_mt=-mt
+  # Look for the abs path the static archive.
+  # $libext is computed by Libtool but let's make sure it's non empty.
+  test -z "$libext" &&
+    AC_MSG_ERROR([the libext variable is empty, did you invoke Libtool?])
+  boost_save_ac_objext=$ac_objext
+  # Generate the test file.
+  AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <$3>
+$5], [$4])])
+dnl Optimization hacks: compiling C++ is slow, especially with Boost.  What
+dnl we're trying to do here is guess the right combination of link flags
+dnl (LIBS / LDFLAGS) to use a given library.  This can take several
+dnl iterations before it succeeds and is thus *very* slow.  So what we do
+dnl instead is that we compile the code first (and thus get an object file,
+dnl typically conftest.o).  Then we try various combinations of link flags
+dnl until we succeed to link conftest.o in an executable.  The problem is
+dnl that the various TRY_LINK / COMPILE_IFELSE macros of Autoconf always
+dnl remove all the temporary files including conftest.o.  So the trick here
+dnl is to temporarily change the value of ac_objext so that conftest.o is
+dnl preserved accross tests.  This is obviously fragile and I will burn in
+dnl hell for not respecting Autoconf's documented interfaces, but in the
+dnl mean time, it optimizes the macro by a factor of 5 to 30.
+dnl Another small optimization: the first argument of AC_COMPILE_IFELSE left
+dnl empty because the test file is generated only once above (before we
+dnl start the for loops).
+  AC_COMPILE_IFELSE([],
+    [ac_objext=do_not_rm_me_plz],
+    [AC_MSG_ERROR([Cannot compile a test that uses Boost $1])])
+  ac_objext=$boost_save_ac_objext
+  boost_failed_libs=
+# Don't bother to ident the 6 nested for loops, only the 2 innermost ones
+# matter.
+for boost_tag_ in -$boost_cv_lib_tag ''; do
+for boost_ver_ in -$boost_cv_lib_version ''; do
+for boost_mt_ in $boost_mt -mt ''; do
+for boost_rtopt_ in $boost_rtopt '' -d; do
+  for boost_lib in \
+    boost_$1$boost_tag_$boost_mt_$boost_rtopt_$boost_ver_ \
+    boost_$1$boost_tag_$boost_rtopt_$boost_ver_ \
+    boost_$1$boost_tag_$boost_mt_$boost_ver_ \
+    boost_$1$boost_tag_$boost_ver_
+  do
+    # Avoid testing twice the same lib
+    case $boost_failed_libs in #(
+      *@$boost_lib@*) continue;;
+    esac
+    # If with_boost is empty, we'll search in /lib first, which is not quite
+    # right so instead we'll try to a location based on where the headers are.
+    boost_tmp_lib=$with_boost
+    test x"$with_boost" = x && boost_tmp_lib=${boost_cv_inc_path%/include}
+    for boost_ldpath in "$boost_tmp_lib/lib" '' \
+             /opt/local/lib /usr/local/lib /opt/lib /usr/lib \
+             "$with_boost" C:/Boost/lib /lib /usr/lib64 /lib64
+    do
+      test -e "$boost_ldpath" || continue
+      boost_save_LDFLAGS=$LDFLAGS
+      # Are we looking for a static library?
+      case $boost_ldpath:$boost_rtopt_ in #(
+        *?*:*s*) # Yes (Non empty boost_ldpath + s in rt opt)
+          Boost_lib_LIBS="$boost_ldpath/lib$boost_lib.$libext"
+          test -e "$Boost_lib_LIBS" || continue;; #(
+        *) # No: use -lboost_foo to find the shared library.
+          Boost_lib_LIBS="-l$boost_lib";;
+      esac
+      boost_save_LIBS=$LIBS
+      LIBS="$Boost_lib_LIBS $LIBS"
+      test x"$boost_ldpath" != x && LDFLAGS="$LDFLAGS -L$boost_ldpath"
+dnl First argument of AC_LINK_IFELSE left empty because the test file is
+dnl generated only once above (before we start the for loops).
+      _BOOST_AC_LINK_IFELSE([],
+                            [Boost_lib=yes], [Boost_lib=no])
+      ac_objext=$boost_save_ac_objext
+      LDFLAGS=$boost_save_LDFLAGS
+      LIBS=$boost_save_LIBS
+      if test x"$Boost_lib" = xyes; then
+        Boost_lib_LDFLAGS="-L$boost_ldpath -R$boost_ldpath"
+        break 6
+      else
+        boost_failed_libs="$boost_failed_libs@$boost_lib@"
+      fi
+    done
+  done
+done
+done
+done
+done
+rm -f conftest.$ac_objext
+])
+case $Boost_lib in #(
+  no) AC_MSG_ERROR([Could not find the flags to link with Boost $1])
+    ;;
+esac
+AC_SUBST(AS_TR_CPP([BOOST_$1_LDFLAGS]), [$Boost_lib_LDFLAGS])
+AC_SUBST(AS_TR_CPP([BOOST_$1_LIBS]), [$Boost_lib_LIBS])
+CPPFLAGS=$boost_save_CPPFLAGS
+AS_VAR_POPDEF([Boost_lib])dnl
+AS_VAR_POPDEF([Boost_lib_LDFLAGS])dnl
+AS_VAR_POPDEF([Boost_lib_LIBS])dnl
+AC_LANG_POP([C++])dnl
+])# BOOST_FIND_LIB
+
+
+# --------------------------------------- #
+# Checks for the various Boost libraries. #
+# --------------------------------------- #
+
+# List of boost libraries: http://www.boost.org/libs/libraries.htm
+# The page http://beta.boost.org/doc/libs is useful: it gives the first release
+# version of each library (among other things).
+
+
+# BOOST_ASIO()
+# ------------
+# Look for Boost.Asio (new in Boost 1.35).
+AC_DEFUN([BOOST_ASIO],
+[AC_REQUIRE([BOOST_SYSTEM])dnl
+BOOST_FIND_HEADER([boost/asio.hpp])])
+
+
+# BOOST_BIND()
+# ------------
+# Look for Boost.Bind
+AC_DEFUN([BOOST_BIND],
+[BOOST_FIND_HEADER([boost/bind.hpp])])
+
+
+# BOOST_CONVERSION()
+# ------------------
+# Look for Boost.Conversion (cast / lexical_cast)
+AC_DEFUN([BOOST_CONVERSION],
+[BOOST_FIND_HEADER([boost/cast.hpp])
+BOOST_FIND_HEADER([boost/lexical_cast.hpp])
+])# BOOST_CONVERSION
+
+
+# BOOST_DATE_TIME([PREFERRED-RT-OPT])
+# -----------------------------------
+# Look for Boost.Date_Time.  For the documentation of PREFERRED-RT-OPT, see the
+# documentation of BOOST_FIND_LIB above.
+AC_DEFUN([BOOST_DATE_TIME],
+[BOOST_FIND_LIB([date_time], [$1],
+                [boost/date_time/posix_time/posix_time.hpp],
+                [boost::posix_time::ptime t;])
+])# BOOST_DATE_TIME
+
+
+# BOOST_FILESYSTEM([PREFERRED-RT-OPT])
+# ------------------------------------
+# Look for Boost.Filesystem.  For the documentation of PREFERRED-RT-OPT, see
+# the documentation of BOOST_FIND_LIB above.
+# Do not check for boost/filesystem.hpp because this file was introduced in
+# 1.34.
+AC_DEFUN([BOOST_FILESYSTEM],
+[# Do we have to check for Boost.System?  This link-time dependency was
+# added as of 1.35.0.  If we have a version <1.35, we must not attempt to
+# find Boost.System as it didn't exist by then.
+if test $boost_major_version -ge 135; then
+BOOST_SYSTEM([$1])
+fi # end of the Boost.System check.
+boost_filesystem_save_LIBS=$LIBS
+boost_filesystem_save_LDFLAGS=$LDFLAGS
+m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
+LIBS="$LIBS $BOOST_SYSTEM_LIBS"
+LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
+BOOST_FIND_LIB([filesystem], [$1],
+                [boost/filesystem/path.hpp], [boost::filesystem::path p;])
+LIBS=$boost_filesystem_save_LIBS
+LDFLAGS=$boost_filesystem_save_LDFLAGS
+])# BOOST_FILESYSTEM
+
+
+# BOOST_FOREACH()
+# ---------------
+# Look for Boost.Foreach
+AC_DEFUN([BOOST_FOREACH],
+[BOOST_FIND_HEADER([boost/foreach.hpp])])
+
+
+# BOOST_FORMAT()
+# --------------
+# Look for Boost.Format
+# Note: we can't check for boost/format/format_fwd.hpp because the header isn't
+# standalone.  It can't be compiled because it triggers the following error:
+# boost/format/detail/config_macros.hpp:88: error: 'locale' in namespace 'std'
+#                                                  does not name a type
+AC_DEFUN([BOOST_FORMAT],
+[BOOST_FIND_HEADER([boost/format.hpp])])
+
+
+# BOOST_FUNCTION()
+# ----------------
+# Look for Boost.Function
+AC_DEFUN([BOOST_FUNCTION],
+[BOOST_FIND_HEADER([boost/function.hpp])])
+
+
+# BOOST_GRAPH([PREFERRED-RT-OPT])
+# -------------------------------
+# Look for Boost.Graphs.  For the documentation of PREFERRED-RT-OPT, see the
+# documentation of BOOST_FIND_LIB above.
+AC_DEFUN([BOOST_GRAPH],
+[BOOST_FIND_LIB([graph], [$1],
+                [boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;])
+])# BOOST_GRAPH
+
+
+# BOOST_IOSTREAMS([PREFERRED-RT-OPT])
+# -------------------------------
+# Look for Boost.IOStreams.  For the documentation of PREFERRED-RT-OPT, see the
+# documentation of BOOST_FIND_LIB above.
+AC_DEFUN([BOOST_IOSTREAMS],
+[BOOST_FIND_LIB([iostreams], [$1],
+                [boost/iostreams/device/file_descriptor.hpp],
+                [boost::iostreams::file_descriptor fd(0); fd.close();])
+])# BOOST_IOSTREAMS
+
+
+# BOOST_HASH()
+# ------------
+# Look for Boost.Functional/Hash
+AC_DEFUN([BOOST_HASH],
+[BOOST_FIND_HEADER([boost/functional/hash.hpp])])
+
+
+# BOOST_LAMBDA()
+# --------------
+# Look for Boost.Lambda
+AC_DEFUN([BOOST_LAMBDA],
+[BOOST_FIND_HEADER([boost/lambda/lambda.hpp])])
+
+
+# BOOST_PREPROCESSOR()
+# --------------------
+# Look for Boost.Preprocessor
+AC_DEFUN([BOOST_PREPROCESSOR],
+[BOOST_FIND_HEADER([boost/preprocessor/repeat.hpp])])
+
+
+# BOOST_PROGRAM_OPTIONS([PREFERRED-RT-OPT])
+# -----------------------------------------
+# Look for Boost.Program_options.  For the documentation of PREFERRED-RT-OPT, see
+# the documentation of BOOST_FIND_LIB above.
+AC_DEFUN([BOOST_PROGRAM_OPTIONS],
+[BOOST_FIND_LIB([program_options], [$1],
+                [boost/program_options.hpp],
+                [boost::program_options::options_description d("test");])
+])# BOOST_PROGRAM_OPTIONS
+
+
+# BOOST_REF()
+# -----------
+# Look for Boost.Ref
+AC_DEFUN([BOOST_REF],
+[BOOST_FIND_HEADER([boost/ref.hpp])])
+
+
+# BOOST_REGEX([PREFERRED-RT-OPT])
+# -------------------------------
+# Look for Boost.Regex.  For the documentation of PREFERRED-RT-OPT, see the
+# documentation of BOOST_FIND_LIB above.
+AC_DEFUN([BOOST_REGEX],
+[BOOST_FIND_LIB([regex], [$1],
+                [boost/regex.hpp],
+                [boost::regex exp("*"); boost::regex_match("foo", exp);])
+])# BOOST_REGEX
+
+
+# BOOST_SERIALIZATION([PREFERRED-RT-OPT])
+# ---------------------------------------
+# Look for Boost.Serialization.  For the documentation of PREFERRED-RT-OPT, see
+# the documentation of BOOST_FIND_LIB above.
+AC_DEFUN([BOOST_SERIALIZATION],
+[BOOST_FIND_LIB([serialization], [$1],
+                [boost/archive/text_oarchive.hpp],
+                [std::ostream* o = 0; // Cheap way to get an ostream...
+                boost::archive::text_oarchive t(*o);])
+])# BOOST_SIGNALS
+
+
+# BOOST_SIGNALS([PREFERRED-RT-OPT])
+# ---------------------------------
+# Look for Boost.Signals.  For the documentation of PREFERRED-RT-OPT, see the
+# documentation of BOOST_FIND_LIB above.
+AC_DEFUN([BOOST_SIGNALS],
+[BOOST_FIND_LIB([signals], [$1],
+                [boost/signal.hpp],
+                [boost::signal<void ()> s;])
+])# BOOST_SIGNALS
+
+
+# BOOST_SMART_PTR()
+# -----------------
+# Look for Boost.SmartPtr
+AC_DEFUN([BOOST_SMART_PTR],
+[BOOST_FIND_HEADER([boost/scoped_ptr.hpp])
+BOOST_FIND_HEADER([boost/shared_ptr.hpp])
+])
+
+
+# BOOST_STRING_ALGO()
+# -------------------
+# Look for Boost.StringAlgo
+AC_DEFUN([BOOST_STRING_ALGO],
+[BOOST_FIND_HEADER([boost/algorithm/string.hpp])
+])
+
+
+# BOOST_SYSTEM([PREFERRED-RT-OPT])
+# --------------------------------
+# Look for Boost.System.  For the documentation of PREFERRED-RT-OPT, see the
+# documentation of BOOST_FIND_LIB above.  This library was introduced in Boost
+# 1.35.0.
+AC_DEFUN([BOOST_SYSTEM],
+[BOOST_FIND_LIB([system], [$1],
+                [boost/system/error_code.hpp],
+                [boost::system::error_code e; e.clear();])
+])# BOOST_SYSTEM
+
+
+# BOOST_TEST([PREFERRED-RT-OPT])
+# ------------------------------
+# Look for Boost.Test.  For the documentation of PREFERRED-RT-OPT, see the
+# documentation of BOOST_FIND_LIB above.
+AC_DEFUN([BOOST_TEST],
+[m4_pattern_allow([^BOOST_CHECK$])dnl
+BOOST_FIND_LIB([unit_test_framework], [$1],
+               [boost/test/unit_test.hpp], [BOOST_CHECK(2 == 2);],
+               [using boost::unit_test::test_suite;
+               test_suite* init_unit_test_suite(int argc, char ** argv)
+               { return NULL; }])
+])# BOOST_TEST
+
+
+# BOOST_THREADS([PREFERRED-RT-OPT])
+# ---------------------------------
+# Look for Boost.Thread.  For the documentation of PREFERRED-RT-OPT, see the
+# documentation of BOOST_FIND_LIB above.
+# FIXME: Provide an alias "BOOST_THREAD".
+AC_DEFUN([BOOST_THREADS],
+[dnl Having the pthread flag is required at least on GCC3 where
+dnl boost/thread.hpp would complain if we try to compile without
+dnl -pthread on GNU/Linux.
+AC_REQUIRE([_BOOST_PTHREAD_FLAG])dnl
+boost_threads_save_LIBS=$LIBS
+boost_threads_save_CPPFLAGS=$CPPFLAGS
+LIBS="$LIBS $boost_cv_pthread_flag"
+# Yes, we *need* to put the -pthread thing in CPPFLAGS because with GCC3,
+# boost/thread.hpp will trigger a #error if -pthread isn't used:
+#   boost/config/requires_threads.hpp:47:5: #error "Compiler threading support
+#   is not turned on. Please set the correct command line options for
+#   threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
+CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag"
+BOOST_FIND_LIB([thread], [$1],
+                [boost/thread.hpp], [boost::thread t; boost::mutex m;])
+BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $boost_cv_pthread_flag"
+BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag"
+LIBS=$boost_threads_save_LIBS
+CPPFLAGS=$boost_threads_save_CPPFLAGS
+])# BOOST_THREADS
+
+
+# BOOST_TOKENIZER()
+# -----------------
+# Look for Boost.Tokenizer
+AC_DEFUN([BOOST_TOKENIZER],
+[BOOST_FIND_HEADER([boost/tokenizer.hpp])])
+
+
+# BOOST_TRIBOOL()
+# ---------------
+# Look for Boost.Tribool
+AC_DEFUN([BOOST_TRIBOOL],
+[BOOST_FIND_HEADER([boost/logic/tribool_fwd.hpp])
+BOOST_FIND_HEADER([boost/logic/tribool.hpp])
+])
+
+
+# BOOST_TUPLE()
+# -------------
+# Look for Boost.Tuple
+AC_DEFUN([BOOST_TUPLE],
+[BOOST_FIND_HEADER([boost/tuple/tuple.hpp])])
+
+
+# BOOST_UTILITY()
+# ---------------
+# Look for Boost.Utility (noncopyable, result_of, base-from-member idiom,
+# etc.)
+AC_DEFUN([BOOST_UTILITY],
+[BOOST_FIND_HEADER([boost/utility.hpp])])
+
+
+# BOOST_VARIANT()
+# ---------------
+# Look for Boost.Variant.
+AC_DEFUN([BOOST_VARIANT],
+[BOOST_FIND_HEADER([boost/variant/variant_fwd.hpp])
+BOOST_FIND_HEADER([boost/variant.hpp])])
+
+
+# BOOST_WAVE([PREFERRED-RT-OPT])
+# ------------------------------
+# NOTE: If you intend to use Wave/Spirit with thread support, make sure you
+# call BOOST_THREADS first.
+# Look for Boost.Wave.  For the documentation of PREFERRED-RT-OPT, see the
+# documentation of BOOST_FIND_LIB above.
+AC_DEFUN([BOOST_WAVE],
+[AC_REQUIRE([BOOST_FILESYSTEM])dnl
+AC_REQUIRE([BOOST_DATE_TIME])dnl
+boost_wave_save_LIBS=$LIBS
+boost_wave_save_LDFLAGS=$LDFLAGS
+m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl
+LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS\
+$BOOST_THREAD_LIBS"
+LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS\
+$BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS"
+BOOST_FIND_LIB([wave], [$1],
+                [boost/wave.hpp],
+                [boost::wave::token_id id; get_token_name(id);])
+LIBS=$boost_wave_save_LIBS
+LDFLAGS=$boost_wave_save_LDFLAGS
+])# BOOST_WAVE
+
+
+# BOOST_XPRESSIVE()
+# -----------------
+# Look for Boost.Xpressive (new since 1.36.0).
+AC_DEFUN([BOOST_XPRESSIVE],
+[BOOST_FIND_HEADER([boost/xpressive/xpressive.hpp])])
+
+
+# ----------------- #
+# Internal helpers. #
+# ----------------- #
+
+
+# _BOOST_PTHREAD_FLAG()
+# ---------------------
+# Internal helper for BOOST_THREADS.  Based on ACX_PTHREAD:
+# http://autoconf-archive.cryp.to/acx_pthread.html
+AC_DEFUN([_BOOST_PTHREAD_FLAG],
+[AC_REQUIRE([AC_PROG_CXX])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_LANG_PUSH([C++])dnl
+AC_CACHE_CHECK([for the flags needed to use pthreads], [boost_cv_pthread_flag],
+[ boost_cv_pthread_flag=
+  # The ordering *is* (sometimes) important.  Some notes on the
+  # individual items follow:
+  # (none): in case threads are in libc; should be tried before -Kthread and
+  #       other compiler flags to prevent continual compiler warnings
+  # -lpthreads: AIX (must check this before -lpthread)
+  # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+  # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+  # -llthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+  # -pthread: GNU Linux/GCC (kernel threads), BSD/GCC (userland threads)
+  # -pthreads: Solaris/GCC
+  # -mthreads: MinGW32/GCC, Lynx/GCC
+  # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+  #      doesn't hurt to check since this sometimes defines pthreads too;
+  #      also defines -D_REENTRANT)
+  #      ... -mt is also the pthreads flag for HP/aCC
+  # -lpthread: GNU Linux, etc.
+  # --thread-safe: KAI C++
+  case $host_os in #(
+    *solaris*)
+      # On Solaris (at least, for some versions), libc contains stubbed
+      # (non-functional) versions of the pthreads routines, so link-based
+      # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
+      # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+      # a function called by this macro, so we could check for that, but
+      # who knows whether they'll stub that too in a future libc.)  So,
+      # we'll just look for -pthreads and -lpthread first:
+      boost_pthread_flags="-pthreads -lpthread -mt -pthread";; #(
+    *)
+      boost_pthread_flags="-lpthreads -Kthread -kthread -llthread -pthread \
+                           -pthreads -mthreads -lpthread --thread-safe -mt";;
+  esac
+  # Generate the test file.
+  AC_LANG_CONFTEST([AC_LANG_PROGRAM([#include <pthread.h>],
+    [pthread_t th; pthread_join(th, 0);
+    pthread_attr_init(0); pthread_cleanup_push(0, 0);
+    pthread_create(0,0,0,0); pthread_cleanup_pop(0);])])
+  for boost_pthread_flag in '' $boost_pthread_flags; do
+    boost_pthread_ok=false
+dnl Re-use the test file already generated.
+    boost_pthreads__save_LIBS=$LIBS
+    LIBS="$LIBS $boost_pthread_flag"
+    AC_LINK_IFELSE([],
+      [if grep ".*$boost_pthread_flag" conftest.err; then
+         echo "This flag seems to have triggered warnings" >&AS_MESSAGE_LOG_FD
+       else
+         boost_pthread_ok=:; boost_cv_pthread_flag=$boost_pthread_flag
+       fi])
+    LIBS=$boost_pthreads__save_LIBS
+    $boost_pthread_ok && break
+  done
+])
+AC_LANG_POP([C++])dnl
+])# _BOOST_PTHREAD_FLAG
+
+
+# _BOOST_gcc_test(MAJOR, MINOR)
+# -----------------------------
+# Internal helper for _BOOST_FIND_COMPILER_TAG.
+m4_define([_BOOST_gcc_test],
+["defined __GNUC__ && __GNUC__ == $1 && __GNUC_MINOR__ == $2 && !defined __ICC @ gcc$1$2"])dnl
+
+
+# _BOOST_FIND_COMPILER_TAG()
+# --------------------------
+# Internal.  When Boost is installed without --layout=system, each library
+# filename will hold a suffix that encodes the compiler used during the
+# build.  The Boost build system seems to call this a `tag'.
+AC_DEFUN([_BOOST_FIND_COMPILER_TAG],
+[AC_REQUIRE([AC_PROG_CXX])dnl
+AC_CACHE_CHECK([for the toolset name used by Boost for $CXX], [boost_cv_lib_tag],
+[AC_LANG_PUSH([C++])dnl
+  boost_cv_lib_tag=unknown
+  # The following tests are mostly inspired by boost/config/auto_link.hpp
+  # The list is sorted to most recent/common to oldest compiler (in order
+  # to increase the likelihood of finding the right compiler with the
+  # least number of compilation attempt).
+  # Beware that some tests are sensible to the order (for instance, we must
+  # look for MinGW before looking for GCC3).
+  # I used one compilation test per compiler with a #error to recognize
+  # each compiler so that it works even when cross-compiling (let me know
+  # if you know a better approach).
+  # Known missing tags (known from Boost's tools/build/v2/tools/common.jam):
+  #   como, edg, kcc, bck, mp, sw, tru, xlc
+  # I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines
+  # the same defines as GCC's).
+  # TODO: Move the test on GCC 4.4 up once it's released.
+  for i in \
+    _BOOST_gcc_test(4, 3) \
+    _BOOST_gcc_test(4, 2) \
+    _BOOST_gcc_test(4, 1) \
+    _BOOST_gcc_test(4, 0) \
+    "defined __GNUC__ && __GNUC__ == 3 && !defined __ICC \
+     && (defined WIN32 || defined WINNT || defined _WIN32 || defined __WIN32 \
+         || defined __WIN32__ || defined __WINNT || defined __WINNT__) @ mgw" \
+    _BOOST_gcc_test(3, 4) \
+    _BOOST_gcc_test(3, 3) \
+    "defined _MSC_VER && _MSC_VER >= 1400 @ vc80" \
+    _BOOST_gcc_test(3, 2) \
+    "defined _MSC_VER && _MSC_VER == 1310 @ vc71" \
+    _BOOST_gcc_test(3, 1) \
+    _BOOST_gcc_test(3, 0) \
+    "defined __BORLANDC__ @ bcb" \
+    "defined __ICC && (defined __unix || defined __unix__) @ il" \
+    "defined __ICL @ iw" \
+    "defined _MSC_VER && _MSC_VER == 1300 @ vc7" \
+    _BOOST_gcc_test(4, 4) \
+    _BOOST_gcc_test(2, 95) \
+    "defined __MWERKS__ && __MWERKS__ <= 0x32FF @ cw9" \
+    "defined _MSC_VER && _MSC_VER < 1300 && !defined UNDER_CE @ vc6" \
+    "defined _MSC_VER && _MSC_VER < 1300 && defined UNDER_CE @ evc4" \
+    "defined __MWERKS__ && __MWERKS__ <= 0x31FF @ cw8"
+  do
+    boost_tag_test=`expr "X$i" : 'X\([[^@]]*\) @ '`
+    boost_tag=`expr "X$i" : 'X[[^@]]* @ \(.*\)'`
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if $boost_tag_test
+/* OK */
+#else
+# error $boost_tag_test
+#endif
+]])], [boost_cv_lib_tag=$boost_tag; break], [])
+  done
+AC_LANG_POP([C++])dnl
+])
+  case $boost_cv_lib_tag in #(
+    # Some newer (>= 1.35?) versions of Boost seem to only use "gcc" as opposed
+    # to "gcc41" for instance.
+    gcc*)
+      # We can specify multiple tags in this variable because it's used by
+      # BOOST_FIND_LIB that does a `for tag in -$boost_cv_lib_tag' ...
+      boost_cv_lib_tag="$boost_cv_lib_tag -gcc"
+      ;; #(
+    unknown)
+      AC_MSG_WARN([[could not figure out which toolset name to use for $CXX]])
+      boost_cv_lib_tag=
+      ;;
+  esac
+])# _BOOST_FIND_COMPILER_TAG
+
+
+# _BOOST_GUESS_WHETHER_TO_USE_MT()
+# --------------------------------
+# Compile a small test to try to guess whether we should favor MT (Multi
+# Thread) flavors of Boost.  Sets boost_guess_use_mt accordingly.
+AC_DEFUN([_BOOST_GUESS_WHETHER_TO_USE_MT],
+[# Check whether we do better use `mt' even though we weren't ask to.
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if defined _REENTRANT || defined _MT || defined __MT__
+/* use -mt */
+#else
+# error MT not needed
+#endif
+]])], [boost_guess_use_mt=:], [boost_guess_use_mt=false])
+])
+
+# _BOOST_AC_LINK_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+# -------------------------------------------------------------------
+# Fork of _AC_LINK_IFELSE that preserves conftest.o across calls.  Fragile,
+# will break when Autoconf changes its internals.  Requires that you manually
+# rm -f conftest.$ac_objext in between to really different tests, otherwise
+# you will try to link a conftest.o left behind by a previous test.
+# Used to aggressively optimize BOOST_FIND_LIB (see the big comment in this
+# macro)
+m4_define([_BOOST_AC_LINK_IFELSE],
+[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
+rm -f conftest$ac_exeext
+boost_ac_ext_save=$ac_ext
+boost_use_source=:
+# If we already have a .o, re-use it.  We change $ac_ext so that $ac_link
+# tries to link the existing object file instead of compiling from source.
+test -f conftest.$ac_objext && ac_ext=$ac_objext && boost_use_source=false &&
+  _AS_ECHO_LOG([re-using the existing conftest.$ac_objext])
+AS_IF([_AC_DO_STDERR($ac_link) && {
+	 test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_executable_p conftest$ac_exeext
+dnl FIXME: use AS_TEST_X instead when 2.61 is widespread enough.
+       }],
+      [$2],
+      [if $boost_use_source; then
+         _AC_MSG_LOG_CONFTEST
+       fi
+       $3])
+dnl Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
+dnl information created by the PGI compiler (conftest_ipa8_conftest.oo),
+dnl as it would interfere with the next link command.
+rm -f core conftest.err conftest_ipa8_conftest.oo \
+      conftest$ac_exeext m4_ifval([$1], [conftest.$ac_ext])[]dnl
+])# _BOOST_AC_LINK_IFELSE
Index: mple/CMakeLists.txt
===================================================================
--- /sample/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,43 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_subdirectory(pingpong)
-
-## NOTE: "AribaTunnel" is not part of the ariba build process. 
-#        It has to be compiled separately!
-
Index: /sample/Makefile.am
===================================================================
--- /sample/Makefile.am	(revision 2378)
+++ /sample/Makefile.am	(revision 2378)
@@ -0,0 +1,2 @@
+#SUBDIRS = pingpong
+SUBDIRS = tidy_pingpong
Index: mple/pingpong/CMakeLists.txt
===================================================================
--- /sample/pingpong/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,78 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-# Find Boost
-find_package(BoostAdditionalVersions QUIET)
-if(NOT DEFINED BoostAdditionalVersions_FOUND)
-    message(WARNING "Could not find FindBoostAdditionalVersions.cmake. "
-        "This might cause the Boost detection to fail")
-endif()
-find_package(Boost 1.42.0 REQUIRED COMPONENTS system)
-mark_as_advanced(Boost_DIR)
-
-include_directories(${Boost_INCLUDE_DIRS})
-
-
-# Include ariba header files
-include_directories("${ariba_SOURCE_DIR}/source/" "${ariba_BINARY_DIR}/source/")
-add_executable(pingpong
-    PingPongMessage.cpp
-    PingPongMessage.h
-    PingPong.cpp
-    PingPong.h
-    main.cpp
-    )
-
-if(${BUILD_STATIC_BINS})
-    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc")
-    string(REPLACE "-rdynamic" "" 
-        CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS
-        "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}"
-        )
-    # Compile system libraries statically
-    set_target_properties(pingpong PROPERTIES
-            LINK_SEARCH_END_STATIC ON)
-endif(${BUILD_STATIC_BINS})
-
-target_link_libraries(pingpong ariba ${Boost_LIBRARIES})
-
-# Installation stuff
-install(TARGETS pingpong
-    DESTINATION lib/ariba
-    COMPONENT Documentation
-    )
Index: /sample/pingpong/Makefile.am
===================================================================
--- /sample/pingpong/Makefile.am	(revision 2378)
+++ /sample/pingpong/Makefile.am	(revision 2378)
@@ -0,0 +1,60 @@
+# sources ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+if OMNET
+lib_LTLIBRARIES = libpingpong.la
+else
+bin_PROGRAMS 	= pingpong
+endif
+
+# compiler flags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AM_CPPFLAGS     = -DLINUX -D_LINUX -I../../source -D_REENTRANT
+AM_CPPFLAGS    += $(BOOST_CPPFLAGS)
+
+if DEBUG
+AM_CPPFLAGS    += -ggdb -DDEBUG -D_DEBUG -O0
+endif
+
+if PROFILING
+AM_CPPFLAGS    += -pg
+endif
+
+if OMNET
+AM_CPPFLAGS    += -fPIC -DUNDERLAY_OMNET
+endif
+
+# linker flags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AM_LDFLAGS      = -L../../source/ariba -lariba
+
+if PROFILING
+AM_LDFLAGS     += -pg
+endif
+
+if OMNET
+AM_LDFLAGS     += -shared -rdynamic
+endif
+
+# sources ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+if OMNET
+
+libpingpong_la_SOURCES = \
+  PingPong.cpp \
+  PingPong.h \
+  PingPongMessage.cpp \
+  PingPongMessage.h
+
+else
+
+#needed to fix autotools bug
+pingpong_CPPFLAGS = $(AM_CPPFLAGS)
+
+pingpong_SOURCES = \
+  PingPong.cpp \
+  PingPong.h \
+  PingPongMessage.cpp \
+  PingPongMessage.h \
+  main.cpp
+
+endif
Index: /sample/pingpong/PingPong.cpp
===================================================================
--- /sample/pingpong/PingPong.cpp	(revision 12775)
+++ /sample/pingpong/PingPong.cpp	(revision 2378)
@@ -1,221 +1,173 @@
 #include "PingPong.h"
-#include <boost/property_tree/ptree.hpp>
-#include <boost/property_tree/json_parser.hpp>
 
-using namespace ariba;
+#include "ariba/interface/UnderlayAbstraction.h"
 
 namespace ariba {
-namespace application {
+namespace appplication {
 namespace pingpong {
 
-// logging
-use_logging_cpp( PingPong );
+use_logging_cpp(PingPong);
+ServiceID PingPong::PINGPONG_ID = ServiceID(111);
 
-// the service that the pingpong wants to use
-ServiceID PingPong::PINGPONG_SERVICEID = ServiceID( 111 );
-
-// construction
-PingPong::PingPong( string config)  :
-        node(),
-        counter( 0 ),
-        pingId( 0 ),
-        config_file(config)
-{
-	Timer::setInterval( 5000 );
+PingPong::PingPong() : pingid( 0 ) {
 }
 
-// destruction
-PingPong::~PingPong() {
+PingPong::~PingPong(){
 }
 
-// implementation of the startup interface
-void PingPong::startup()
-{
-    using boost::property_tree::ptree;
-    using boost::property_tree::json_parser::read_json;
-    
-	// set up logging
-	logging_rootlevel_debug();
-	logging_classlevel_debug(PingPong);
-
-	logging_info( "[PINGPONG]\t starting up PingPong service ... " );
-
-    // read config
-    ptree config;
-    try
-    {
-        read_json(config_file, config);
-    }
-    catch ( exception& e )
-    {
-        logging_warn("ERROR: Failed to read config file Â»" << config_file << "Â«: ");
-        logging_warn(e.what());
-        logging_warn("---> Using fallback config.");
-        
-        config.put("ariba.spovnet_name", "pingpong");
-    }
-    
-    // use node name also in the application
-    name = config.get("ariba.node_name", "NO_NAME");
-    
-	// bind communication and node listener
-	node.bind( this );                              /*NodeListener*/
-	node.bind( this, PingPong::PINGPONG_SERVICEID); /*CommunicationListener*/
-
-    // connecting
-    logging_debug( "connecting ... " );
-
-	node.connect(config.get_child("ariba"));
-
-	// ping pong started up...
-	logging_info( "[PINGPONG]\t pingpong starting up with"
-			<< " [spovnetid " << node.getSpoVNetId().toString() << "]"
-			<< " and [nodeid " << node.getNodeId().toString() << "]" );
+void PingPong::setMode(bool startingNode){
+	startping = startingNode;
 }
 
-// implementation of the startup interface
-void PingPong::shutdown() {
+void PingPong::startup(){
+	abstraction = new UnderlayAbstraction();
 
-	logging_info( "[PINGPONG]\t pingpong service starting shutdown sequence ..." );
+	logging_info( "starting up PingPong service ... " );
 
-	// stop timer
+	SpoVNetID spovnetid (Identifier(5000));
+
+	setMode( !Configuration::instance().read<bool>("GENERAL_Initiator") );
+
+	NodeID nodeid = (Configuration::instance().exists("BASE_nodeid") ?
+			NodeID(Identifier(Configuration::instance().read<unsigned long>("BASE_nodeid"))) :
+			NodeID::UNSPECIFIED);
+
+	IPv4Locator* locallocator = (Configuration::instance().exists("BASE_localLocator") ?
+					&(IPv4Locator::fromString(Configuration::instance().read<string>("BASE_localLocator"))) :
+					NULL);
+
+	uint16_t localport = Configuration::instance().exists("BASE_port") ?
+				Configuration::instance().read<uint16_t>("BASE_port") :
+				ARIBA_DEFAULT_PORT;
+
+	if( !startping ){
+
+		context = abstraction->createSpoVNet(
+			spovnetid, nodeid, locallocator, localport );
+
+	} else {
+
+		if( !Configuration::instance().exists("BASE_bootstrapIP")){
+			logging_fatal( "no bootstrap address found" );
+			return;
+		}
+
+		logging_info( "using bootstrap point " <<
+			Configuration::instance().read<string>("BASE_bootstrapIP") );
+
+		EndpointDescriptor bootstrap(
+		new IPv4Locator(IPv4Locator::fromString(
+			Configuration::instance().read<string>("BASE_bootstrapIP"))));
+
+		context = abstraction->joinSpoVNet(
+			spovnetid, bootstrap, nodeid, locallocator, localport );
+
+	}
+
+	overlay = &context->getOverlay();
+	overlay->bind( this, PingPong::PINGPONG_ID );
+
+	logging_info( "PingPong started up" );
+
+	// trigger the creation of the pathload measurement module
+	//PathloadMeasurement::instance( overlay );
+}
+
+void PingPong::shutdown(){
+	logging_info( "shutting down PingPong service ..." );
+
+	overlay->unbind( this, PingPong::PINGPONG_ID );
 	Timer::stop();
 
-	// leave spovnet
-	node.leave();
+	if( !startping ) abstraction->destroySpoVNet( context );
+	else             abstraction->leaveSpoVNet( context );
 
-	// unbind communication and node listener
-	node.unbind( this );                               /*NodeListener*/
-	node.unbind( this, PingPong::PINGPONG_SERVICEID ); /*CommunicationListener*/
+	delete abstraction;
 
-	// now we are completely shut down
-	logging_info( "pingpong service shut down" );
+	logging_info( "PingPong service shut down" );
 }
 
-// timer event
-void PingPong::eventFunction()
-{
-	// We ping all nodes that are known in the overlay structure
-	// this can be all nodes (OneHop) overlay or just some neighbors
-	// in case of a Chord or Kademlia structure
-	// NOTE: Currently ariba only supports the Chord overlay.
+bool PingPong::receiveMessage(const Message* message, const LinkID& link, const NodeID& node){
 
-	// In this sample we use auto-links: we just send out our message
-	// to the node and the link is established automatically. for more
-	// control we would use the node->establishLink function to create
-	// a link and start using the link in the CommunicationListener::onLinkUp
-	// function that is implemented further down in PingPong::onLinkUp
-	
-	// NOTE: This example still uses the old deprecated ariba::message messages 
-	//   with the ariba built-in serialization. 
-	// For future applications please use the new reboost::message_t messages. 
-	//   Data is stored in high efficient zero-copy buffers of type 
-	//   reboost::shared_buffer_t. These buffers hold plain data, so you have to 
-	//   serialize the data "on your own".
-	// We recommend third-party serialization libraries like:
-	//   - Protocol Buffers (http://en.wikipedia.org/wiki/Protocol_Buffers)
-	//   - MessagePack      (http://en.wikipedia.org/wiki/MessagePack)
+	PingPongMessage* incoming = ((Message*)message)->decapsulate<PingPongMessage>();
 
-	
-	// don't do anything if we have no neighbors
-	if ( node.getNeighborNodes().size() == 0)
-    {
-        logging_info( "[PINGPONG]\t +++ no neighbors +++" );
-        return;
-    }
-    
-    
-	pingId++;
-    logging_info( "\n|||||||||| >>>>>>>>>>\n"
-	        << "[PINGPONG]\t PINGING overlay neighbors with ping id " << pingId );
-	PingPongMessage pingmsg( pingId, name );
-	
-	//-----------------------------------------------------------------------
-	// Option 1: get all neighboring nodes and send the message to each
-	//-----------------------------------------------------------------------
-	counter++;
-	if (counter<0 || counter>4) {
-		counter = 0;
-		string s;
-		for (int i=0; i<names.size();i++) {
-			if (i!=0) s+= ", ";
-			s = s+names[i];
-		}
-		logging_info("[PINGPONG]\t ----> I am " << name << " and I know " << s);
-		names.clear();
-	}
+	logging_info( "received ping message on link " << link.toString() <<
+				 " from node with id " << (int)incoming->getid());
 
-	vector<NodeID> nodes = node.getNeighborNodes();
-	BOOST_FOREACH( NodeID nid, nodes ){
-		logging_info( "[PINGPONG]\t sending ping message to " << nid.toString() );
-		node.sendMessage( pingmsg, nid, PingPong::PINGPONG_SERVICEID );
-	}
-
-	//-----------------------------------------------------------------------
-	// Option 2: send a "broadcast message" that actually does the same thing
-	//           internally, gets all neighboring nodes and sends the message
-	//-----------------------------------------------------------------------
-	// node->sendBroadcastMessage( pingmsg, PingPong::PINGPONG_SERVICEID );
+// 	if( ((int)incoming->getid() % 5) == 0 )
+// 		PathloadMeasurement::instance().measure( node, this );
 }
 
-void PingPong::onJoinCompleted( const SpoVNetID& vid ) {
-	logging_info( "pingpong node join completed, spovnetid=" << vid.toString() );
+void PingPong::eventFunction(){
 
-	// start the timer to ping every second
-	Timer::start();
+	logging_info( "pinging our remote nodes" );
+
+	RemoteNodes::iterator i = remoteNodes.begin();
+	RemoteNodes::iterator iend = remoteNodes.end();
+
+	pingid++;
+
+	for( ; i != iend; i++ ){
+		logging_info( "     -> pinging " << i->first );
+
+		PingPongMessage pingmsg( pingid );
+		overlay->sendMessage( &pingmsg, i->second );
+	}
 }
 
-void PingPong::onJoinFailed( const SpoVNetID& vid ) {
-	logging_error("pingpong node join failed, spovnetid=" << vid.toString() );
+void PingPong::onMeasurement(NodeID node, double mbps){
+	logging_info( "pingpong received measurement for node " << node.toString() << " with result " << mbps );
 }
 
-void PingPong::onLeaveCompleted( const SpoVNetID& vid ){
-	logging_info("pingpong node leave completed, spovnetid=" << vid.toString() );
+void PingPong::onJoinSuccess( const SpoVNetID& spovnetid ){
 }
 
-void PingPong::onLeaveFailed( const SpoVNetID& vid ){
-	logging_error("pingpong node leave failed, spovnetid=" << vid.toString() );
+void PingPong::onOverlayCreate( const SpoVNetID& id ){
 }
 
-void PingPong::onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk) {
-	PingPongMessage* pingmsg = msg.getMessage()->convert<PingPongMessage> ();
-	bool found=false;
-	for (int i=0;i<names.size(); i++) if (names[i]==pingmsg->getName()) found=true;
-	if (!found) names.push_back(pingmsg->getName());
-	logging_info( "\n<<<<<<<<<< ||||||||||\n"
-	        << "[PINGPONG]\t RECEIVED ping message on link "
-	        << lnk.toString()
-	        << " " << (node.isLinkDirect(lnk) ? "[DIRECT-LINK]" : "[INDIRECT-LINK]")
-	        << " HopCount: " << node.getHopCount(lnk)
-			<< " from node " << remote.toString()
-			<< " (" << pingmsg->getName() << ")"
-			<< ": " << pingmsg->info() );
-	delete pingmsg;
+void PingPong::onOverlayDestroy( const SpoVNetID& id ){
 }
 
-void PingPong::onLinkUp(const LinkID& lnk, const NodeID& remote){
-	logging_info( "received link-up event for link " << lnk.toString()
-			<< " and node " << remote.toString() );
-}
-
-void PingPong::onLinkDown(const LinkID& lnk, const NodeID& remote){
-	logging_info( "received link-down event for link " << lnk.toString()
-			<< " and node " << remote.toString() );
-}
-
-void PingPong::onLinkChanged(const LinkID& lnk, const NodeID& remote){
-	logging_info( "link-changed event for link " << lnk.toString()
-			<< " and node " << remote.toString() );
-}
-
-bool PingPong::onLinkRequest(const NodeID& remote) {
-	logging_info( "node " << remote.toString() << " wants to build up a link with us ... allowing" );
+bool PingPong::isJoinAllowed( const NodeID& nodeid, const SpoVNetID& spovnetid ){
 	return true;
 }
 
-void PingPong::onLinkFail(const LinkID& lnk, const NodeID& remote){
-	logging_info( "received link-failed event for link " << lnk.toString()
-			<< " and node " << remote.toString() );
+void PingPong::onNodeJoin( const NodeID& nodeid, const SpoVNetID& spovnetid ){
+
+	if( !startping ){
+
+		logging_info( "establishing link to node " << nodeid.toString() );
+		const LinkID link = overlay->establishLink( nodeid, PingPong::PINGPONG_ID );
+
+		logging_info( "adding node to registered nodes in pingpong: " << nodeid.toString() );
+		remoteNodes.insert( make_pair(nodeid,link) );
+
+		Timer::setInterval( 2000 );
+		Timer::start();
+	}
 }
 
-}}} // namespace ariba, application, pingpong
+void PingPong::onNodeLeave( const NodeID& id, const SpoVNetID& spovnetid ){
+	RemoteNodes::iterator i = remoteNodes.find( id );
+	if( i != remoteNodes.end() ) remoteNodes.erase( i );
+}
+
+void PingPong::onJoinFail( const SpoVNetID& spovnetid ){
+}
+
+void PingPong::onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote ){
+}
+
+void PingPong::onLinkDown( const LinkID& link, const NodeID& local, const NodeID& remote ){
+}
+
+void PingPong::onLinkChanged( const LinkID& link, const NodeID& local, const NodeID& remote ){
+}
+
+void PingPong::onLinkFail(const LinkID& id, const NodeID& local, const NodeID& remote){
+}
+
+void PingPong::onLinkQoSChanged(const LinkID& id, const NodeID& local, const NodeID& remote , const QoSParameterSet& qos){
+}
+
+}}} // namespace ariba, appplication, pingpong
Index: /sample/pingpong/PingPong.h
===================================================================
--- /sample/pingpong/PingPong.h	(revision 12775)
+++ /sample/pingpong/PingPong.h	(revision 2378)
@@ -2,77 +2,99 @@
 #define __PINGPONG_H_
 
-#include "ariba/ariba.h"
+#include <map>
+#include <iostream>
+#include <vector>
+#include "ariba/utility/types.h"
+#include "ariba/utility/system/Timer.h"
+#include "ariba/utility/misc/Helper.h"
+#include "ariba/utility/messages.h"
+#include "ariba/utility/measurement/PathloadMeasurement.h"
+#include "ariba/utility/configuration/Configuration.h"
+#include "ariba/utility/logging/Logging.h"
+#include "ariba/utility/measurement/PathloadMeasurement.h"
+#include "ariba/utility/system/StartupInterface.h"
+#include "ariba/interface/UnderlayAbstraction.h"
+#include "ariba/interface/AribaContext.h"
+#include "ariba/interface/ServiceInterface.h"
 #include "PingPongMessage.h"
-#include "ariba/utility/system/StartupInterface.h"
-#include "ariba/utility/system/Timer.h"
 
-#include <vector>
-
-using namespace ariba;
+using std::vector;
+using std::map;
+using std::cout;
+using ariba::application::pingpong::PingPongMessage;
+using ariba::interface::ServiceInterface;
+using ariba::interface::UnderlayAbstraction;
+using ariba::interface::AribaContext;
+using ariba::utility::NodeID;
+using ariba::utility::LinkID;
 using ariba::utility::StartupInterface;
 using ariba::utility::Timer;
+using ariba::utility::Configuration;
+using ariba::utility::NodeID;
+using ariba::utility::Identifier;
+using ariba::utility::ServiceID;
+using ariba::utility::PathloadMeasurement;
+using ariba::utility::PathloadMeasurementListener;
 
 namespace ariba {
-namespace application {
+namespace appplication {
 namespace pingpong {
 
-using namespace std;
-
 /**
- * The PingPong main class
- * This class implements an example service for demonstration purposes
- * The pingpong class sends and receives messages between two SpoVNet
- * instances
- */
-class PingPong: public NodeListener,
-	public CommunicationListener,
+/* The PingPong main class
+/* This class implements an example service for demonstration purposes
+/* The pingpong class sends and receives messages between two SpoVNet
+/* instances
+**/
+class PingPong :
+	public ServiceInterface,
 	public StartupInterface,
-	public Timer {
+	public Timer,
+	public PathloadMeasurementListener {
 
 	use_logging_h(PingPong);
 
 public:
-	PingPong( string config );
+	PingPong();
 	virtual ~PingPong();
+	void setMode( bool startingNode );
+
+
+	virtual void onOverlayCreate( const SpoVNetID& id );
+	virtual void onOverlayDestroy( const SpoVNetID& id );
+	virtual bool isJoinAllowed( const NodeID& nodeid, const SpoVNetID& spovnetid );
+	virtual void onNodeJoin( const NodeID& nodeid, const SpoVNetID& spovnetid );
+	virtual void onNodeLeave( const NodeID& id, const SpoVNetID& spovnetid );
+	virtual void onJoinSuccess( const SpoVNetID& spovnetid );
+	virtual void onJoinFail( const SpoVNetID& spovnetid );
+	virtual void onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkDown( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkChanged( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkFail(const LinkID& id, const NodeID& local, const NodeID& remote);
+	virtual void onLinkQoSChanged(const LinkID& id, const NodeID& local, const NodeID& remote , const QoSParameterSet& qos);
+
+	virtual bool receiveMessage( const Message* message, const LinkID& link, const NodeID& node );
 
 protected:
-	// communication listener interface
-	virtual bool onLinkRequest(const NodeID& remote);
-	virtual void onMessage(const DataMessage& msg, const NodeID& remote,
-		const LinkID& lnk = LinkID::UNSPECIFIED);
-	virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
-	virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
-	virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote);
-	virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
-
-	// node listener interface
-	virtual void onJoinCompleted(const SpoVNetID& vid);
-	virtual void onJoinFailed(const SpoVNetID& vid);
-	virtual void onLeaveCompleted(const SpoVNetID& vid);
-	virtual void onLeaveFailed(const SpoVNetID& vid);
-
-	// startup wrapper interface
 	virtual void startup();
 	virtual void shutdown();
 
-	// timer events
-	virtual void eventFunction();
+	virtual void eventFunction(); // timer event function
+	virtual void onMeasurement(NodeID node, double mbps); // measurement event function
 
 private:
-	Node node;
-	string name;
-	int counter;
-	vector<string> names;
-
-	// the ping pong service id
-	static ServiceID PINGPONG_SERVICEID;
-
-	// the current ping id
-	unsigned long pingId;
-
-	string config_file;
+	bool startping;
+	UnderlayAbstraction* abstraction;
+	AribaContext* context;
+	BaseOverlay* overlay;
+	static ServiceID PINGPONG_ID;
+	unsigned long pingid;
+	typedef map<NodeID, LinkID> RemoteNodes;
+	RemoteNodes remoteNodes;
 };
 
-}}} // namespace ariba, application, pingpong
+ARIBA_SIMULATION_SERVICE(PingPong);
+
+}}} // namespace ariba, appplication, pingpong
 
 #endif // __PINGPONG_H_
Index: /sample/pingpong/PingPongMessage.cpp
===================================================================
--- /sample/pingpong/PingPongMessage.cpp	(revision 12775)
+++ /sample/pingpong/PingPongMessage.cpp	(revision 2378)
@@ -1,4 +1,3 @@
 #include "PingPongMessage.h"
-#include <sstream>
 
 namespace ariba {
@@ -11,5 +10,5 @@
 }
 
-PingPongMessage::PingPongMessage(uint8_t _id, string name) : id(_id),name(name) {
+PingPongMessage::PingPongMessage(uint8_t _id) : id(_id) {
 }
 
@@ -17,9 +16,6 @@
 }
 
-string PingPongMessage::info()
-{
-    ostringstream out;
-    out << "ping pong message id " << (int) id;
-	return out.str();
+string PingPongMessage::info(){
+	return "ping pong message id " + ariba::utility::Helper::ultos(id);
 }
 
Index: /sample/pingpong/PingPongMessage.h
===================================================================
--- /sample/pingpong/PingPongMessage.h	(revision 12775)
+++ /sample/pingpong/PingPongMessage.h	(revision 2378)
@@ -3,8 +3,10 @@
 
 #include <string>
-#include "ariba/ariba.h"
+#include "ariba/utility/messages.h"
+#include "ariba/utility/serialization.h"
+#include "ariba/utility/misc/Helper.h"
 
-using namespace ariba;
 using std::string;
+using ariba::utility::Message;
 
 namespace ariba {
@@ -18,22 +20,18 @@
 public:
 	PingPongMessage();
-	PingPongMessage( uint8_t _id, string name = string("<ping>") );
+	PingPongMessage(uint8_t _id);
 	virtual ~PingPongMessage();
-
+	
 	string info();
 	uint8_t getid();
 
-	inline string getName() const {
-		return name;
-	}
 private:
 	uint8_t id;
-	string name;
 };
 
 }}} // namespace ariba, appplication , pingpong
 
-sznBeginDefault( ariba::application::pingpong::PingPongMessage, X ) {
-	X && id && T(name);
+sznBeginDefault( ariba::application ::pingpong::PingPongMessage, X ) {
+	X && id;
 } sznEnd();
 
Index: /sample/pingpong/main.cpp
===================================================================
--- /sample/pingpong/main.cpp	(revision 12775)
+++ /sample/pingpong/main.cpp	(revision 2378)
@@ -5,23 +5,21 @@
 using std::string;
 using ariba::utility::StartupWrapper;
-using ariba::application::pingpong::PingPong;
+using ariba::appplication::pingpong::PingPong;
 
 int main( int argc, char** argv ) {
 
-	// get config file
-	string config;
+	string config = "../etc/settings.cnf";
 	if (argc >= 2) config = argv[1];
 
-	StartupWrapper::startSystem();
+	StartupWrapper::initConfig( config );
+	StartupWrapper::initSystem();
 
 	// this will do the main functionality and block
-	PingPong ping(config);
-	StartupWrapper::startup(&ping);
+	PingPong ping;
+	StartupWrapper::startup(&ping, true);
 
-	// --> we will run blocking until <enter> is hit
+	// this will run blocking until <enter> is hit
 
-	StartupWrapper::shutdown(&ping);
-	StartupWrapper::stopSystem();
-
+	StartupWrapper::shutdown();
 	return 0;
 }
Index: /sample/tidy_pingpong/Makefile.am
===================================================================
--- /sample/tidy_pingpong/Makefile.am	(revision 2378)
+++ /sample/tidy_pingpong/Makefile.am	(revision 2378)
@@ -0,0 +1,60 @@
+# sources ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+if OMNET
+lib_LTLIBRARIES = libpingpong.la
+else
+bin_PROGRAMS 	= pingpong
+endif
+
+# compiler flags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AM_CPPFLAGS     = -DLINUX -D_LINUX -I../../source -D_REENTRANT
+AM_CPPFLAGS    += $(BOOST_CPPFLAGS)
+
+if DEBUG
+AM_CPPFLAGS    += -ggdb -DDEBUG -D_DEBUG -O0
+endif
+
+if PROFILING
+AM_CPPFLAGS    += -pg
+endif
+
+if OMNET
+AM_CPPFLAGS    += -fPIC -DUNDERLAY_OMNET
+endif
+
+# linker flags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AM_LDFLAGS      = -L../../source/ariba -lariba
+
+if PROFILING
+AM_LDFLAGS     += -pg
+endif
+
+if OMNET
+AM_LDFLAGS     += -shared -rdynamic
+endif
+
+# sources ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+if OMNET
+
+libpingpong_la_SOURCES = \
+  TidyPingPong.cpp \
+  TidyPingPong.h \
+  TidyPingPongMessage.cpp \
+  TidyPingPongMessage.h
+
+else
+
+#needed to fix autotools bug
+pingpong_CPPFLAGS = $(AM_CPPFLAGS)
+
+pingpong_SOURCES = \
+  TidyPingPongMessage.cpp \
+  TidyPingPongMessage.h \
+  TidyPingPong.cpp \
+  TidyPingPong.h \
+  main.cpp
+
+endif
Index: /sample/tidy_pingpong/TidyPingPong.cpp
===================================================================
--- /sample/tidy_pingpong/TidyPingPong.cpp	(revision 2378)
+++ /sample/tidy_pingpong/TidyPingPong.cpp	(revision 2378)
@@ -0,0 +1,138 @@
+
+#include "TidyPingPong.h"
+#include "ariba/utility/configuration/Configuration.h"
+
+using ariba::utility::Configuration;
+using namespace ariba;
+
+namespace ariba {
+namespace application {
+namespace pingpong {
+
+// logging
+use_logging_cpp( PingPong);
+
+// the service id of the ping pong service
+ServiceID PingPong::PINGPONG_ID = ServiceID(111);
+
+// construction
+PingPong::PingPong() : pingId( 0 ) {
+}
+
+// destruction
+PingPong::~PingPong() {
+}
+
+// implementation of the startup interface
+void PingPong::startup() {
+
+	// create ariba module
+	logging_info("Creating ariba underlay module ... ");
+	ariba = new AribaModule();
+
+	logging_info("Starting up PingPong service ... ");
+
+	// --- get config ---
+	Configuration& config = Configuration::instance();
+
+	// generate spovnet name
+	Name spovnetName("pingpong");
+
+	// get initiator flag
+	this->isInitiator = Configuration::instance().read<bool> ("node.initiator");
+
+	// get node name
+	Name nodeName = Name::UNSPECIFIED;
+	if (config.exists("node.name")) nodeName
+			= config.read<string> ("node.name");
+
+	// configure ariba module
+	if (config.exists("ariba.ip.addr")) ariba->setProperty("ip.addr",
+			config.read<string> ("ariba.ip.addr"));
+	if (config.exists("ariba.tcp.port")) ariba->setProperty("tcp.port",
+			config.read<string> ("ariba.tcp.port"));
+	if (config.exists("ariba.udp.port")) ariba->setProperty("udp.port",
+			config.read<string> ("ariba.udp.port"));
+	if (config.exists("ariba.bootstrap.hints")) ariba->setProperty("bootstrap.hints",
+			config.read<string> ("ariba.bootstrap.hints"));
+
+	// start ariba module
+	ariba->start();
+
+	// create node and join
+	node = new Node(*ariba, nodeName);
+
+	// start node module
+	node->start();
+
+	if (!isInitiator) {
+		node->join(spovnetName);
+	} else {
+		node->initiate(spovnetName);
+	}
+
+	// bind communication and node listener
+	node->bind(this);
+	node->bind(this, PingPong::PINGPONG_ID);
+
+	// ping pong started up...
+	logging_info("PingPong started up");
+}
+
+// implementation of the startup interface
+void PingPong::shutdown() {
+	logging_info("PingPong service starting shutdown sequence ...");
+
+	// stop timer
+	Timer::stop();
+
+	// leave spovnet
+	node->leave();
+
+	// unbind listeners
+	node->unbind( this );
+	node->unbind( this, PingPong::PINGPONG_ID );
+
+	logging_info("PingPong service shut down!");
+}
+
+// node listener interface
+void PingPong::onJoinCompleted( const SpoVNetID& vid ) {
+	logging_info("PingPong node join completed, spovnetid=" << vid.toString() );
+}
+
+void PingPong::onJoinFailed( const SpoVNetID& vid ) {
+	logging_info("PingPong node join failed, spovnetid=" << vid.toString() );
+}
+
+// communication listener
+bool PingPong::onLinkRequest(const NodeID& remote, Message* msg) {
+	return false;
+}
+
+void PingPong::onMessage(Message* msg, const NodeID& remote, const LinkID& lnk =
+		LinkID::UNSPECIFIED) {
+	PingPongMessage* incoming = msg->decapsulate<PingPongMessage> ();
+
+	logging_info("received ping message on link " << lnk.toString()
+			<< " from node with id " << (int) incoming->getid());
+}
+
+// timer event
+void PingPong::eventFunction() {
+
+ 	logging_info("pinging our remote nodes");
+// 	RemoteNodes::iterator i = remoteNodes.begin();
+// 	RemoteNodes::iterator iend = remoteNodes.end();
+//
+// 	pingid++;
+//
+// 	for (; i != iend; i++) {
+// 		logging_info("     -> pinging " << i->first);
+//
+// 		PingPongMessage pingmsg(pingid);
+// 		overlay->sendMessage(&pingmsg, i->second);
+// 	}
+}
+
+}}} // namespace ariba, application, pingpong
Index: /sample/tidy_pingpong/TidyPingPong.h
===================================================================
--- /sample/tidy_pingpong/TidyPingPong.h	(revision 2378)
+++ /sample/tidy_pingpong/TidyPingPong.h	(revision 2378)
@@ -0,0 +1,75 @@
+#ifndef __PINGPONG_H_
+#define __PINGPONG_H_
+
+#include "ariba/tidy/ariba.h"
+#include "TidyPingPongMessage.h"
+
+using namespace ariba;
+
+#include "ariba/utility/system/StartupInterface.h"
+#include "ariba/utility/system/Timer.h"
+using ariba::utility::StartupInterface;
+using ariba::utility::Timer;
+
+namespace ariba {
+namespace application {
+namespace pingpong {
+
+/**
+/* The PingPong main class
+/* This class implements an example service for demonstration purposes
+/* The pingpong class sends and receives messages between two SpoVNet
+/* instances
+**/
+class PingPong :
+	public NodeListener,
+	public CommunicationListener,
+	public StartupInterface,
+	public Timer {
+
+	use_logging_h(PingPong);
+
+public:
+	PingPong();
+	virtual ~PingPong();
+
+protected:
+	// communication listener interface
+	virtual bool onLinkRequest(const NodeID& remote, Message* msg);
+	virtual void onMessage(Message* msg, const NodeID& remote, const LinkID& lnk);
+
+	// node listener interface
+	virtual void onJoinCompleted( const SpoVNetID& vid );
+	virtual void onJoinFailed( const SpoVNetID& vid );
+
+	// startup wrapper interface
+	virtual void startup();
+	virtual void shutdown();
+
+	// timer events
+ 	virtual void eventFunction();
+
+private:
+	// the ariba module and a node
+	AribaModule* ariba;
+	Node* node;
+
+	// flag, wheter this node is the initiator of this spovnet
+	bool isInitiator;
+
+ 	// the ping pong service id
+ 	static ServiceID PINGPONG_ID;
+
+ 	// the current ping id
+ 	unsigned long pingId;
+
+// 	// the known remote nodes
+// 	typedef map<NodeID, LinkID> RemoteNodes;
+// 	RemoteNodes remoteNodes;
+};
+
+//ARIBA_SIMULATION_SERVICE(PingPong);
+
+}}} // namespace ariba, application, pingpong
+
+#endif // __PINGPONG_H_
Index: /sample/tidy_pingpong/TidyPingPongMessage.cpp
===================================================================
--- /sample/tidy_pingpong/TidyPingPongMessage.cpp	(revision 2378)
+++ /sample/tidy_pingpong/TidyPingPongMessage.cpp	(revision 2378)
@@ -0,0 +1,26 @@
+#include "TidyPingPongMessage.h"
+
+namespace ariba {
+namespace application {
+namespace pingpong {
+
+vsznDefault(PingPongMessage);
+
+PingPongMessage::PingPongMessage() : id(0) {
+}
+
+PingPongMessage::PingPongMessage(uint8_t _id) : id(_id) {
+}
+
+PingPongMessage::~PingPongMessage(){
+}
+
+string PingPongMessage::info(){
+	return "ping pong message id " + ariba::utility::Helper::ultos(id);
+}
+
+uint8_t PingPongMessage::getid(){
+	return id;
+}
+
+}}} // namespace ariba, appplication, pingpong
Index: /sample/tidy_pingpong/TidyPingPongMessage.h
===================================================================
--- /sample/tidy_pingpong/TidyPingPongMessage.h	(revision 2378)
+++ /sample/tidy_pingpong/TidyPingPongMessage.h	(revision 2378)
@@ -0,0 +1,40 @@
+#ifndef PINGPONGMESSAGES_H_
+#define PINGPONGMESSAGES_H_
+
+// #include "ariba/utility/messages.h"
+// #include "ariba/utility/serialization.h"
+// #include "ariba/utility/misc/Helper.h"
+// using ariba::utility::Message;
+
+#include <string>
+#include "ariba/tidy/ariba.h"
+
+using namespace ariba;
+using std::string;
+
+namespace ariba {
+namespace application {
+namespace pingpong {
+
+using_serialization;
+
+class PingPongMessage : public Message {
+	VSERIALIZEABLE;
+public:
+	PingPongMessage();
+	PingPongMessage( uint8_t _id );
+	virtual ~PingPongMessage();
+
+	string info();
+	uint8_t getid();
+private:
+	uint8_t id;
+};
+
+}}} // namespace ariba, appplication , pingpong
+
+sznBeginDefault( ariba::application::pingpong::PingPongMessage, X ) {
+	X && id;
+} sznEnd();
+
+#endif /* PINGPONGMESSAGES_H_ */
Index: /sample/tidy_pingpong/main.cpp
===================================================================
--- /sample/tidy_pingpong/main.cpp	(revision 2378)
+++ /sample/tidy_pingpong/main.cpp	(revision 2378)
@@ -0,0 +1,25 @@
+#include <string>
+#include "ariba/utility/system/StartupWrapper.h"
+#include "TidyPingPong.h"
+
+using std::string;
+using ariba::utility::StartupWrapper;
+using ariba::application::pingpong::PingPong;
+
+int main( int argc, char** argv ) {
+
+	// get config file
+	string config = "../etc/settings.cnf";
+	if (argc >= 2) config = argv[1];
+
+	StartupWrapper::initConfig( config );
+	StartupWrapper::initSystem();
+
+	// this will do the main functionality and block
+	PingPong ping;
+	StartupWrapper::startup(&ping, true);
+
+	// this will run blocking until <enter> is hit
+	StartupWrapper::shutdown();
+	return 0;
+}
Index: urce/CMakeLists.txt
===================================================================
--- /source/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,40 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_subdirectory(ariba)
-add_subdirectory(services)
Index: /source/Makefile.am
===================================================================
--- /source/Makefile.am	(revision 2378)
+++ /source/Makefile.am	(revision 2378)
@@ -0,0 +1,1 @@
+SUBDIRS = ariba
Index: urce/ariba/CMakeLists.txt
===================================================================
--- /source/ariba/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,276 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
-project(libariba)
-
-list(APPEND CMAKE_MODULE_PATH "${libariba_SOURCE_DIR}/../../CMakeModules")
-
-
-######################################################
-### Increment this whenever the interface changes! ###
-######################################################
-set(ariba_SOVERSION 2)
-######################################################
-
-
-# Find Boost
-find_package(BoostAdditionalVersions QUIET)
-if(NOT DEFINED BoostAdditionalVersions_FOUND)
-    message(WARNING "Could not find FindBoostAdditionalVersions.cmake. "
-        "This might cause the Boost detection to fail")
-endif()
-find_package(Boost 1.42.0 REQUIRED COMPONENTS system thread)
-if(NOT Boost_FOUND)
-    message(FATAL_ERROR "Could not find Boost. "
-            "Please have a look at the Boost_* cache variables.")
-endif(NOT Boost_FOUND)
-
-mark_as_advanced(Boost_DIR)
-include(BoostPthreadWorkaround)
-
-include_directories(${Boost_INCLUDE_DIRS})
-list(APPEND ariba_LINK_LIBRARIES ${Boost_LIBRARIES})
-
-
-# Find gmp
-find_package(GMP REQUIRED)
-if(NOT GMP_FOUND)
-    message(FATAL_ERROR "Could not find GMP. "
-            "Please have a look at the GMP_* cache variables.")
-endif(NOT GMP_FOUND)
-include_directories(${GMP_INCLUDE_DIRS})
-list(APPEND ariba_LINK_LIBRARIES ${GMP_LIBRARIES})
-
-
-# Bluetooth support?
-find_package(LibBluetooth)
-if(NOT LIBBLUETOOTH_FOUND)
-    message(STATUS "Couldn't find libbluetooth. "
-        "Will build ariba withouth bluetooth support")
-endif()
-include(CMakeDependentOption)
-cmake_dependent_option(ENABLE_BLUETOOTH
-    "Enable bluetooth support" #doc
-    ON # default value
-    "LIBBLUETOOTH_FOUND" # only show if this evaluates to true
-    OFF # value if the condition is not met
-    )
-if(ENABLE_BLUETOOTH)
-    set(HAVE_LIBBLUETOOTH TRUE)
-    include_directories("${LIBBLUETOOTH_INCLUDE_DIR}")
-    list(APPEND ariba_LINK_LIBRARIES ${LIBBLUETOOTH_LIBRARIES})
-endif(ENABLE_BLUETOOTH)
-
-
-# Avahi support?
-find_package(Avahi COMPONENTS client common)
-if(NOT AVAHI_FOUND)
-    message(STATUS "Couldn't find Avahi. "
-        "Will build ariba withouth multicast DNS support")
-endif()
-cmake_dependent_option(ENABLE_AVAHI
-    "Enable Avahi (multicast DNS) support" #doc
-    ON # default value
-    "AVAHI_FOUND" # only show if this evaluates to true
-    OFF # value if the condition is not met
-    )
-if(ENABLE_AVAHI)
-    set(HAVE_AVAHI TRUE)
-    include_directories(${AVAHI_INCLUDE_DIRS})
-    list(APPEND ariba_LINK_LIBRARIES ${AVAHI_LIBRARIES})
-endif(ENABLE_AVAHI)
-
-
-# Log4Cxx support?
-find_package(Log4Cxx)
-if(NOT LOG4CXX_FOUND)
-    message(STATUS "Couldn't find Log4Cxx. "
-        "Will build ariba withouth extended logging support")
-endif()
-cmake_dependent_option(ENABLE_LOG4CXX
-    "Enable Log4Cxx (extended logging) support" #doc
-    ON # default value
-    "LOG4CXX_FOUND" # only show if this evaluates to true
-    OFF # value if the condition is not met
-    )
-if(ENABLE_LOG4CXX)
-    set(HAVE_LOG4CXX TRUE)
-    include_directories(${LOG4CXX_INCLUDE_DIRS})
-    list(APPEND ariba_LINK_LIBRARIES ${LOG4CXX_LIBRARIES})
-endif(ENABLE_LOG4CXX)
-
-
-
-set(add_headers_INSTALL_DIR include/ariba/)
-set(add_headers_INSTALL_COMPONENT Development)
-set(add_headers_VAR libariba_HEADERS)
-set(add_sources_VAR libariba_SOURCES)
-
-# Voodoo to collect the source files from the subdirectories
-function(add_subdir_sources_helper subdir)
-    set(CURRENT_SOURCE_DIR "${CURRENT_SOURCE_DIR}${subdir}/")
-    set(add_headers_INSTALL_DIR "${add_headers_INSTALL_DIR}${subdir}/")
-    add_subdirectory(${subdir})
-    set(${add_headers_VAR} ${${add_headers_VAR}} PARENT_SCOPE)
-    set(${add_sources_VAR} ${${add_sources_VAR}} PARENT_SCOPE)
-endfunction(add_subdir_sources_helper subdir)
-
-macro(add_subdir_sources subdirs)
-    foreach(subdir ${subdirs} ${ARGN})
-        add_subdir_sources_helper(${subdir})
-    endforeach(subdir ${subdirs} ${ARGN})
-    set(${add_headers_VAR} ${${add_headers_VAR}} PARENT_SCOPE)
-    set(${add_sources_VAR} ${${add_sources_VAR}} PARENT_SCOPE)
-endmacro(add_subdir_sources subdirs)
-
-macro(add_headers sources)
-    foreach(source ${sources} ${ARGN})
-        list(APPEND ${add_headers_VAR} "${CURRENT_SOURCE_DIR}${source}")
-    endforeach(source ${sources} ${ARGN})
-    
-    install(FILES ${sources} ${ARGN}
-        DESTINATION "${add_headers_INSTALL_DIR}"
-        COMPONENT "${add_headers_INSTALL_COMPONENT}"
-        )
-    
-    set(${add_headers_VAR} ${${add_headers_VAR}} PARENT_SCOPE)
-endmacro(add_headers sources)
-
-macro(add_sources sources)
-    foreach(source ${sources} ${ARGN})
-        list(APPEND ${add_sources_VAR} "${CURRENT_SOURCE_DIR}${source}")
-    endforeach(source ${sources} ${ARGN})
-    set(${add_sources_VAR} ${${add_sources_VAR}} PARENT_SCOPE)
-endmacro(add_sources sources)
-
-
-# Headers to be exported
-add_headers(
-    ariba.h
-#    AribaModule.h
-    CommunicationListener.h
-    DataMessage.h
-    Identifiers.h
-    LinkProperties.h
-    Message.h
-    Module.h
-    Name.h
-    Node.h
-    NodeListener.h
-    SideportListener.h
-    SpoVNetProperties.h
-    )
-
-add_sources(
-#    AribaModule.cpp
-    CommunicationListener.cpp
-    DataMessage.cpp
-    Identifiers.cpp
-    LinkProperties.cpp
-    Module.cpp
-    Name.cpp
-    Node.cpp
-    NodeListener.cpp
-    SideportListener.cpp
-    SpoVNetProperties.cpp
-    )
-
-# Can't use add_subdir_sources() here because we want it in this scope not
-# in our parent's scope
-add_subdir_sources_helper(communication)
-add_subdir_sources_helper(overlay)
-add_subdir_sources_helper(utility)
-
-
-if(CMAKE_BUILD_TYPE)
-    if(${CMAKE_BUILD_TYPE} STREQUAL Debug)
-        set(DEBUG ON)
-    endif()
-endif()
-
-option(HAVE_MAEMO
-    "Whether we compile for the maemo platform" #TODO: maybe detect automatically
-    OFF
-    )
-
-set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall")
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
-
-# Configure the template file
-configure_file(
-    config.h.in
-    config.h
-    )
-include_directories("${CMAKE_CURRENT_BINARY_DIR}/..")
-list(APPEND libariba_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/config.h")
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config.h"
-    DESTINATION "${add_headers_INSTALL_DIR}"
-    COMPONENT "${add_headers_INSTALL_COMPONENT}"
-    )
-
-# Add the parent directory to the includes because we reference headers with
-# "ariba/path/to/file" all the time
-include_directories("${CMAKE_CURRENT_SOURCE_DIR}/..")
-
-
-# Compile the actual library
-
-include(BuildSharedAndStaticLib)
-
-set(ariba_SOURCES ${libariba_SOURCES} ${libariba_HEADERS})
-# ariba_LINK_LIBRARIES, ariba_VERSION and ariba_SOVERSION already defined
-
-build_shared_and_static_libs(ariba)
-
-
-# Install binaries
-install(TARGETS ariba ${ariba_STATIC_TARGET} EXPORT ariba-targets
-    LIBRARY DESTINATION lib COMPONENT Runtime
-    ARCHIVE DESTINATION lib COMPONENT Development
-    RUNTIME DESTINATION bin COMPONENT Runtime
-    )
-
-
-# Make libariba usable from build tree
-export(TARGETS ariba ${ariba_STATIC_TARGET} FILE ariba-exports.cmake)
-
-if(ariba_BINARY_DIR)
-    export(TARGETS ariba ${ariba_STATIC_TARGET}
-        FILE "${ariba_BINARY_DIR}/ariba-exports.cmake")
-endif(ariba_BINARY_DIR)
Index: urce/ariba/CommunicationListener.cpp
===================================================================
--- /source/ariba/CommunicationListener.cpp	(revision 12775)
+++ 	(revision )
@@ -1,110 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "CommunicationListener.h"
-
-namespace ariba {
-
-CommunicationListener CommunicationListener::DEFAULT;
-
-CommunicationListener::CommunicationListener() {
-}
-
-CommunicationListener::~CommunicationListener() {
-}
-
-void CommunicationListener::onLinkUp(const LinkID& l, const NodeID& r) {
-}
-
-void CommunicationListener::onLinkDown(const LinkID& l, const NodeID& r) {
-}
-
-void CommunicationListener::onLinkChanged(const LinkID& l, const NodeID& r) {
-}
-
-void CommunicationListener::onLinkFail(const LinkID& l, const NodeID& r) {
-    onLinkDown(l, r);
-}
-
-bool CommunicationListener::onLinkRequest(const NodeID& remote) {
-	return true;
-}
-
-void CommunicationListener::onMessage(const DataMessage& msg,
-	const NodeID& remote, const LinkID& lnk) {
-}
-
-// this implementation provides backward compatibility
-// overwrite it to use the new interface
-void CommunicationListener::onMessage(reboost::shared_buffer_t message,
-        const NodeID& remote,
-        const LinkID& lnk,
-        const SequenceNumber& seqnum,
-        const ariba::overlay::OverlayMsg* overlay_msg)
-{
-    // copy data
-    Data data;
-    data.setLength(message.size() * 8);
-    memcpy(data.getBuffer(), message.data(), message.size());
-    
-    // and prepare old-style overlay message
-    Message legacy_msg;
-    legacy_msg.setPayload(data);
-    
-    
-    // * call legacy handler *
-    this->onMessage(legacy_msg, remote, lnk);
-}
-
-void CommunicationListener::onKeyValue( const Data& key, const vector<Data>& value ) {
-}
-
-bool CommunicationListener::onPing(const NodeID& remote)
-{
-    return true;
-}
-
-void CommunicationListener::onPingLost(const NodeID& remote)
-{
-}
-
-void CommunicationListener::onPong(const NodeID& remote)
-{
-}
-
-} // namespace ariba
Index: urce/ariba/CommunicationListener.h
===================================================================
--- /source/ariba/CommunicationListener.h	(revision 12775)
+++ 	(revision )
@@ -1,188 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef COMMUNICATIONLISTENER_H_
-#define COMMUNICATIONLISTENER_H_
-
-#include "Message.h"
-#include "Identifiers.h"
-#include "LinkProperties.h"
-#include "DataMessage.h"
-#include "ariba/overlay/SequenceNumber.h"
-
-namespace ariba {
-
-typedef ariba::overlay::SequenceNumber SequenceNumber;
-
-// forward decl
-namespace overlay {
-	class BaseOverlay;
-	class OverlayMsg;
-}
-
-/** \addtogroup public
- * @{
- * Listener for communication events on links.
- */
-class CommunicationListener {
-
-	friend class ariba::overlay::BaseOverlay;
-	friend class Node;
-
-public:
-	static CommunicationListener DEFAULT; //< default implementation
-
-protected:
-
-	/**
-	 * Construct a communication listener
-	 */
-	CommunicationListener();
-
-	/**
-	 * Destruct a communication listener
-	 */
-	virtual ~CommunicationListener();
-
-	// --- link events ---
-
-	/**
-	 * Event called when a link goes up
-	 * @param lnk The id of the link
-	 * @param remote The remote node where the link ends
-	 */
-	virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
-
-	/**
-	 * Event called when a link goes down
-	 * @param lnk The id of the link
-	 * @param remote The remote node where the link ends
-	 */
-	virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
-
-	/**
-	 * Event called when a link has changed,
-	 * e.g. through mobility
-	 * @param lnk The id of the link
-	 * @param remote The remote node where the link ends
-	 */
-	virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote);
-
-	/**
-	 * Event called when a link has failed
-	 * @param lnk The id of the link
-	 * @param remote The remote node where the link ends
-	 */
-	virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
-
-	/**
-	 * Request from remote node to open up a link
-	 * @param remote The remote node that requests the new link
-	 */
-	virtual bool onLinkRequest(const NodeID& remote);
-
-	// --- general receive method ---
-
-	/**
-	 * @DEPRECATED
-	 * 
-	 * Called when a message is incoming
-	 * @param msg The data message that is received
-	 * @param remote The remote node that sent the message
-	 * @param lnk The link id of the link where the message is received
-	 */
-	virtual void onMessage(const DataMessage& msg, const NodeID& remote,
-			const LinkID& lnk = LinkID::UNSPECIFIED);
-
-
-    /**
-     * NOTE: This interface is still unstable and may change in future releases.
-     *   ---> Especially the parameter Â«overlay_msgÂ» may be replaced or removed.
-     *   
-     * Called when a message is incoming
-     * @param msg A shared buffer with the (serialized) payload
-     * @param remote The remote node that sent the message
-     * @param lnk The link id of the link where the message is received
-     * @param overlay_msg A pointer to the ariba internal Overlay Message
-     */
-    virtual void onMessage(reboost::shared_buffer_t message,
-            const NodeID& remote,
-            const LinkID& lnk,
-            const SequenceNumber& seqnum,
-            const ariba::overlay::OverlayMsg* overlay_msg);
-
-	// --- dht functionality ---
-
-	/**
-	 * Called when a key has been resolved in the DHT
-	 * @param key The key that was requested
-	 * @param value the data items the key was resolved to
-	 */
-	virtual void onKeyValue( const Data& key, const vector<Data>& value );
-
-    // --- ping pong (routed) ---
-    /**
-     * Called when a ping message was received.
-     * 
-     * @param remote Node which sent the ping message
-     * @return bool Allows to send a pong message (default: true)
-     */
-    virtual bool onPing(const NodeID& remote);
-
-    /**
-     * Called when a ping message is lost.
-     * 
-     * NOTE: A ping message could also get lost without notice.
-     * 
-     * @param remote Node to which the ping message was sent
-     */
-    virtual void onPingLost(const NodeID& remote);
-    
-    /**
-     * Called when a pong message was received.
-     * 
-     * @param remote Node which sent the pong message
-     */
-    virtual void onPong(const NodeID& remote);
-};
-
-} // namespace ariba
-
-/** @} */
-
-#endif /* COMMUNICATIONLISTENER_H_ */
Index: urce/ariba/DataMessage.cpp
===================================================================
--- /source/ariba/DataMessage.cpp	(revision 12775)
+++ 	(revision )
@@ -1,9 +1,0 @@
-
-#include "DataMessage.h"
-
-namespace ariba {
-
-const DataMessage DataMessage::UNSPECIFIED;
-
-} // namespace ariba
-
Index: urce/ariba/DataMessage.h
===================================================================
--- /source/ariba/DataMessage.h	(revision 12775)
+++ 	(revision )
@@ -1,155 +1,0 @@
-#ifndef DATAMESSAGE_H_
-#define DATAMESSAGE_H_
-
-#define USE_MESSAGE_UTILITY
-
-#include <memory>
-#include <inttypes.h>
-
-// use message utility
-#ifdef USE_MESSAGE_UTILITY
-//  #include "ariba/utility/messages.h"
-  #include "ariba/utility/messages/Message.h"
-  namespace ariba {
-    typedef utility::Message Message;
-  }
-#endif
-
-namespace ariba {
-
-// define sequence number type
-typedef uint16_t seqnum_t;
-
-/**
- * \addtogroup public
- * @{
- * This class wraps different representations of a message. In its current
- * version is allows to specify binary data (as void*) with a size specifying
- * the number of bytes of data or an message object that can be
- * serialized if necessary. The main idea is, that simulation environments
- * do not necessarily need to serialize messages.
- *
- * For performance reasons methods of this class are inlined where possible!
- *
- * @author Sebastian Mies <mies@tm.uka.de>
- */
-class DataMessage {
-private:
-	void* data; //< internal buffer pointer
-	size_t size; //< internal buffer pointer size
-public:
-	static const DataMessage UNSPECIFIED; //< default implementation of a data message
-
-	/**
-	 * Default constructor for a data message
-	 */
-	inline DataMessage() {
-		this->data = NULL;
-		this->size = 0;
-	}
-
-	/**
-	 * Constructor for a data message
-	 * @param data Data buffer to carry in the message
-	 * @param size Size of the buffer pointed to
-	 */
-	inline DataMessage( const void* data, const size_t size ) {
-		this->data = const_cast<void*>(data);
-		this->size = size;
-	}
-
-	/**
-	 * Copy constructor for a data message
-	 * @param message The other message to copy from
-	 */
-	inline DataMessage(const DataMessage& message){
-		this->data = message.data;
-		this->size = message.size;
-	}
-
-#ifdef USE_MESSAGE_UTILITY
-	/**
-	 * Construct a data message from a normal message
-	 * @param message The normal message to store
-	 */
-	inline DataMessage( const Message* message ) {
-		this->data = (void*)const_cast<Message*>(message);
-		this->size = ~0;
-	}
-
-	/**
-	 * Construct a data message from a normal message
-	 * @param message The normal message to store
-	 */
-	inline DataMessage( const Message& message ) {
-		this->data = (void*)const_cast<Message*>(&message);
-		this->size = ~0;
-	}
-
-	/**
-	 * Get the internal message when constructued through one
-	 * @return pointer to the message
-	 */
-	inline Message* getMessage() const {
-		if (isData()) {
-			return new Message( Data((uint8_t*)data,size*8) );
-		}
-		return (Message*)data;
-	}
-
-	/**
-	 * Conversion function to convert to Message*
-	 * @return internal message
-	 */
-	inline operator Message* () const {
-		return getMessage();
-	}
-#endif
-
-	/**
-	 * Is the data message a normal message?
-	 * @return true, if the data message is a normal message
-	 */
-	inline bool isMessage() const {
-		return size == ~(size_t)0;
-	}
-
-	/**
-	 * Is the data message a data message
-	 * @return true, if the data message is not a normal message
-	 */
-	inline bool isData() const {
-		return !isMessage();
-	}
-
-	/**
-	 * Directly access the internal data pointer
-	 * @return internal data pointer
-	 */
-	inline void* getData() const {
-		return data;
-	}
-
-	/**
-	 * Get the size of the internal buffer
-	 * @return internal buffer size
-	 */
-	inline size_t getSize() const {
-		return size;
-	}
-
-	/**
-	 * Is the data message invalid?
-	 * @return true, if data message is invalid
-	 */
-	inline bool isUnspecified() const {
-		return data == NULL;
-	}
-
-};
-
-} // namespace ariba
-
-/** @} */
-
-#endif /* DATAMESSAGE_H_ */
Index: urce/ariba/Identifiers.cpp
===================================================================
--- /source/ariba/Identifiers.cpp	(revision 12775)
+++ 	(revision )
@@ -1,43 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "Identifiers.h"
-
-namespace ariba {
-
-} // namespace ariba
Index: urce/ariba/Identifiers.h
===================================================================
--- /source/ariba/Identifiers.h	(revision 12775)
+++ 	(revision )
@@ -1,59 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef IDENTIFIERS_H_
-#define IDENTIFIERS_H_
-
-#include "ariba/utility/types/NodeID.h"
-#include "ariba/utility/types/ServiceID.h"
-#include "ariba/utility/types/LinkID.h"
-#include "ariba/utility/types/SpoVNetID.h"
-/** \addtogroup public
- * @{
- */
-
-namespace ariba {
-	typedef utility::NodeID NodeID;
-	typedef utility::LinkID LinkID;
-	typedef utility::SpoVNetID SpoVNetID;
-	typedef utility::ServiceID ServiceID;
-} // namespace ariba
-
-/** @} */
-
-#endif /* IDENTIFIERS_H_ */
Index: urce/ariba/LinkProperties.cpp
===================================================================
--- /source/ariba/LinkProperties.cpp	(revision 12775)
+++ 	(revision )
@@ -1,55 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "LinkProperties.h"
-
-namespace ariba {
-
-const LinkProperties LinkProperties::DEFAULT;
-
-LinkProperties::LinkProperties() {
-}
-
-LinkProperties::~LinkProperties() {
-}
-
-string LinkProperties::toString() const {
-	return "";
-}
-
-} // namespace ariba
Index: urce/ariba/LinkProperties.h
===================================================================
--- /source/ariba/LinkProperties.h	(revision 12775)
+++ 	(revision )
@@ -1,90 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef LINKPROPERTIES_H_
-#define LINKPROPERTIES_H_
-
-#include <string>
-#include <iostream>
-#include <sstream>
-
-using std::string;
-
-namespace ariba {
-// forward declaration
-class LinkProperties;
-}
-
-namespace ariba {
-
-/**
- * \addtogroup public
- * @{
- *
- * Link properties storage. Currently empty but will
- * contain properties to create the link in the future
- */
-class LinkProperties {
-public:
-	/**
-	 * Constructor of LinkProperties
-	 */
-	LinkProperties();
-
-	/**
-	 * Destructor of LinkProperties
-	 */
-	virtual ~LinkProperties();
-
-	/**
-	 * Convert to readable string
-	 * @return string representation
-	 */
-	string toString() const;
-
-	/**
-	 * Default instance of LinkProperties
-	 */
-	static const LinkProperties DEFAULT;
-};
-
-} // namespace ariba
-
-/** @} */
-
-#endif /* LINKPROPERTIES_H_ */
Index: /source/ariba/Makefile.am
===================================================================
--- /source/ariba/Makefile.am	(revision 2378)
+++ /source/ariba/Makefile.am	(revision 2378)
@@ -0,0 +1,400 @@
+lib_LTLIBRARIES     = libariba.la
+libariba_la_SOURCES =
+
+# compiler flags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# read the autotools book 11.4 for setting the versioning number
+# this is different from normal versioning schemes and important
+# to set correctly as the runtime linker chooses the correct lib
+# depending on the versioning information here! This is not the
+# project version number!!
+
+libariba_la_LDFLAGS = -version-info 0:0:0
+
+# compiler flags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AM_CPPFLAGS     = -DLINUX -D_LINUX -I../ -D_REENTRANT -DSCTP_KERN
+AM_CPPFLAGS    += $(BOOST_CPPFLAGS)
+
+if DEBUG
+AM_CPPFLAGS    += -ggdb -DDEBUG -D_DEBUG -O0
+endif
+
+if PROFILING
+AM_CPPFLAGS    += -pg
+endif
+
+if OMNET
+AM_CPPFLAGS    += -fPIC -DUNDERLAY_OMNET
+endif
+
+# linker flags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AM_LDFLAGS      = $(BOOST_THREAD_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS)
+LIBS           += $(BOOST_THREAD_LIBS) $(BOOST_SYSTEM_LIBS)
+
+if PROFILING
+AM_LDFLAGS     += -pg
+endif
+
+if OMNET
+AM_LDFLAGS     += -shared -rdynamic
+endif
+
+# sources and subdirs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+#interfaces headers for make install - don't 
+#remove the here listed .h files from _SOURCES!
+libariba_la_INCLUDES += \
+  tidy/AribaModule.h \
+  tidy/TidyCommunicationListener.h \
+  tidy/Identifiers.h \
+  tidy/LinkProperties.h \
+  tidy/TidyMessage.h \
+  tidy/Module.h \
+  tidy/Name.h \
+  tidy/Node.h \
+  tidy/NodeListener.h \
+  tidy/SpoVNetProperties.h
+
+#tidy interface
+libariba_la_SOURCES += \
+  tidy/AribaModule.cpp \
+  tidy/AribaModule.h \
+  tidy/TidyCommunicationListener.cpp \
+  tidy/TidyCommunicationListener.h \
+  tidy/Identifiers.cpp \
+  tidy/Identifiers.h \
+  tidy/LinkProperties.cpp \
+  tidy/LinkProperties.h \
+  tidy/TidyMessage.cpp \
+  tidy/TidyMessage.h \
+  tidy/Module.cpp \
+  tidy/Module.h \
+  tidy/Name.cpp \
+  tidy/Name.h \
+  tidy/Node.cpp \
+  tidy/Node.h \
+  tidy/NodeListener.cpp \
+  tidy/NodeListener.h \
+  tidy/SpoVNetProperties.cpp \
+  tidy/SpoVNetProperties.h
+  
+#communication
+libariba_la_SOURCES += \
+  communication/BaseCommunication.cpp \
+  communication/BaseCommunication.h \
+  communication/CommunicationEvents.cpp \
+  communication/CommunicationEvents.h \
+  communication/EndpointDescriptor.cpp \
+  communication/EndpointDescriptor.h
+
+#communication :: messages
+libariba_la_SOURCES += \
+  communication/messages/AribaBaseMsg.cpp \
+  communication/messages/AribaBaseMsg.h
+
+#communication :: modules
+libariba_la_SOURCES += \
+  communication/modules/modules.h \
+  communication/modules/_namespace.h
+
+#communication :: modules :: network
+libariba_la_SOURCES += \
+  communication/modules/network/NetworkLocator.cpp \
+  communication/modules/network/NetworkLocator.h \
+  communication/modules/network/NetworkProtocol.cpp \
+  communication/modules/network/NetworkProtocol.h
+
+#communication :: modules :: network :: ip
+libariba_la_SOURCES += \
+  communication/modules/network/ip/IPv4Locator.cpp \
+  communication/modules/network/ip/IPv4Locator.h  \
+  communication/modules/network/ip/IPv4NetworkProtocol.cpp \
+  communication/modules/network/ip/IPv4NetworkProtocol.h
+
+if OMNET
+#communication :: modules :: network :: omnet
+libariba_la_SOURCES += \
+  communication/modules/network/omnet/OmnetNetworkProtocol.cpp \
+  communication/modules/network/omnet/OmnetNetworkProtocol.h
+endif
+
+#communication :: modules :: transport
+libariba_la_SOURCES += \
+  communication/modules/transport/TransportLocator.cpp \
+  communication/modules/transport/TransportLocator.h \
+  communication/modules/transport/TransportProtocol.cpp \
+  communication/modules/transport/TransportProtocol.h
+
+if OMNET
+#communication :: modules :: transport :: omnet
+libariba_la_SOURCES += \
+  communication/modules/transport/omnet/AribaOmnetMessage_m.cc \
+  communication/modules/transport/omnet/AribaOmnetMessage_m.h \
+  communication/modules/transport/omnet/AribaOmnetModule.cpp \
+  communication/modules/transport/omnet/AribaOmnetModule.h
+endif
+
+if OMNET
+else
+#communication :: modules :: transport :: protlib
+libariba_la_SOURCES += \
+  communication/modules/transport/protlib/timer_module.cpp \
+  communication/modules/transport/protlib/threadsafe_db.cpp \
+  communication/modules/transport/protlib/address.cpp \
+  communication/modules/transport/protlib/ie.cpp \
+  communication/modules/transport/protlib/tp_over_tcp.cpp \
+  communication/modules/transport/protlib/setuid.cpp \
+  communication/modules/transport/protlib/tp.cpp \
+  communication/modules/transport/protlib/connectionmap_uds.cpp \
+  communication/modules/transport/protlib/logfile.cpp \
+  communication/modules/transport/protlib/timer.cpp \
+  communication/modules/transport/protlib/connectionmap.cpp \
+  communication/modules/transport/protlib/fqueue.cpp \
+  communication/modules/transport/protlib/threads.cpp \
+  communication/modules/transport/protlib/messages.cpp \
+  communication/modules/transport/protlib/queuemanager.cpp \
+  communication/modules/transport/protlib/network_message.cpp \
+  communication/modules/transport/protlib/configuration.cpp \
+  communication/modules/transport/protlib/tp_over_uds.cpp \
+  communication/modules/transport/protlib/tp_over_udp.cpp \
+  communication/modules/transport/protlib/tp_over_tls_tcp.cpp \
+  communication/modules/transport/protlib/fastqueue.c \
+  communication/modules/transport/protlib/eclock_gettime.c \
+  communication/modules/transport/protlib/testqueue.c \
+  communication/modules/transport/protlib/tp_over_uds.h \
+  communication/modules/transport/protlib/threadsafe_db.h \
+  communication/modules/transport/protlib/configuration.h \
+  communication/modules/transport/protlib/ie.h \
+  communication/modules/transport/protlib/llhashers.h \
+  communication/modules/transport/protlib/fqueue.h \
+  communication/modules/transport/protlib/assocdata_uds.h \
+  communication/modules/transport/protlib/address.h \
+  communication/modules/transport/protlib/logfile.h \
+  communication/modules/transport/protlib/timer.h \
+  communication/modules/transport/protlib/queuemanager.h \
+  communication/modules/transport/protlib/messages.h \
+  communication/modules/transport/protlib/assocdata.h \
+  communication/modules/transport/protlib/protlib_types.h \
+  communication/modules/transport/protlib/tp_over_tcp.h \
+  communication/modules/transport/protlib/tp.h \
+  communication/modules/transport/protlib/threads.h \
+  communication/modules/transport/protlib/connectionmap.h \
+  communication/modules/transport/protlib/timer_module.h \
+  communication/modules/transport/protlib/fastqueue.h \
+  communication/modules/transport/protlib/tperror.h \
+  communication/modules/transport/protlib/tp_over_tls_tcp.h \
+  communication/modules/transport/protlib/network_message.h \
+  communication/modules/transport/protlib/tp_over_udp.h \
+  communication/modules/transport/protlib/setuid.h \
+  communication/modules/transport/protlib/cleanuphandler.h \
+  communication/modules/transport/protlib/connectionmap_uds.h
+endif
+
+if OMNET
+else
+#communication :: modules :: transport :: tcp
+libariba_la_SOURCES += \
+  communication/modules/transport/tcp/TCPTransport.cpp \
+  communication/modules/transport/tcp/TCPTransport.h \
+  communication/modules/transport/tcp/TCPTransportLocator.cpp \
+  communication/modules/transport/tcp/TCPTransportLocator.h
+endif
+
+#communication :: networkinfo
+libariba_la_SOURCES += \
+  communication/networkinfo/AddressInformation.cpp \
+  communication/networkinfo/AddressInformation.h \
+  communication/networkinfo/NetworkChangeDetection.cpp \
+  communication/networkinfo/NetworkChangeDetection.h \
+  communication/networkinfo/NetworkChangeInterface.h \
+  communication/networkinfo/NetworkInterface.h \
+  communication/networkinfo/NetworkInformation.cpp \
+  communication/networkinfo/NetworkInformation.h \
+  communication/networkinfo/NetworkInterface.cpp
+
+#interface
+libariba_la_SOURCES += \
+  interface/UnderlayAbstraction.cpp \
+  interface/UnderlayAbstraction.h \
+  interface/AribaContext.cpp \
+  interface/AribaContext.h \
+  interface/ServiceInterface.cpp \
+  interface/ServiceInterface.h
+
+#overlay
+libariba_la_SOURCES += \
+  overlay/BaseOverlay.cpp \
+  overlay/BaseOverlay.h \
+  overlay/OverlayEvents.cpp \
+  overlay/OverlayEvents.h
+
+#overlay :: messages
+libariba_la_SOURCES += \
+  overlay/messages/JoinReply.cpp \
+  overlay/messages/JoinReply.h \
+  overlay/messages/JoinRequest.cpp \
+  overlay/messages/JoinRequest.h \
+  overlay/messages/OverlayMsg.cpp \
+  overlay/messages/OverlayMsg.h
+
+#overlay :: modules
+libariba_la_SOURCES += \
+  overlay/modules/OverlayStructureEvents.cpp \
+  overlay/modules/OverlayStructureEvents.h \
+  overlay/modules/OverlayFactory.cpp \
+  overlay/modules/OverlayFactory.h \
+  overlay/modules/OverlayInterface.cpp \
+  overlay/modules/OverlayInterface.h
+
+#overlay :: modules :: chord
+# libariba_la_SOURCES += \
+#   overlay/modules/chord/ChordSuccessorList.h \
+#   overlay/modules/chord/Chord.h \
+#   overlay/modules/chord/ChordFingerTable.h \
+#   overlay/modules/chord/ChordSuccessorList.cc \
+#   overlay/modules/chord/Chord.cc \
+#   overlay/modules/chord/ChordFingerTable.cc
+
+#overlay :: modules :: onehop
+libariba_la_SOURCES += \
+  overlay/modules/onehop/OneHop.cpp \
+  overlay/modules/onehop/OneHop.h \
+  overlay/modules/onehop/messages/OneHopMessage.cpp \
+  overlay/modules/onehop/messages/OneHopMessage.h \
+  overlay/modules/onehop/messages/NodeListingRequest.cpp \
+  overlay/modules/onehop/messages/NodeListingRequest.h \
+  overlay/modules/onehop/messages/NodeListingReply.cpp \
+  overlay/modules/onehop/messages/NodeListingReply.h
+
+#utility
+libariba_la_SOURCES += \
+  utility/types.h \
+  utility/messages.h \
+  utility/serialization.h
+
+#utility :: configuration
+libariba_la_SOURCES += \
+  utility/configuration/ConfigFile.cpp \
+  utility/configuration/ConfigFile.h \
+  utility/configuration/Configuration.cpp \
+  utility/configuration/Configuration.h
+
+#utility :: internal
+libariba_la_SOURCES += \
+  utility/internal/Utilities.hpp
+
+#utility :: logging
+libariba_la_SOURCES += \
+  utility/logging/Logging.h
+
+#utility :: measurement
+libariba_la_SOURCES += \
+  utility/measurement/PathloadMeasurement.cpp \
+  utility/measurement/PathloadMeasurement.h
+
+#utility :: messages
+libariba_la_SOURCES += \
+  utility/messages/_namespace.h \
+  utility/messages/Message.cpp \
+  utility/messages/Message.h \
+  utility/messages/MessageControlInfo.cpp \
+  utility/messages/MessageControlInfo.h \
+  utility/messages/MessageProvider.cpp \
+  utility/messages/MessageProvider.h \
+  utility/messages/MessageReceiver.cpp \
+  utility/messages/MessageReceiver.h \
+  utility/messages/MessageSender.cpp \
+  utility/messages/MessageSender.h \
+  utility/messages/MessageUtilities.h \
+  utility/messages/TextMessage.cpp \
+  utility/messages/TextMessage.h
+
+#utility :: misc
+libariba_la_SOURCES += \
+  utility/misc/Demultiplexer.hpp \
+  utility/misc/Helper.cpp \
+  utility/misc/Helper.h \
+  utility/misc/KeyMapping.hpp \
+  utility/misc/OvlVis.cpp \
+  utility/misc/OvlVis.h \
+  utility/misc/sha1.cpp \
+  utility/misc/sha1.h
+
+#utility :: serialization
+libariba_la_SOURCES += \
+  utility/serialization/Serialization.cpp \
+  utility/serialization/DataUtilities.hpp \
+  utility/serialization/Serialization.hpp \
+  utility/serialization/Data.hpp \
+  utility/serialization/DataStream.hpp
+
+#utility :: system
+libariba_la_SOURCES += \
+  utility/system/BlockingMethod.cpp \
+  utility/system/BlockingMethod.h \
+  utility/system/SystemEvent.cpp \
+  utility/system/SystemEvent.h \
+  utility/system/SystemEventListener.cpp \
+  utility/system/SystemEventListener.h \
+  utility/system/SystemEventType.cpp \
+  utility/system/SystemEventType.h \
+  utility/system/SystemQueue.cpp \
+  utility/system/SystemQueue.h \
+  utility/system/Timer.cpp \
+  utility/system/Timer.h \
+  utility/system/StartupWrapper.cpp \
+  utility/system/StartupWrapper.h \
+  utility/system/StartupInterface.h
+
+#utility :: types
+libariba_la_SOURCES += \
+  utility/types/_namespace.h \
+  utility/types/Address.cpp \
+  utility/types/Address.h \
+  utility/types/Data.hpp \
+  utility/types/Identifier.cpp \
+  utility/types/Identifier.h \
+  utility/types/LinkID.cpp \
+  utility/types/LinkID.h \
+  utility/types/Locator.cpp \
+  utility/types/Locator.h \
+  utility/types/NodeID.cpp \
+  utility/types/NodeID.h \
+  utility/types/OverlayParameterSet.cpp \
+  utility/types/OverlayParameterSet.h \
+  utility/types/QoSParameterSet.cpp \
+  utility/types/QoSParameterSet.h \
+  utility/types/SecurityParameterSet.cpp \
+  utility/types/SecurityParameterSet.h \
+  utility/types/ServiceID.cpp \
+  utility/types/ServiceID.h \
+  utility/types/SpoVNetID.cpp \
+  utility/types/SpoVNetID.h
+
+#autotools does not support hierarchical folders in the header dir
+#so we copy them on our own using, similar to 14.3 in the autobook
+
+
+#TODO: do we still need this? what is the default dir?#do we want the version no in the folder
+# so people can install multiple header versions?
+libariba_ladir = ${pkgincludedir}
+
+# header files to install - TODO: extract all *.h and *.hpp files ~~~~
+
+### --> no more longer needed when the tidy interface is done!
+#
+#              |
+#              |
+#             \/
+#
+# install-data-local:
+# 	@for f in $(libariba_la_SOURCES); do \
+# 		d=`echo $$f | sed -e 's,/[^/]*$$,,'`; \
+# 		$(mkinstalldirs) $(DESTDIR)$(libariba_ladir)/$$d; \
+# 		if test -f $(srcdir)/$$f; then p=$(srcdir)/$$f; else p=$$f; fi; \
+# 		$(INSTALL_DATA) $$p $(DESTDIR)$(libariba_ladir)/$$f; \
+# 	done
+# 
+# uninstall-local:
+# 	rm -rf $(DESTDIR)$(libariba_ladir)
Index: urce/ariba/Message.h
===================================================================
--- /source/ariba/Message.h	(revision 12775)
+++ 	(revision )
@@ -1,62 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef TIDYMESSAGE_H_
-#define TIDYMESSAGE_H_
-
-#include <inttypes.h>
-
-// legacy messages
-#include "ariba/utility/messages/Message.h"
-// reboost messages
-#include "ariba/utility/transport/messages/message.hpp"
-
-/** \addtogroup public
- * @{
- */
-
-
-namespace ariba {
-	typedef uint16_t seqnum_t;
-	//! \addtogroup public
-	typedef utility::Message Message;
-} // namespace ariba
-
-/** @} */
-
-#endif /* MESSAGE_H_ */
Index: urce/ariba/Module.cpp
===================================================================
--- /source/ariba/Module.cpp	(revision 12775)
+++ 	(revision )
@@ -1,82 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "Module.h"
-
-namespace ariba {
-
-// dummy
-Module::Module() {
-}
-
-// dummy
-Module::~Module() {
-}
-
-// dummy
-void Module::initialize() {
-}
-
-// dummy
-void Module::start() {
-}
-
-// dummy
-void Module::stop() {
-}
-
-// dummy
-string Module::getName() const {
-	return string("<empty module>");
-}
-
-// dummy
-void Module::setProperty( string key, string value ) {
-}
-
-// dummy
-const string Module::getProperty( string key ) const {
-	return string("<n/a>");
-}
-
-// dummy
-const vector<string> Module::getProperties() const {
-	return vector<string>();
-}
-
-} // namespace ariba
Index: urce/ariba/Module.h
===================================================================
--- /source/ariba/Module.h	(revision 12775)
+++ 	(revision )
@@ -1,117 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef MODULE_H_
-#define MODULE_H_
-
-#include <string>
-#include <vector>
-
-// usings
-using std::vector;
-using std::string;
-
-namespace ariba {
-
-/**
- * \addtogroup public
- * @{
- *
- * This class serves as base class for generic modules that
- * can be initialized, started, stopped and configured using standard
- * human-readable properties.
- *
- * @author Sebastian Mies <mies@tm.uka.de>
- */
-class Module {
-public:
-	Module();
-	virtual ~Module();
-
-	/**
-	 * This method (re-)initializes this module.
-	 */
-	virtual void initialize();
-
-	/**
-	 * This method (re-)starts this module
-	 */
-	virtual void start();
-
-	/**
-	 * This method stops this module
-	 */
-	virtual void stop();
-
-	/**
-	 * Returns the name of this module
-	 *
-	 * @return The name of this module
-	 */
-	virtual string getName() const;
-
-	/**
-	 * Sets a property in this module
-	 *
-	 * @param key The key of the property
-	 * @param value The value of the property
-	 */
-	virtual void setProperty( string key, string value );
-
-	/**
-	 * Returns the value of a specified property
-	 *
-	 * @param key The key of the property
-	 * @return The value of the property
-	 */
-	virtual const string getProperty( string key ) const;
-
-	/**
-	 * Returns a vector containing all possible property keys in a
-	 * human-readable form
-	 *
-	 * @return A vector containing all possible property keys
-	 */
-	virtual const vector<string> getProperties() const;
-};
-
-} // namespace ariba
-
-/** @} */
-
-#endif /* MODULE_H_ */
Index: urce/ariba/Name.cpp
===================================================================
--- /source/ariba/Name.cpp	(revision 12775)
+++ 	(revision )
@@ -1,178 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "Name.h"
-
-#include "ariba/utility/types/Identifier.h"
-
-using ariba::utility::Identifier;
-
-std::ostream& operator<<( std::ostream& s, const ariba::Name& n ) {
-	return s << n.toString();
-}
-
-namespace ariba {
-
-const Name Name::UNSPECIFIED;
-
-void Name::init(const char* name, int len, bool copy, bool hreadable) {
-
-	// delete the old buffer
-	if( _bytes != NULL ) {
-		delete[] _bytes;
-		_bytes = NULL;
-		_length = 0;
-	}
-
-	// alloc new stuff
-	if (len == -1)
-		len = strlen(name);
-
-	if (copy) {
-
-		if ( (name!=NULL) && (len>0) ){
-			_bytes = new uint8_t[len];
-			memcpy( _bytes, name, len );
-		} else {
-			len = 0;
-			_bytes = NULL;
-		}
-
-	} else {
-		_bytes = (uint8_t*)name;
-	}
-
-	_copy = copy;
-	_length = len;
-	_hreadable = hreadable;
-}
-
-Name::Name()
-	: _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
-}
-
-Name::Name(const char* name, int len, bool copy)
-	: _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
-	init(name, len, copy, len == -1);
-}
-
-Name::Name(string name)
-	: _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
-	init(name.c_str(), name.length(), true, true);
-}
-
-Name::Name(const Name& name)
-	: _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
-	init((const char*)name.bytes(), name.length(), true, name._hreadable);
-}
-
-Name::~Name() {
-	if (_copy && (_bytes!=NULL)){
-		delete[] _bytes;
-		_bytes = NULL;
-		_length = 0;
-	}
-}
-
-Name& Name::operator=( const Name& name ) {
-	init((const char*)name.bytes(), name.length(), true, name._hreadable);
-	return *this;
-}
-
-const uint8_t* Name::bytes() const {
-	return _bytes;
-}
-
-const size_t Name::length() const {
-	return _length;
-}
-
-bool Name::operator==(const Name& name) const {
-
-	// unspecified Name objects
-	if (_bytes == NULL && name._bytes == NULL &&
-		length() == name.length()) return true;
-
-	// specified name objects
-	if (_bytes == NULL || name._bytes == NULL) return false;
-	if (name.length() != length()) return false;
-	return (memcmp(name.bytes(), bytes(), length()) == 0);
-}
-
-bool Name::operator!=(const Name& name) const {
-	return !(*this == name);
-}
-
-bool Name::isUnspecified() const {
-	return *this == UNSPECIFIED;
-}
-
-Name Name::random() {
-	char name[17];
-	srand( time(NULL) );
-
-	for (int i=0;i<16; i++)
-		name[i] = ("abcdefghijklmnopqrstuvwxyz")[((unsigned)rand())%26];
-	name[16] = 0;
-
-	// force use of the std::string ctor with this
-	return Name( string(name) );
-}
-
-string Name::toString() const {
-	if (_hreadable) {
-		char str[256];
-		for (size_t i=0; i<length(); i++) str[i] = bytes()[i];
-		str[length()] = 0;
-		return string(str);
-	} else {
-		return string("<not readable>");
-	}
-}
-
-NodeID Name::toNodeId() const {
-	if( bytes()==NULL || length()==0 ) return NodeID::UNSPECIFIED;
-	return NodeID( Identifier::sha1(bytes(),length()) );
-}
-
-SpoVNetID Name::toSpoVNetId() const {
-	if( bytes()==NULL || length()==0 ) return SpoVNetID::UNSPECIFIED;
-	return SpoVNetID( Identifier::sha1(bytes(),length()) );
-}
-
-} // namespace ariba
Index: urce/ariba/Name.h
===================================================================
--- /source/ariba/Name.h	(revision 12775)
+++ 	(revision )
@@ -1,166 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef NAME_H_
-#define NAME_H_
-
-#include <iostream>
-#include <memory.h>
-#include <string>
-
-using std::string;
-
-// forward declaration
-namespace ariba { class Name; }
-
-std::ostream& operator<<( std::ostream&, const ariba::Name& );
-
-#include "Identifiers.h"
-
-namespace ariba {
-
-/**
- * \addtogroup public
- * @{
- *
- * This class is a wrapper for canonical names.
- * Currently only human readable names are supported.
- *
- * @author Sebastian Mies <mies@tm.uka.de>
- */
-class Name {
-	friend std::ostream& operator<<( std::ostream&, const ::ariba::Name& );
-public:
-	static const Name UNSPECIFIED;
-
-	/**
-	 * Constructs a new, yet unspecified name.
-	 */
-	Name();
-
-	/**
-	 * Constructs a new name. If no length is specified, a human-readable
-	 * name is assumed.
-	 *
-	 * @param name The name
-	 * @param len The optional name length, if binary data is used as name
-	 * @param copy A flag, whether the name's memory needs to be copied
-	 */
-	Name(const char* name, int len = -1, bool copy = false);
-
-	/**
-	 * Constructs a new name out of a human readable string.
-	 *
-	 * @param name A human readable name
-	 */
-	Name(string name);
-
-	/**
-	 * The copy constructor.
-	 */
-	Name(const Name& name);
-
-	/**
-	 * Destroys the name and releases underlying memory if this name is a copy.
-	 */
-	virtual ~Name();
-
-	/**
-	 * Returns the binary bytes of the name
-	 *
-	 * @return The binary data
-	 */
-	const uint8_t* bytes() const;
-
-	/**
-	 * Returns the length of the name in bytes.
-	 *
-	 * @return The length of the name
-	 */
-	const size_t length() const;
-
-	/**
-	 * The common assign operator
-	 */
-	Name& operator=( const Name& name );
-
-	/**
-	 * The common implementation of the "equal" operator.
-	 */
-	bool operator==(const Name& name) const;
-
-	/**
-	 * The common implementation of the "unequal" operator.
-	 */
-	bool operator!=(const Name& name) const;
-
-	/**
-	 * Returns true, if the name is yet unspecified
-	 */
-	bool isUnspecified() const;
-
-	/**
-	 * Returns a random name.
-	 */
-	static Name random();
-
-	/**
-	 * Returns a human-readable representation of this name
-	 */
-	string toString() const;
-
-	// hack: to be changed!
-	NodeID toNodeId() const;
-
-	// hack: to be changed!
-	SpoVNetID toSpoVNetId() const;
-
-private:
-	uint8_t* _bytes; //< internal pointer
-	int _length; //< length of internal pointer
-	bool _copy; //< is the buffer a real copy
-	bool _hreadable; //< is the name human readable
-
-	void init(const char* name, int len, bool copy, bool hreadable);
-};
-
-} // namespace ariba
-
-/** @} */
-
-#endif /* NAME_H_ */
Index: urce/ariba/Node.cpp
===================================================================
--- /source/ariba/Node.cpp	(revision 12775)
+++ 	(revision )
@@ -1,463 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "Node.h"
-
-#include <boost/foreach.hpp>
-
-#include "ariba/overlay/BaseOverlay.h"
-#include "ariba/communication/BaseCommunication.h"
-
-#include "ariba/utility/types/OverlayParameterSet.h"
-#include "ariba/communication/EndpointDescriptor.h"
-
-#include <boost/property_tree/exceptions.hpp>
-
-using namespace std;
-using ariba::communication::EndpointDescriptor;
-using boost::property_tree::ptree;
-
-namespace ariba {
-
-use_logging_cpp(Node);
-
-//Node::Node(AribaModule& ariba_mod, const Name& node_name) :
-//	name(node_name), ariba_mod(ariba_mod) {
-//	base_overlay = new BaseOverlay();
-//}
-
-Node::Node()  :
-        name(Name::UNSPECIFIED),
-        base_communication(NULL),
-        base_overlay(NULL)
-{
-    base_communication = new BaseCommunication();
-    base_overlay = new BaseOverlay();
-}
-
-Node::~Node() {
-	delete base_overlay;
-	base_overlay = NULL;
-	
-	delete base_communication;
-	base_communication = NULL;
-}
-
-void Node::connect(const ptree& config)
-{
-    using namespace boost::property_tree;
-    using namespace addressing2;
-    
-    assert( ! base_communication->isStarted() );
-    assert( ! base_overlay->isStarted() );
-
-    // XXX needed since Â»empty_ptree<ptree>()Â« is not working
-    //   ---> see: http://stackoverflow.com/questions/5003549/where-is-boost-property-treeempty-ptree
-    static const ptree empty_pt;
-    
-    // SpovNet ID
-    Name spovnet_name(config.get<string>("spovnet_name"));
-    spovnetId = spovnet_name.toSpoVNetId();
-    
-    // Node ID
-    try
-    {
-        name = config.get<string>("node_name");
-    }
-    catch ( ptree_bad_path& e )
-    {
-        name = Name::UNSPECIFIED;
-    }
-    nodeId = generateNodeId(name);
-
-    
-    
-    /* Base Communication */
-    EndpointSetPtr listen_on;
-    try
-    {
-        listen_on = endpoint_set::create_EndpointSet(
-            config.get_child("listen_on"));
-    }
-    catch ( ptree_bad_path& e )
-    {
-        /* no endpoints specified, using default: Â»[::]:41322+Â« */
-        
-        ptree default_listen_on;
-        default_listen_on.put("endp.category", "TCPIP");
-        default_listen_on.put("endp.addr", "::");
-        default_listen_on.put("endp.port", 0);  // defaults to 41322 (or higher)
-        
-        listen_on = endpoint_set::create_EndpointSet(default_listen_on);
-//        logging_warn("No endpoints specified in config. ---> Using default.");
-        cout << "No endpoints specified in config. ---> Using default." << endl;
-    }
-    base_communication->start(listen_on);
-    
-    // TODO maybe notify the upper layer whether we have any active endpoints
-    
-
-    /* Base Overlay */
-    base_overlay->start( base_communication, nodeId );
-
-    base_overlay->createSpoVNet( spovnetId );
-    base_overlay->joinSpoVNet( spovnetId );
-    
-    
-    
-    /* Bootstrap */
-    const ptree& bootstrap_pt = config.get_child("bootstrap", empty_pt);
-    
-    // Static Bootstrap
-    try
-    {
-        // read endpoint_set from config
-        EndpointSetPtr ep_set = endpoint_set::create_EndpointSet(
-                bootstrap_pt.get_child("direct"));
-        
-        EndpointDescriptor ep = EndpointDescriptor::UNSPECIFIED();
-        ep.replace_endpoint_set(ep_set);
-        
-        // try to connect
-        base_overlay->joinSpoVNet( spovnetId, ep);
-    }
-    catch ( ptree_bad_path& e )
-    {
-//        logging_info("No direct bootstrap info in config.");
-        cout << "No direct bootstrap info in config." << endl;
-    }
-
-    
-    /* Bootstrap modules */
-    vector<pair<BootstrapManager::BootstrapType,string> > internalmodules;
-    
-    // Bootstrap: Broadcast
-    if ( bootstrap_pt.get("broadcast", false) )
-    {
-        internalmodules.push_back(make_pair(
-                BootstrapManager::BootstrapTypePeriodicBroadcast,""));
-    }
-    
-    // Bootstrap: MDNS
-    if ( bootstrap_pt.get("mdns", false) )
-    {
-        internalmodules.push_back(make_pair(
-                BootstrapManager::BootstrapTypeMulticastDns,""));
-    }
-
-    // Bootstrap: SDP
-    if ( bootstrap_pt.get("sdp", false) )
-    {
-        internalmodules.push_back(make_pair(
-                BootstrapManager::BootstrapTypeBluetoothSdp,""));
-    }
-
-    // start automatic overlay bootstrapping modules
-    base_overlay->startBootstrapModules(internalmodules);
-}
-
-//void Node::join(const Name& vnetname) {
-//	spovnetId = vnetname.toSpoVNetId();
-//	nodeId = generateNodeId(name);
-//
-//	// start base comm if not started
-//	if( !ariba_mod.base_comm->isStarted() )
-//		ariba_mod.base_comm->start();
-//
-//	// start base overlay if not started
-//	// join against ourselfs
-//	if( !base_overlay->isStarted() )
-//		base_overlay->start( *ariba_mod.base_comm, nodeId );
-//	base_overlay->joinSpoVNet( spovnetId );
-//
-//	// join against static bootstrap points and
-//	// start automatic bootstrapping modules
-//	vector<AribaModule::BootstrapMechanism> mechanisms
-//		= ariba_mod.getBootstrapMechanisms(vnetname);
-//
-//	vector<pair<BootstrapManager::BootstrapType,string> > internalmodules;
-//
-//	BOOST_FOREACH(AribaModule::BootstrapMechanism m, mechanisms){
-//		switch(m){
-//			case AribaModule::BootstrapMechanismStatic:
-//			{
-//				const communication::EndpointDescriptor* ep =
-//							ariba_mod.getBootstrapNode(vnetname, m);
-//					if( ep != NULL && ep->isUnspecified() == false )
-//						base_overlay->joinSpoVNet( spovnetId, *ep);
-//				break;
-//			}
-//			case AribaModule::BootstrapMechanismBroadcast:
-//				internalmodules.push_back(make_pair(
-//						BootstrapManager::BootstrapTypePeriodicBroadcast,
-//						ariba_mod.getBootstrapInfo(vnetname, m)));
-//				break;
-//			case AribaModule::BootstrapMechanismMulticastDNS:
-//				internalmodules.push_back(make_pair(
-//						BootstrapManager::BootstrapTypeMulticastDns,
-//						ariba_mod.getBootstrapInfo(vnetname, m)));
-//				break;
-//			case AribaModule::BootstrapMechanismSDP:
-//				internalmodules.push_back(make_pair(
-//						BootstrapManager::BootstrapTypeBluetoothSdp,
-//						ariba_mod.getBootstrapInfo(vnetname, m)));
-//				break;
-//			default:
-//				break;
-//		}
-//	}
-//
-//	// start automatic overlay bootstrapping modules
-//	base_overlay->startBootstrapModules(internalmodules);
-//
-//	// done
-//}
-//
-//void Node::initiate(const Name& vnetname, const SpoVNetProperties& parm) {
-//	utility::OverlayParameterSet ovrpset;
-//	ovrpset.setOverlayStructure(
-//			(utility::OverlayParameterSet::_OverlayStructure)
-//			parm.getBaseOverlayType()
-//			);
-//
-//	spovnetId = vnetname.toSpoVNetId();
-//	nodeId = generateNodeId(name);
-//
-//	// start base comm if not started
-//	if( !ariba_mod.base_comm->isStarted() )
-//		ariba_mod.base_comm->start();
-//
-//	// start base overlay if not started
-//	if( !base_overlay->isStarted() )
-//		base_overlay->start( *ariba_mod.base_comm, nodeId );
-//
-//	base_overlay->createSpoVNet( spovnetId, ovrpset );
-//}
-
-void Node::leave() {
-	base_overlay->stopBootstrapModules();
-	base_overlay->leaveSpoVNet();
-	base_communication->stop();  // XXX before Â»base_overlay->stop()Â« ??
-	base_overlay->stop();
-}
-
-const SpoVNetProperties& Node::getSpoVNetProperties() const {
-	return SpoVNetProperties::DEFAULT;
-}
-
-const SpoVNetID& Node::getSpoVNetId() const {
-	return spovnetId;
-}
-
-const NodeID& Node::getNodeId(const LinkID& lid) const {
-	if( lid == LinkID::UNSPECIFIED ) return nodeId;
-	else return base_overlay->getNodeID( lid );
-}
-
-NodeID Node::generateNodeId(const Name& name) const {
-	if (name == Name::UNSPECIFIED) return Name::random().toNodeId();
-	else return name.toNodeId();
-}
-
-vector<NodeID> Node::getNeighborNodes() const {
-	return base_overlay->getOverlayNeighbors();
-}
-
-LinkID Node::establishLink(const NodeID& nid, const ServiceID& sid) {
-	return base_overlay->establishLink(nid, sid);
-}
-
-void Node::dropLink(const LinkID& lnk) {
-	base_overlay->dropLink(lnk);
-}
-
-bool Node::isLinkDirect(const ariba::LinkID& lnk) const
-{
-    return base_overlay->isLinkDirect(lnk);
-}
-
-int Node::getHopCount(const ariba::LinkID& lnk) const
-{
-    return base_overlay->getHopCount(lnk);
-}
-
-
-
-
-/* +++++ Message sending +++++ */
-void Node::check_send_priority(uint8_t priority)
-{
-    if ( priority < send_priority::HIGHEST || priority > send_priority::LOWEST )
-        throw std::invalid_argument("Illegal priority");     
-}
-
-
-// +++ new interface +++
-const SequenceNumber& Node::sendMessage(reboost::message_t msg, const LinkID& lnk, uint8_t priority)
-{
-    // check priority
-    check_send_priority(priority);
-        
-    // * call base overlay *
-    return base_overlay->sendMessage(msg, lnk, priority);
-}
-
-// +++ legacy interface +++
-seqnum_t Node::sendMessage(const DataMessage& msg, const LinkID& lnk)
-{
-    reboost::message_t message = ((Message*) msg)->wrap_up_for_sending();
-    
-    try
-    {
-        base_overlay->sendMessage(message, lnk, send_priority::NORMAL);
-        return 0;
-    }
-    catch ( ariba::overlay::message_not_sent& e )
-    {
-        logging_warn("Message could not be sent. Dropped.");
-        return -1;
-    }
-}
-
-
-// +++ new interface +++
-const SequenceNumber& Node::sendMessage(reboost::message_t msg, const NodeID& nid,
-        const ServiceID& sid, uint8_t priority, const LinkProperties& req) {
-
-    // check priority
-    check_send_priority(priority);
-        
-    // * call base overlay *
-    return base_overlay->sendMessage(msg, nid, priority, sid);
-}
-
-// +++ legacy interface +++
-seqnum_t Node::sendMessage(const DataMessage& msg, const NodeID& nid,
-		const ServiceID& sid, const LinkProperties& req) {
-    
-//    reboost::message_t message = ((Message*) msg)->wrap_up_for_sending();
-    reboost::message_t message;
-    message.push_back( ((Message*) msg)->serialize_into_shared_buffer() );
-    
-    try
-    {
-        sendMessage(message, nid, sid, send_priority::NORMAL, req);
-        return 0;
-    }
-    catch ( ariba::overlay::message_not_sent& e )
-    {
-        logging_warn("Message could not be sent. Dropped.");
-        return -1;
-    }
-}
-
-
-// +++ new interface +++
-NodeID Node::sendMessageCloserToNodeID(reboost::message_t msg, const NodeID& nid, const ServiceID& sid,
-        uint8_t priority, const LinkProperties& req) {
-
-    // check priority
-    check_send_priority(priority);
-        
-    // * call base overlay *
-    return base_overlay->sendMessageCloserToNodeID(msg, nid, priority, sid);
-}
-
-// +++ legacy interface +++
-NodeID Node::sendMessageCloserToNodeID(const DataMessage& msg, const NodeID& nid, const ServiceID& sid,
-        const LinkProperties& req) {
-    
-    reboost::message_t message = ((Message*) msg)->wrap_up_for_sending();
-    
-    return sendMessageCloserToNodeID(message, nid, sid, send_priority::NORMAL, req);
-}
-
-
-// +++ new interface +++
-void Node::sendBroadcastMessage(reboost::message_t msg, const ServiceID& sid, uint8_t priority) {
-
-    // check priority
-    check_send_priority(priority);
-        
-    // * call base overlay *
-    return base_overlay->broadcastMessage(msg, sid, priority);
-}
-
-// +++ legacy interface +++
-void Node::sendBroadcastMessage(const DataMessage& msg, const ServiceID& sid) {
-    reboost::message_t message = ((Message*) msg)->wrap_up_for_sending();
-
-	return sendBroadcastMessage(message, sid);
-}
-
-
-/* +++++ [Message sending] +++++ */
-
-
-
-
-bool Node::bind(NodeListener* listener) {
-	return base_overlay->bind(listener);
-}
-
-bool Node::unbind(NodeListener* listener) {
-	return base_overlay->unbind(listener);
-}
-
-bool Node::bind(CommunicationListener* listener, const ServiceID& sid) {
-	// bind the listener
-	bool ret = base_overlay->bind(listener, sid);
-
-//	// now that we have a listener, we can ask if sniffing is ok
-//	if( ariba_mod.sideport_sniffer != NULL ){
-//		base_overlay->registerSidePort(ariba_mod.sideport_sniffer);
-//	}
-
-	return ret;
-}
-
-bool Node::unbind(CommunicationListener* listener, const ServiceID& sid) {
-	return base_overlay->unbind(listener, sid);
-}
-
-// @see Module.h
-string Node::getName() const {
-	return name.toString();
-}
-
-} // namespace ariba
Index: urce/ariba/Node.h
===================================================================
--- /source/ariba/Node.h	(revision 12775)
+++ 	(revision )
@@ -1,442 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef NODE_H_
-#define NODE_H_
-
-// forward declarations
-namespace ariba {
-	class Node;
-    namespace communication {
-        class BaseCommunication;
-    }
-    namespace overlay {
-        class BaseOverlay;
-    }
-}
-
-#include <vector>
-#include <iostream>
-#include <exception>
-
-#include "Module.h"
-#include "Identifiers.h"
-#include "SpoVNetProperties.h"
-#include "NodeListener.h"
-#include "Name.h"
-//#include "AribaModule.h"
-#include "CommunicationListener.h"
-#include "DataMessage.h"
-#include "SideportListener.h"
-#include "ariba/overlay/SequenceNumber.h"
-#include "ariba/utility/logging/Logging.h"
-#include "ariba/overlay/PublicExceptions.h"
-
-// reboost messages
-#include "ariba/utility/transport/messages/message.hpp"
-
-#include <boost/property_tree/ptree.hpp>
-
-using std::vector;
-using ariba::overlay::BaseOverlay;
-
-namespace ariba {
-
-typedef overlay::message_not_sent message_not_sent;
-// typedef ariba::overlay::SequenceNumber SequenceNumber; // XXX see CommunicationListener
-
-using boost::property_tree::ptree;
-
-// sendMessage-Priorities
-struct send_priority
-{
-    enum SEND_PRIORITY
-    {
-        HIGHEST = 2,
-        HIGHER = 3,
-        NORMAL = 4,
-        LOWER = 5,
-        LOWEST = 6
-    };
-};
-
-
-
-/**
- * \addtogroup public
- * @{
- *
- * This class should implement all ariba node functionality.
- *
- * @author Sebastian Mies <mies@tm.uka.de>
- * @author Christoph Mayer <mayer@tm.uka.de>
- */
-// TODO do we really want to inherit from Module.. ?
-class Node: public Module {
-	use_logging_h(Node);
-public:
-    
-	/**
-	 * Constructs a new node using a given ariba module
-	 *
-	 * @param ariba_mod The ariba module
-	 * @param name The canonical node name of the new node. When NULL a
-	 *   randomly chosen name is created.
-	 * @param len The length of the canonical node name or -1, if the name
-	 *   is a zero-terminated char-string.
-	 */
-//	Node(AribaModule& ariba_mod, const Name& node_name = Name::UNSPECIFIED);
-	
-	// XXX EXPERIMENTAL
-	Node();
-
-	/**
-	 * Destroys the node. Before destruction some pre-conditions
-	 * must be met:<br />
-	 *
-	 * 1. The node is not part of any SpoVNet <br />
-	 * 2. All listeners must be unbound from this node <br />
-	 * 3. The module has been stopped<br />
-	 */
-	virtual ~Node();
-
-	//--- node control ---
-
-    /**
-     * XXX EXPERIMENTAL
-     * 
-     * Replaces initialte & join
-     */
-    void connect(const ptree& config);
-
-    // XXX DEPRECATED
-	/**
-	 * This method instructs the node to join a particular spovnet.
-	 * Callees may bind with a NodeListener to receive events, when
-	 * a node has been successfully joined.
-	 *
-	 * @param vnetId The SpoVNet name
-	 */
-//	void join(const Name& name);
-
-	/**
-	 * This method initiates a new SpoVNet with the given SpoVNetID and
-	 * parameters.
-	 *
-	 * @param name The SpoVNet name
-	 * @param param The SpoVNet properties
-	 */
-//	void initiate(const Name& name, const SpoVNetProperties& parm =
-//			SpoVNetProperties::DEFAULT);
-
-	/**
-	 * This method initiates the leave procedure of this node.
-	 */
-	void leave();
-
-	/**
-	 * This method is used to bind a node listener to this node.
-	 *
-	 * @param listener The node listener
-	 * @return boolean indicating success of failure
-	 */
-	bool bind(NodeListener* listener);
-
-	/**
-	 * This method is used to unbind a node listener to this node.
-	 *
-	 * @param listener The node listener
-	 * @return boolean indicating success of failure
-	 */
-	bool unbind(NodeListener* listener);
-
-	//--- spovnet properties ---
-
-	/**
-	 * Returns the properties of the spovnet the node has joined.
-	 *
-	 * @return The properties of the spovnet the node has joined
-	 */
-	const SpoVNetProperties& getSpoVNetProperties() const;
-
-	/**
-	 * Returns the spovnet identifier
-	 *
-	 * @return The spovnet idenfifier
-	 */
-	const SpoVNetID& getSpoVNetId() const;
-
-	/**
-	 * Returns true, if the node is part of a spovnet.
-	 *
-	 * @return True, if the node is part of a spovnet
-	 */
-	bool isJoined() const;
-
-	//--- addressing ---
-
-	/**
-	 * Returns the node id of this node if the link id is unspecified or
-	 * the node id of the remote node.
-	 *
-	 * @return The local or the remote node identifier
-	 */
-	const NodeID& getNodeId(const LinkID& lid = LinkID::UNSPECIFIED) const;
-
-	/**
-	 * Returns the node id to a node name according to the currently joined
-	 * spovnet (usually derives a node identifier by hashing the name).
-	 *
-	 * @return The node identifier to the given name
-	 */
-	NodeID generateNodeId(const Name& name) const;
-
-	/**
-	 * Returns the name of this node if the link id is unspecified or
-	 * the node name of the remote node, if known -- otherwise it returns
-	 * an unspecified name.
-	 *
-	 * @return A node's name or an unspecified name, if unknown
-	 */
-	const Name getNodeName(const LinkID& lid = LinkID::UNSPECIFIED) const;
-
-	/**
-	 * Get a list of neighboring nodes in the overlay structure.
-	 * The number and identities of nodes depends highly on the
-	 * used overlay structure.
-	 *
-	 * @return a list of NodeIDs that are neighbors in the overlay structure
-	 * @see sendBroadcastMessage
-	 */
-	vector<NodeID> getNeighborNodes() const;
-
-	//--- communication ---
-
-	/**
-	 * Establishes a new link to another node and service with the given
-	 * link properties. An optional message could be sent with the request.
-	 *
-	 * @param nid The remote node identifier
-	 * @param sid The remote service identifier
-	 * @param req The required link properties
-	 * @param msg An optional message that is sent with the request
-	 * @return A new link id
-	 */
-	LinkID establishLink(const NodeID& nid, const ServiceID& sid);
-
-	/**
-	 * This method drops an established link.
-	 *
-	 * @param lnk The link identifier of an active link
-	 */
-	void dropLink(const LinkID& lnk);
-
-	/**
-	 * Returns whether a link is direct or relayed over other nodes
-	 * @param lnk LinkID of the link
-	 * @return true if link is direct; false otherwise
-	 */
-	bool isLinkDirect(const ariba::LinkID& lnk) const;
-	
-	/**
-	 * Returns the latest measured hop count on this link.
-	 * NOTE: This is not guaranteed to be up to date.
-	 * 
-	 * @param lnk LinkID of the link
-	 * @return overlay hop count on this link 
-	 */
-	int getHopCount(const ariba::LinkID& lnk) const;
-	
-	
-	/* +++++ Message sending +++++ */
-
-	
-    /**
-     * Sends a message via an established link. If reliable transport was
-     * selected, the method returns a sequence number and a communication event
-     * is triggered on message delivery or loss.
-     * 
-     * +++ New interface, using efficient zero-copy reboost messages. +++
-     *
-     * @param msg The message to be sent
-     * @param lnk The link to be used for sending the message
-     */
-    const SequenceNumber& sendMessage(reboost::message_t msg, const LinkID& lnk, uint8_t priority=send_priority::NORMAL);
-
-    /**
-     * +++ Legacy interface, converts old ariba messages into new reboost messages. +++
-     */    
-    seqnum_t sendMessage(const DataMessage& msg, const LinkID& lnk);
-
-    
-    /**
-     * Sends a one-shot message to a service. If link properties are specified,
-     * the node tries to fulfill those requirements. This may cause the node
-     * to first establish a temporary link, second sending the message and last
-     * dropping the link. This would result in a small amount of extra latency
-     * until the message is delivered. If reliable transport was selected,
-     * the method returns a sequence number and a communication event is
-     * triggered on message delivery or loss.
-     * 
-     * +++ New interface, using efficient zero-copy reboost messages. +++
-     *
-     * @param msg The message to be sent
-     * @param nid The remote node identifier
-     * @param sid The remote service identifier
-     * @param req The requirements associated with the message
-     * @return A sequence number
-     */
-    const SequenceNumber& sendMessage(reboost::message_t msg, const NodeID& nid, const ServiceID& sid,
-            uint8_t priority=send_priority::NORMAL, const LinkProperties& req = LinkProperties::DEFAULT);
-
-    /**
-     * +++ Legacy interface, converts old ariba messages into new reboost messages. +++
-     */
-	seqnum_t sendMessage(const DataMessage& msg, const NodeID& nid, const ServiceID& sid,
-			const LinkProperties& req = LinkProperties::DEFAULT);
-
-    
-    /**
-     * like the above function, but sends the message to the closest directly known node
-     * to the specified address
-     * 
-     * +++ New interface, using efficient zero-copy reboost messages. +++
-     * 
-     */
-    NodeID sendMessageCloserToNodeID(reboost::message_t msg, const NodeID& nid, const ServiceID& sid,
-            uint8_t priority=send_priority::NORMAL, const LinkProperties& req = LinkProperties::DEFAULT);
-
-    /**
-     * +++ Legacy interface, converts old ariba messages into new reboost messages. +++
-     */
-    NodeID sendMessageCloserToNodeID(const DataMessage& msg, const NodeID& nid, const ServiceID& sid,
-            const LinkProperties& req = LinkProperties::DEFAULT);
-
-	
-    /**
-     * Sends a message to all known hosts in the overlay structure
-     * the nodes that are reached here depend on the overlay structure.
-     *
-     * +++ New interface, using efficient zero-copy reboost messages. +++
-     *
-     * @param msg The message to be send
-     * @param sid The id of the service that should receive the message
-     * @see getNeighborNodes
-     */
-	void sendBroadcastMessage(reboost::message_t msg, const ServiceID& sid, uint8_t priority=send_priority::NORMAL);
-
-    /**
-     * +++ Legacy interface, converts old ariba messages into new reboost messages. +++
-     */
-	void sendBroadcastMessage(const DataMessage& msg, const ServiceID& sid);
-
-	
-	/* +++++ [Message sending] +++++ */
-	
-	
-	
-	// --- communication listeners ---
-
-	/**
-	 * Binds a listener to a specifed service identifier.
-	 * Whenever a link is established/dropped or messages are received the
-	 * events inside the interface are called.
-	 *
-	 * @param listener The listener to be registered
-	 * @param sid The service identifier
-	 * @return boolean indicating success of failure
-	 */
-	bool bind(CommunicationListener* listener, const ServiceID& sid);
-
-	/**
-	 * Un-binds a listener from this node.
-	 *
-	 * @param The listener to be unbound
-	 * @return boolean indicating success of failure
-	 */
-	bool unbind(CommunicationListener* listener, const ServiceID& sid);
-
-	//-------------------------------------------------------------------------
-	//
-	// --- optimization proposal: allow direct endpoint descriptor exchange ---
-	// main-idea: directly allow exchanging endpoint descriptors to establish
-	// links. Depending on the overlay structure used in the base overlay, this
-	// allows a node to directly establish links between two nodes when an
-	// endpoint descriptor is known.
-	//
-	//const EndpointDescriptor& getEndpointDescriptor( const LinkID& lid );
-	//void sendMessage( EndpointDescriptor& epd, Message* msg );
-	//LinkID setupLink( const EndpointDescriptor& endpointDesc,
-	//		const LinkProperties& req = LinkProperties::UNSPECIFIED,
-	//		const Message* msg = NULL );
-	//
-	//-------------------------------------------------------------------------
-
-	// --- module implementation ---
-	//
-	// main-idea: use module properties to configure nodeid, spovnetid etc. and
-	// select start/stop procedures. This allows simulations to start a
-	// node without manually calling join etc.
-
-	/** @see Module.h */
-	string getName() const;
-	
-	
-private:
-	inline void check_send_priority(uint8_t priority);
-
-	
-protected:
-	// friends
-	friend class AribaModule;
-
-	// member variables
-	Name name;                             //< node name
-//	AribaModule* ariba_mod;	               //< ariba module
-	SpoVNetID spovnetId; 	               //< current spovnet id
-	NodeID nodeId; 		              	   //< current node id
-	communication::BaseCommunication* base_communication;
-	overlay::BaseOverlay* base_overlay;    //< the base overlay
-
-};
-
-} // namespace ariba
-
-/** @} */
-
-#endif /* NODE_H_ */
Index: urce/ariba/NodeListener.cpp
===================================================================
--- /source/ariba/NodeListener.cpp	(revision 12775)
+++ 	(revision )
@@ -1,68 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-
-#include "NodeListener.h"
-
-namespace ariba {
-
-NodeListener::NodeListener() {
-}
-
-NodeListener::~NodeListener() {
-}
-
-void NodeListener::onJoinCompleted(const SpoVNetID& vid ) {
-}
-
-void NodeListener::onJoinFailed(const SpoVNetID& vid ) {
-}
-
-void NodeListener::onLeaveCompleted(const SpoVNetID& vid ) {
-}
-
-void NodeListener::onLeaveFailed(const SpoVNetID& vid ) {
-}
-
-void NodeListener::onOverlayConnected(const SpoVNetID& vid) {
-}
-
-void NodeListener::onOverlayDisconnected(const SpoVNetID& vid){
-}
-
-} // namespace ariba
Index: urce/ariba/NodeListener.h
===================================================================
--- /source/ariba/NodeListener.h	(revision 12775)
+++ 	(revision )
@@ -1,132 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef NODELISTENER_H_
-#define NODELISTENER_H_
-
-#include "Identifiers.h"
-
-namespace ariba {
-
-// forward decl
-namespace overlay {
-	class BaseOverlay;
-}
-
-/**
- * \addtogroup public
- * @{
- *
- * This class is used to inform a listener about node changes.
- *
- * @author Sebastian Mies <mies@tm.uka.de>
- * @author Christoph Mayer <mayer@tm.uka.de>
- * @author Mario Hock <mario.hock@student.kit.edu>
- */
-class NodeListener {
-	friend class ariba::overlay::BaseOverlay;
-public:
-	NodeListener();
-	virtual ~NodeListener();
-
-protected:
-	/**
-	 * This event method is called, when a node has completed its join
-	 * procedure.
-	 *
-	 * @param vid The spovnet id
-	 * @param nid The node id
-	 */
-	virtual void onJoinCompleted( const SpoVNetID& vid );
-
-	/**
-	 * This event method is called, when a node failed to join a spovnet.
-	 *
-	 * @param vid The spovnet id
-	 * @param nid The node id
-	 */
-	virtual void onJoinFailed( const SpoVNetID& vid );
-
-	/**
-	 * This event method is called, when a node succeeded to leave a spovnet.
-	 *
-	 * @param vid The spovnet id
-	 * @param nid The node id
-	 */
-	virtual void onLeaveCompleted( const SpoVNetID& vid );
-
-	/**
-	 * This event method is called, when a node failed to leave a spovnet.
-	 *
-	 * @param vid The spovnet id
-	 * @param nid The node id
-	 */
-	virtual void onLeaveFailed( const SpoVNetID& vid );
-    
-    /**
-     * This event method is called, when the number of neighbours gets above one.
-     * 
-     * Usually this means, the node is now connected to an existing spovnet, or
-     * another node connected to this node and a "two-elemnt" spovnet just formed up.
-     * 
-     * NOTE: This method can be called again, after Â»onOverlayDisconnectedÂ« has
-     * been called.
-     *
-     * @param vid The spovnet id
-     */
-    virtual void onOverlayConnected( const SpoVNetID& vid );
-    
-    /**
-     * This event method is called, when the number of neighbours drops to zero.
-     * 
-     * Usually this means, the note has lost connection to the spovnet, or the 
-     * spovnet ceased to exist, since all other nodes are gone.
-     * 
-     * NOTE: This method will only be called after Â»onOverlayConnectedÂ« has been
-     * called.
-     * 
-     * @param vid The spovnet id
-     */
-    virtual void onOverlayDisconnected( const SpoVNetID& vid );
-};
-
-} // namespace ariba
-
-/** @} */
-
-#endif /* NODELISTENER_H_ */
Index: urce/ariba/SideportListener.cpp
===================================================================
--- /source/ariba/SideportListener.cpp	(revision 12775)
+++ 	(revision )
@@ -1,184 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "SideportListener.h"
-
-#include "ariba/overlay/BaseOverlay.h"
-#include "ariba/overlay/LinkDescriptor.h"
-#include "ariba/utility/addressing2/tcpip_endpoint.hpp"
-
-using ariba::overlay::LinkDescriptor;
-
-namespace ariba {
-
-SideportListener SideportListener::DEFAULT;
-
-SideportListener::SideportListener() : overlay(NULL) {
-}
-
-SideportListener::~SideportListener(){
-}
-
-string SideportListener::getEndpointDescription( const LinkID& link ) const {
-	if( overlay == NULL ) {
-		return "";
-	}
-	return overlay->getEndpointDescriptor(link).toString();
-}
-
-string SideportListener::getEndpointDescription( const NodeID& node ) const {
-	if( overlay == NULL ) {
-		return "";
-	}
-	return overlay->getEndpointDescriptor(node).toString();
-}
-
-const NodeID& SideportListener::getNodeID( const LinkID& link ) const {
-	if( overlay == NULL ) return NodeID::UNSPECIFIED;
-	return overlay->getNodeID(link);
-}
-
-vector<LinkID> SideportListener::getLinkIDs( const NodeID& node ) const {
-	if( overlay == NULL ) return vector<LinkID>();
-	return overlay->getLinkIDs( node );
-}
-
-string SideportListener::getHtmlLinks(){
-	return overlay->getLinkHTMLInfo();
-}
-
-vector<NodeID> SideportListener::getOverlayNeighbors(bool deep){
-	vector<NodeID> nodes;
-	if( overlay == NULL ) return nodes;
-
-	nodes = overlay->getOverlayNeighbors(deep);
-	return nodes;
-}
-
-bool SideportListener::isRelayedNode(const NodeID& node){
-	if( overlay == NULL ) return false;
-
-	bool relay = false;
-
-	BOOST_FOREACH( LinkDescriptor* link, overlay->links ){
-
-		// is we find a direct connection this is not a relayed node
-		if(link->relayed == false && link->remoteNode == node && link->up)
-			return false;
-
-		// if we find a relay connection this can be a relayed node
-		// but only if we find no direct connection as above
-		if( link->relayed && link->remoteNode == node && link->up)
-			relay = true;
-	}
-
-	return relay;
-}
-
-bool SideportListener::isRelayingNode(const NodeID& node){
-	if( overlay == NULL ) return false;
-
-	vector<NodeID> directnodes;
-	BOOST_FOREACH( LinkDescriptor* link, overlay->links ){
-		if(link == NULL) continue;
-
-		BOOST_FOREACH(NodeID route, link->routeRecord){
-			if(route == node) return true;
-		}
-	}
-
-	return false;
-}
-
-SideportListener::Protocol SideportListener::getReachabilityProtocol(const NodeID& node){
-	int ret = SideportListener::undefined;
-	if( overlay == NULL ) return (Protocol)ret;
-
-	LinkDescriptor* link = NULL;
-	BOOST_FOREACH( LinkDescriptor* lnk, overlay->links ){
-		if(lnk->up && lnk->remoteNode == node && !lnk->relayed && lnk->communicationUp){
-			link = lnk;
-			break;
-		}
-	}
-
-	if (link == NULL) return (Protocol)ret;
-
-	BaseCommunication::LinkDescriptor& bclink =
-			overlay->bc->queryLocalLink(link->communicationId);
-
-	if(bclink.isUnspecified() || bclink.remoteLocator == NULL) return (Protocol)ret;
-
-	addressing2::EndpointPtr locator = bclink.remoteLocator;
-
-	if( locator->get_category() == addressing2::endpoint_category::TCPIP )
-	{
-        boost::shared_ptr<addressing2::tcpip_endpoint> endp =
-                boost::dynamic_pointer_cast<addressing2::tcpip_endpoint>(locator);
-	    
-		if( endp->to_asio().address().is_v4() )
-		{
-			ret = SideportListener::ipv4;
-		}else {
-			ret = SideportListener::ipv6;
-		}
-
-	}else if( locator->get_category() == addressing2::endpoint_category::BLUETOOTH ){
-		ret = SideportListener::rfcomm;
-	}
-
-	return (Protocol)ret;
-}
-
-void SideportListener::configure( overlay::BaseOverlay* _overlay ) {
-	overlay = _overlay;
-}
-
-void SideportListener::onLinkUp(const LinkID& lnk, const NodeID& local, const NodeID& remote, const SpoVNetID& spovnet){
-}
-
-void SideportListener::onLinkDown(const LinkID& lnk, const NodeID& local, const NodeID& remote, const SpoVNetID& spovnet){
-}
-
-void SideportListener::onLinkChanged(const LinkID& lnk, const NodeID& local, const NodeID& remote, const SpoVNetID& spovnet){
-}
-
-void SideportListener::onLinkFail(const LinkID& lnk, const NodeID& local, const NodeID& remote, const SpoVNetID& spovnet){
-}
-
-} // namespace ariba
Index: urce/ariba/SideportListener.h
===================================================================
--- /source/ariba/SideportListener.h	(revision 12775)
+++ 	(revision )
@@ -1,271 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef SIDEPORTLISTENER_H_
-#define SIDEPORTLISTENER_H_
-
-#include <vector>
-#include <map>
-#include <iostream>
-#include <boost/foreach.hpp>
-#include "Identifiers.h"
-#include "CommunicationListener.h"
-
-using std::map;
-using std::vector;
-
-namespace ariba {
-
-// forward declarations
-class Node;
-class AribaModule;
-namespace overlay {
-	class BaseOverlay;
-}
-
-/**
- * \addtogroup public
- * @{
- *
- * A sideport class to gather advanced information about nodes, links,
- * their endpoints and get information about all link activity on a node.
- *
- * @author Christoph Mayer <mayer@tm.uka.de>
- */
-class SideportListener {
-
-	friend class Node;
-	friend class AribaModule;
-	friend class overlay::BaseOverlay;
-
-public:
-
-	/**
-	 * A default object of the SideportListener that has empty
-	 * event functions and will return invalid information.
-	 */
-	static SideportListener DEFAULT;
-
-	/**
-	 * Constructor of the SideportListener.
-	 */
-	SideportListener();
-
-	/**
-	 * Virtual Desctructor for the SideportListener.
-	 */
-	virtual ~SideportListener();
-
-	/**
-	 * Get a descriptive string that identifies
-	 * the remote endpoint for the given link.
-	 *
-	 *  @param link The link to query endpoint information for.
-	 *  @return A descriptive endpoint information.
-	 */
-	string getEndpointDescription(
-			const LinkID& link
-			) const;
-
-	/**
-	 * Get a descriprive string that identifiers the remote node.
-	 *
-	 * @param node The node id to query endpoint information.
-	 * @return A descriptive endpoint information.
-	 */
-	string getEndpointDescription(
-			const NodeID& node = NodeID::UNSPECIFIED
-			) const;
-
-	/**
-	 * Get the remote endpoint node id for the given string,
-	 * or the local nodeid for an unspecified link.
-	 *
-	 * @param link The link to get the remote node.
-	 * @return The nodeid of the remote end of the link
-	 * 			or the local nodeid for an unspecified link.
-	 */
-	const NodeID& getNodeID(
-			const LinkID& link = LinkID::UNSPECIFIED
-			) const;
-
-	/**
-	 * Get all links that end at the specified node id.
-	 * Or all links from the local node when the node id
-	 * is set to unspecified.
-	 *
-	 * @param node The remote node to query all links or unspecified
-	 * 			for all local starting links
-	 * @return A vector of link ids.
-	 */
-	vector<LinkID> getLinkIDs(
-			const NodeID& node = NodeID::UNSPECIFIED
-			) const;
-
-	/**
-	 * Get html presentation of the links.
-	 * @return html of links
-	 */
-	string getHtmlLinks();
-
-	/**
-	 * Get the neighbots in the overlay structure
-	 * @return A vector of NodeIDs of the neighbors
-	 */
-	vector<NodeID> getOverlayNeighbors(bool deep = true);
-
-	/**
-	 * Is this node acting as a relay for us
-	 *
-	 * @param node The node in question
-	 * @return true, if this node is relaying for us
-	 */
-	bool isRelayingNode(const NodeID& node);
-
-	/**
-	 * Is this node only reachable for us through a relay?
-	 *
-	 * @param node The node in question
-	 * @return true, if we reach this node only over a relay
-	 */
-	bool isRelayedNode(const NodeID& node);
-
-	/**
-	 * Protocols for some layer, can be combined
-	 */
-	enum Protocol {
-		undefined = 0x0,
-		rfcomm = 0x1,
-		ipv4 = 0x2,
-		ipv6 = 0x3
-	};
-
-	/**
-	 * Through which protocol is a node reachable.
-	 *
-	 * @param node The node for which to return protocol reachability
-	 * @return Combination of protocols
-	 */
-	Protocol getReachabilityProtocol(const NodeID& node);
-
-protected:
-
-	/**
-	 * Notification function when a link has gone up.
-	 *
-	 * @param lnk The corresponding link id.
-	 * @param local The local node id.
-	 * @param remote The remote node id.
-	 * @param spovnet The SpoVNet ID.
-	 */
-	virtual void onLinkUp(
-			const LinkID& lnk,
-			const NodeID& local,
-			const NodeID& remote,
-			const SpoVNetID& spovnet
-			);
-
-	/**
-	 * Notification function when a link has gone down.
-	 *
-	 * @param lnk The corresponding link id.
-	 * @param local The local node id.
-	 * @param remote The remote node id.
-	 * @param spovnet The SpoVNet ID.
-	 */
-	virtual void onLinkDown(
-			const LinkID& lnk,
-			const NodeID& local,
-			const NodeID& remote,
-			const SpoVNetID& spovnet
-			);
-
-	/**
-	 * Notification function when a link has changed
-	 *
-	 * @param lnk The corresponding link id.
-	 * @param local The local node id.
-	 * @param remote The remote node id.
-	 * @param spovnet The SpoVNet ID.
-	 */
-	virtual void onLinkChanged(
-			const LinkID& lnk,
-			const NodeID& local,
-			const NodeID& remote,
-			const SpoVNetID& spovnet
-			);
-
-	/**
-	 * Notification function when a link has failed
-	 *
-	 * @param lnk The corresponding link id.
-	 * @param local The local node id.
-	 * @param remote The remote node id.
-	 * @param spovnet The SpoVNet ID.
-	 */
-	virtual void onLinkFail(
-			const LinkID& lnk,
-			const NodeID& local,
-			const NodeID& remote,
-			const SpoVNetID& spovnet
-			);
-
-private:
-
-	/**
-	 * Configure the sideport with the correct base overlay.
-	 *
-	 * @param _overlay The BaseOverlay where to attach the sideport.
-	 */
-	void configure(
-			overlay::BaseOverlay* _overlay
-			);
-
-	/**
-	 * The configured BaseOverlay where
-	 * the sideport is attached to.
-	 */
-	overlay::BaseOverlay* overlay;
-
-};
-
-} // namespace ariba
-
-/** @} */
-
-#endif // SIDEPORTLISTENER_H_
Index: urce/ariba/SpoVNetProperties.cpp
===================================================================
--- /source/ariba/SpoVNetProperties.cpp	(revision 12775)
+++ 	(revision )
@@ -1,67 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "SpoVNetProperties.h"
-
-namespace ariba {
-
-const SpoVNetProperties SpoVNetProperties::DEFAULT;
-
-SpoVNetProperties::SpoVNetProperties() :
-		type( CHORD_OVERLAY ){
-}
-
-SpoVNetProperties::SpoVNetProperties(const SpoVNetProperties& copy) :
-		type( copy.type ){
-}
-
-SpoVNetProperties::~SpoVNetProperties() {
-}
-
-const SpoVNetProperties::OverlayType SpoVNetProperties::getBaseOverlayType() const {
-	return (OverlayType)type;
-}
-
-std::string SpoVNetProperties::toString() const {
-	std::ostringstream buf;
-	buf << "spovnet"
-		<< " overlay_type=" << type;
-	return buf.str();
-}
-
-} // namespace ariba
Index: urce/ariba/SpoVNetProperties.h
===================================================================
--- /source/ariba/SpoVNetProperties.h	(revision 12775)
+++ 	(revision )
@@ -1,124 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef SPOVNETPROPERTIES_H_
-#define SPOVNETPROPERTIES_H_
-
-#include <string>
-#include <iostream>
-#include <streambuf>
-
-using std::string;
-
-namespace ariba {
-// forward declaration
-class SpoVNetProperties;
-}
-
-#include "Identifiers.h"
-#include "Name.h"
-
-namespace ariba {
-
-/**
- * \addtogroup public
- * @{
- *
- * This class implements a container that holds all properties of a
- * SpoVNet instance. It may evolve with new features when new features
- * are introduced.
- *
- * @author Sebastian Mies <mies@tm.uka.de>
- * @author Christoph Mayer <mayer@tm.uka.de>
- */
-class SpoVNetProperties {
-public:
-	/**
-	 * Different types of overlays that are supported
-	 */
-	enum OverlayType {
-		ONE_HOP_OVERLAY = 0,
-		CHORD_OVERLAY = 1,
-	};
-
-	/**
-	 * This object holds the default settings for a newly created spovnet
-	 * instance.
-	 */
-	static const SpoVNetProperties DEFAULT;
-
-	/**
-	 * Constructs a new default SpoVnet property object.
-	 */
-	SpoVNetProperties();
-
-	/**
-	 * Copy constructor.
-	 */
-	SpoVNetProperties(const SpoVNetProperties& copy);
-
-	/**
-	 * Destructor.
-	 */
-	virtual ~SpoVNetProperties();
-
-	/**
-	 * Returns the overlay type.
-	 */
-	const OverlayType getBaseOverlayType() const;
-
-	void setBaseOverlayType( OverlayType type ) {
-		this->type = type;
-	}
-
-	/**
-	 * Returns a human readable string representation of the SpoVNet properties
-	 *
-	 * @return A human readable string representation of the SpoVNet properties
-	 */
-	std::string toString() const;
-
-private:
-	uint8_t type;
-};
-
-} // namespace ariba
-
-/** @} */
-
-#endif /* SPOVNETPROPERTIES_H_ */
Index: urce/ariba/ariba.h
===================================================================
--- /source/ariba/ariba.h	(revision 12775)
+++ 	(revision )
@@ -1,58 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef ARIBA_H_
-#define ARIBA_H_
-
-/**
- * This file includes all standard headers for a working ariba substrate
- */
-
-#include "CommunicationListener.h"
-#include "DataMessage.h"
-#include "Identifiers.h"
-#include "LinkProperties.h"
-#include "Message.h"
-#include "Module.h"
-#include "Name.h"
-#include "Node.h"
-#include "NodeListener.h"
-#include "SideportListener.h"
-#include "SpoVNetProperties.h"
-
-#endif /* ARIBA_H_ */
Index: /source/ariba/communication/BaseCommunication.cpp
===================================================================
--- /source/ariba/communication/BaseCommunication.cpp	(revision 12775)
+++ /source/ariba/communication/BaseCommunication.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,12 +35,7 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "BaseCommunication.h"
-
-#include "networkinfo/AddressDiscovery.h"
-#include "ariba/utility/types/PeerID.h"
-#include "ariba/utility/system/SystemQueue.h"
-#include <boost/function.hpp>
 
 #ifdef UNDERLAY_OMNET
@@ -57,137 +52,145 @@
 namespace communication {
 
-using namespace ariba::addressing2;
-
-using ariba::utility::PeerID;
-using ariba::utility::SystemQueue;
-
 use_logging_cpp(BaseCommunication);
-
-
-BaseCommunication::BaseCommunication() 
-	: listenOn_endpoints(new addressing2::endpoint_set()),
-	  currentSeqnum( 0 ),
-	  transport( NULL ),
-	  messageReceiver( NULL ),
-	  started( false )
-{
-}
-
-
-BaseCommunication::~BaseCommunication(){
-}
-
-
-void BaseCommunication::start(EndpointSetPtr listen_on) {
-    assert ( ! started );
-    
-    listenOn_endpoints = listen_on;
-    logging_info("Setting local end-points: " << listenOn_endpoints->to_string());
-    
-	logging_info( "Starting up ..." );
-	currentSeqnum = 0;
-
-	// creating transports
-	//  ---> transport_peer holds the set of the active endpoints we're listening on
-	logging_info( "Creating transports ..." );
-	transport = new transport_peer();
-	active_listenOn_endpoints = transport->add_listenOn_endpoints(listenOn_endpoints);
-	logging_info( "XXX. Active endpoints = " << active_listenOn_endpoints->to_string() ); // XXX
-
-	logging_info( "Searching for local locators ..." );
-	local_endpoints = AddressDiscovery::discover_endpoints(active_listenOn_endpoints);
-	if ( local_endpoints->count() > 0 )
-	{
-	    logging_info( "Done. Discovered local endpoints: " << local_endpoints->to_string() );
-	}
-	else
-	{
-	    logging_warn("WARING!! No local endpoints found, NO COMMUNICATION POSSIBLE!!");
-	    
-	    // TODO notify application, so that it may react properly. throw exception..?
-	    assert( false );
-	}
-
-	
-    // create local EndpointDescriptor
-	//  ---> localDescriptor hold the set endpoints that can be used to reach us
-    localDescriptor.getPeerId() = PeerID::random();
-    localDescriptor.replace_endpoint_set(local_endpoints);
-    logging_info( "Using PeerID: " << localDescriptor.getPeerId() );
-
-    // start transport_peer
-	transport->register_listener( this );
+const BaseCommunication::LinkDescriptor BaseCommunication::LinkDescriptor::UNSPECIFIED;
+
+BaseCommunication::BaseCommunication(const NetworkLocator* _locallocator, const uint16_t _listenport)
+	: messageReceiver( NULL ), currentSeqnum( 0 ), listenport( _listenport ) {
+
+	logging_info( "starting up base communication and creating transports ..." );
+	logging_info( "using port " << listenport );
+
+#ifdef UNDERLAY_OMNET
+	AribaOmnetModule* module = StartupWrapper::getCurrentModule();
+	module->setServerPort( listenport );
+
+	transport = module;
+	network = new OmnetNetworkProtocol( module );
+#else
+	transport = new TCPTransport( listenport );
+	network = new IPv4NetworkProtocol();
+#endif
+
+	logging_debug( "searching for local locators ..." );
+
+	NetworkProtocol::NetworkLocatorSet locators = network->getAddresses();
+	NetworkProtocol::NetworkLocatorSet::iterator i = locators.begin();
+	NetworkProtocol::NetworkLocatorSet::iterator iend = locators.end();
+
+	//
+	// choose the first locator that is not localhost
+	//
+
+	bool foundLocator = false;
+
+	for( ; i != iend; i++){
+		logging_debug( "local locator found " + (*i)->toString() );
+		IPv4Locator* ipv4locator = dynamic_cast<IPv4Locator*>(*i);
+
+		// TODO: which locators are find to bind to?
+		// localhost is not too bad, works when testing locally
+		// with several instances. the manual override currently
+		// enables to use an arbitrary address, guess this is fine.
+		// so the manual override also can use ANY, LOCALHOST, BROADCAST
+
+		if( *ipv4locator != IPv4Locator::LOCALHOST &&
+		    *ipv4locator != IPv4Locator::ANY       &&
+		    *ipv4locator != IPv4Locator::BROADCAST  ){
+
+			ipv4locator->setPort(listenport);
+			localDescriptor.locator = ipv4locator;
+			localDescriptor.isUnspec = false;
+			logging_info( "binding to addr = " + ipv4locator->toString() );
+			foundLocator = true;
+			break;
+		}
+	} // for( ; i != iend; i++)
+
+
+	if( _locallocator != NULL ) {
+		if( localDescriptor.locator != NULL) delete localDescriptor.locator;
+		localDescriptor.locator = new IPv4Locator( IPv4Locator::fromString( _locallocator->toString()) );
+		localDescriptor.isUnspec = false;
+		logging_debug( "manual locator override, using locator=" <<
+					localDescriptor.locator->toString() );
+		foundLocator = true;
+	}
+
+	// if we found no local locator, exit using logging fatal
+	if( !foundLocator )
+		logging_fatal( "did not find a useable local locator!" );
+
+	transport->addMessageReceiver( this );
 	transport->start();
 
+#ifndef UNDERLAY_OMNET
+	//
 	// bind to the network change detection
+	//
+
 	networkMonitor.registerNotification( this );
-
+#endif
+
+	//
 	// base comm startup done
-	started = true;
-	logging_info( "Started up." );
-}
-
-void BaseCommunication::stop() {
-	logging_info( "Stopping transports ..." );
+	//
+
+	logging_info( "base communication started up" );
+}
+
+BaseCommunication::~BaseCommunication() {
+
+	logging_info( "stopping base communication and transport ..." );
 
 	transport->stop();
 	delete transport;
-	started = false;
-
-	logging_info( "Stopped." );
-}
-
-bool BaseCommunication::isStarted(){
-	return started;
+	delete network;
+
+	logging_info( "base communication stopped" );
 }
 
 const LinkID BaseCommunication::establishLink(
-	const EndpointDescriptor& descriptor,
-	const LinkID& link_id,
-	const QoSParameterSet& qos,
-	const SecurityParameterSet& sec) {
-
-	// copy link id
-	LinkID linkid = link_id;
-
-	// debug
-	logging_debug( "Request to establish link" );
-
-	// create link identifier
-	if (linkid.isUnspecified())	linkid = LinkID::create();
-
-	// create link descriptor
-	logging_debug( "Creating new descriptor entry with local link id=" << linkid.toString() );
-	LinkDescriptor* ld = new LinkDescriptor();
-	ld->localLink = linkid;
-	addLink( ld );
-
-
-    /* send a message to request new link to remote */
-    logging_debug( "Send messages with request to open link to " << descriptor.toString() );
-
-    /*
-	 * Create Link-Request Message:
-	 * NOTE: - Their PeerID (in parent message)
-	 * - Our LinkID
-	 * - Our PeerID
-	 * - Our EndpointDescriptor
-	 */
-	reboost::message_t linkmsg;
-	linkmsg.push_back(linkid.serialize());
-	linkmsg.push_back(localDescriptor.getPeerId().serialize());
-	linkmsg.push_back(localDescriptor.endpoints->serialize());
-	
-//	// XXX AKTUELL BUG FINDING...
-//	reboost::shared_buffer_t xxx = localDescriptor.endpoints->serialize();
-//	EndpointSetPtr xxx_set = endpoint_set::create_EndpointSet();
-//	xxx_set->deserialize(xxx);
-//	cout << "/// MARIO VORHER: " << localDescriptor.endpoints->to_string() << endl;
-//	cout << "/// MARIO NACHHER: " << xxx_set->to_string() << endl;
-	
-	// send message
-	// TODO move enum to BaseComm
-	send_to_peer(AribaBaseMsg::typeLinkRequest, descriptor.getPeerId(), linkmsg,
-	        descriptor, system_priority::OVERLAY);
+			const EndpointDescriptor& descriptor,
+			const QoSParameterSet& qos,
+			const SecurityParameterSet& sec){
+
+	logging_debug( "request to establish link" );
+
+	//
+	// just use the first locator in the endp descriptors
+	//
+
+	if( descriptor.locator == NULL ){
+		logging_error( "invalid destination endpoint" );
+		return LinkID::UNSPECIFIED;
+	}
+
+	if( localDescriptor.locator == NULL ){
+		logging_error( "invalid local endpoint" );
+		return LinkID::UNSPECIFIED;
+	}
+
+	const NetworkLocator* remote = descriptor.locator;
+	const NetworkLocator* local =  localDescriptor.locator;
+
+	//
+	// create link and link descriptor
+	//
+
+	LinkID linkid = LinkID::create();
+
+	logging_debug( "creating new local descriptor entry with local link id " + linkid.toString() );
+	LinkDescriptor linkDescriptor( linkid, local, LinkID::UNSPECIFIED, remote, descriptor );
+	addLink( linkDescriptor );
+
+	//
+	// create a base msg with our link id and
+	// a request to open a link on the other side
+	//
+
+	logging_debug( "sending out base messages with request to open link to " + remote->toString() );
+	AribaBaseMsg baseMsg( remote, AribaBaseMsg::LINK_STATE_OPEN_REQUEST, linkid,
+								LinkID::UNSPECIFIED );
+	transport->sendMessage(&baseMsg);
 
 	return linkid;
@@ -196,23 +199,29 @@
 void BaseCommunication::dropLink(const LinkID link) {
 
-	logging_debug( "Starting to drop link " + link.toString() );
+	logging_debug( "starting to drop link " + link.toString() );
 
 	// see if we have the link
-	LinkDescriptor& ld = queryLocalLink( link );
-	if( ld.isUnspecified() ) {
-		logging_error( "Don't know the link you want to drop "+ link.toString() );
+	LinkDescriptor& descriptor = queryLocalLink( link );
+	if( descriptor.isUnspecified() ){
+		logging_error( "don't know the link you want to drop" );
 		return;
 	}
 
+	// create message to drop the link
+	logging_debug( "sending out link close request. for us, the link is closed now" );
+	AribaBaseMsg msg(
+		descriptor.remoteLocator,
+		AribaBaseMsg::LINK_STATE_CLOSE_REQUEST,
+		descriptor.localLink,
+		descriptor.remoteLink
+	);
+
+	// send message to drop the link
+	transport->sendMessage( &msg );
+
 	// tell the registered listeners
-	foreach( CommunicationEvents* i, eventListener ) {
-		i->onLinkDown( link, ld.localLocator, ld.remoteLocator );
-	}
-
-
-	// * send message to drop the link *
-	logging_debug( "Sending out link close request. for us, the link is closed now" );
-	reboost::message_t empty_message;
-	send_over_link( AribaBaseMsg::typeLinkClose, empty_message, ld, system_priority::OVERLAY );
+	BOOST_FOREACH( CommunicationEvents* i, eventListener ){
+		i->onLinkDown( link, descriptor.localLocator, descriptor.remoteLocator );
+	}
 
 	// remove from map
@@ -220,62 +229,53 @@
 }
 
-
-seqnum_t BaseCommunication::sendMessage( const LinkID& lid,
-        reboost::message_t message,
-        uint8_t priority,
-        bool bypass_overlay) throw(communication_message_not_sent)
-{
-    // message type: direct data or (normal) data 
-    AribaBaseMsg::type_ type;
-    if ( bypass_overlay )
-    {
-        type = AribaBaseMsg::typeDirectData;
-        logging_debug( "Sending out direct-message to link " << lid.toString() );
-    }
-    else
-    {
-        type = AribaBaseMsg::typeData;
-        logging_debug( "Sending out message to link " << lid.toString() );
-    }
-
-    
+seqnum_t BaseCommunication::sendMessage( const LinkID lid, const Message* message) {
+
+	logging_debug( "sending out message to link " + lid.toString() );
+
 	// query local link info
-	LinkDescriptor& ld = queryLocalLink(lid);
-	if( ld.isUnspecified() )
-	{
-	    throw communication_message_not_sent("Don't know the link with id "
-	            + lid.toString());
-	}
-
-	// link not up-> error
-	if( !ld.up )
-	{
-	    throw communication_message_not_sent("Can not send on link "
-	            + lid.toString() + ": link not up");
-	}
-
-
-	// * send message *
-	bool okay = send_over_link( type, message, ld, priority );
-
-	if ( ! okay )
-	{
-	    throw communication_message_not_sent("send_over_link failed!");
-	}
-	
+	LinkDescriptor& linkDesc = queryLocalLink(lid);
+	if( linkDesc.isUnspecified() ){
+		logging_error( "don't know the link with id " + lid.toString() );
+		return 0;
+	}
+
+	// create message
+	AribaBaseMsg msg(
+		linkDesc.remoteLocator,
+		AribaBaseMsg::LINK_STATE_DATA,
+		linkDesc.localLink,
+		linkDesc.remoteLink
+	);
+
+	// encapsulate the payload message
+	msg.encapsulate( const_cast<Message*>(message) );
+
+	// send message
+	transport->sendMessage( &msg );
+
 	return ++currentSeqnum;
 }
 
 const EndpointDescriptor& BaseCommunication::getEndpointDescriptor(const LinkID link) const {
-	if( link.isUnspecified() ){
+
+	if( link == LinkID::UNSPECIFIED){
 		return localDescriptor;
 	} else {
 		LinkDescriptor& linkDesc = queryLocalLink(link);
-		if (linkDesc.isUnspecified()) return EndpointDescriptor::UNSPECIFIED();
-		return linkDesc.remoteDescriptor;
-	}
+		if (linkDesc.isUnspecified()) return EndpointDescriptor::UNSPECIFIED;
+		return linkDesc.remoteEndpoint;
+	}
+}
+
+void BaseCommunication::registerMessageReceiver(MessageReceiver* _receiver) {
+	messageReceiver = _receiver;
+}
+
+void BaseCommunication::unregisterMessageReceiver(MessageReceiver* _receiver) {
+	messageReceiver = NULL;
 }
 
 void BaseCommunication::registerEventListener(CommunicationEvents* _events){
+
 	if( eventListener.find( _events ) == eventListener.end() )
 		eventListener.insert( _events );
@@ -283,4 +283,5 @@
 
 void BaseCommunication::unregisterEventListener(CommunicationEvents* _events){
+
 	EventListenerSet::iterator i = eventListener.find( _events );
 	if( i != eventListener.end() )
@@ -289,493 +290,288 @@
 
 
-
-/*------------------------------
- | ASIO thread --> SystemQueue |
- ------------------------------*/
-
-/// ASIO thread
-void BaseCommunication::receive_message(transport_connection::sptr connection,
-	reboost::shared_buffer_t msg) {
-
-	logging_debug( "Dispatching message" );
-	
-    SystemQueue::instance().scheduleCall(
-            boost::bind(
-                    &BaseCommunication::receiveMessage,
-                    this,
-                    connection,
-                    msg)
-        );
-}
-
-/// ASIO thread
-void BaseCommunication::connection_terminated(transport_connection::sptr connection)
-{
-    SystemQueue::instance().scheduleCall(
-            boost::bind(
-                    &BaseCommunication::connectionTerminated,
-                    this,
-                    connection)
-        );
-}
-
-/*--------------------------------
- | [ASIO thread --> SystemQueue] |
- -------------------------------*/
-
-/// ARIBA thread (System Queue)
-void BaseCommunication::connectionTerminated(transport_connection::sptr connection)
-{
-    vector<LinkID*> links = connection->get_communication_links();
-    
-    logging_debug("[BaseCommunication] Connection terminated: "
-            << connection->getLocalEndpoint()->to_string()
-            << " <--> " << connection->getRemoteEndpoint()->to_string()
-            << " (" << links.size() << " links)");
-    
-    // remove all links that used the terminated connection
-    for ( vector<LinkID*>::iterator it = links.begin(); it != links.end(); ++it )
-    {
-        LinkID& link_id = **it;
-        
-        logging_debug("  ---> Removing link: " << link_id.toString());
-        
-        // searching for link, not found-> warn
-        LinkDescriptor& linkDesc = queryLocalLink( link_id );
-        if (linkDesc.isUnspecified()) {
-            logging_warn("Failed to find local link " << link_id.toString());
-            continue;
-        }
-
-        // inform listeners
-        foreach( CommunicationEvents* i, eventListener ){
-            i->onLinkFail( linkDesc.localLink,
-                    linkDesc.localLocator, linkDesc.remoteLocator );
-        }
-
-        // remove the link descriptor
-        removeLink( link_id );
-    }
-}
-
-/// ARIBA thread (System Queue)
-void BaseCommunication::receiveMessage(transport_connection::sptr connection,
-        reboost::shared_buffer_t message)
-{
-    // XXX
-    logging_debug("/// [receiveMessage] buffersize: " << message.size());
-        
-    // get type
-    uint8_t type = message.data()[0];
-    reboost::shared_buffer_t sub_buff = message(1);
-    
-    // get link id
-    LinkID link_id;
-    if ( type != AribaBaseMsg::typeLinkRequest)
-    {
-        sub_buff = link_id.deserialize(sub_buff);
-    }
-    
-	// handle message
-	switch ( type )
-	{
-		// ---------------------------------------------------------------------
-		// data message
-		// ---------------------------------------------------------------------
-		case AribaBaseMsg::typeData:
-		{
-			logging_debug( "Received data message, forwarding to overlay." );
-			if( messageReceiver != NULL )
-			{
-				messageReceiver->receiveMessage(
-					sub_buff, link_id, NodeID::UNSPECIFIED, false
-				);
-			}
-			
+bool BaseCommunication::receiveMessage(const Message* message, const LinkID& link, const NodeID& node){
+
+	//
+	// these messages arrive from the Transport module
+	// and are incoming network messages. Unpack the
+	// AribaBaseMsg and handle control packets,
+	// deliver data packets to the overlay
+	//
+
+	AribaBaseMsg* spovmsg = ((Message*)message)->decapsulate<AribaBaseMsg>();
+	logging_debug( "receiving base comm message of type " + spovmsg->getTypeString() );
+
+	//
+	// deliver data to the overlays. we just give the
+	// inner packet to every registered overlay ...
+	//
+
+	if( spovmsg->getType() == AribaBaseMsg::LINK_STATE_DATA ){
+
+		logging_debug( "received data message, forwarding to overlay" );
+
+		//
+		// put the linkid as address into the message
+		// and sent it to the receiver
+		//
+
+		if( messageReceiver != NULL ) {
+			messageReceiver->receiveMessage(
+				spovmsg,
+				spovmsg->getRemoteLink(),
+				NodeID::UNSPECIFIED
+			);
+		}
+
+	} // LINK_STATE_DATA
+
+	//
+	// handle link open requests
+	//
+
+	else if( spovmsg->getType() == AribaBaseMsg::LINK_STATE_OPEN_REQUEST ){
+
+		logging_debug( "received link open request" );
+
+		//
+		// create a link context
+		//
+
+		//  in an incoming packet the localLink is from
+		// the sender perspective local and from our
+		// perspective remote
+
+		logging_debug( "creating local link" );
+
+		LinkID localLink  = LinkID::create();
+		LinkID remoteLink = spovmsg->getLocalLink();
+
+
+		const NetworkLocator* localLocator  = dynamic_cast<const NetworkLocator*>(localDescriptor.locator);
+		const NetworkLocator* remoteLocator = dynamic_cast<const NetworkLocator*>(message->getSourceAddress());
+
+		logging_debug( "localLocator=" + localLocator->toString() + " remoteLocator="+remoteLocator->toString());
+
+		// ask the registered listeners if this link
+		// creation is fine. we will only allow the
+		// link if all of them agree
+
+		bool allowlink = true;
+		BOOST_FOREACH( CommunicationEvents* i, eventListener ){
+			allowlink &= i->onLinkRequest( localLink, localLocator, remoteLocator );
+		}
+
+		if( !allowlink ){
+			logging_warn( "overlay denied creation of link" );
+			return true;
+		}
+
+		//
+		// create and save the descriptor for the link
+		//
+
+		LinkDescriptor linkDescriptor(localLink, localLocator, remoteLink,
+					remoteLocator, EndpointDescriptor(remoteLocator));
+
+		logging_debug( "saving new link descriptor with " <<
+				"[local link " << localLink.toString() << "] " <<
+				"[local locator " << localLocator->toString() << "] " <<
+				"[remote link " << remoteLink.toString() << "] " <<
+				"[remote locator " << remoteLocator->toString() << "]" );
+
+		addLink( linkDescriptor );
+
+		//
+		// send out a link reply
+		//
+
+		logging_debug( "sending back link open reply for " <<
+					"[local link " << localLink.toString() << "] " <<
+					"[remote link " << remoteLink.toString() << "]" );
+
+		AribaBaseMsg reply(remoteLocator,
+				     AribaBaseMsg::LINK_STATE_OPEN_REPLY,
+				     localLink,
+				     remoteLink);
+
+		transport->sendMessage( &reply );
+
+		//
+		// the link is now open
+		//
+
+		BOOST_FOREACH( CommunicationEvents* i, eventListener ){
+			i->onLinkUp( localLink, localLocator, remoteLocator );
+		}
+
+	} // LINK_STATE_OPEN_REQUEST
+
+	//
+	// handle link open replies
+	//
+
+	else if( spovmsg->getType() == AribaBaseMsg::LINK_STATE_OPEN_REPLY ){
+
+		logging_debug( "received link open reply for a link we initiated" );
+
+		// this is a reply to a link open request, so we have already
+		// a link mapping and can now set the remote link to valid
+		LinkDescriptor& linkDesc = queryLocalLink( spovmsg->getRemoteLink() );
+
+		if (linkDesc.isUnspecified()) {
+			logging_warn("Failed to find local link "+spovmsg->getRemoteLink().toString());
+			return false;
+		}
+
+		linkDesc.remoteLink = spovmsg->getLocalLink();
+		logging_debug( "the link is now up with local link id " + spovmsg->getRemoteLink().toString() );
+
+		BOOST_FOREACH( CommunicationEvents* i, eventListener ){
+			i->onLinkUp( linkDesc.localLink, linkDesc.localLocator, linkDesc.remoteLocator );
+		}
+
+	} // LINK_STATE_OPEN_REPLY
+
+	//
+	// handle link close requests
+	//
+
+	else if( spovmsg->getType() == AribaBaseMsg::LINK_STATE_CLOSE_REQUEST ){
+
+		const LinkID& localLink = spovmsg->getRemoteLink();
+		logging_debug( "received link close request for link " + localLink.toString() );
+
+		//
+		// the link is closed immediately, we
+		// don't need to send out a reply, so we
+		// delete the mapping and inform
+		//
+
+		LinkDescriptor& linkDesc = queryLocalLink( localLink );
+		if (linkDesc.isUnspecified()) {
+			logging_warn("Failed to find local link "+localLink.toString());
+			return false;
+		}
+
+		BOOST_FOREACH( CommunicationEvents* i, eventListener ){
+			i->onLinkDown( linkDesc.localLink, linkDesc.localLocator, linkDesc.remoteLocator );
+		}
+
+		removeLink( localLink );
+
+	} // LINK_STATE_CLOSE_REQUEST
+
+	//
+	// handle locator updates
+	//
+
+	else if( spovmsg->getType() == AribaBaseMsg::LINK_STATE_UPDATE ){
+
+		const LinkID& localLink = spovmsg->getRemoteLink();
+		logging_debug( "received link update for link " + localLink.toString() );
+
+		//
+		// find the link description
+		//
+
+		LinkDescriptor& linkDesc = queryLocalLink( localLink );
+		if (linkDesc.isUnspecified()) {
+			logging_warn("Failed to update local link "+localLink.toString());
+			return false;
+		}
+
+		//
+		// update the remote locator
+		//
+
+		const NetworkLocator* oldremote = linkDesc.remoteLocator;
+		linkDesc.remoteLocator = dynamic_cast<const NetworkLocator*>(message->getSourceAddress());
+
+		//
+		// inform the listeners (local link has _not_ changed!)
+		//
+
+		BOOST_FOREACH( CommunicationEvents* i, eventListener ){
+			i->onLinkChanged(
+				linkDesc.localLink,	// linkid
+				linkDesc.localLocator,	// old local
+				linkDesc.localLocator,	// new local
+				oldremote,		// old remote
+				linkDesc.remoteLocator	// new remote
+			);
+		}
+
+	} // LINK_STATE_UPDATE
+
+	return true;
+}
+
+void BaseCommunication::addLink( const LinkDescriptor& link ) {
+	linkSet.push_back( link );
+}
+
+void BaseCommunication::removeLink( const LinkID& localLink ) {
+
+	LinkSet::iterator i = linkSet.begin();
+	LinkSet::iterator iend = linkSet.end();
+
+	for( ; i != iend; i++){
+		if( (*i).localLink == localLink){
+			linkSet.erase( i );
 			break;
 		}
-
-        // ---------------------------------------------------------------------
-        // direct data message (bypass overlay-layer)
-        // ---------------------------------------------------------------------
-        case AribaBaseMsg::typeDirectData:
-        {
-            logging_debug( "Received direct data message, forwarding to application." );
-            
-            if( messageReceiver != NULL )
-            {
-                messageReceiver->receiveMessage(
-                    sub_buff, link_id, NodeID::UNSPECIFIED, true
-                );
-            }
-            
-            break;
-        }
-
-
-        
-		// ---------------------------------------------------------------------
-		// handle link request from remote
-		// ---------------------------------------------------------------------
-		case AribaBaseMsg::typeLinkRequest:
-		{
-			logging_debug( "Received link open request on "
-			        << connection->getLocalEndpoint()->to_string() );
-			
-			/*
-			 * Deserialize Peer Message
-			 * - Our PeerID 
-			 */
-			PeerID our_peer_id;
-			sub_buff = our_peer_id.deserialize(sub_buff);
-
-            /// not the correct peer id-> skip request
-            if ( our_peer_id != localDescriptor.getPeerId() &&
-                    ! our_peer_id.isUnspecified() /* overlay bootstrap */ )
-            {
-                logging_info("Received link request for "
-                    << our_peer_id.toString()
-                    << "but i'm "
-                    << localDescriptor.getPeerId()
-                    << ": Ignoring!");
-                
-                // TODO terminate connection?
-                
-                break;
-            }
-
-            
-		    /*
-		     * Deserialize Link-Request Message:
-		     * - Their LinkID
-		     * - Their PeerID
-		     * - Their EndpointDescriptor
-		     */
-            LinkID their_link_id;
-            PeerID their_peer_id;
-            EndpointSetPtr their_endpoints = endpoint_set::create_EndpointSet();
-            sub_buff = their_link_id.deserialize(sub_buff);
-            sub_buff = their_peer_id.deserialize(sub_buff);
-            sub_buff = their_endpoints->deserialize(sub_buff);
-            /* [ Deserialize Link-Request Message ] */
-
-            
-			/// only answer the first request
-			if (!queryRemoteLink(their_link_id).isUnspecified())
-			{
-			    
-			    // TODO aktuell: When will these connections be closed?
-			    // ---> Close it now (if it services no links) ?
-			    //   (see also ! allowlink below)
-			    
-			    // XXX AKTUELL TESTING !! This will cause race conditions. So this is test-code only!
-			    if ( connection->get_communication_links().size() == 0 )
-			    {
-			        connection->terminate();
-			    }
-			    
-				logging_debug("Link request already received. Ignore!");
-				break;
-			}
-
-			/// create link ids
-			LinkID localLink  = LinkID::create();
-			LinkID remoteLink = their_link_id;  // XXX intermediate variable is unnecessary
-			logging_debug(
-			        "local=" << connection->getLocalEndpoint()->to_string()
-				<< " remote=" << connection->getRemoteEndpoint()->to_string()
-			);
-
-			// check if link creation is allowed by ALL listeners
-			bool allowlink = true;
-			foreach( CommunicationEvents* i, eventListener ){
-				allowlink &= i->onLinkRequest( localLink,
-				        connection->getLocalEndpoint(),
-				        connection->getRemoteEndpoint());
-			}
-
-			// not allowed-> warn
-			if( !allowlink ){
-				logging_warn( "Overlay denied creation of link" );
-				return;
-			}
-
-			// create descriptor
-			LinkDescriptor* ld = new LinkDescriptor();
-			ld->localLink = localLink;
-			ld->remoteLink = remoteLink;
-			ld->localLocator = connection->getLocalEndpoint();
-			ld->remoteLocator = connection->getRemoteEndpoint();
-			ld->remoteDescriptor = EndpointDescriptor(their_peer_id, their_endpoints);
-			ld->set_connection(connection);
-
-            
-			// update endpoints (should only have any effect in case of NAT)
-			ld->remoteDescriptor.endpoints->add_endpoint(connection->getRemoteEndpoint());
-//			localDescriptor.endpoints->add_endpoint(connection->getLocalEndpoint());  // XXX 0.0.0.0:0
-
-			// link is now up-> add it
-			ld->up = true;
-			addLink(ld);
-
-
-			
-            /* sending link reply */
-            logging_debug( "Sending link reply with ids "
-                << "local=" << localLink.toString() << ", "
-                << "remote=" << remoteLink.toString() );
-
-		    /*
-		     * Create Link-Reply Message:
-		     * - Our LinkID
-		     * - Our Endpoint_Set (as update)
-		     * - Their EndpointDescriptor (maybe they learn something about NAT)
-		     */
-		    reboost::message_t linkmsg;
-		    linkmsg.push_back(localLink.serialize());
-		    linkmsg.push_back(localDescriptor.endpoints->serialize());
-		    linkmsg.push_back(ld->remoteDescriptor.endpoints->serialize());
-		    
-		    // XXX
-		    cout << "/// MARIO: " << ld->get_connection()->getRemoteEndpoint()->to_string() << endl;
-		    
-		    // send message
-			bool sent = send_over_link( AribaBaseMsg::typeLinkReply, linkmsg, *ld, system_priority::OVERLAY );
-			
-			if ( ! sent )
-			{
-			    logging_error("ERROR: Could not send LinkReply to: " << ld->remoteLocator->to_string());
-			    
-			    // TODO remove link, close link, ..?
-			    
-			    break;
-			}
-
-
-            // link is up!
-            logging_debug( "Link (initiated from remote) is up with "
-                << "local(id=" << ld->localLink.toString() << ","
-                << "locator=" << ld->localLocator->to_string() << ") "
-                << "remote(id=" << ld->remoteLink.toString() << ", "
-                << "locator=" << ld->remoteLocator->to_string() << ")"
-            );
-
-			// inform listeners about new open link
-			foreach( CommunicationEvents* i, eventListener ) {
-				i->onLinkUp( localLink, ld->localLocator, ld->remoteLocator);
-			}
-
-			// done
-			break;
-		}
-
-		// ---------------------------------------------------------------------
-		// handle link request reply
-		// ---------------------------------------------------------------------
-		case AribaBaseMsg::typeLinkReply:
-		{
-			logging_debug( "Received link open reply for a link we initiated" );
-
-            /*
-             * Deserialize Link-Reply Message:
-             * - Their LinkID
-             * - Their Endpoint_Set (as update)
-             * - Our EndpointDescriptor (maybe we can learn something about NAT)
-             */
-			LinkID their_link_id;
-			EndpointSetPtr their_endpoints = endpoint_set::create_EndpointSet();
-			EndpointSetPtr our_endpoints = endpoint_set::create_EndpointSet();
-			sub_buff = their_link_id.deserialize(sub_buff);
-			sub_buff = their_endpoints->deserialize(sub_buff);
-			sub_buff = our_endpoints->deserialize(sub_buff);
-
-            
-			// this is a reply to a link open request, so we have already
-			// a link mapping and can now set the remote link to valid
-			LinkDescriptor& ld = queryLocalLink( link_id );
-
-			// no link found-> warn!
-			if (ld.isUnspecified()) {
-				logging_warn("Failed to find local link " << link_id.toString());
-				return;
-			}
-			
-			if ( ld.up )
-			{
-                logging_warn("Got link replay for already open link. Ignore. LinkID: " << link_id.toString());
-                
-                // TODO send LinkClose ?
-                return;			    
-			}
-
-			// store the connection
-			ld.set_connection(connection);
-			
-			// set remote locator and link id
-			ld.remoteLink = their_link_id;
-			ld.remoteLocator = connection->getRemoteEndpoint();
-			
-			
-			/* Update endpoints */
-			// NOTE: we might loose some information here, but it's our only chance to get rid of outdated information.
-			ld.remoteDescriptor.replace_endpoint_set(their_endpoints);
-			
-			// add actual remote endpoint to this set (should only have any effect in case of NAT)
-			ld.remoteDescriptor.endpoints->add_endpoint(connection->getRemoteEndpoint());
-			
-			// TODO In case of NAT, we could learn something about our external IP.
-			//   ---> But we must trust the remote peer about this information!!  
-//			localDescriptor.endpoints->add_endpoints(our_endpoints);
-			
-			
-			
-			
-			ld.up = true;
-
-			logging_debug( "Link is now up with local id "
-				<< ld.localLink.toString() << " and remote id "
-				<< ld.remoteLink.toString() );
-
-
-			// inform lisneters about link up event
-			foreach( CommunicationEvents* i, eventListener ){
-				i->onLinkUp( ld.localLink, ld.localLocator, ld.remoteLocator );
-			}
-
-			// done
-			break;
-		}
-
-		// ---------------------------------------------------------------------
-		// handle link close requests
-		// ---------------------------------------------------------------------
-		case AribaBaseMsg::typeLinkClose: {
-			// get remote link
-//			const LinkID& localLink = msg.getRemoteLink();
-			logging_debug( "Received link close request for link " << link_id.toString() );
-
-			// searching for link, not found-> warn
-			LinkDescriptor& linkDesc = queryLocalLink( link_id );
-			if (linkDesc.isUnspecified()) {
-				logging_warn("Failed to find local link " << link_id.toString());
-				return;
-			}
-
-			// inform listeners
-			foreach( CommunicationEvents* i, eventListener ){
-				i->onLinkDown( linkDesc.localLink,
-						linkDesc.localLocator, linkDesc.remoteLocator );
-			}
-
-			// remove the link descriptor
-			removeLink( link_id );
-
-			// done
-			break;
-		}
-
-		// ---------------------------------------------------------------------
-		// handle link locator changes  -- TODO is this ever called..?
-		// ---------------------------------------------------------------------
-//		case AribaBaseMsg::typeLinkUpdate: {
-//			const LinkID& localLink = msg.getRemoteLink();
-//			logging_debug( "Received link update for link "
-//				<< localLink.toString() );
-//
-//			// find the link description
-//			LinkDescriptor& linkDesc = queryLocalLink( localLink );
-//			if (linkDesc.isUnspecified()) {
-//				logging_warn("Failed to update local link "
-//					<< localLink.toString());
-//				return;
-//			}
-//
-//			// update the remote locator
-//			addressing2::EndpointPtr oldremote = linkDesc.remoteLocator;
-//			linkDesc.remoteLocator = connection->getRemoteEndpoint();
-//			
-//			// TODO update linkDesc.connection ?
-//
-//			// inform the listeners (local link has _not_ changed!)
-//			foreach( CommunicationEvents* i, eventListener ){
-//				i->onLinkChanged(
-//					linkDesc.localLink,	// linkid
-//					linkDesc.localLocator,	// old local
-//					linkDesc.localLocator,	// new local
-//					oldremote,		        // old remote
-//					linkDesc.remoteLocator	// new remote
-//				);
-//			}
-//
-//			// done
-//			break;
-//		}
-		
-		
-        default: {
-            logging_warn( "Received unknown message type!" );
-            break;
-        }
-
-	}
-}
-
-/// add a newly allocated link to the set of links
-void BaseCommunication::addLink( LinkDescriptor* link ) {
-	linkSet.push_back( link );
-}
-
-/// remove a link from set
-void BaseCommunication::removeLink( const LinkID& localLink ) {
-	for(LinkSet::iterator i=linkSet.begin(); i != linkSet.end(); i++){
-		if( (*i)->localLink != localLink) continue;
-//		remove_endpoint((*i)->remoteLocator);  // XXX
-		delete *i;
-		linkSet.erase( i );
-		break;
-	}
-}
-
-/// query a descriptor by local link id
+	}
+}
+
 BaseCommunication::LinkDescriptor& BaseCommunication::queryLocalLink( const LinkID& link ) const {
-	for (size_t i=0; i<linkSet.size();i++)
-		if (linkSet[i]->localLink == link) return (LinkDescriptor&)*linkSet[i];
-
-	return LinkDescriptor::UNSPECIFIED();
-}
-
-/// query a descriptor by remote link id
+	for (int i=0; i<linkSet.size();i++)
+		if (linkSet[i].localLink == link) return (LinkDescriptor&)linkSet[i];
+	return (LinkDescriptor&)LinkDescriptor::UNSPECIFIED;
+}
+
 BaseCommunication::LinkDescriptor& BaseCommunication::queryRemoteLink( const LinkID& link ) const {
-	for (size_t i=0; i<linkSet.size();i++)
-		if (linkSet[i]->remoteLink == link) return (LinkDescriptor&)*linkSet[i];
-
-	return LinkDescriptor::UNSPECIFIED();
-}
-
-//LinkIDs BaseCommunication::getLocalLinks( const address_v* addr ) const {
-//	LinkIDs ids;
-//	for (size_t i=0; i<linkSet.size(); i++){
-//		if( addr == NULL ){
-//			ids.push_back( linkSet[i]->localLink );
-//		} else {
-//			if ( *linkSet[i]->remoteLocator == *addr )
-//				ids.push_back( linkSet[i]->localLink );
-//		}
-//	}
-//	return ids;
-//}
+	for (int i=0; i<linkSet.size();i++)
+		if (linkSet[i].remoteLink == link) return (LinkDescriptor&)linkSet[i];
+	return (LinkDescriptor&)LinkDescriptor::UNSPECIFIED;
+}
+
+LinkIDs BaseCommunication::getLocalLinks( const EndpointDescriptor& ep ) const {
+	LinkIDs ids;
+
+	for (int i=0; i<linkSet.size(); i++){
+		if( ep == EndpointDescriptor::UNSPECIFIED ){
+			ids.push_back( linkSet[i].localLink );
+		} else {
+			if ( linkSet[i].remoteLocator == ep.locator )
+				ids.push_back( linkSet[i].localLink );
+		}
+	}
+
+	return ids;
+}
 
 void BaseCommunication::onNetworkChange(const NetworkChangeInterface::NetworkChangeInfo& info){
 
-/*- disabled!
-
+#ifdef UNDERLAY_OMNET
+
+	// we have no mobility support for simulations
+	return
+
+#endif // UNDERLAY_OMNET
+
+	//
 	// we only care about address changes, not about interface changes
 	// as address changes are triggered by interface changes, we are safe here
+	//
+
 	if( info.type != NetworkChangeInterface::EventTypeAddressNew &&
 		info.type != NetworkChangeInterface::EventTypeAddressDelete ) return;
 
-	logging_info( "base communication is handling network address changes" );
-
+	logging_info("base communication is handling network address changes");
+
+	//
 	// get all now available addresses
+	//
+
 	NetworkInformation networkInformation;
 	AddressInformation addressInformation;
@@ -814,5 +610,5 @@
 
 	for( ; i != iend; i++){
-		logging_debug( "local locator found " << (*i)->toString() );
+		logging_debug( "local locator found " + (*i)->toString() );
 		IPv4Locator* ipv4locator = dynamic_cast<IPv4Locator*>(*i);
 
@@ -900,80 +696,5 @@
 		transport->sendMessage( &updateMsg );
 	}
-*/
-}
-
-
-addressing2::EndpointPtr BaseCommunication::get_local_endpoint_of_link(
-        const LinkID& linkid)
-{
-    LinkDescriptor& ld = queryLocalLink(linkid);
-    
-    return ld.get_connection()->getLocalEndpoint();
-}
-
-addressing2::EndpointPtr BaseCommunication::get_remote_endpoint_of_link(
-        const LinkID& linkid)
-{
-    LinkDescriptor& ld = queryLocalLink(linkid);
-    
-    return ld.get_connection()->getRemoteEndpoint();
-}
-
-
-
-bool BaseCommunication::send_over_link(
-        const uint8_t type,
-        reboost::message_t message,
-        const LinkDescriptor& desc,
-        const uint8_t priority)
-{
-    /*
-     * Create Link Message:
-     * - Type
-     * - Their LinkID
-     */
-    // link id
-    message.push_front(desc.remoteLink.serialize());
-    // type
-    memcpy(message.push_front(sizeof(uint8_t)).mutable_data(), &type, sizeof(uint8_t));
-    /* [ Create Link Message ] */
-    
-    
-    /* send message */
-    transport_connection::sptr conn = desc.get_connection();
-    if ( ! conn )
-    {
-        cout << "/// MARIO: No connection!!" << endl;  // XXX debug
-        return false;
-    }
-    
-    // * send over connection *
-    return conn->send(message, priority);
-}
-
-void BaseCommunication::send_to_peer(
-        const uint8_t type,
-        const PeerID& peer_id,
-        reboost::message_t message,
-        const EndpointDescriptor& endpoint,
-        const uint8_t priority )
-{
-    /*
-     * Create Peer Message:
-     * - Type
-     * - Their PeerID
-     */
-    // peer id
-    message.push_front(peer_id.serialize());
-    // type
-    memcpy(message.push_front(sizeof(uint8_t)).mutable_data(), &type, sizeof(uint8_t));
-    
-    
-    /* send message */
-    transport->send(endpoint.getEndpoints(), message, priority);
-}
-
-
-
+}
 
 }} // namespace ariba, communication
Index: /source/ariba/communication/BaseCommunication.h
===================================================================
--- /source/ariba/communication/BaseCommunication.h	(revision 12775)
+++ /source/ariba/communication/BaseCommunication.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,12 +35,11 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef BASECOMMUNICATION_H_
 #define BASECOMMUNICATION_H_
 
-// boost & std includes
-#include <boost/unordered_map.hpp>
-#include <boost/unordered_set.hpp>
+#include <ext/hash_map>
+#include <ext/hash_set>
 #include <map>
 #include <set>
@@ -50,62 +49,65 @@
 #include <boost/foreach.hpp>
 
-#ifdef ECLIPSE_PARSER
-    #define foreach(a, b) for(a : b)
-#else
-    #define foreach(a, b) BOOST_FOREACH(a, b)
-#endif
-
-// utilities
 #include "ariba/utility/types.h"
-#include "ariba/utility/messages/MessageReceiver.h"
+#include "ariba/utility/messages.h"
 #include "ariba/utility/logging/Logging.h"
 #include "ariba/utility/misc/Demultiplexer.hpp"
-#include "ariba/utility/system/SystemEventListener.h"
-
-// new transport and addressing
-#include "ariba/utility/transport/transport_peer.hpp"
-#include "ariba/utility/transport/interfaces/transport_connection.hpp"
-#include "ariba/utility/transport/interfaces/transport_listener.hpp"
-#include "ariba/utility/addressing2/endpoint.hpp"
-
-// communication
+
 #include "ariba/communication/CommunicationEvents.h"
 #include "ariba/communication/EndpointDescriptor.h"
-#include "ariba/communication/messages/AribaBaseMsg.h"
-
-// network changes
 #include "ariba/communication/networkinfo/NetworkChangeInterface.h"
 #include "ariba/communication/networkinfo/NetworkChangeDetection.h"
 #include "ariba/communication/networkinfo/NetworkInformation.h"
-
-namespace ariba {
-    class SideportListener;
-}
+#include "ariba/communication/networkinfo/AddressInformation.h"
+#include "ariba/communication/messages/AribaBaseMsg.h"
+#include "ariba/communication/modules/transport/TransportProtocol.h"
+#include "ariba/communication/modules/network/NetworkProtocol.h"
+#include "ariba/communication/modules/network/NetworkLocator.h"
+
+#ifndef UNDERLAY_OMNET
+  #include "ariba/communication/modules/transport/tcp/TCPTransport.h"
+  #include "ariba/communication/modules/network/ip/IPv4NetworkProtocol.h"
+#endif
+
+using __gnu_cxx::hash_set;
+using __gnu_cxx::hash_map;
+
+using std::cout;
+using std::set;
+using std::map;
+using std::vector;
+using std::pair;
+using std::make_pair;
+using std::find;
+
+using ariba::communication::NetworkChangeDetection;
+using ariba::communication::NetworkChangeInterface;
+using ariba::communication::NetworkInterfaceList;
+using ariba::communication::NetworkInformation;
+using ariba::communication::AddressInformation;
+using ariba::communication::AddressList;
+using ariba::communication::AribaBaseMsg;
+using ariba::communication::CommunicationEvents;
+
+using ariba::utility::Demultiplexer;
+using ariba::utility::QoSParameterSet;
+using ariba::utility::SecurityParameterSet;
+using ariba::utility::Address;
+using ariba::utility::LinkID;
+using ariba::utility::LinkIDs;
+using ariba::utility::Message;
+using ariba::utility::MessageReceiver;
+using ariba::utility::seqnum_t;
+
+using ariba::communication::TransportProtocol;
+using ariba::communication::NetworkProtocol;
+using ariba::communication::NetworkLocator;
+#ifndef UNDERLAY_OMNET
+  using ariba::communication::IPv4NetworkProtocol;
+  using ariba::communication::TCPTransport;
+#endif
 
 namespace ariba {
 namespace communication {
-
-
-class communication_message_not_sent: public std::runtime_error
-{
-public:
-    /** Takes a character string describing the error.  */
-    explicit communication_message_not_sent(const string& __arg)  :
-        std::runtime_error(__arg)
-    {
-    }
-    
-    virtual ~communication_message_not_sent() throw() {}
-};
-
-
-
-using namespace std;
-using namespace ariba::transport;
-using namespace ariba::utility;
-
-// use base ariba types (clarifies multiple definitions)
-using ariba::utility::Message;
-using ariba::utility::seqnum_t;
 
 /**
@@ -115,36 +117,36 @@
  * protocols and addressing schemes.
  *
- * @author Sebastian Mies, Christoph Mayer, Mario Hock
+ * @author Sebastian Mies, Christoph Mayer
  */
-class BaseCommunication:
-	public NetworkChangeInterface,
-	public transport_listener {
+class BaseCommunication : public MessageReceiver, NetworkChangeInterface {
 
 	use_logging_h(BaseCommunication);
-	friend class ariba::SideportListener;
 
 public:
-	/// Default ctor that just creates an non-functional base communication
-	BaseCommunication();
-
-	/// Default dtor that does nothing
+	/**
+	 * Constructs a Base Communication instance.
+	 * Listens default on port number 41402
+	 */
+	BaseCommunication(const NetworkLocator* _locallocator, const uint16_t _listenport);
+
+	/**
+	 * Destructs a Base Communication instance
+	 */
 	virtual ~BaseCommunication();
 
-	/// Startup the base communication, start modules etc.
-	void start(addressing2::EndpointSetPtr listen_on);
-
-	/// Stops the base communication, stop modules etc.
-	void stop();
-
-	/// Check whether the base communication has been started up
-	bool isStarted();
-
-	/// Establishes a link to another end-point.
-	const LinkID establishLink(const EndpointDescriptor& descriptor,
-		const LinkID& linkid = LinkID::UNSPECIFIED, const QoSParameterSet& qos =
-				QoSParameterSet::DEFAULT, const SecurityParameterSet& sec =
-				SecurityParameterSet::DEFAULT);
-
-	/// Drops a link
+	/**
+	 * Establishes a link to another end-point
+	 */
+	const LinkID establishLink(
+			const EndpointDescriptor& descriptor,
+			const QoSParameterSet& qos = QoSParameterSet::DEFAULT,
+			const SecurityParameterSet& sec = SecurityParameterSet::DEFAULT
+	);
+
+	/**
+	 * Drops a link
+	 *
+	 * @param The link id of the link that should be dropped
+	 */
 	void dropLink(const LinkID link);
 
@@ -156,8 +158,5 @@
 	 * @return A sequence number for this message
 	 */
-	seqnum_t sendMessage(const LinkID& lid,
-	        reboost::message_t message,
-	        uint8_t priority,
-	        bool bypass_overlay = false) throw(communication_message_not_sent);
+	seqnum_t sendMessage(const LinkID lid, const Message* message);
 
 	/**
@@ -167,6 +166,5 @@
 	 * @return The end-point descriptor of the link's end-point
 	 */
-	const EndpointDescriptor& getEndpointDescriptor(const LinkID link =
-			LinkID::UNSPECIFIED) const;
+	const EndpointDescriptor& getEndpointDescriptor( const LinkID link = LinkID::UNSPECIFIED ) const;
 
 	/**
@@ -176,5 +174,5 @@
 	 * @return List of LinkID
 	 */
-//	LinkIDs getLocalLinks(const address_v* addr) const;  // XXX aktuell
+	LinkIDs getLocalLinks( const EndpointDescriptor& ep = EndpointDescriptor::UNSPECIFIED ) const;
 
 	/**
@@ -183,7 +181,5 @@
 	 * @param _receiver The receiving side
 	 */
-	void registerMessageReceiver(MessageReceiver* receiver) {
-		messageReceiver = receiver;
-	}
+	void registerMessageReceiver( MessageReceiver* _receiver );
 
 	/**
@@ -192,236 +188,140 @@
 	 * @param _receiver The receiving side
 	 */
-	void unregisterMessageReceiver(MessageReceiver* receiver) {
-		messageReceiver = NULL;
-	}
-
-	void registerEventListener(CommunicationEvents* _events);
-
-	void unregisterEventListener(CommunicationEvents* _events);
-
-	/**
-	 * called within the ASIO thread
-	 * when a message is received from underlay transport
-	 */ 
-	virtual void receive_message(transport_connection::sptr connection,
-		reboost::shared_buffer_t msg);
-
-    /**
-     * called within the ASIO thread
-     * when a connection is terminated (e.g. TCP close)
-     */ 
-    virtual void connection_terminated(transport_connection::sptr connection);
-
-    addressing2::EndpointPtr get_local_endpoint_of_link(const LinkID& linkid);
-    addressing2::EndpointPtr get_remote_endpoint_of_link(const LinkID& linkid);
-
-	
+	void unregisterMessageReceiver( MessageReceiver* _receiver );
+
+	void registerEventListener( CommunicationEvents* _events );
+	void unregisterEventListener( CommunicationEvents* _events );
+
 protected:
 
 	/**
-	 * called within the ARIBA thread (System Queue)
-	 * when a message is received from underlay transport
-	 */ 
-	void receiveMessage(transport_connection::sptr connection,
-	        reboost::shared_buffer_t message);
-	
-    /**
-     * called within the ARIBA thread (System Queue)
-     * when a connection is terminated (e.g. TCP close)
-     */ 
-    void connectionTerminated(transport_connection::sptr connection);
-	
-
-	/// called when a network interface change happens
-	virtual void onNetworkChange(
-		const NetworkChangeInterface::NetworkChangeInfo& info);
+	 * Called from the Transport when async items
+	 * from the SystemQueue are delivered
+	 */
+	virtual bool receiveMessage( const Message* message, const LinkID& link, const NodeID& node );
+
+	/**
+	 * Called when a network interface change happens
+	 */
+	virtual void onNetworkChange( const NetworkChangeInterface::NetworkChangeInfo& info );
 
 private:
-	/**
-	 * A link descriptor consisting of the end-point descriptor and currently
-	 * used underlay address.
+
+	/**
+	 * A link descriptor consisting of the
+	 * end-point descriptor and currently used locator and
+	 * message receiver
 	 */
 	class LinkDescriptor {
 	public:
-
-		/// default constructor
+		static const LinkDescriptor UNSPECIFIED;
+
 		LinkDescriptor() :
-			localLink(LinkID::UNSPECIFIED),
-			remoteLink(LinkID::UNSPECIFIED),
-			up(false) {
+			localLink(),
+			localLocator(NULL),
+			remoteLink(),
+			remoteLocator(NULL),
+			remoteEndpoint(EndpointDescriptor::UNSPECIFIED){
 		}
 
-		~LinkDescriptor()
-		{
-			if ( connection )
-			{
-			    connection->unregister_communication_link(&localLink);
-			}
+		LinkDescriptor(const LinkID& _localLink, const NetworkLocator*& _localLocator,
+				const LinkID& _remoteLink, const NetworkLocator*& _remoteLocator,
+				const EndpointDescriptor& _remoteEndpoint ) :
+			localLink(_localLink),
+			localLocator(_localLocator),
+			remoteLink(_remoteLink),
+			remoteLocator(_remoteLocator),
+			remoteEndpoint(_remoteEndpoint){
 		}
 
+		LinkDescriptor( const LinkDescriptor& desc ) :
+			localLink(desc.localLink),
+			localLocator(desc.localLocator),
+			remoteLink(desc.remoteLink),
+			remoteLocator(desc.remoteLocator),
+			remoteEndpoint(desc.remoteEndpoint){
+		}
+
 		bool isUnspecified() const {
-			return (this == &UNSPECIFIED());
+			return (this == &UNSPECIFIED);
 		}
 
-		static LinkDescriptor& UNSPECIFIED(){
-			static LinkDescriptor* unspec = NULL;
-			if(unspec == NULL) unspec = new LinkDescriptor();
-			return *unspec;
-		}
-		
-		
-		transport_connection::sptr get_connection() const
-		{
-		    return connection;
-		}
-		
-		void set_connection(const transport_connection::sptr& conn)
-		{
-		    // unregister from old connection,
-		    // if any (but normally there shouldn't..)
-		    if ( connection )
-		    {
-		        connection->unregister_communication_link(&localLink);
-		    }
-
-		    // * set_connection *
-		    connection = conn;
-		    
-		    // register this link with the connection
-		    conn->register_communication_link(&localLink);
-		}
-
-		bool unspecified;
-
-		/// link identifiers
-		LinkID localLink;
-		addressing2::EndpointPtr localLocator;
-
-		/// used underlay addresses for the link
-		LinkID remoteLink;
-		addressing2::EndpointPtr remoteLocator;
-
-		/// the remote end-point descriptor
-		EndpointDescriptor remoteDescriptor;
-
-		/// flag, whether this link is up
-		bool up;
-		
-		
-	private:
-		/// connection if link is up
-		transport_connection::sptr connection;
+		LinkID 			localLink;
+		const NetworkLocator* 	localLocator;
+		LinkID 			remoteLink;
+		const NetworkLocator* 	remoteLocator;
+		EndpointDescriptor 	remoteEndpoint;
 	};
 
-	/// Link management: list of links
-	typedef vector<LinkDescriptor*> LinkSet;
-
-	/// Link management: the set of currently managed links
+	/**
+	 * Link management: add a link
+	 */
+	void addLink( const LinkDescriptor& link );
+
+	/**
+	 * Link management: remove alink
+	 */
+	void removeLink( const LinkID& localLink );
+
+	/**
+	 * Link management: get link information using the local link
+	 */
+	LinkDescriptor& queryLocalLink( const LinkID& localLink ) const;
+
+	/**
+	 * Link management: get link information using the remote link
+	 */
+	LinkDescriptor& queryRemoteLink( const LinkID& remoteLink ) const;
+
+	/**
+	 * Link management: list of links
+	 */
+	typedef vector<LinkDescriptor> LinkSet;
+
+	/**
+	 * Link management: the set of currently managed links
+	 */
 	LinkSet linkSet;
 
-	/// Link management: add a link
-	void addLink( LinkDescriptor* link );
-
-	/// Link management: remove a link
-	void removeLink(const LinkID& localLink);
-
-	/// Link management: get link information using the local link
-	LinkDescriptor& queryLocalLink(const LinkID& localLink) const;
-
-	/// Link management: get link information using the remote link
-	LinkDescriptor& queryRemoteLink(const LinkID& remoteLink) const;
-
-	/// The local end-point descriptor
+	/**
+	 * The message receiver
+	 */
+	MessageReceiver* messageReceiver;
+
+	/**
+	 * The local end-point descriptor
+	 */
 	EndpointDescriptor localDescriptor;
-	
-	/**
-	 * endpoint_set holding the addresses of the "server"-sockets,
-	 * ---> that should be opened
-	 * 
-	 * (e.g. 0.0.0.0:41322)
-	 */
-	addressing2::EndpointSetPtr listenOn_endpoints;
-	
-    /**
-     * endpoint_set holding the addresses of the "server"-sockets,
-     * ---> that are actually open
-     * 
-     * (e.g. 0.0.0.0:41322)
-     * 
-     * XXX should only be in transport_peer
-     */
-	addressing2::EndpointSetPtr active_listenOn_endpoints;
-	
-    /**
-     * endpoint_set holding the addresses of the "server"-sockets,
-     * ---> here the discovered "addressable" addresses are stored
-     * 
-     * (e.g. 192.168.0.5:41322)
-     * 
-     * XXX should only be in localDescriptor
-     */
-	addressing2::EndpointSetPtr local_endpoints;
-
-	/// network change detector
+
+	/**
+	 * Network information and protocol
+	 */
+	NetworkProtocol* network;
+
+	/**
+	 * Transport information and protocol
+	 */
+	TransportProtocol* transport;
+
+#ifndef UNDERLAY_OMNET
+	/**
+	 * Detect changes in the routing/interface, etc.
+	 * stuff needed for mobility detection
+	 */
 	NetworkChangeDetection networkMonitor;
-
-	/// list of all remote addresses of links to end-points
-	// XXX DEPRECATED
-//	class endpoint_reference {
-//	public:
-//		int count; ///< the number of open links to this end-point
-//		const address_v* endpoint; ///< the end-point itself
-//	};
-//	vector<endpoint_reference> remote_endpoints;
-
-	// XXX DEPRECATED
-//	/// adds an end-point to the list
-//	void add_endpoint( const address_v* endpoint );
-//
-//	/// removes an end-point from the list
-//	void remove_endpoint( const address_v* endpoint );
-
-	/// event listener
+#endif
+
+	/**
+	 * The local listen port
+	 */
+	uint16_t listenport;
+
 	typedef set<CommunicationEvents*> EventListenerSet;
 	EventListenerSet eventListener;
 
-	/// sequence numbers
 	seqnum_t currentSeqnum;
-
-	/// transport peer
-	transport_peer* transport;
-
-	/// the base overlay message receiver
-	MessageReceiver* messageReceiver;
-
-	
-	/* 
-	 * Sends a message over an existing link.
-	 *   ---> Adds Â»Link MessageÂ« Header
-	 */
-	bool send_over_link(
-	        const uint8_t type,
-	        reboost::message_t message,
-	        const LinkDescriptor& desc,
-	        const uint8_t priority);
-
-    /* 
-     * Sends a message to a known peer. (To all known endpoints.)
-     *   ---> Adds Â»Peer MessageÂ« Header
-     */
-	void send_to_peer(
-	        const uint8_t type,
-	        const PeerID& peer_id,
-	        reboost::message_t message,
-	        const EndpointDescriptor& endpoint,
-	        const uint8_t priority );
-	
-
-	/// state of the base communication
-	bool started;
-
 };
 
 }} // namespace ariba, communication
 
-#endif /* BASECOMMUNICATION_H_ */
+#endif /*BASECOMMUNICATION_H_*/
Index: urce/ariba/communication/CMakeLists.txt
===================================================================
--- /source/ariba/communication/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,51 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    BaseCommunication.h
-    CommunicationEvents.h
-    EndpointDescriptor.h
-    )
-
-add_sources(
-    BaseCommunication.cpp
-    CommunicationEvents.cpp
-    EndpointDescriptor.cpp
-    )
-
-add_subdir_sources(messages networkinfo)
Index: /source/ariba/communication/CommunicationEvents.cpp
===================================================================
--- /source/ariba/communication/CommunicationEvents.cpp	(revision 12775)
+++ /source/ariba/communication/CommunicationEvents.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "CommunicationEvents.h"
@@ -48,36 +48,22 @@
 }
 
-bool CommunicationEvents::onLinkRequest(const LinkID& id,
-        const addressing2::EndpointPtr local,
-        const addressing2::EndpointPtr remote)
-{
+bool CommunicationEvents::onLinkRequest( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ) {
 	return true;
 }
 
-void CommunicationEvents::onLinkUp(const LinkID& id,
-        const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote)
-{
+void CommunicationEvents::onLinkUp( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ) {
 }
 
-void CommunicationEvents::onLinkDown(const LinkID& id,
-        const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote)
-{
+void CommunicationEvents::onLinkDown( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ) {
 }
 
-void CommunicationEvents::onLinkChanged(const LinkID& id,
-        const addressing2::EndpointPtr oldlocal,  const addressing2::EndpointPtr newlocal,
-        const addressing2::EndpointPtr oldremote, const addressing2::EndpointPtr newremote)
-{
+
+void CommunicationEvents::onLinkChanged( const LinkID& id, const NetworkLocator* oldlocal, const NetworkLocator* newlocal, const NetworkLocator* oldremote, const NetworkLocator* newremote ) {
 }
 
-void CommunicationEvents::onLinkFail(const LinkID& id,
-        const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote)
-{
+void CommunicationEvents::onLinkFail( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote ){
 }
 
-void CommunicationEvents::onLinkQoSChanged(const LinkID& id,
-        const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote,
-        const QoSParameterSet& qos)
-{
+void CommunicationEvents::onLinkQoSChanged( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote, const QoSParameterSet& qos ){
 }
 
Index: /source/ariba/communication/CommunicationEvents.h
===================================================================
--- /source/ariba/communication/CommunicationEvents.h	(revision 12775)
+++ /source/ariba/communication/CommunicationEvents.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __COMMUNICATION_EVENTS_H
@@ -41,14 +41,16 @@
 
 #include "ariba/utility/types/LinkID.h"
+#include "ariba/communication/modules/network/NetworkLocator.h"
 #include "ariba/utility/types/QoSParameterSet.h"
-#include "ariba/utility/addressing2/endpoint.hpp"
+
+using ariba::utility::LinkID;
+using ariba::utility::QoSParameterSet;
+using ariba::communication::NetworkLocator;
 
 namespace ariba {
 namespace communication {
 
-using ariba::utility::LinkID;
-using ariba::utility::QoSParameterSet;
+class CommunicationEvents {
 
-class CommunicationEvents {
 	friend class BaseCommunication;
 
@@ -67,7 +69,5 @@
 	 * @return True, if the link should be established
 	 */
-	virtual bool onLinkRequest(const LinkID& id,
-	        const addressing2::EndpointPtr local,
-	        const addressing2::EndpointPtr remote);
+	virtual bool onLinkRequest( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote );
 
 	/**
@@ -77,6 +77,5 @@
 	 * @param id The link id of the established link
 	 */
-	virtual void onLinkUp(const LinkID& id,
-	        const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote);
+	virtual void onLinkUp( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote );
 
 	/**
@@ -85,6 +84,5 @@
 	 * @param id The link identifier of the dropped link
 	 */
-	virtual void onLinkDown(const LinkID& id,
-	        const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote);
+	virtual void onLinkDown( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote );
 
 	/**
@@ -96,14 +94,9 @@
 	 * @param id The link identifier of the changed link
 	 */
-	virtual void onLinkChanged(const LinkID& id,
-		const addressing2::EndpointPtr oldlocal,  const addressing2::EndpointPtr newlocal,
-		const addressing2::EndpointPtr oldremote, const addressing2::EndpointPtr newremote);
+	virtual void onLinkChanged( const LinkID& id, const NetworkLocator* oldlocal, const NetworkLocator* newlocal, const NetworkLocator* oldremote, const NetworkLocator* newremote );
 
-	virtual void onLinkFail(const LinkID& id,
-	        const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote);
+	virtual void onLinkFail( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote );
 
-	virtual void onLinkQoSChanged(const LinkID& id,
-	        const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote,
-	        const QoSParameterSet& qos);
+	virtual void onLinkQoSChanged( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote, const QoSParameterSet& qos );
 };
 
Index: /source/ariba/communication/EndpointDescriptor.cpp
===================================================================
--- /source/ariba/communication/EndpointDescriptor.cpp	(revision 12775)
+++ /source/ariba/communication/EndpointDescriptor.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "EndpointDescriptor.h"
@@ -42,52 +42,51 @@
 namespace communication {
 
-//vsznDefault(EndpointDescriptor);
+vsznDefault(EndpointDescriptor);
 
-EndpointDescriptor::EndpointDescriptor()  :
-        endpoints(new addressing2::endpoint_set())
-{
+const EndpointDescriptor EndpointDescriptor::UNSPECIFIED;
+
+EndpointDescriptor::EndpointDescriptor() : locator( NULL ), isUnspec( true ){
 }
 
-EndpointDescriptor::~EndpointDescriptor(){
-
+EndpointDescriptor::EndpointDescriptor(const EndpointDescriptor& rh){
+	locator = (rh.locator != NULL) ? new IPv4Locator(*rh.locator) : NULL;
+	isUnspec = rh.isUnspec;
 }
 
-EndpointDescriptor::EndpointDescriptor(const EndpointDescriptor& rh) :
-	endpoints(rh.endpoints){
+EndpointDescriptor::EndpointDescriptor(const Locator* _locator){
+	locator = new IPv4Locator(*dynamic_cast<IPv4Locator*>((Locator*)_locator));
+	isUnspec = false;
 }
 
-EndpointDescriptor::EndpointDescriptor(
-        const PeerID& peer_id,
-        addressing2::EndpointSetPtr endpoints ) :
-    peerId(peer_id),
-	endpoints(endpoints)
-{
+EndpointDescriptor::~EndpointDescriptor() {
 }
 
-EndpointDescriptor::EndpointDescriptor(const string& str)  :
-        endpoints(new addressing2::endpoint_set())
-{
-    cout << "ERROR: Construction of EndpointDescriptor from String is not functional!!" << endl;
-    assert( false );
+bool EndpointDescriptor::isUnspecified() const {
+	return isUnspec;
+}
+
+string EndpointDescriptor::toString() const {
+	if( locator == NULL ) return "<undefined locator>";
+	else                  return locator->toString();
+}
+
+EndpointDescriptor* EndpointDescriptor::fromString( string str ) {
+	EndpointDescriptor* ep = new EndpointDescriptor();
+	ep->locator->fromString(str);
+	ep->isUnspec = false;
+	return ep;
 }
 
 
-reboost::message_t EndpointDescriptor::serialize() const
-{
-    reboost::message_t msg;
-    msg.push_back(peerId.serialize());
-    msg.push_back(endpoints->serialize());
-    
-    return msg;
+bool EndpointDescriptor::operator==(const EndpointDescriptor& rh) const {
+
+	if( locator != NULL && rh.locator != NULL )
+		return ( locator->operator==(*rh.locator) );
+
+	if( locator != rh.locator )
+		return false;
+
+	return (isUnspec == rh.isUnspec);
 }
 
-reboost::shared_buffer_t EndpointDescriptor::deserialize(reboost::shared_buffer_t buff)
-{
-    buff = peerId.deserialize(buff);
-    buff = endpoints->deserialize(buff);
-    
-    return buff;
-}
-
-
 }} // namespace ariba, communication
Index: /source/ariba/communication/EndpointDescriptor.h
===================================================================
--- /source/ariba/communication/EndpointDescriptor.h	(revision 12775)
+++ /source/ariba/communication/EndpointDescriptor.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,19 +35,26 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef ENDPOINTDESCRIPTOR_H_
 #define ENDPOINTDESCRIPTOR_H_
 
+#include "ariba/utility/types.h"
+#include "ariba/utility/serialization.h"
+#include "ariba/communication/modules/network/ip/IPv4Locator.h"
 #include <string>
 #include <set>
-//#include "ariba/utility/serialization.h"
-#include "ariba/utility/types/PeerID.h"
 
-#include "ariba/utility/addressing2/endpoint_set.hpp"
+using std::string;
+using std::set;
+using ariba::utility::Locator;
+using ariba::communication::IPv4Locator;
 
-// reboost messages
-#include "ariba/utility/transport/messages/message.hpp"
-
+// needed for friend decleration
+// in different namespace
+namespace ariba {
+namespace interface {
+	class UnderlayAbstraction;
+}}
 
 namespace ariba {
@@ -55,127 +62,52 @@
 
 using_serialization;
-using namespace std;
-using ariba::utility::PeerID;
 
+class EndpointDescriptor : VSerializeable {
+	VSERIALIZEABLE;
 
-/**
- * This class is used a transitions helper between the old addressing and
- * serialization to the new addressing2 and the new message classes
- * 
- * Maybe it will be replaced, or at least modified in the future.
- */
-//class EndpointDescriptor: public VSerializeable { VSERIALIZEABLE
-//    friend class BaseCommunication;
-class EndpointDescriptor
-{
-    friend class BaseCommunication;
+	friend class BaseCommunication;
+	friend class ariba::interface::UnderlayAbstraction;
 
 public:
-	/// creates an empty endpoint descriptor with zero endpoints
+	/**
+	 * The default constructor.
+	 */
 	EndpointDescriptor();
 
-	/// destructor.
+	EndpointDescriptor(const EndpointDescriptor& rh);
+	EndpointDescriptor(const Locator* _locator);
+
+	/**
+	 * The destructor.
+	 */
 	virtual ~EndpointDescriptor();
 
-	/// copy constructor
-	EndpointDescriptor(const EndpointDescriptor& rh);
+	/**
+	 * An unspecified end-point
+	 */
+	static const EndpointDescriptor UNSPECIFIED;
 
-	/// construct end-points from an endpoint set
-	EndpointDescriptor(const PeerID& peer_id, addressing2::EndpointSetPtr endpoints );
+	/**
+	 * Returns true, if the descriptor is unspecified.
+	 *
+	 * @return True, if the descriptor is unspecified.
+	 */
+	bool isUnspecified() const;
 
-	// FIXME NOT WORKING !!
-	/// construct end-points from a string
-	EndpointDescriptor(const string& str);
+	virtual string toString() const;
+	static EndpointDescriptor* fromString( string str );
 
-	/// convert end-points to string
-	string toString() const {
-		return endpoints->to_string();
-	}
+	bool operator==( const EndpointDescriptor& rh ) const;
 
-	static EndpointDescriptor& UNSPECIFIED() {
-		static EndpointDescriptor* unspec = NULL;
-		if(unspec == NULL) unspec = new EndpointDescriptor();
-
-		return *unspec;
-	}
-
-	/// returns true, if this object is the unspecified object
-	bool isUnspecified() const {
-		return (this == &UNSPECIFIED());
-	}
-
-//	/// create endpoint
-//	static EndpointDescriptor* fromString(string str) {
-//		return new EndpointDescriptor(str);
-//	}
-
-	bool operator==(const EndpointDescriptor& rh) const {
-		if (rh.isUnspecified() && isUnspecified()) return true;
-		if (rh.isUnspecified() ^  isUnspecified()) return false;
-
-		assert( (!rh.isUnspecified()) && (!isUnspecified()) );
-		return endpoints == rh.endpoints;
-	}
-
-	bool operator!=(const EndpointDescriptor& rh) const {
-		return ( !operator==(rh) );
-	}
-
-	EndpointDescriptor& operator=( const EndpointDescriptor& rhs) {
-		endpoints = rhs.endpoints;
-		return *this;
-	}
-
-	/// returns the end-points of this descriptor
-	addressing2::const_EndpointSetPtr getEndpoints() const {
-		return endpoints;
-	}
-	
-	void replace_endpoint_set(addressing2::EndpointSetPtr new_endpoints)
-	{
-	    endpoints = new_endpoints;
-	}
-	
-	/// returns a reference to the peer id
-	PeerID& getPeerId() {
-		return peerId;
-	}
-
-
-	/// returns a reference to the constant peer id
-	const PeerID& getPeerId() const {
-		return peerId;
-	}
-	
-	/// returns a message with peerId and endpoints in it
-	reboost::message_t serialize() const;
-	
-	/// deserialite peerId and endpoints
-	reboost::shared_buffer_t deserialize(reboost::shared_buffer_t buff);
-	
 private:
-	addressing2::EndpointSetPtr endpoints;
-	PeerID peerId;
+	bool isUnspec;
+	IPv4Locator* locator;
 };
 
 }} // namespace ariba, communication
 
-//sznBeginDefault( ariba::communication::EndpointDescriptor, X ){
-//
-//    // TODO
-//    assert(false);
-//    
-//	// serialize peer id
-//	X && &peerId;
-//
-//	// serialize end-points
-//	uint16_t len = endpoints.to_bytes_size();
-//	X && len;
-//	uint8_t* buffer = X.bytes( len );
-//	if (buffer!=NULL) {
-//		if (X.isDeserializer()) endpoints.assign(buffer,len);
-//		else endpoints.to_bytes(buffer);
-//	}
-//}sznEnd();
+sznBeginDefault( ariba::communication::EndpointDescriptor, X ) {
+	X && VO(locator);
+} sznEnd();
 
 #endif /*ENDPOINTDESCRIPTOR_H_*/
Index: /source/ariba/communication/messages/AribaBaseMsg.cpp
===================================================================
--- /source/ariba/communication/messages/AribaBaseMsg.cpp	(revision 12775)
+++ /source/ariba/communication/messages/AribaBaseMsg.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "AribaBaseMsg.h"
@@ -44,28 +44,42 @@
 vsznDefault(AribaBaseMsg);
 
-AribaBaseMsg::AribaBaseMsg( type_ _type,
-	const LinkID& localLink, const LinkID& remoteLink ) :
-	type((uint8_t)_type),
-	localLink(localLink),remoteLink(remoteLink) {
+AribaBaseMsg::AribaBaseMsg(
+	const Address* address,
+	LINK_STATE _state,
+	const LinkID& _localLink,
+	const LinkID& _remoteLink )
+		: state( (uint8_t)_state ),
+		  localLink( _localLink ),
+		  remoteLink( _remoteLink ){
+
+	Message::setDestinationAddress( address );
 }
 
-AribaBaseMsg::~AribaBaseMsg() {
+AribaBaseMsg::~AribaBaseMsg(){
 }
 
-const string AribaBaseMsg::getTypeString() const {
-	switch (getType()) {
-		case typeData:
-			return "typeData";
-		case typeLinkRequest:
-			return "typeLinkRequest";
-		case typeLinkReply:
-			return "typeLinkReply";
-		case typeLinkClose:
-			return "typeLinkClose";
-		case typeLinkUpdate:
-			return "typeLinkUpdate";
-		default:
-			return "unknown";
+const AribaBaseMsg::LINK_STATE AribaBaseMsg::getType(){
+	return (LINK_STATE)state;
+}
+
+const LinkID& AribaBaseMsg::getLocalLink(){
+	return localLink;
+}
+
+const LinkID& AribaBaseMsg::getRemoteLink(){
+	return remoteLink;
+}
+
+const string AribaBaseMsg::getTypeString(){
+
+	switch( getType() ){
+		case LINK_STATE_DATA: 		return "LINK_STATE_DATA";
+		case LINK_STATE_OPEN_REQUEST: 	return "LINK_STATE_OPEN_REQUEST";
+		case LINK_STATE_OPEN_REPLY: 	return "LINK_STATE_OPEN_REPLY";
+		case LINK_STATE_CLOSE_REQUEST: 	return "LINK_STATE_CLOSE_REQUEST";
+		case LINK_STATE_UPDATE:		return "LINK_STATE_UPDATE";
+		default:			"unknown";
 	}
+
 	return "unknown";
 }
Index: /source/ariba/communication/messages/AribaBaseMsg.h
===================================================================
--- /source/ariba/communication/messages/AribaBaseMsg.h	(revision 12775)
+++ /source/ariba/communication/messages/AribaBaseMsg.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef ARIBA_BASE_MSG_H__
@@ -42,12 +42,9 @@
 #include <string>
 #include <boost/cstdint.hpp>
-//#include "ariba/utility/messages.h"
-#include "ariba/utility/messages/Message.h"
+#include "ariba/utility/messages.h"
 #include "ariba/utility/serialization.h"
 #include "ariba/utility/types/LinkID.h"
 #include "ariba/utility/types/Address.h"
 #include "ariba/utility/types/ServiceID.h"
-
-#include "../EndpointDescriptor.h"
 
 using std::string;
@@ -62,55 +59,33 @@
 using_serialization;
 
-// XXX This whole message is DEPRECATED
 class AribaBaseMsg : public Message {
 	VSERIALIZEABLE;
 public:
-	enum type_ {
-		typeData = 0,
-		typeLinkRequest = 1,
-		typeLinkReply = 2,
-		typeLinkClose = 3,
-		typeLinkUpdate = 4,
-		typeDirectData = 5
-	};
 
-	AribaBaseMsg( type_ type = typeData,
-			const LinkID& localLink = LinkID::UNSPECIFIED,
-			const LinkID& remoteLink = LinkID::UNSPECIFIED );
+	typedef enum _LINK_STATE {
+		LINK_STATE_DATA          = 0,
+		LINK_STATE_OPEN_REQUEST  = 1,
+		LINK_STATE_OPEN_REPLY    = 2,
+		LINK_STATE_CLOSE_REQUEST = 3, // there is no close reply. send request and local link is closed
+		LINK_STATE_UPDATE        = 4,
+	} LINK_STATE;
+
+	AribaBaseMsg(	const Address* address    = NULL,
+			LINK_STATE _state         = LINK_STATE_DATA,
+			const LinkID& _localLink  = LinkID::UNSPECIFIED,
+			const LinkID& _remoteLink = LinkID::UNSPECIFIED );
 
 	virtual ~AribaBaseMsg();
 
-	const string getTypeString() const;
-
-	const type_ getType() const {
-		return (type_)type;
-	}
-
-	const LinkID& getLocalLink() const {
-		return localLink;
-	}
-
-	const LinkID& getRemoteLink() const {
-		return remoteLink;
-	}
-
-	EndpointDescriptor& getLocalDescriptor() {
-		return localDescriptor;
-	}
-
-	EndpointDescriptor& getRemoteDescriptor() {
-		return remoteDescriptor;
-	}
+	const LINK_STATE getType();
+	const string getTypeString();
+	const LinkID& getLocalLink();
+	const LinkID& getRemoteLink();
 
 private:
-	uint8_t type;		// the link message type
-
-	// remote and local link ids
+	uint8_t state;		// the link message type
 	LinkID localLink;	// the local link id
 	LinkID remoteLink;	// the remote link id
 
-	// remote and local endpoint descriptors
-	EndpointDescriptor localDescriptor;
-	EndpointDescriptor remoteDescriptor;
 };
 
@@ -118,8 +93,5 @@
 
 sznBeginDefault( ariba::communication::AribaBaseMsg, X ) {
-	X && type && &remoteLink;
-	if (type == typeLinkReply || type == typeLinkRequest)
-		X && &localLink && localDescriptor && remoteDescriptor;
-//	X && Payload();
+	X && state && &localLink && &remoteLink && Payload();
 } sznEnd();
 
Index: urce/ariba/communication/messages/CMakeLists.txt
===================================================================
--- /source/ariba/communication/messages/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,41 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-#add_headers(AribaBaseMsg.h)
-
-#add_sources(AribaBaseMsg.cpp)
Index: /source/ariba/communication/modules/_namespace.h
===================================================================
--- /source/ariba/communication/modules/_namespace.h	(revision 2378)
+++ /source/ariba/communication/modules/_namespace.h	(revision 2378)
@@ -0,0 +1,47 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#undef NAMESPACE_BEGIN
+#undef NAMESPACE_END
+
+#define NAMESPACE_BEGIN \
+	namespace ariba { \
+	namespace communication {
+
+#define NAMESPACE_END \
+	}}
Index: /source/ariba/communication/modules/modules.h
===================================================================
--- /source/ariba/communication/modules/modules.h	(revision 2378)
+++ /source/ariba/communication/modules/modules.h	(revision 2378)
@@ -0,0 +1,60 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef MODULES_H_
+#define MODULES_H_
+
+// network
+#include "network/NetworkProtocol.h"
+#include "network/NetworkLocator.h"
+#include "network/ip/IPv4Locator.h"
+#include "network/ip/IPv4NetworkProtocol.h"
+
+// transport
+#include "transport/TransportLocator.h"
+#include "transport/TransportProtocol.h"
+
+#ifdef UNDERLAY_OMNET
+  #include "ariba/communication/modules/transport/omnet/SpoVNetOmnetModule.h"
+  #include "ariba/communication/modules/network/omnet/OmnetNetworkProtocol.h"
+#else
+  #include "ariba/communication/modules/transport/tcp/TCPTransport.h"
+  #include "ariba/communication/modules/transport/tcp/TCPTransportLocator.h"
+#endif
+
+#endif /* MODULES_H_ */
Index: /source/ariba/communication/modules/network/NetworkLocator.cpp
===================================================================
--- /source/ariba/communication/modules/network/NetworkLocator.cpp	(revision 2378)
+++ /source/ariba/communication/modules/network/NetworkLocator.cpp	(revision 2378)
@@ -0,0 +1,49 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "NetworkLocator.h"
+
+NAMESPACE_BEGIN;
+
+NetworkLocator::NetworkLocator() {
+}
+
+NetworkLocator::~NetworkLocator() {
+}
+
+NAMESPACE_END;
Index: /source/ariba/communication/modules/network/NetworkLocator.h
===================================================================
--- /source/ariba/communication/modules/network/NetworkLocator.h	(revision 2378)
+++ /source/ariba/communication/modules/network/NetworkLocator.h	(revision 2378)
@@ -0,0 +1,63 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef NETWORKLOCATOR_H_
+#define NETWORKLOCATOR_H_
+
+#include <string>
+#include "ariba/utility/types/Locator.h"
+
+#include "../_namespace.h"
+NAMESPACE_BEGIN;
+
+using std::string;
+using ariba::utility::Locator;
+
+class NetworkLocator : public Locator {
+public:
+	NetworkLocator();
+	virtual ~NetworkLocator();
+
+	virtual bool operator==(const NetworkLocator& rh) const = 0;
+	virtual bool operator!=(const NetworkLocator& rh) const = 0;
+	virtual string toString() const = 0;
+};
+
+NAMESPACE_END;
+
+#endif /* NETWORKLOCATOR_H_ */
Index: /source/ariba/communication/modules/network/NetworkProtocol.cpp
===================================================================
--- /source/ariba/communication/modules/network/NetworkProtocol.cpp	(revision 2378)
+++ /source/ariba/communication/modules/network/NetworkProtocol.cpp	(revision 2378)
@@ -0,0 +1,49 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "NetworkProtocol.h"
+
+NAMESPACE_BEGIN;
+
+NetworkProtocol::NetworkProtocol() {
+}
+
+NetworkProtocol::~NetworkProtocol() {
+}
+
+NAMESPACE_END;
Index: /source/ariba/communication/modules/network/NetworkProtocol.h
===================================================================
--- /source/ariba/communication/modules/network/NetworkProtocol.h	(revision 2378)
+++ /source/ariba/communication/modules/network/NetworkProtocol.h	(revision 2378)
@@ -0,0 +1,61 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef NETWORKPROTOCOL_H_
+#define NETWORKPROTOCOL_H_
+
+#include "../_namespace.h"
+#include "ariba/communication/modules/network/NetworkLocator.h"
+#include <vector>
+
+using std::vector;
+
+NAMESPACE_BEGIN;
+
+class NetworkProtocol {
+public:
+	NetworkProtocol();
+	virtual ~NetworkProtocol();
+
+	typedef vector<NetworkLocator*> NetworkLocatorSet;
+	virtual const NetworkLocatorSet getAddresses() const = 0;
+};
+
+NAMESPACE_END;
+
+#endif /* NETWORKPROTOCOL_H_ */
Index: /source/ariba/communication/modules/network/ip/IPv4Locator.cpp
===================================================================
--- /source/ariba/communication/modules/network/ip/IPv4Locator.cpp	(revision 2378)
+++ /source/ariba/communication/modules/network/ip/IPv4Locator.cpp	(revision 2378)
@@ -0,0 +1,96 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "IPv4Locator.h"
+
+namespace ariba {
+namespace communication {
+
+vsznDefault(IPv4Locator);
+
+IPv4Locator IPv4Locator::ANY        = IPv4Locator::fromString("0.0.0.0");
+IPv4Locator IPv4Locator::LOCALHOST  = IPv4Locator::fromString("127.0.0.1");
+IPv4Locator IPv4Locator::BROADCAST  = IPv4Locator::fromString("255.255.255.255");
+
+IPv4Locator::IPv4Locator() {
+	this->port = 0;
+}
+
+IPv4Locator::~IPv4Locator() {
+}
+
+bool IPv4Locator::operator==(const NetworkLocator& rh) const {
+
+	IPv4Locator* ipv4Rh = dynamic_cast<IPv4Locator*>(const_cast<NetworkLocator*>(&rh));
+	if( ipv4Rh == NULL ) return false;
+
+	return (this->ipv4Address == ipv4Rh->ipv4Address) /*&& (this->port == ipv4Rh->port)*/;
+}
+
+bool IPv4Locator::operator!=(const NetworkLocator& rh) const {
+	return (!operator==(rh));
+}
+
+IPv4Locator IPv4Locator::fromString(string addr){
+
+	IPv4Locator locator;
+	string::size_type p = addr.find(':');
+
+	string port = "";
+	if (p != string::npos) {
+		port = addr.substr(p+1);
+		addr = addr.substr(0,p);
+		std::istringstream i(port);
+		i >> locator.port;
+	}
+	locator.ipv4Address = boost::asio::ip::address_v4::from_string( addr );
+
+	return locator;
+}
+
+string IPv4Locator::toString() const {
+	std::ostringstream o;
+	o << ipv4Address.to_string();
+	if (port!=0) o << ":" << port;
+	return o.str();
+}
+
+IPv4Locator::IPv4Locator(const IPv4Locator& rh) : ipv4Address(rh.ipv4Address), port(rh.port){
+}
+
+}} // namespace ariba, communication
Index: /source/ariba/communication/modules/network/ip/IPv4Locator.h
===================================================================
--- /source/ariba/communication/modules/network/ip/IPv4Locator.h	(revision 2378)
+++ /source/ariba/communication/modules/network/ip/IPv4Locator.h	(revision 2378)
@@ -0,0 +1,105 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef IPV4LOCATOR_H_
+#define IPV4LOCATOR_H_
+
+#include <string>
+
+#include "ariba/communication/modules/network/NetworkLocator.h"
+#include <boost/asio/ip/address_v4.hpp>
+
+using std::string;
+using ariba::communication::NetworkLocator;
+
+namespace ariba {
+namespace communication {
+
+/**
+ * An address class for IPv4 locators (= addresses).
+ *
+ * This class handles IPv4 locators only.
+ *
+ */
+class IPv4Locator: public NetworkLocator {
+	VSERIALIZEABLE;
+public:
+	/** Constructor initializing the address to the one given in string representation. */
+	IPv4Locator();
+	IPv4Locator(const IPv4Locator& rh);
+
+	static IPv4Locator LOCALHOST;
+	static IPv4Locator ANY;
+	static IPv4Locator BROADCAST;
+
+	virtual bool operator==(const NetworkLocator& rh) const;
+	virtual bool operator!=(const NetworkLocator& rh) const;
+
+	/** Default destructor. */
+	virtual ~IPv4Locator();
+
+	static IPv4Locator fromString(string addr);
+	virtual string toString() const;
+
+	string getIP() const {
+		return ipv4Address.to_string();
+	}
+
+	void setPort( uint16_t port ) {
+		this->port = port;
+	}
+
+	uint16_t getPort() const {
+		return this->port;
+	}
+private:
+	boost::asio::ip::address_v4 ipv4Address;
+	uint16_t port;
+
+};
+
+}} // namespace ariba, communication
+
+sznBeginDefault( ariba::communication::IPv4Locator, X ) {
+	boost::asio::ip::address_v4::bytes_type buffer = ipv4Address.to_bytes();
+	for (int i=0; i<4; i++) X && buffer[i];
+	if (X.isDeserializer()) ipv4Address = boost::asio::ip::address_v4(buffer);
+	X && port;
+} sznEnd();
+
+#endif /* IPV4LOCATOR_H_ */
Index: /source/ariba/communication/modules/network/ip/IPv4NetworkProtocol.cpp
===================================================================
--- /source/ariba/communication/modules/network/ip/IPv4NetworkProtocol.cpp	(revision 2378)
+++ /source/ariba/communication/modules/network/ip/IPv4NetworkProtocol.cpp	(revision 2378)
@@ -0,0 +1,80 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "IPv4NetworkProtocol.h"
+
+namespace ariba {
+namespace communication {
+
+IPv4NetworkProtocol::IPv4NetworkProtocol(){
+}
+
+IPv4NetworkProtocol::~IPv4NetworkProtocol(){
+}
+
+const NetworkProtocol::NetworkLocatorSet IPv4NetworkProtocol::getAddresses() const{
+
+	NetworkProtocol::NetworkLocatorSet interfaces;
+
+	struct ifaddrs* ifaceBuffer = NULL;
+	struct ifaddrs* tmpAddr     = NULL;
+	void*           tmpAddrPtr  = NULL;
+	char            straddr     [INET_ADDRSTRLEN];
+
+	int ret = getifaddrs( &ifaceBuffer );
+	if( ret != 0 ) return interfaces;
+
+	for( struct ifaddrs* i=ifaceBuffer; i != NULL; i=i->ifa_next ){
+
+		// ignore devices that are disabled or have no ip
+		if(i == NULL || i->ifa_addr == NULL) continue;
+
+		// only look at IPv4, not IPv6 addresses
+		if(i->ifa_addr->sa_family != AF_INET) continue;
+
+		tmpAddrPtr= &((struct sockaddr_in*)i->ifa_addr)->sin_addr;
+		inet_ntop( i->ifa_addr->sa_family, tmpAddrPtr, straddr, sizeof(straddr) );
+
+		IPv4Locator* iplocator = new IPv4Locator(IPv4Locator::fromString(straddr));
+		interfaces.push_back( iplocator );
+	}
+
+	return interfaces;
+}
+
+}} // namespace ariba, communication
Index: /source/ariba/communication/modules/network/ip/IPv4NetworkProtocol.h
===================================================================
--- /source/ariba/communication/modules/network/ip/IPv4NetworkProtocol.h	(revision 2378)
+++ /source/ariba/communication/modules/network/ip/IPv4NetworkProtocol.h	(revision 2378)
@@ -0,0 +1,71 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef IPV4_NETWORK_PROTOCOL_H__
+#define IPV4_NETWORK_PROTOCOL_H__
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <net/if.h>
+#include <ifaddrs.h>
+
+#include "ariba/communication/modules/network/ip/IPv4Locator.h"
+#include "ariba/communication/modules/network/NetworkProtocol.h"
+#include "ariba/communication/modules/network/NetworkLocator.h"
+
+using ariba::communication::IPv4Locator;
+using ariba::communication::NetworkProtocol;
+using ariba::communication::NetworkLocator;
+
+namespace ariba {
+namespace communication {
+
+class IPv4NetworkProtocol : public NetworkProtocol{
+public:
+	IPv4NetworkProtocol();
+	virtual ~IPv4NetworkProtocol();
+
+	virtual const NetworkProtocol::NetworkLocatorSet getAddresses() const;
+
+};
+
+}} // namespace ariba, communication
+
+#endif // IPV4_NETWORK_PROTOCOL_H__
Index: /source/ariba/communication/modules/network/omnet/OmnetNetworkProtocol.cpp
===================================================================
--- /source/ariba/communication/modules/network/omnet/OmnetNetworkProtocol.cpp	(revision 2378)
+++ /source/ariba/communication/modules/network/omnet/OmnetNetworkProtocol.cpp	(revision 2378)
@@ -0,0 +1,81 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "OmnetNetworkProtocol.h"
+
+namespace ariba {
+namespace communication {
+
+OmnetNetworkProtocol::OmnetNetworkProtocol(cSimpleModule* _module) : module(_module) {
+}
+
+OmnetNetworkProtocol::~OmnetNetworkProtocol(){
+}
+
+const NetworkProtocol::NetworkLocatorSet OmnetNetworkProtocol::getAddresses() const{
+
+	NetworkProtocol::NetworkLocatorSet interfaces;
+	InterfaceTable* table = NULL;
+
+	for( cModule* mod = module; mod->parentModule() != NULL; mod = mod->parentModule() ){
+		cModule* rtmod = mod->submodule("interfaceTable");
+		if( rtmod == NULL) continue;
+
+ 		InterfaceTable* rt = dynamic_cast<InterfaceTable*>(rtmod);
+		if( rt == NULL ) continue;
+
+		table = rt;
+		break;
+	}
+
+	if( table == NULL ) return interfaces;
+
+	for( int i=0; i<table->numInterfaces(); i++ ){
+		InterfaceEntry* entry = table->interfaceAt( i );
+		IPv4InterfaceData* v4 = entry->ipv4();
+		IPAddress address = v4->inetAddress();
+		if( address.isUnspecified() ) continue;
+
+		IPv4Locator* iplocator = new IPv4Locator( IPv4Locator::fromString(address.str()) );
+		interfaces.push_back( iplocator );
+	}
+
+	return interfaces;
+}
+
+}} // namespace ariba, communication, internal
Index: /source/ariba/communication/modules/network/omnet/OmnetNetworkProtocol.h
===================================================================
--- /source/ariba/communication/modules/network/omnet/OmnetNetworkProtocol.h	(revision 2378)
+++ /source/ariba/communication/modules/network/omnet/OmnetNetworkProtocol.h	(revision 2378)
@@ -0,0 +1,72 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef __OMNET_NETWORK_PROTOCOL_H
+#define __OMNET_NETWORK_PROTOCOL_H
+
+#include "ariba/communication/modules/network/ip/IPv4Locator.h"
+#include "ariba/communication/modules/network/NetworkProtocol.h"
+#include "ariba/communication/modules/network/NetworkLocator.h"
+#include <iostream>
+#include <omnetpp.h>
+#include <InterfaceTable.h>
+#include <IPv4InterfaceData.h>
+#include <IPAddress.h>
+
+using std::cout;
+using ariba::communication::IPv4Locator;
+using ariba::communication::NetworkProtocol;
+using ariba::communication::NetworkLocator;
+
+namespace ariba {
+namespace communication {
+
+class OmnetNetworkProtocol : public NetworkProtocol{
+public:
+	OmnetNetworkProtocol( cSimpleModule* _module );
+	virtual ~OmnetNetworkProtocol();
+
+	virtual const NetworkProtocol::NetworkLocatorSet getAddresses() const;
+
+protected:
+	cSimpleModule* module;
+};
+
+}} // namespace ariba, communication, internal
+
+#endif // __OMNET_NETWORK_PROTOCOL_H
Index: /source/ariba/communication/modules/transport/TransportLocator.cpp
===================================================================
--- /source/ariba/communication/modules/transport/TransportLocator.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/TransportLocator.cpp	(revision 2378)
@@ -0,0 +1,49 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "TransportLocator.h"
+
+NAMESPACE_BEGIN;
+
+TransportLocator::TransportLocator() {
+}
+
+TransportLocator::~TransportLocator() {
+}
+
+NAMESPACE_END;
Index: /source/ariba/communication/modules/transport/TransportLocator.h
===================================================================
--- /source/ariba/communication/modules/transport/TransportLocator.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/TransportLocator.h	(revision 2378)
@@ -0,0 +1,82 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef TRANSPORTLOCATOR_H_
+#define TRANSPORTLOCATOR_H_
+
+#include <vector>
+#include "boost/cstdint.hpp"
+#include "ariba/utility/types/Locator.h"
+#include "../network/NetworkLocator.h"
+
+using ariba::utility::Locator;
+using std::vector;
+
+#include "ariba/communication/modules/_namespace.h"
+NAMESPACE_BEGIN;
+
+class TransportLocator : public Locator {
+public:
+	typedef uint16_t prot_t;
+
+private:
+	prot_t type;
+	vector<NetworkLocator*> netLocators;
+
+public:
+	TransportLocator();
+	virtual ~TransportLocator();
+
+	inline prot_t getType() const {
+		return type;
+	}
+
+	inline void setType( prot_t type ) {
+		this->type = type;
+	}
+
+	inline const vector<NetworkLocator*> getNetworkLocators() const {
+		return netLocators;
+	}
+
+	virtual bool operator==( TransportLocator* locator ) const = 0;
+};
+
+NAMESPACE_END;
+
+#endif /* TRANSPORTLOCATOR_H_ */
Index: /source/ariba/communication/modules/transport/TransportProtocol.cpp
===================================================================
--- /source/ariba/communication/modules/transport/TransportProtocol.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/TransportProtocol.cpp	(revision 2378)
@@ -0,0 +1,50 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "TransportProtocol.h"
+
+#include "../_namespace.h"
+NAMESPACE_BEGIN;
+
+TransportProtocol::TransportProtocol() {
+}
+
+TransportProtocol::~TransportProtocol() {
+}
+
+NAMESPACE_END;
Index: /source/ariba/communication/modules/transport/TransportProtocol.h
===================================================================
--- /source/ariba/communication/modules/transport/TransportProtocol.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/TransportProtocol.h	(revision 2378)
@@ -0,0 +1,67 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef TRANSPORTPROTOCOL_H_
+#define TRANSPORTPROTOCOL_H_
+
+#include <vector>
+#include "TransportLocator.h"
+#include "ariba/utility/messages.h"
+
+#include "ariba/communication/modules/_namespace.h"
+NAMESPACE_BEGIN;
+
+using std::vector;
+using ariba::utility::MessageSender;
+using ariba::utility::MessageProvider;
+
+class TransportProtocol : public MessageSender, public MessageProvider {
+public:
+	TransportProtocol();
+	virtual ~TransportProtocol();
+
+	virtual void start() = 0;
+	virtual void stop() = 0;
+	virtual void terminate(const NetworkLocator* local, const NetworkLocator* remote) = 0;
+	virtual TransportLocator::prot_t getId() = 0;
+	virtual const vector<TransportLocator*> getLocators() = 0;
+};
+
+NAMESPACE_END;
+
+#endif /* TRANSPORTPROTOCOL_H_ */
Index: /source/ariba/communication/modules/transport/omnet/AribaOmnetMessage.msg
===================================================================
--- /source/ariba/communication/modules/transport/omnet/AribaOmnetMessage.msg	(revision 2378)
+++ /source/ariba/communication/modules/transport/omnet/AribaOmnetMessage.msg	(revision 2378)
@@ -0,0 +1,44 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+message AribaOmnetMessage
+{
+	fields:
+		unsigned int port;
+		unsigned char data[];
+}
Index: /source/ariba/communication/modules/transport/omnet/AribaOmnetMessage_m.cc
===================================================================
--- /source/ariba/communication/modules/transport/omnet/AribaOmnetMessage_m.cc	(revision 2378)
+++ /source/ariba/communication/modules/transport/omnet/AribaOmnetMessage_m.cc	(revision 2378)
@@ -0,0 +1,351 @@
+//
+// Generated file, do not edit! Created by opp_msgc 3.4 from ./AribaOmnetMessage.msg.
+//
+
+// Disable warnings about unused variables, empty switch stmts, etc:
+#ifdef _MSC_VER
+#  pragma warning(disable:4101)
+#  pragma warning(disable:4065)
+#endif
+
+#include <iostream>
+#include <sstream>
+#include "./AribaOmnetMessage_m.h"
+
+// Template rule which fires if a struct or class doesn't have operator<<
+template<typename T>
+std::ostream& operator<<(std::ostream& out,const T&) {return out;}
+
+// Another default rule (prevents compiler from choosing base class' doPacking())
+template<typename T>
+void doPacking(cCommBuffer *, T& t) {
+    throw new cRuntimeError("Parsim error: no doPacking() function for type %s or its base class (check .msg and _m.cc/h files!)",opp_typename(typeid(t)));
+}
+template<typename T>
+void doUnpacking(cCommBuffer *, T& t) {
+    throw new cRuntimeError("Parsim error: no doUnpacking() function for type %s or its base class (check .msg and _m.cc/h files!)",opp_typename(typeid(t)));
+}
+
+// Automatically supply array (un)packing functions
+template<typename T>
+void doPacking(cCommBuffer *b, T *t, int n) {
+    for (int i=0; i<n; i++)
+        doPacking(b,t[i]);
+}
+template<typename T>
+void doUnpacking(cCommBuffer *b, T *t, int n) {
+    for (int i=0; i<n; i++)
+        doUnpacking(b,t[i]);
+}
+inline void doPacking(cCommBuffer *, cPolymorphic&) {}
+inline void doUnpacking(cCommBuffer *, cPolymorphic&) {}
+
+#define DOPACKING(T,R) \
+    inline void doPacking(cCommBuffer *b, T R a) {b->pack(a);}  \
+    inline void doPacking(cCommBuffer *b, T *a, int n) {b->pack(a,n);}  \
+    inline void doUnpacking(cCommBuffer *b, T& a) {b->unpack(a);}  \
+    inline void doUnpacking(cCommBuffer *b, T *a, int n) {b->unpack(a,n);}
+#define _
+DOPACKING(char,_)
+DOPACKING(unsigned char,_)
+DOPACKING(bool,_)
+DOPACKING(short,_)
+DOPACKING(unsigned short,_)
+DOPACKING(int,_)
+DOPACKING(unsigned int,_)
+DOPACKING(long,_)
+DOPACKING(unsigned long,_)
+DOPACKING(float,_)
+DOPACKING(double,_)
+DOPACKING(long double,_)
+DOPACKING(char *,_)
+DOPACKING(const char *,_)
+DOPACKING(opp_string,&)
+//DOPACKING(std::string,&)
+#undef _
+#undef DOPACKING
+
+
+Register_Class(AribaOmnetMessage);
+
+AribaOmnetMessage::AribaOmnetMessage(const char *name, int kind) : cMessage(name,kind)
+{
+    unsigned int i;
+    this->port_var = 0;
+    data_arraysize = 0;
+    this->data_var = 0;
+}
+
+AribaOmnetMessage::AribaOmnetMessage(const AribaOmnetMessage& other) : cMessage()
+{
+    unsigned int i;
+    setName(other.name());
+    data_arraysize = 0;
+    this->data_var = 0;
+    operator=(other);
+}
+
+AribaOmnetMessage::~AribaOmnetMessage()
+{
+    unsigned int i;
+    delete [] data_var;
+}
+
+AribaOmnetMessage& AribaOmnetMessage::operator=(const AribaOmnetMessage& other)
+{
+    if (this==&other) return *this;
+    unsigned int i;
+    cMessage::operator=(other);
+    this->port_var = other.port_var;
+    delete [] this->data_var;
+    this->data_var = (other.data_arraysize==0) ? NULL : new unsigned char[other.data_arraysize];
+    data_arraysize = other.data_arraysize;
+    for (i=0; i<data_arraysize; i++)
+        this->data_var[i] = other.data_var[i];
+    return *this;
+}
+
+void AribaOmnetMessage::netPack(cCommBuffer *b)
+{
+    cMessage::netPack(b);
+    doPacking(b,this->port_var);
+    b->pack(data_arraysize);
+    doPacking(b,this->data_var,data_arraysize);
+}
+
+void AribaOmnetMessage::netUnpack(cCommBuffer *b)
+{
+    cMessage::netUnpack(b);
+    doUnpacking(b,this->port_var);
+    delete [] this->data_var;
+    b->unpack(data_arraysize);
+    if (data_arraysize==0) {
+        this->data_var = 0;
+    } else {
+        this->data_var = new unsigned char[data_arraysize];
+        doUnpacking(b,this->data_var,data_arraysize);
+    }
+}
+
+unsigned int AribaOmnetMessage::getPort() const
+{
+    return port_var;
+}
+
+void AribaOmnetMessage::setPort(unsigned int port_var)
+{
+    this->port_var = port_var;
+}
+
+void AribaOmnetMessage::setDataArraySize(unsigned int size)
+{
+    unsigned char *data_var2 = (size==0) ? NULL : new unsigned char[size];
+    unsigned int sz = data_arraysize < size ? data_arraysize : size;
+    unsigned int i;
+    for (i=0; i<sz; i++)
+        data_var2[i] = this->data_var[i];
+    for (i=sz; i<size; i++)
+        data_var2[i] = 0;
+    data_arraysize = size;
+    delete [] this->data_var;
+    this->data_var = data_var2;
+}
+
+unsigned int AribaOmnetMessage::getDataArraySize() const
+{
+    return data_arraysize;
+}
+
+unsigned char AribaOmnetMessage::getData(unsigned int k) const
+{
+    if (k>=data_arraysize) throw new cRuntimeError("Array of size %d indexed by %d", data_arraysize, k);
+    return data_var[k];
+}
+
+void AribaOmnetMessage::setData(unsigned int k, unsigned char data_var)
+{
+    if (k>=data_arraysize) throw new cRuntimeError("Array of size %d indexed by %d", data_arraysize, k);
+    this->data_var[k]=data_var;
+}
+
+class AribaOmnetMessageDescriptor : public cClassDescriptor
+{
+  public:
+    AribaOmnetMessageDescriptor();
+    virtual ~AribaOmnetMessageDescriptor();
+
+    virtual bool doesSupport(cPolymorphic *obj);
+    virtual const char *getProperty(const char *propertyname);
+    virtual int getFieldCount(void *object);
+    virtual const char *getFieldName(void *object, int field);
+    virtual unsigned int getFieldTypeFlags(void *object, int field);
+    virtual const char *getFieldTypeString(void *object, int field);
+    virtual const char *getFieldProperty(void *object, int field, const char *propertyname);
+    virtual int getArraySize(void *object, int field);
+
+    virtual bool getFieldAsString(void *object, int field, int i, char *resultbuf, int bufsize);
+    virtual bool setFieldAsString(void *object, int field, int i, const char *value);
+
+    virtual const char *getFieldStructName(void *object, int field);
+    virtual void *getFieldStructPointer(void *object, int field, int i);
+};
+
+Register_ClassDescriptor(AribaOmnetMessageDescriptor);
+
+AribaOmnetMessageDescriptor::AribaOmnetMessageDescriptor() : cClassDescriptor("AribaOmnetMessage", "cMessage")
+{
+}
+
+AribaOmnetMessageDescriptor::~AribaOmnetMessageDescriptor()
+{
+}
+
+bool AribaOmnetMessageDescriptor::doesSupport(cPolymorphic *obj)
+{
+    return dynamic_cast<AribaOmnetMessage *>(obj)!=NULL;
+}
+
+const char *AribaOmnetMessageDescriptor::getProperty(const char *propertyname)
+{
+    cClassDescriptor *basedesc = getBaseClassDescriptor();
+    return basedesc ? basedesc->getProperty(propertyname) : NULL;
+}
+
+int AribaOmnetMessageDescriptor::getFieldCount(void *object)
+{
+    cClassDescriptor *basedesc = getBaseClassDescriptor();
+    return basedesc ? 2+basedesc->getFieldCount(object) : 2;
+}
+
+unsigned int AribaOmnetMessageDescriptor::getFieldTypeFlags(void *object, int field)
+{
+    cClassDescriptor *basedesc = getBaseClassDescriptor();
+    if (basedesc) {
+        if (field < basedesc->getFieldCount(object))
+            return basedesc->getFieldTypeFlags(object, field);
+        field -= basedesc->getFieldCount(object);
+    }
+    switch (field) {
+        case 0: return FD_ISEDITABLE;
+        case 1: return FD_ISARRAY | FD_ISEDITABLE;
+        default: return 0;
+    }
+}
+
+const char *AribaOmnetMessageDescriptor::getFieldName(void *object, int field)
+{
+    cClassDescriptor *basedesc = getBaseClassDescriptor();
+    if (basedesc) {
+        if (field < basedesc->getFieldCount(object))
+            return basedesc->getFieldName(object, field);
+        field -= basedesc->getFieldCount(object);
+    }
+    switch (field) {
+        case 0: return "port";
+        case 1: return "data";
+        default: return NULL;
+    }
+}
+
+const char *AribaOmnetMessageDescriptor::getFieldTypeString(void *object, int field)
+{
+    cClassDescriptor *basedesc = getBaseClassDescriptor();
+    if (basedesc) {
+        if (field < basedesc->getFieldCount(object))
+            return basedesc->getFieldTypeString(object, field);
+        field -= basedesc->getFieldCount(object);
+    }
+    switch (field) {
+        case 0: return "unsigned int";
+        case 1: return "unsigned char";
+        default: return NULL;
+    }
+}
+
+const char *AribaOmnetMessageDescriptor::getFieldProperty(void *object, int field, const char *propertyname)
+{
+    cClassDescriptor *basedesc = getBaseClassDescriptor();
+    if (basedesc) {
+        if (field < basedesc->getFieldCount(object))
+            return basedesc->getFieldProperty(object, field, propertyname);
+        field -= basedesc->getFieldCount(object);
+    }
+    switch (field) {
+        default: return NULL;
+    }
+}
+
+int AribaOmnetMessageDescriptor::getArraySize(void *object, int field)
+{
+    cClassDescriptor *basedesc = getBaseClassDescriptor();
+    if (basedesc) {
+        if (field < basedesc->getFieldCount(object))
+            return basedesc->getArraySize(object, field);
+        field -= basedesc->getFieldCount(object);
+    }
+    AribaOmnetMessage *pp _MAYBEUNUSED = (AribaOmnetMessage *)object;
+    switch (field) {
+        case 1: return pp->getDataArraySize();
+        default: return 0;
+    }
+}
+
+bool AribaOmnetMessageDescriptor::getFieldAsString(void *object, int field, int i, char *resultbuf, int bufsize)
+{
+    cClassDescriptor *basedesc = getBaseClassDescriptor();
+    if (basedesc) {
+        if (field < basedesc->getFieldCount(object))
+            return basedesc->getFieldAsString(object,field,i,resultbuf,bufsize);
+        field -= basedesc->getFieldCount(object);
+    }
+    AribaOmnetMessage *pp _MAYBEUNUSED = (AribaOmnetMessage *)object;
+    switch (field) {
+        case 0: long2string(pp->getPort(),resultbuf,bufsize); return true;
+        case 1: long2string(pp->getData(i),resultbuf,bufsize); return true;
+        default: return false;
+    }
+}
+
+bool AribaOmnetMessageDescriptor::setFieldAsString(void *object, int field, int i, const char *value)
+{
+    cClassDescriptor *basedesc = getBaseClassDescriptor();
+    if (basedesc) {
+        if (field < basedesc->getFieldCount(object))
+            return basedesc->setFieldAsString(object,field,i,value);
+        field -= basedesc->getFieldCount(object);
+    }
+    AribaOmnetMessage *pp _MAYBEUNUSED = (AribaOmnetMessage *)object;
+    switch (field) {
+        case 0: pp->setPort(string2long(value)); return true;
+        case 1: pp->setData(i,string2long(value)); return true;
+        default: return false;
+    }
+}
+
+const char *AribaOmnetMessageDescriptor::getFieldStructName(void *object, int field)
+{
+    cClassDescriptor *basedesc = getBaseClassDescriptor();
+    if (basedesc) {
+        if (field < basedesc->getFieldCount(object))
+            return basedesc->getFieldStructName(object, field);
+        field -= basedesc->getFieldCount(object);
+    }
+    switch (field) {
+        default: return NULL;
+    }
+}
+
+void *AribaOmnetMessageDescriptor::getFieldStructPointer(void *object, int field, int i)
+{
+    cClassDescriptor *basedesc = getBaseClassDescriptor();
+    if (basedesc) {
+        if (field < basedesc->getFieldCount(object))
+            return basedesc->getFieldStructPointer(object, field, i);
+        field -= basedesc->getFieldCount(object);
+    }
+    AribaOmnetMessage *pp _MAYBEUNUSED = (AribaOmnetMessage *)object;
+    switch (field) {
+        default: return NULL;
+    }
+}
+
Index: /source/ariba/communication/modules/transport/omnet/AribaOmnetMessage_m.h
===================================================================
--- /source/ariba/communication/modules/transport/omnet/AribaOmnetMessage_m.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/omnet/AribaOmnetMessage_m.h	(revision 2378)
@@ -0,0 +1,59 @@
+//
+// Generated file, do not edit! Created by opp_msgc 3.4 from ./SpoVNetOmnetMessage.msg.
+//
+
+#ifndef _ARIBAOMNETMESSAGE_M_H_
+#define _ARIBAOMNETMESSAGE_M_H_
+
+#include <omnetpp.h>
+
+// opp_msgc version check
+#define MSGC_VERSION 0x0304
+#if (MSGC_VERSION!=OMNETPP_VERSION)
+#    error Version mismatch! Probably this file was generated by an earlier version of opp_msgc: 'make clean' should help.
+#endif
+
+
+/**
+ * Class generated from <tt>./AribaOmnetMessage.msg</tt> by opp_msgc.
+ * <pre>
+ * message AribaOmnetMessage
+ * {
+ * 	fields:
+ * 		unsigned int port;
+ * 		unsigned char data[];
+ * }
+ * </pre>
+ */
+class AribaOmnetMessage : public cMessage
+{
+  protected:
+    unsigned int port_var;
+    unsigned char *data_var; // array ptr
+    unsigned int data_arraysize;
+
+    // protected and unimplemented operator==(), to prevent accidental usage
+    bool operator==(const AribaOmnetMessage&);
+
+  public:
+    AribaOmnetMessage(const char *name=NULL, int kind=0);
+    AribaOmnetMessage(const AribaOmnetMessage& other);
+    virtual ~AribaOmnetMessage();
+    AribaOmnetMessage& operator=(const AribaOmnetMessage& other);
+    virtual cPolymorphic *dup() const {return new AribaOmnetMessage(*this);}
+    virtual void netPack(cCommBuffer *b);
+    virtual void netUnpack(cCommBuffer *b);
+
+    // field getter/setter methods
+    virtual unsigned int getPort() const;
+    virtual void setPort(unsigned int port_var);
+    virtual void setDataArraySize(unsigned int size);
+    virtual unsigned int getDataArraySize() const;
+    virtual unsigned char getData(unsigned int k) const;
+    virtual void setData(unsigned int k, unsigned char data_var);
+};
+
+inline void doPacking(cCommBuffer *b, AribaOmnetMessage& obj) {obj.netPack(b);}
+inline void doUnpacking(cCommBuffer *b, AribaOmnetMessage& obj) {obj.netUnpack(b);}
+
+#endif // _ARIBAOMNETMESSAGE_M_H_
Index: /source/ariba/communication/modules/transport/omnet/AribaOmnetModule.cpp
===================================================================
--- /source/ariba/communication/modules/transport/omnet/AribaOmnetModule.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/omnet/AribaOmnetModule.cpp	(revision 2378)
@@ -0,0 +1,322 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "AribaOmnetModule.h"
+
+#include "ariba/utility/system/StartupWrapper.h" // circular inclusion
+#include "ariba/interface/ServiceInterface.h"
+using ariba::utility::StartupWrapper;
+using ariba::interface::ServiceInterface;
+
+namespace ariba {
+namespace communication {
+
+use_logging_cpp( AribaOmnetModule );
+
+AribaOmnetModule::AribaOmnetModule(){
+}
+
+AribaOmnetModule::~AribaOmnetModule(){
+}
+
+void AribaOmnetModule::setServerPort(uint16_t _port){
+	serverPort = _port;
+}
+
+void AribaOmnetModule::start(){
+
+	//ostringstream o;
+	//o << (void*)this;
+	//cout << "AribaOmnetModule " + o.str() + " start" << std::endl;
+
+	Enter_Method_Silent();
+
+ 	serverSocket.setCallbackObject(this);
+    	serverSocket.setOutputGate(gate("tcpOut"));
+	serverSocket.bind( IPvXAddress(), serverPort );
+	serverSocket.listen();
+
+	logging_debug( cModule::fullPath() << "listening on server socket" );
+}
+
+void AribaOmnetModule::stop(){
+
+	Enter_Method_Silent();
+
+	logging_debug( "stopping module " << cModule::fullPath() );
+
+	SocketMap::iterator i = sockets.begin();
+	SocketMap::iterator iend = sockets.end();
+
+	for( ; i != iend; i++ )
+		i->second->close();
+
+	serverSocket.close();
+}
+
+TransportLocator::prot_t AribaOmnetModule::getId(){
+	return 6; // TCP
+}
+
+const vector<TransportLocator*> AribaOmnetModule::getLocators(){
+	return vector<TransportLocator*>();
+}
+
+int AribaOmnetModule::numInitStages() const {
+	// the FlatNetworkConfiguration distributes the IP address in stage 3
+	// so to get the assigned IP address we init in stage 4 :)
+	return 4;
+}
+
+void AribaOmnetModule::initialize(int stage){
+	if( stage != 3 ) return;
+
+	StartupWrapper::initSystem();
+	StartupWrapper::initConfig( par("configfile").stringValue() );
+
+	StartupWrapper::insertCurrentModule( this );
+
+	logging_debug( "initializing " << cModule::fullPath() );
+	logging_debug( "AribaOmnetModule " << (void*)this << " initialize" );
+
+	StartupInterface* service = NULL;
+	cModuleType* type = findModuleType( ARIBA_SIMULATION_MODULE );
+
+	if( type != NULL ) {
+		logging_debug( "found module type ... creating ..." );
+		service = (StartupInterface*)type->create( ARIBA_SIMULATION_MODULE, this );
+	} else {
+		logging_fatal( "module type not found " << ARIBA_SIMULATION_MODULE );
+	}
+
+	if( service == NULL ){
+		logging_fatal( "no service defined for simulation. " <<
+				"service not loaded using load-libs in omnetpp.ini, " <<
+				" or ARIBA_SIMULATION_SERVICE() not used" );
+	} else {
+		StartupWrapper::startup( service );
+	}
+}
+
+void AribaOmnetModule::handleMessage(cMessage* msg){
+
+	logging_debug( cModule::fullPath() << " handling message" );
+	bool socketfound = false;
+
+	SocketMap::iterator i = sockets.begin();
+	SocketMap::iterator iend = sockets.end();
+
+	for( ; i != iend; i++ ){
+		if( i->second->belongsToSocket( msg )){
+			i->second->processMessage( msg );
+			socketfound = true;
+
+			logging_debug( cModule::fullPath() << " found socket for message" );
+			break;
+		}
+	}
+
+	if( ! socketfound ) {
+
+		logging_debug( cModule::fullPath() << " creating new socket for message" );
+
+		TCPSocket* dispatch = new TCPSocket( msg );
+		dispatch->setCallbackObject( this, dispatch );
+		dispatch->setOutputGate(gate("tcpOut"));
+
+		ostringstream o;
+		o << dispatch->remoteAddress().str() << ":" << dispatch->remotePort();
+
+		sockets.insert( make_pair(o.str(), dispatch) );
+		dispatch->processMessage( msg );
+	}
+}
+
+void AribaOmnetModule::finish(){
+	StartupWrapper::shutdown();
+}
+
+seqnum_t AribaOmnetModule::sendMessage(const Message* message){
+
+	Enter_Method_Silent();
+	logging_debug( cModule::fullPath() << " sending message" );
+
+	//
+	// serialize the data, get the destination address
+	//
+
+	Data data = data_serialize( message );
+	const_cast<Message*>(message)->dropPayload();
+
+	const IPv4Locator* address = dynamic_cast<const IPv4Locator*>(message->getDestinationAddress());
+	if( address == NULL ) return 0;
+
+	size_t len = data.getLength()/8;
+	uint8_t* buffer = data.getBuffer();
+
+	AribaOmnetMessage* outmsg = new AribaOmnetMessage( "AribaOmnetMessage");
+	outmsg->setPort( serverPort );
+	outmsg->setDataArraySize( len );
+	outmsg->setByteLength( len );
+
+	for( size_t i=0; i<len; i++, buffer++)
+		outmsg->setData(i, *buffer);
+
+	//
+	// find the socket for this endpoint
+	//
+
+	SocketMap::iterator i = sockets.find( address->toString() );
+	TCPSocket* connectionSocket = NULL;
+
+	if( i == sockets.end() ){
+
+		logging_debug( cModule::fullPath() <<
+			" creating new socket, connecting and queueing message" );
+
+		// don't have no connection yet for this endpoint
+		// initiate a connection and remember the message for later sending ...
+
+		SocketMap::iterator ret = sockets.insert(
+					make_pair(address->toString(), new TCPSocket()) );
+		connectionSocket = ret->second;
+
+		connectionSocket->setCallbackObject( this, connectionSocket );
+		connectionSocket->setOutputGate(gate("tcpOut"));
+
+		pendingSends.insert( make_pair(connectionSocket, outmsg) );
+		connectionSocket->connect( address->getIP().c_str(), address->getPort() );
+
+	} else {
+
+		logging_debug( cModule::fullPath() << " found socket, just sending out message" );
+		connectionSocket = i->second;
+		connectionSocket->send( outmsg );
+	}
+
+	//
+	// release the data and we are out!
+	//
+
+	data.release();
+	return 0;
+}
+
+void AribaOmnetModule::socketDataArrived(int connId, void* socket, cMessage* msg, bool urgent){
+
+	TCPSocket* tcpsocket = (TCPSocket*)socket;
+
+	AribaOmnetMessage* encap = dynamic_cast<AribaOmnetMessage*>(msg);
+	if( encap == NULL ) return;
+
+	logging_debug( cModule::fullPath() << " socket data arrived " << msg->info() );
+
+	size_t len = encap->getDataArraySize();
+	Data data( len*8 );
+ 	uint8_t* pnt = data.getBuffer();
+
+	for( size_t i=0; i<len; i++, pnt++)
+		*pnt = encap->getData( i );
+
+	Message* spovnetmsg = new Message(data);
+
+	ostringstream o;
+	o << tcpsocket->remoteAddress().str() << ":" << encap->getPort();
+	spovnetmsg->setSourceAddress( new IPv4Locator(IPv4Locator::fromString(o.str())) );
+
+	logging_debug( cModule::fullPath() << " forwarding to base communication" );
+	MessageProvider::sendMessageToReceivers( spovnetmsg );
+
+	delete encap;
+}
+
+void AribaOmnetModule::socketFailure(int connId, void* socket, int code){
+	logging_warn( cModule::fullPath() << " socket failure " << code );
+}
+
+void AribaOmnetModule::socketClosed(int connId, void* socket){
+	logging_debug( cModule::fullPath() << " socket closed" );
+}
+
+void AribaOmnetModule::socketPeerClosed(int connId, void* socket){
+
+	logging_debug( cModule::fullPath() << " socket peer closed" );
+	TCPSocket* tcpsocket = (TCPSocket*)socket;
+
+	SocketMap::iterator i = sockets.begin();
+	SocketMap::iterator iend = sockets.end();
+
+	for( ; i != iend; i++ ){
+
+		if( i->second == tcpsocket ){
+			sockets.erase( i );
+			delete tcpsocket;
+			break;
+		}
+	}
+}
+
+void AribaOmnetModule::socketEstablished(int connId, void* socket){
+
+	logging_debug( cModule::fullPath() << " socket established" );
+
+	TCPSocket* tcpsocket = (TCPSocket*)socket;
+	assert( tcpsocket != NULL );
+
+	// if we have pending data for this socket
+	// we are on the client side and initiated the connection
+	// else, this is a dispatched socket on the server side
+
+	PendingSendQueue::iterator i = pendingSends.find( tcpsocket );
+	if( i != pendingSends.end() ){
+
+		logging_debug( cModule::fullPath() << " socket established ... scheduling send msg" );
+
+		tcpsocket->send( i->second );
+		pendingSends.erase( i );
+
+	} else {
+		logging_debug( cModule::fullPath() << " dispatch socket established ... server side" );
+	}
+}
+
+void AribaOmnetModule::socketStatusArrived(int connId, void* socket, TCPStatusInfo *status){
+	logging_debug( cModule::fullPath() << " socket status arrivede" );
+}
+
+}} // namespace ariba, communication, internal
Index: /source/ariba/communication/modules/transport/omnet/AribaOmnetModule.h
===================================================================
--- /source/ariba/communication/modules/transport/omnet/AribaOmnetModule.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/omnet/AribaOmnetModule.h	(revision 2378)
@@ -0,0 +1,150 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef ARIBA_OMNET_MODULE_H__
+#define ARIBA_OMNET_MODULE_H__
+
+#include "ariba/utility/types.h"
+#include "ariba/utility/messages.h"
+#include "ariba/utility/types/Address.h"
+#include "ariba/utility/misc/Helper.h"
+#include "ariba/utility/logging/Logging.h"
+#include "ariba/utility/serialization/DataStream.hpp"
+#include "ariba/communication/modules/transport/TransportProtocol.h"
+#include "ariba/communication/modules/transport/TransportLocator.h"
+#include "ariba/communication/modules/network/ip/IPv4Locator.h"
+#include "AribaOmnetMessage_m.h"
+#include <omnetpp.h>
+#include <INETDefs.h>
+#include <TCPSocket.h>
+#include <map>
+#include <iostream>
+#include <sstream>
+#include <vector>
+
+using std::vector;
+using std::ostringstream;
+using std::cout;
+using std::pair;
+using std::make_pair;
+using std::map;
+using std::multimap;
+using ariba::utility::seqnum_t;
+using ariba::utility::Message;
+using ariba::utility::Address;
+using ariba::utility::serialization::data_serialize;
+using ariba::communication::IPv4Locator;
+
+namespace ariba {
+namespace communication {
+
+class INET_API AribaOmnetModule : public cSimpleModule, public TransportProtocol, TCPSocket::CallbackInterface {
+
+	use_logging_h( AribaOmnetModule );
+
+public:
+	AribaOmnetModule();
+	virtual ~AribaOmnetModule();
+
+	void setServerPort(uint16_t _port);
+
+	/**
+	 * see TransportProtocol
+	 */
+	virtual void start();
+	virtual void stop();
+	virtual TransportLocator::prot_t getId();
+	virtual const vector<TransportLocator*> getLocators();
+	virtual seqnum_t sendMessage( const Message* message );
+
+	/**
+	 * see TCPSocket::CallbackInterface
+	 */
+	virtual void socketDataArrived( int connId, void* socket, cMessage* msg, bool urgent );
+	virtual void socketFailure( int connId, void* socket, int code );
+	virtual void socketClosed( int connId, void* socket );
+	virtual void socketPeerClosed( int connId, void* socket );
+	virtual void socketEstablished( int connId, void* socket );
+	virtual void socketStatusArrived( int connId, void* socket, TCPStatusInfo *status);
+
+protected:
+	/**
+	 * Called from Omnet++ on initialization of the simulation
+	 */
+	virtual void initialize(int stage);
+ 	virtual int numInitStages () const ;
+
+	/**
+	 * Called from Omnet++ during simulation:
+	 * called when the module receives a message
+	 */
+	virtual void handleMessage( cMessage* msg );
+
+	/** Called from Omnet++ during simulation:
+	 * called when the simulation terminates.
+	 * Can be used for writing statistics and the likes.
+	 */
+	virtual void finish();
+
+private:
+	/**
+	 * All our sockets to other nodes and the server socket
+	 */
+	TCPSocket serverSocket;
+	typedef multimap<string, TCPSocket*> SocketMap;
+	SocketMap sockets;
+	uint16_t serverPort;
+
+	/**
+	 * Pending data that we have to send when the socket
+	 * has been opened asynchronously
+	 */
+	typedef map<TCPSocket*, AribaOmnetMessage*> PendingSendQueue;
+	PendingSendQueue pendingSends;
+
+};
+
+//
+// The module class needs to be registered with OMNeT++
+//
+
+Define_Module( AribaOmnetModule );
+
+}} // namespace ariba, communication
+
+#endif // ARIBA_OMNET_MODULE_H__
Index: /source/ariba/communication/modules/transport/protlib/address.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/address.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/address.cpp	(revision 2378)
@@ -0,0 +1,1564 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file address.cpp
+/// GIST address objects
+/// ----------------------------------------------------------
+/// $Id: address.cpp 3046 2008-06-18 14:40:43Z hiwi-laier $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/address.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup ieaddress
+ * GIST address objects
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include "address.h"
+#include "threadsafe_db.h"
+#include "logfile.h"
+
+#include <net/if.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <ifaddrs.h>
+#include <iomanip>
+#include <netdb.h>
+
+namespace protlib {
+
+/** @addtogroup ieaddress Address Objects
+ * @{
+ */
+  using namespace log;
+/***** class address *****/
+
+/** Set subtype. */
+address::address(subtype_t st) 
+	: subtype(st) 
+{ 
+  //Log(DEBUG_LOG,LOG_NORMAL,"address","address constructor called for " << (void *) this); 
+}
+
+/** Log and throw a nomem_error */
+void address::throw_nomem_error() const {
+	try {
+	  ERRCLog("address", "Not enough memory for address");
+	} catch(...) {}
+	throw IEError(IEError::ERROR_NO_MEM);
+} // end throw_nomem_error
+
+
+/***** class hostaddress *****/
+
+/***** inherited from IE *****/
+
+hostaddress* hostaddress::new_instance() const {
+	hostaddress* ha = NULL;
+	catch_bad_alloc(ha = new hostaddress());
+	return ha;
+} // end new_instance
+
+hostaddress* hostaddress::copy() const {
+	hostaddress* ha = NULL;
+	catch_bad_alloc(ha =  new hostaddress(*this));
+	return ha;
+} // end copy 
+
+bool hostaddress::operator==(const address& ie) const {
+	const hostaddress* haddr = dynamic_cast<const hostaddress*>(&ie);
+	if (haddr) {
+#ifdef DEBUG_HARD
+	  Log(DEBUG_LOG,LOG_NORMAL,"hostaddress","::operator==()" << haddr->get_ip_str()<<"=="<<this->get_ip_str());
+	  if (!ipv4flag)
+	    Log(DEBUG_LOG,LOG_NORMAL,"hostaddress","::operator==(), v6=" << IN6_ARE_ADDR_EQUAL(ipv6addr.s6_addr, haddr->ipv6addr.s6_addr));
+#endif
+	  return ipv4flag ? (ipv4addr.s_addr==haddr->ipv4addr.s_addr) :
+	                    IN6_ARE_ADDR_EQUAL(ipv6addr.s6_addr, haddr->ipv6addr.s6_addr);
+	} else return false;
+} // end operator==
+
+/***** new in hostaddress *****/
+
+
+/** Initialize hostaddress from string if possible. */
+hostaddress::hostaddress(const char *str, bool *res) 
+	: address(IPv6HostAddress),
+	  ipv4flag(false), 
+	  outstring(NULL)
+{
+	register bool tmpres = false;
+	clear_ip();
+	tmpres = set_ip(str);
+	if (res) *res = tmpres;
+} // end string constructor hostaddress
+
+
+/** Set IPv4 from string or leave object unchanged.
+ * This changes object type to IPv4.
+ * @return true on success.
+ */
+bool 
+hostaddress::set_ipv4(const char *str) {
+	struct in_addr in;
+	if (str && (inet_pton(AF_INET,str,&in)>0)) {
+		set_ip(in);
+		return true;
+	} else return false;
+} // end set_ipv4
+
+/** Set IPv4 address from struct in_addr. 
+ * This changes object type to IPv4. 
+ */
+void hostaddress::set_ip(const struct in_addr &in) {
+	clear_ip();
+	ipv4addr = in;	
+	// set subtype to IPv4
+	set_subtype(true);
+	return;
+} // end set_ip(in_addr)
+
+/** Set IPv6 from string or leave object unchanged.
+ * This changes object type to IPv6.
+ * @return true on success.
+ */
+bool hostaddress::set_ipv6(const char *str) {
+	struct in6_addr in;
+	if (str && (inet_pton(AF_INET6,str,&in)>0)) {
+		set_ip(in);
+		return true;
+	} else return false;
+} // end set_ipv6	
+
+/** Set IPv6 address from struct in6_addr. 
+ * This changes object type to IPv6. 
+ */
+void 
+hostaddress::set_ip(const struct in6_addr &in) {
+	clear_ip();
+	ipv6addr = in;	
+	// set subtype to IPv6
+	set_subtype(false);
+	return;
+} // end set_ip(in6_addr)
+
+
+
+void hostaddress::set_ip(const hostaddress& h) {
+	clear_ip();
+	if (h.ipv4flag) {
+		ipv4addr = h.ipv4addr;
+	} else {
+		ipv6addr = h.ipv6addr;
+	} // end if ipv4flag
+	set_subtype(h.ipv4flag);
+} // end set_ip(hostaddress)
+
+/** Check if IP address is unspecified (set to 0). */
+bool hostaddress::is_ip_unspec() const {
+	if (ipv4flag) return (ipv4addr.s_addr==0);
+	else return IN6_IS_ADDR_UNSPECIFIED(ipv6addr.s6_addr);
+	// never reached
+	return true;
+} // end is_unspec
+
+/** Get IP address as a string. The output string is kept inside the
+ * hostaddress object and should be copied if used for a longer time.
+ */
+const char* hostaddress::get_ip_str() const 
+{
+  // If outstring exists then it is valid.
+  if (outstring) 
+    return outstring;
+  else
+    outstring= (ipv4flag ? new(nothrow) char[INET_ADDRSTRLEN] : 
+		           new(nothrow) char[INET6_ADDRSTRLEN]);
+
+  if (hostaddress::get_ip_str(outstring)) 
+    return outstring;
+  else 
+  {
+    // error
+    if (outstring) 
+      delete[] outstring;
+
+    return (outstring = NULL);
+  } // end if get_ip_str()
+} // end get_ip_str
+
+/** Get IP address as a string.
+ * @param str string buffer
+ */
+const char* hostaddress::get_ip_str(char *str) const 
+{
+  if (!str) return NULL;
+  memset(str,0, ipv4flag ? INET_ADDRSTRLEN : INET6_ADDRSTRLEN);
+  return ipv4flag ? inet_ntop(AF_INET,(void*)&ipv4addr,str,INET_ADDRSTRLEN) 
+                  : inet_ntop(AF_INET6,(void*)&ipv6addr,str,INET6_ADDRSTRLEN);
+} // end get_ip_str(char*)
+
+
+/** Get IP address as an in_addr if possible.
+ * @return true on success.
+ */
+bool hostaddress::get_ip(struct in_addr& in) const {
+	if (ipv4flag) {
+		in = ipv4addr;
+		return true;
+	} else if (IN6_IS_ADDR_V4MAPPED(ipv6addr.s6_addr)) {
+		memcpy(&(in.s_addr),ipv6addr.s6_addr+12,4);
+		return true;
+	} else return false;
+} // get_ip
+
+/** Get IP address as an in6_addr.
+ * If this is an IPv4 address, it is mapped to IPv6.
+ * @return true since this is always possible.
+ */
+bool hostaddress::get_ip(struct in6_addr& in) const {
+	if (ipv4flag) {
+		// map to IPv6
+		memset(in.s6_addr,0,10);
+		memset(in.s6_addr+10,255,2);
+		memcpy(in.s6_addr+12,&(ipv4addr.s_addr),4);
+	} else in = ipv6addr;
+	return true;
+} // get_ip
+
+/// returns false if address is not allowed to be used
+/// as source address: loopback, multicast, broadcast, unspecified
+bool 
+hostaddress::is_bogus_source() const
+{
+  if (ipv4flag)
+  { // IPv4
+    if ( IN_MULTICAST(ipv4addr.s_addr) || 
+	 ipv4addr.s_addr == INADDR_LOOPBACK  ||
+         ipv4addr.s_addr == INADDR_ANY ||
+         ipv4addr.s_addr == INADDR_BROADCAST
+       )
+    {
+      return true;
+    }
+  }
+  else
+  { // IPv6
+    if ( ipv6addr.s6_addr == in6addr_any.s6_addr ||
+	 ipv6addr.s6_addr == in6addr_loopback.s6_addr )
+      return true;
+  }
+
+  return false;
+}
+
+
+/** Convert the IP address to IPv6 by mapping it from IPv4 to IPv6 if
+ * necessary
+ */
+void hostaddress::convert_to_ipv6() {
+	if (ipv4flag) {
+		if (is_ip_unspec()) {
+			// clear IP and set to IPv6
+			clear_ip();
+			set_subtype(false);
+		} else {
+			// map to IPv6
+			struct in6_addr in;
+			get_ip(in);
+			// set IP
+			set_ip(in);
+		} // end if is_ip_unspec()
+	} // end if ipv4flag
+} // end convert_to_ipv6
+
+/** Two addresses are equivalent if they are equal after converting both to
+ * IPv6.
+ */
+bool hostaddress::equiv(const hostaddress& h) const {
+	bool thisipv4 = is_ipv4();
+	bool result = false;
+	hostaddress* ipv4haddr = NULL;
+	const hostaddress* ipv6haddr = NULL;
+	// if both IPv4 or both IPv6 then just test for equality
+	if (thisipv4==h.is_ipv4()) return operator==(h);
+	// OK, one is IPv6 and the other is IPv4 (to be converted!).
+	// Allocating memory dynamically because I do not know the concrete
+	// type of *this or h.
+	try {
+		if (thisipv4) {
+			ipv6haddr = &h;
+			if (h.is_mapped_ip()) ipv4haddr = this->copy();
+		} else {
+			ipv6haddr = this;
+			if (is_mapped_ip()) ipv4haddr = h.copy();
+		} // end if thisipv4
+	} catch(IEError&) { ipv4haddr = NULL; }
+	if (ipv4haddr) {
+		ipv4haddr->convert_to_ipv6();
+		result = ((*ipv4haddr)==(*ipv6haddr));
+		delete ipv4haddr;
+		return result;
+	} else return false;
+} // end equiv
+
+
+/** Set subtype and IPv4 flag. This does NOT clear the outstring buffer.
+ * Use clear_ip(). 
+ */
+void hostaddress::set_subtype(bool ipv4) {
+	ipv4flag = ipv4; 
+	subtype = ipv4flag ? IPv4HostAddress : IPv6HostAddress;
+} // end set_subtype
+
+/** Clear the IP address buffer and the outstring if it exists. */
+void hostaddress::clear_ip() {
+	// only need to clear ipv6 because of union
+	ipv6addr = in6addr_any;
+	if (outstring) {
+		delete[] outstring;
+		outstring = NULL;
+	} // end if outstring
+} // end clear_ip
+
+
+/** Match this IP address against another IP address.
+ * Two IP addresses match if they are equal.
+ * @return -1 on no match or error, e.g. when IPv4 and IPv6 are matched
+ * @return the length of the matched prefix.
+ */
+int hostaddress::match_against(const hostaddress& ha) const {
+	if (ipv4flag==ha.ipv4flag) {
+		if (operator==(ha)) {
+			if (ipv4flag) return 32;
+			else return 128;
+		} else return -1;
+	} else return -1;
+} // end match_against(
+
+/** Match this IP address against the given network prefix.
+ * @return -1 on no match or error, e.g. when IPv4 and IPv6 are matched
+ * @return the length of the matched prefix.
+ */
+int hostaddress::match_against(const netaddress& na) const {
+	uint32 word1 = 0;
+	uint32 word2 = 0;
+	const prefix_length_t preflen = na.get_pref_len();
+	prefix_length_t lenwords = preflen/32;
+	prefix_length_t lenbits = preflen%32;
+	// now 0<=lenwords<=4, 0<=lenbits<=31
+	prefix_length_t i;
+	const hostaddress& ha = dynamic_cast<const hostaddress&>(na);
+	if (ipv4flag==na.ipv4flag) {
+		if (ipv4flag) {
+			if (preflen >= 32)
+				lenbits = 32;
+			// match IPv4
+			word1 = ntohl(ipv4addr.s_addr);
+			word2 = ntohl(ha.ipv4addr.s_addr);
+			// shift right
+			word1 >>= (32-lenbits);
+			word2 >>= (32-lenbits);
+			if (word1==word2) return preflen;
+			else return -1;
+		} else {
+			if (preflen > 128)
+				return -1;
+			// match IPv6
+			// match words
+			for (i=0;i<lenwords;i++) {
+			  word1 = ntohl(ipv6addr.s6_addr32[i]);    // RB: as long as both words are in same order we dont need ntohl?!
+			  word2 = ntohl(ha.ipv6addr.s6_addr32[i]);
+				if (word1!=word2) return -1;
+			} // end for i
+			// now i points to the next word to be matched
+			// match bits
+			if (lenbits) {
+				word1 = ntohl(ipv6addr.s6_addr32[i]);
+				word2 = ntohl(ha.ipv6addr.s6_addr32[i]);
+				// shift right
+				word1 >>= (32-lenbits);
+				word2 >>= (32-lenbits);
+				if (word1==word2) return preflen;
+				else return -1;
+			} else {
+				// no extra bits to match and everything OK
+				return preflen;
+			} // end if lenbits
+		} // end if ipv4flag
+	} else return -1;
+} // end match_against
+
+/***** class appladdress *****/
+
+/***** inherited from IE *****/
+
+appladdress* appladdress::new_instance() const {
+	appladdress* aa = NULL;
+	catch_bad_alloc(aa = new appladdress());
+	return aa;
+} // end new_instance
+
+appladdress* appladdress::copy() const {
+	appladdress* aa = NULL;
+	catch_bad_alloc(aa = new appladdress(*this));
+	return aa;
+} // end copy 
+
+bool appladdress::operator==(const address& ie) const {
+	const appladdress* app = dynamic_cast<const appladdress*>(&ie);
+	if (app) {
+		// if the IEs are equal when casted to type hostaddress, then
+		// only protocols and ports have to be checked.
+		// Otherwise they are not equal.
+		if (hostaddress::operator==(ie)) {
+		    if (proto!=app->proto) cout << "protocols not matching" << endl;
+		    if (port !=app->port) cout << "ports not matching" << endl;
+
+		    return ((proto==app->proto) && (port==app->port));
+		} else return false;
+	} else return false;
+} // end operator==
+
+
+/***** class netaddress *****/
+
+/***** inherited from IE *****/
+
+netaddress* netaddress::new_instance() const {
+	netaddress* na = NULL;
+	catch_bad_alloc(na = new netaddress());
+	return na;
+} // end new_instance
+
+netaddress* netaddress::copy() const {
+	netaddress* na = NULL;
+	catch_bad_alloc(na = new netaddress(*this));
+	return na;
+} // end copy 
+
+bool netaddress::operator==(const address& ie) const {
+	const netaddress* na = dynamic_cast<const netaddress*>(&ie);
+	if (na) {
+		// if the IEs are equal when casted to type hostaddress, then
+		// only prefix lengths have to be checked.
+		// Otherwise they are not equal.
+		if (hostaddress::operator==(ie)) {
+		    if (prefix_length!=na->prefix_length) cout << "Prefix length not matching" << endl;
+		    return (prefix_length==na->prefix_length);
+		} else return false;
+	} else return false;
+} // end operator==
+
+
+/***** inherited from hostaddress *****/
+
+/** Convert the IP address to IPv6 by mapping it from IPv4 to IPv6 if
+ * necessary. The prefix length is converted, too.
+ */
+void netaddress::convert_to_ipv6() {
+	if (ipv4flag) {
+		// map IP
+		hostaddress::convert_to_ipv6();
+		// adjust prefix length
+		set_pref_len(prefix_length+96);
+	} // end if ipv4flag
+} // end convert_to_ipv6
+
+/** Set subtype and IPv4 flag. This does NOT clear the outstring buffer.
+ * Use clear_ip(). 
+ * In addition the prefix length is checked and set to reasonable values.
+ */
+void netaddress::set_subtype(bool ipv4) {
+	ipv4flag = ipv4; 
+	if (ipv4) {
+		subtype = IPv4NetAddress; 
+		if (prefix_length>32) prefix_length = 32;
+	} else {
+		subtype = IPv6NetAddress;
+		if (prefix_length>128) prefix_length = 128;
+	} // end if ipv4flag
+} // end set_subtype
+
+/***** new members in netaddress *****/
+
+/** Constructor sets address type and clears prefix length. */
+netaddress::netaddress() : 
+  hostaddress(),
+  prefix_length(0)
+ {
+	set_subtype(ipv4flag);
+} // end constructor
+
+netaddress::netaddress(const netaddress& na) : hostaddress(na) {
+	prefix_length = na.prefix_length;
+	set_subtype(ipv4flag);
+} // end copy constructor
+
+/** Initialize with the given host address and prefix length. 
+ * Prefix length is optional and set to 0 if missing.
+ */
+netaddress::netaddress(const hostaddress& h, prefix_length_t len) : hostaddress(h) {
+  set_subtype(ipv4flag);
+  set_pref_len(len); // this will cut the prefix value accordingly
+} // end constructor(hostaddress,len)
+
+/** Initialize from string which contains IP and prefix length separated by
+ * '/'.
+ */
+netaddress::netaddress(const char* str, bool *res) : hostaddress() {
+	bool tmpres = true; // MUST BE true
+	bool tmpres2 = false;
+	long int len = 0;
+	uint32 iplen;
+	char* i = NULL;
+	char* errptr = NULL;
+	char ipstr[INET6_ADDRSTRLEN] = {0};
+	// look for /
+	i = strchr(str,'/');
+	if (i) {
+		iplen = i-str;
+		i++;
+		// decode prefix length
+		len = strtol(i,&errptr,10);
+		if ((*i) && errptr && ((*errptr)==0)) {
+			// prefix OK
+			prefix_length = len;
+		} else {
+			prefix_length = 0;
+			tmpres = false;
+		} // end if prefix OK
+		if (iplen<=INET6_ADDRSTRLEN) {
+			// copy IP string
+			strncpy(ipstr,str,iplen);
+			ipstr[INET6_ADDRSTRLEN-1] = 0;
+			// set str to ipstr
+			str = ipstr;
+		} // end if iplen valid
+	} else {
+		// no prefix found, OK
+		prefix_length = 0;
+	} // end if i
+	// set IP, this also sets ipvflag.
+	tmpres2 = set_ip(str);
+	if (res) *res = (tmpres && tmpres2);
+	set_subtype(ipv4flag);
+} // end constructor(string)
+
+/** Initialize from string and prefix length.
+ * If the string does not contain a valid IP address, it is set to all 0 by
+ * the hostaddress constructor.
+ */
+netaddress::netaddress(const char* str, prefix_length_t len, bool *res) : hostaddress(str,res) {
+  set_subtype(ipv4flag);
+  set_pref_len(len); // this will cut the prefix value accordingly
+} // end constructor(string,port)
+
+/** Assigns the given netaddress address by using hostaddress::operator=(). */
+netaddress& netaddress::operator=(const netaddress& na) {
+  prefix_length = na.prefix_length;
+  hostaddress::operator=(na);
+  return *this;
+} // end operator=
+
+
+/** Assigns the given netaddress address by using hostaddress::operator=(). */
+netaddress& netaddress::operator=(const hostaddress& na) {
+	hostaddress::operator=(na);
+	set_pref_len(128);
+	return *this;
+} // end operator=
+
+
+/** Set prefix length and return old value.
+ * will also cut prefix_length if needed (i.e., if len too large for addr type)
+ */
+prefix_length_t netaddress::set_pref_len(prefix_length_t len) {
+	register prefix_length_t olen = prefix_length;
+	prefix_length = ipv4flag ? ( (len>32) ? 32 : len ) :
+	                           ( (len>128) ? 128 : len );
+	return olen;
+} // end set_port
+
+
+
+/** Compare two netaddress objects. If neither a<b and b<a then a and b are
+ * considered equal.
+ */
+bool netaddress::operator<(const netaddress& na) const {
+	uint32 word1 = 0;
+	uint32 word2 = 0;
+	prefix_length_t lenwords = prefix_length/32;
+	prefix_length_t lenbits = prefix_length%32;
+	// now 0<=lenwords<=4, 0<=lenbits<=31
+	prefix_length_t i;
+	// IPv4 is always < IPv6
+	if ((!ipv4flag) && na.ipv4flag) return false;
+	else if (ipv4flag && (!na.ipv4flag)) return true;
+	// now ipv4flag == na.ipv4flag
+	else if (prefix_length<na.prefix_length) return true;
+	else if (prefix_length>na.prefix_length) return false;
+	// now prefix_length == na.prefix_length
+	else if (ipv4flag) {
+		// compare IPv4 with same prefix length
+		word1 = ntohl(ipv4addr.s_addr);
+		word2 = ntohl(na.ipv4addr.s_addr);
+		// shift right
+		word1 >>= (32-lenbits);
+		word2 >>= (32-lenbits);
+		if (word1<word2) return true;
+		else return false;
+	} else {
+		// compare IPv6 with same prefix length
+		// compare words
+		for (i=0;i<lenwords;i++) {
+			word1 = ntohl(ipv6addr.s6_addr32[i]);
+			word2 = ntohl(na.ipv6addr.s6_addr32[i]);
+			if (word1<word2) return true;
+			if (word1>word2) return false;
+		} // end for i
+		// now i points to the next word to be compared and previous words are equal
+		// compare bits
+		if (lenbits) {
+			word1 = ntohl(ipv6addr.s6_addr32[i]);
+			word2 = ntohl(na.ipv6addr.s6_addr32[i]);
+			// shift right
+			word1 >>= (32-lenbits);
+			word2 >>= (32-lenbits);
+			if (word1<word2) return true;
+			else return false;
+		} else {
+			// no extra bist to compare and everything equal
+			return false;
+		} // end if lenbits
+	} // end if ipv4flag, prefox
+} // end match_against
+
+/**
+ * Compare function for the radix trie:
+ *
+ * Compare this and na from *pos up to max(this->prefix, na->prefix)
+ *
+ * In pos return the position where the compare ended.
+ *
+ * The return value is 0 if the strings are equal and all of this' string
+ * was consumed, otherwise the sign will indicate the bit in this' string
+ * at pos (i.e. if the search should continue left or right of na).
+ *
+ * pos < 0 indicates error
+ */
+int
+netaddress::rdx_cmp(const netaddress *na, int *pos) const
+{
+	if (na == NULL) {
+		*pos = -1;
+		return 0;
+	}
+
+	if (na->ipv4flag != ipv4flag ||
+	    *pos > na->prefix_length ||
+	    *pos > prefix_length) {
+		*pos = -1;
+		return 0;
+	}
+
+	if (na->prefix_length == 0) {
+		*pos = 1;
+		if (ipv4flag)
+			return ((ntohl(ipv4addr.s_addr) & 0x80000000) == 0 ?
+			    -1 : 1);
+		else
+			return ((htonl(ipv6addr.s6_addr32[0]) & 0x80000000) == 0 ?
+			    -1 : 1);
+	}
+
+	if (*pos < 0)
+		*pos = 0;
+
+	uint32_t w1, w2, w3;
+	int diff, i, p1, p2;
+
+	if (ipv4flag) {
+		diff = *pos;
+		w1 = ntohl(ipv4addr.s_addr);
+		w2 = ntohl(na->ipv4addr.s_addr);
+		// in w3 store the difference
+		w3 = w1 ^ w2;
+		// mask out anything after prefix_length and before *pos
+		w3 = (w3 >> (32 - prefix_length)) << (32 - prefix_length + diff);
+		if (w3 == 0 && prefix_length <= na->prefix_length) {
+			*pos = min(prefix_length, na->prefix_length);
+			return 0;
+		}
+		// pos = 0 means start up front, so we need to fix up to that
+		diff++;
+		while (diff <= prefix_length && diff <= na->prefix_length) {
+			if ((w3 & 0x80000000) != 0) {
+				*pos = diff;
+				return (((w1 & (1 << (32 - diff))) >>
+				    (32 - diff)) == 0 ? -1 : 1);
+			}
+			w3 = w3 << 1;
+			diff++;
+		}
+		// difference past na->prefix_length
+		*pos = diff;
+		return (((w1 & (1 << (32 - diff))) >>
+		    (32 - diff)) == 0 ? -1 : 1);
+	}
+
+	diff = *pos;
+	for (i = diff / 32; i < 4; i++) {
+		diff = diff % 32;
+		w1 = ntohl(ipv6addr.s6_addr32[i]);
+		w2 = ntohl(na->ipv6addr.s6_addr32[i]);
+		w3 = w1 ^ w2;
+		p1 = (prefix_length - (i * 32));
+		p1 = p1 > 32 ? 32 : p1;
+		p2 = (na->prefix_length - (i * 32));
+		p1 = p2 > 32 ? 32 : p2;
+
+		w3 = (w3 >> (32 - p1)) << (32 - p1 + diff);
+		if (w3 == 0 && prefix_length <= na->prefix_length) {
+			*pos = min(prefix_length, na->prefix_length);
+			if (prefix_length <= ((i + 1) * 32))
+				return 0;
+		}
+		// pos = 0 means start up front, so we need to fix up to that
+		diff++;
+		while (diff <= p1 && diff <= p2) {
+			if ((w3 & 0x80000000) != 0) {
+				*pos = diff + (i * 32);
+				return (((w1 & (1 << (32 - diff))) >>
+				    (32 - diff)) == 0 ? -1 : 1);
+			}
+			w3 = w3 << 1;
+			diff++;
+		}
+		if (diff + (32 * i) <= prefix_length &&
+		    diff + (32 * i) <= na->prefix_length) {
+			diff--;
+			continue;
+		}
+		// difference past na->prefix_length
+		*pos = diff + (i * 32);
+		if (diff == 33) {
+			diff = 1;
+			if (i == 3)
+				abort();
+			w1 = ntohl(ipv6addr.s6_addr32[i+1]);
+		}
+		return (((w1 & (1 << (32 - diff))) >>
+		    (32 - diff)) == 0 ? -1 : 1);
+	}
+
+	// Not reachable, but gcc complains
+	return 0;
+}
+
+udsaddress* udsaddress::new_instance() const {
+	udsaddress* ha = NULL;
+	catch_bad_alloc(ha = new udsaddress());
+	return ha;
+} // end new_instance
+
+udsaddress* udsaddress::copy() const {
+        udsaddress* ha = NULL;
+	catch_bad_alloc(ha =  new udsaddress(*this));
+	return ha;
+} // end copy 
+
+bool udsaddress::operator==(const address& ie) const {
+	const udsaddress* app = dynamic_cast<const udsaddress*>(&ie);
+	if (app) {
+	    return (app->socknum == socknum) && (app->uds_socket == uds_socket);
+	} else return false;
+} // end operator==
+
+AddressList::AddrProperty *AddressList::LocalAddr_P;
+AddressList::AddrProperty *AddressList::ConfiguredAddr_P;
+AddressList::AddrProperty *AddressList::IgnoreAddr_P;
+AddressList::AddrProperty *AddressList::AnyAddr_P;
+
+AddressList::AddressList()
+{
+	if (LocalAddr_P == 0) {
+		LocalAddr_P = new AddrProperty("local");
+		ConfiguredAddr_P = new AddrProperty("configured");
+		IgnoreAddr_P = new AddrProperty("ignore");
+		AnyAddr_P = new AddrProperty("wildcard");
+	}
+	interfaces = 0;
+}
+
+AddressList::~AddressList()
+{
+	// Refcount AddressLists in order to GC properties?
+}
+
+AddressList::iflist_t *
+AddressList::get_interfaces()
+{
+	iflist_t *iflist;
+
+	if (interfaces != 0)
+		iflist = new iflist_t(*interfaces);
+	else {
+		iflist = new iflist_t();
+		getifaddrs_iflist(*iflist);
+	}
+
+	return iflist;
+}
+
+bool
+AddressList::by_interface(bool start_empty)
+{
+	if (interfaces != 0)
+		return false;
+
+	interfaces = new iflist_t();
+	if (!start_empty)
+		getifaddrs_iflist(*interfaces);
+
+	return true;
+}
+
+bool
+AddressList::add_interface(char *name)
+{
+	if (interfaces == 0)
+		return false;
+
+	return (interfaces->insert(name)).second;
+}
+
+bool
+AddressList::del_interface(char *name)
+{
+	if (interfaces == 0)
+		return false;
+
+	return (interfaces->erase(name) > 0);
+}
+
+bool
+AddressList::add_property(netaddress &na, AddrProperty *p, bool propagate)
+{
+	propmap_t *props, *lpfm_props;
+	propmap_t::iterator it;
+	addr2prop_t::node *node;
+
+	node = prop_trie.lookup_node(na, false, false);
+	if (node != NULL) {
+		props = node->data;
+		if (props == NULL) {
+			props = new propmap_t();
+			node->data = props;
+		}
+		props->insert(pair<AddrProperty *, bool>(p, propagate));
+		
+	} else {
+		props = new propmap_t();
+		props->insert(pair<AddrProperty *, bool>(p, propagate));
+		node = prop_trie.insert(na, *props);
+	}
+
+	if (propagate)
+		bequeath(node, p, true);
+
+	// copy lpfm properties
+	lpfm_props = prop_trie.lookup(na, true);
+	if (lpfm_props == NULL)
+		return true;
+
+	for (it = lpfm_props->begin(); it != lpfm_props->end(); it++) {
+		if ((*it).second)
+			props->insert((*it));
+	}
+
+	return true;
+}
+
+bool
+AddressList::del_property(netaddress &na, AddrProperty *p, bool propagate)
+{
+	propmap_t *props, *lpfm_props;
+	propmap_t::iterator it;
+	addr2prop_t::node *node;
+
+	node = prop_trie.lookup_node(na, false, true);
+	if (node == NULL) {
+		// no exact match
+		if (!propagate) {
+			node = prop_trie.lookup_node(na, true, true);
+			if (node == NULL) {
+				// no lpfm either, we're done
+				return false;
+			}
+
+			props = node->data;
+			it = props->find(p);
+			if (it == props->end()) {
+				// lpfm doesn't have p set -> done
+				return false;
+			}
+		}
+		// insert an empty propmap
+		props = new propmap_t();
+		node = prop_trie.insert(na, *props);
+
+		// copy other lpfm properties
+		lpfm_props = prop_trie.lookup(na, true);
+		if (p != AnyAddr_P && lpfm_props != NULL) {
+			for (it = lpfm_props->begin(); it != lpfm_props->end();
+			    it++) {
+				if ((*it).first != p && (*it).second)
+					props->insert((*it));
+			}
+		}
+	} else {
+		props = node->data;
+		if (p == AnyAddr_P) {
+			props->clear();
+		} else {
+			it = props->find(p);
+			if (it == props->end() && !propagate)
+				return false;
+
+			props->erase(it);
+		}
+	}
+
+	if (propagate)
+		bequeath(node, p, false);
+
+	return true;
+}
+
+bool
+AddressList::add_host_prop(const char *name, AddrProperty *p)
+{
+	netaddress na;
+	sockaddr_in *sin;
+	sockaddr_in6 *sin6;
+	struct addrinfo hints = {0}, *res, *cur;
+	int error;
+	char buf[1024];
+
+	if (name == NULL) {
+		name = buf;
+		if (gethostname(buf, sizeof(buf)) != 0)
+			return false;
+		buf[sizeof(buf) - 1] = '\0';
+	}
+	hints.ai_flags = AI_ADDRCONFIG | AI_CANONNAME;
+	hints.ai_family = AF_UNSPEC;
+	error = getaddrinfo(name, NULL, &hints, &res);
+	if (error != 0)
+		return false;
+
+	for(cur = res; cur != NULL && error == 0; cur = cur->ai_next) {
+		if (cur->ai_family == AF_INET) {
+			sin = (struct sockaddr_in *)cur->ai_addr;
+			na.set_ip(sin->sin_addr);
+			na.set_pref_len(32);
+		} else if (cur->ai_family == AF_INET6) {
+			sin6 = (struct sockaddr_in6 *)cur->ai_addr;
+			na.set_ip(sin6->sin6_addr);
+			na.set_pref_len(128);
+		} else
+			continue;
+
+		// cout << ++i << "XXMOB: " << na << endl;
+
+		error += add_property(na, p) ? 0 : 1;
+		// XXXMOB: for some reason we need a 'reset' here
+		//         if we want to use /etc/hosts
+		na.set_ip("127.0.0.1");
+	}
+	freeaddrinfo(res);
+
+	return (error == 0);
+}
+
+bool
+AddressList::del_host_prop(const char *name, AddrProperty *p)
+{
+	netaddress na;
+	sockaddr_in *sin;
+	sockaddr_in6 *sin6;
+	struct addrinfo hints = {0}, *res, *cur;
+	int error;
+	char buf[1024];
+
+	if (name == NULL) {
+		name = buf;
+		if (gethostname(buf, sizeof(buf)) != 0)
+			return false;
+		buf[sizeof(buf) - 1] = '\0';
+	}
+	hints.ai_flags = AI_ADDRCONFIG;
+	hints.ai_family = AF_UNSPEC;
+	error = getaddrinfo(name, NULL, &hints, &res);
+	if (error != 0)
+		return false;
+
+	for(cur = res; cur != NULL && error == 0; cur = cur->ai_next) {
+		if (cur->ai_family == AF_INET) {
+			sin = (struct sockaddr_in *)cur->ai_addr;
+			na.set_ip(sin->sin_addr);
+			na.set_pref_len(32);
+		} else if (cur->ai_family == AF_INET6) {
+			sin6 = (struct sockaddr_in6 *)cur->ai_addr;
+			na.set_ip(sin6->sin6_addr);
+			na.set_pref_len(128);
+		} else
+			continue;
+
+		error += del_property(na, p) ? 0 : 1;
+	}
+	freeaddrinfo(res);
+
+	return (error == 0);
+}
+
+bool
+AddressList::ignore(netaddress &na, bool propagate)
+{
+	del_property(na, AnyAddr_P, propagate);
+	return add_property(na, IgnoreAddr_P);
+}
+
+bool
+AddressList::unignore(netaddress &na, bool propagate)
+{
+	return del_property(na, IgnoreAddr_P, propagate);
+}
+
+bool
+AddressList::ignore_bogons(void)
+{
+	netaddress na;
+
+	// according to IANA Tue Apr 17 09:14:31 PDT 2007
+	na.set_ip("0.0.0.0");na.set_pref_len(7);
+	ignore(na);
+	na.set_ip("2.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("5.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("7.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("23.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("27.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("31.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("36.0.0.0");na.set_pref_len(7);
+	ignore(na);
+	na.set_ip("39.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("42.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("49.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("50.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("94.0.0.0");na.set_pref_len(7);
+	ignore(na);
+	na.set_ip("100.0.0.0");na.set_pref_len(6);
+	ignore(na);
+	na.set_ip("104.0.0.0");na.set_pref_len(5);
+	ignore(na);
+	na.set_ip("112.0.0.0");na.set_pref_len(6);
+	ignore(na);
+	na.set_ip("169.254.0.0");na.set_pref_len(16);
+	ignore(na);
+	na.set_ip("173.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("174.0.0.0");na.set_pref_len(7);
+	ignore(na);
+	na.set_ip("176.0.0.0");na.set_pref_len(5);
+	ignore(na);
+	na.set_ip("184.0.0.0");na.set_pref_len(6);
+	ignore(na);
+	na.set_ip("191.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("192.0.2.0");na.set_pref_len(24);
+	ignore(na);
+	na.set_ip("197.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("198.18.0.0");na.set_pref_len(15);
+	ignore(na);
+	na.set_ip("223.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("240.0.0.0");na.set_pref_len(4);
+	ignore(na);
+	// according to http://www.cymru.com/Documents/bogonv6-list.html#agg
+	na.set_ip("0000::");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("0100::");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("0200::");na.set_pref_len(7);
+	ignore(na);
+	na.set_ip("0400::");na.set_pref_len(7);
+	ignore(na);
+	na.set_ip("0600::");na.set_pref_len(7);
+	ignore(na);
+	na.set_ip("0800::");na.set_pref_len(5);
+	ignore(na);
+	na.set_ip("1000::");na.set_pref_len(4);
+	ignore(na);
+	na.set_ip("2000::");na.set_pref_len(16);
+	ignore(na);
+	na.set_ip("2001:1000::");na.set_pref_len(23);
+	ignore(na);
+	na.set_ip("2001:1600::");na.set_pref_len(23);
+	ignore(na);
+	na.set_ip("2001:2000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:3000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:4000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:5000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:6000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:7000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:8000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:9000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:A000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:B000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:C000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:D000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:E000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("2001:F000::");na.set_pref_len(20);
+	ignore(na);
+	na.set_ip("3FFF::");na.set_pref_len(16);
+	ignore(na);
+	na.set_ip("4000::");na.set_pref_len(3);
+	ignore(na);
+	na.set_ip("6000::");na.set_pref_len(3);
+	ignore(na);
+	na.set_ip("8000::");na.set_pref_len(3);
+	ignore(na);
+	na.set_ip("A000::");na.set_pref_len(3);
+	ignore(na);
+	na.set_ip("C000::");na.set_pref_len(3);
+	ignore(na);
+	na.set_ip("E000::");na.set_pref_len(4);
+	ignore(na);
+	na.set_ip("F000::");na.set_pref_len(5);
+	ignore(na);
+	na.set_ip("F800::");na.set_pref_len(6);
+	ignore(na);
+	na.set_ip("FC00::");na.set_pref_len(7);
+	ignore(na);
+	na.set_ip("FE00::");na.set_pref_len(9);
+	ignore(na);
+
+	return true;
+}
+
+bool
+AddressList::ignore_locals(void)
+{
+	netaddress na;
+
+	na.set_ip("10.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("172.16.0.0");na.set_pref_len(12);
+	ignore(na);
+	na.set_ip("192.168.0.0");na.set_pref_len(16);
+	ignore(na);
+	na.set_ip("FE80::");na.set_pref_len(10);
+	ignore(na);
+	na.set_ip("FEC0::");na.set_pref_len(10);
+	ignore(na);
+
+	return true;
+}
+
+bool
+AddressList::ignore_loopback(void)
+{
+	netaddress na;
+
+	na.set_ip("127.0.0.0");na.set_pref_len(8);
+	ignore(na);
+	na.set_ip("::1");na.set_pref_len(128);
+	ignore(na);
+
+	return true;
+}
+
+bool
+AddressList::addr_is(netaddress &na, AddrProperty *prop)
+{
+	propmap_t *props;
+	propmap_t::iterator it;
+
+	if (addr_is_in(na, IgnoreAddr_P))
+		return false;
+
+	props = prop_trie.lookup(na, false);
+	if (props != NULL) {
+		it = props->find(prop);
+		if (it != props->end()) {
+			return true;
+		}
+	}
+
+	if (prop != LocalAddr_P)
+		return false;
+
+	return getifaddrs_is_local(na);
+}
+
+bool
+AddressList::addr_is_in(netaddress &na, AddrProperty *prop)
+{
+	addr2prop_t::node *node;
+	propmap_t *props;
+	propmap_t::iterator it;
+
+	node = prop_trie.lookup_node(na, true, true);
+	if (node == NULL)
+		return false;
+
+	props = node->data;
+	it = props->find(prop);
+	if (it == props->end())
+		return false;
+
+	if (!(*it).second && props != prop_trie.lookup(na, false))
+			return false;
+
+	return true;
+}
+
+AddressList::addrlist_t *
+AddressList::get_addrs(AddrProperty *prop)
+{
+	addr2prop_t::node *node;
+	netaddress na;
+	addrlist_t *res = new addrlist_t();
+
+	if (res == 0)
+		return res;
+
+	if (prop == LocalAddr_P || prop == AnyAddr_P)
+		getifaddrs_get_addrs(*res);
+
+	na.set_ip("0.0.0.0");
+	na.set_pref_len(0);
+	node = prop_trie.lookup_node(na, true, false);
+	collect(node, prop, *res);
+
+	na.set_ip("::");
+	node = prop_trie.lookup_node(na, true, false);
+	collect(node, prop, *res);
+
+	return res;
+}
+
+netaddress *
+AddressList::get_first(AddrProperty *p, bool IPv4)
+{
+	addr2prop_t::node *node;
+	netaddress na;
+	addrlist_t list;
+	addrlist_t::iterator it;
+
+	if (IPv4) {
+		na.set_ip("0.0.0.0");
+		na.set_pref_len(0);
+	} else {
+		na.set_ip("::");
+		na.set_pref_len(0);
+	}
+
+	node = prop_trie.lookup_node(na, true, false);
+	node = collect_first(node, p);
+	if (node != NULL)
+		return new netaddress(*node->key);
+
+	if (p == LocalAddr_P) {
+		getifaddrs_get_addrs(list);
+		for (it = list.begin(); it != list.end(); it++)
+			if ((*it).is_ipv4() == IPv4)
+				return new netaddress(*it);
+	}
+
+	return NULL;
+}
+
+netaddress *
+AddressList::get_src_addr(const netaddress &dest, uint32_t *prefs)
+{
+	netaddress *res;
+	int sfd;
+
+	sfd = socket(dest.is_ipv4()?AF_INET:AF_INET6, SOCK_DGRAM, 0);
+	if (sfd == -1)
+		return NULL;
+
+#ifdef IPV6_ADDR_PREFERENCES
+	if (prefs != NULL && setsockopt(s, IPV6_ADDR_PREFERENCES,
+	    (void *)prefs, sizeof (*prefs)) == -1) {
+		close(sfd);
+		return NULL;
+	}
+#endif
+	if (dest.is_ipv4()) {
+		struct sockaddr_in sin = {0};
+		socklen_t slen = sizeof(sin);
+		sin.sin_family = AF_INET;
+		sin.sin_port = htons(4);
+		dest.get_ip(sin.sin_addr);
+		if (connect(sfd, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
+			close(sfd);
+			return NULL;
+		}
+		if (getsockname(sfd, (struct sockaddr *)&sin, &slen) == -1) {
+			close(sfd);
+			return NULL;
+		}
+		close(sfd);
+		res = new netaddress();
+		res->set_ip(sin.sin_addr);
+		res->set_pref_len(32);
+		return (res);
+	} else {
+		struct sockaddr_in6 sin6 = {0};
+		socklen_t slen = sizeof(sin6);
+		sin6.sin6_family = AF_INET6;
+		sin6.sin6_port = htons(4);
+		dest.get_ip(sin6.sin6_addr);
+		if (connect(sfd, (struct sockaddr *)&sin6,
+		    sizeof(sin6)) == -1) {
+			close(sfd);
+			return NULL;
+		}
+		if (getsockname(sfd, (struct sockaddr *)&sin6, &slen) == -1) {
+			close(sfd);
+			return NULL;
+		}
+		close(sfd);
+		res = new netaddress();
+		res->set_ip(sin6.sin6_addr);
+		res->set_pref_len(128);
+		return (res);
+	}
+}
+
+void
+AddressList::getifaddrs_iflist(iflist_t &list)
+{
+	struct ifaddrs *ifap, *cifa;
+
+	if (::getifaddrs(&ifap) != 0)
+		return;
+
+	for (cifa = ifap; cifa != NULL; cifa = cifa->ifa_next) {
+		list.insert(cifa->ifa_name);
+	}
+
+	freeifaddrs(ifap);
+}
+
+bool
+AddressList::getifaddrs_is_local(netaddress &na)
+{
+	struct ifaddrs *ifap, *cifa;
+
+	if (::getifaddrs(&ifap) != 0)
+		return false;
+
+	for (cifa = ifap; cifa != NULL; cifa = cifa->ifa_next) {
+		hostaddress ha;
+
+		if (cifa->ifa_addr->sa_family == AF_INET) {
+			ha.set_ip(
+			    ((struct sockaddr_in *)cifa->ifa_addr)->sin_addr);
+		} else if (cifa->ifa_addr->sa_family == AF_INET6) {
+			ha.set_ip(
+			    ((struct sockaddr_in6 *)cifa->ifa_addr)->sin6_addr);
+		} else {
+			continue;
+		}
+
+		if (interfaces &&
+		    interfaces->find(cifa->ifa_name) == interfaces->end())
+			continue;
+
+		if (ha.match_against(na) >= na.get_pref_len()) {
+			freeifaddrs(ifap);
+			return true;
+		}
+	}
+
+	freeifaddrs(ifap);
+
+	return false;
+}
+
+void
+AddressList::getifaddrs_get_addrs(addrlist_t &list)
+{
+	struct ifaddrs *ifap, *cifa;
+
+	if (::getifaddrs(&ifap) != 0)
+		return;
+
+	for (cifa = ifap; cifa != NULL; cifa = cifa->ifa_next) {
+		hostaddress *ha;
+		netaddress na;
+
+		if (interfaces &&
+		    interfaces->find(cifa->ifa_name) == interfaces->end())
+			continue;
+
+		if (cifa->ifa_addr->sa_family == AF_INET) {
+			ha = new hostaddress;
+			ha->set_ip(
+			    ((struct sockaddr_in *)cifa->ifa_addr)->sin_addr);
+			na.set_pref_len(32);
+		} else if (cifa->ifa_addr->sa_family == AF_INET6) {
+			ha = new hostaddress;
+			ha->set_ip(
+			    ((struct sockaddr_in6 *)cifa->ifa_addr)->sin6_addr);
+			na.set_pref_len(128);
+		} else {
+			continue;
+		}
+
+		na.set_ip(*ha);
+		if (!addr_is_in(na, IgnoreAddr_P))
+			list.insert(*ha);
+	}
+
+	freeifaddrs(ifap);
+}
+
+void
+AddressList::bequeath(addr2prop_t::node *head, AddrProperty *p, bool add)
+{
+	propmap_t *props;
+	propmap_t::iterator it;
+
+	if (p == AnyAddr_P && add)
+		return;
+
+	props = head->data;
+	if (props != NULL) {
+		if (p == AnyAddr_P) {
+			props->clear();
+		} else {
+			if (add) {
+				props->insert(pair<AddrProperty *, bool>
+				    (p, true));
+			} else {
+				it = props->find(p);
+				if (it != props->end())
+					props->erase(it);
+			}
+		}
+	}
+
+	if (head->left->index > head->index)
+		bequeath(head->left, p, add);
+	if (head->right->index > head->index)
+		bequeath(head->right, p, add);
+}
+
+void
+AddressList::collect(addr2prop_t::node *head, AddrProperty *p,
+    addrlist_t &list)
+{
+	propmap_t *props;
+	propmap_t::iterator it;
+
+	props = head->data;
+	if (props != NULL) {
+		if (p == AnyAddr_P) {
+			it = props->begin();
+		} else {
+			it = props->find(p);
+		}
+		if (it != props->end()) {
+			list.insert(*(new netaddress(*head->key)));
+		}
+	}
+
+	if (head->left->index > head->index)
+		collect(head->left, p, list);
+	if (head->right->index > head->index)
+		collect(head->right, p, list);
+	
+}
+
+AddressList::addr2prop_t::node *
+AddressList::collect_first(addr2prop_t::node *head, AddrProperty *p)
+{
+	addr2prop_t::node *res = NULL;
+	propmap_t *props;
+	propmap_t::iterator it;
+
+	props = head->data;
+	if (props != NULL) {
+		if (p == AnyAddr_P) {
+			it = props->begin();
+		} else {
+			it = props->find(p);
+		}
+		if (it != props->end()) {
+			return head;
+		}
+	}
+
+	if (head->left->index > head->index) {
+		res = collect_first(head->left, p);
+		if (res != NULL)
+			return res;
+	}
+	if (head->right->index > head->index) {
+		res = collect_first(head->right, p);
+		if (res != NULL)
+			return res;
+	}
+
+	return NULL;
+}
+
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/address.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/address.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/address.h	(revision 2378)
@@ -0,0 +1,1452 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file address.h
+/// GIST address objects
+/// ----------------------------------------------------------
+/// $Id: address.h 3063 2008-07-02 08:02:45Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/address.h $
+// ===========================================================
+//
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup ieaddress
+ *
+ * GIST address objects
+ */
+
+#ifndef PROTLIB__ADDRESS_H
+#define PROTLIB__ADDRESS_H
+
+#include "protlib_types.h"
+#include "ie.h"
+
+#include <ext/hash_map>
+#include <netinet/in.h>
+#include <set>
+
+#include "logfile.h"
+#include "threadsafe_db.h"
+
+namespace protlib {
+  using namespace log;
+
+/// Address base class
+/** This is the base class for IP host and application addresses, router,
+ * interface and user identification and AS numbers.
+ */
+class address {
+  public:
+	virtual address* new_instance() const = 0;
+	virtual address* copy() const = 0;
+	virtual bool operator==(const address& address) const = 0;
+
+	inline bool operator!=(const address& address) const {
+		return (!(*this==address));
+	}
+
+
+	enum subtype_t {
+		/** 255 is not a valid subtype and is used to register for all
+		 * subtypes.
+		 * @note This is no valid subtype because it is not in 0..64.
+		 */
+		all_subtypes          = 255,
+		// @{
+		/// address subtypes
+		/** These are the address-specific subtypes. */
+		IPv4HostAddress       =   1,
+		IPv6HostAddress       =   2,
+		IPv4NetAddress        =   3,
+		IPv6NetAddress        =   4,
+		IPv4ApplAddress       =   5,
+		IPv6ApplAddress       =   6,
+		IPv6Unspecified	      =   7,
+		UDSAddress            =   8,
+		FlowAddressSpec       =  12,
+		AS16                  =  14,
+		AS32                  =  15,
+		IEEE48                =  16,
+		EUI48                 =  17,
+		EUI64                 =  18,
+		NAI                   =  32,
+		X509                  =  33
+		// @}
+	}; // end subtype_t
+
+	virtual ~address() {};
+
+  subtype_t get_type() const { return subtype; };
+
+  protected:
+	/// constructor with subtype
+	address(subtype_t st);
+        /// virtual destructor
+
+	void throw_nomem_error() const;
+
+	subtype_t subtype;
+};
+
+// forward declaration
+class netaddress;
+
+/// IP Host Address
+/** This class can hold IPv4 and IPv6 Host Addresses. */
+class hostaddress : public address {
+
+  public:
+	virtual hostaddress* new_instance() const;
+	virtual hostaddress* copy() const;
+	virtual bool operator==(const address& ie) const;
+
+	/// constructor
+	hostaddress();
+	/// copy constructor
+	hostaddress(const hostaddress& h);
+	/// assignment
+	hostaddress& operator=(const hostaddress& h);
+	/// constructor from string
+	hostaddress(const char *str, bool *res = NULL);
+	/// constructor from in6_addr
+	hostaddress(const struct in6_addr& ipv6addr);
+	/// destructor
+	virtual ~hostaddress();
+	/// set IPv4 from string
+	bool set_ipv4(const char *str);
+	/// set IPv4 from in_addr
+	void set_ip(const struct in_addr &in);
+	/// set IPv6 from string
+	bool set_ipv6(const char *str);
+	/// set IPv6 from in6_addr
+	void set_ip(const struct in6_addr &in);
+	/// set IPv4 or IPv6 from string
+	bool set_ip(const char *str);
+	bool set_ip(const string& str);
+	/// set IP from hostaddress
+	void set_ip(const hostaddress& h);
+	/// is IP unspecified
+	bool is_ip_unspec() const;
+	/// get ip address as string
+	const char *get_ip_str() const;
+	/// get ip address as string
+	const char *get_ip_str(char *str) const;
+	/// is it IPv4
+	bool is_ipv4() const;
+	/// is it IPv6
+	bool is_ipv6() const;
+	/// is bogus source (e.g. localhost, multicast)
+	bool is_bogus_source() const;
+	/// is it a 4to6-mapped address?
+	bool is_mapped_ip() const;
+	/// get as in_addr?
+	bool get_ip(struct in_addr& in) const;
+	/// get as in6_addr?
+	bool get_ip(struct in6_addr& in) const;
+	/// get as in6_addr?
+	const struct in6_addr *get_ip() const { return ipv4flag ? 0 : &ipv6addr; };
+	/// convert to iPv6
+	virtual void convert_to_ipv6();
+	/// are they equivalent
+	virtual bool equiv(const hostaddress& h) const;
+	/// lookup host name
+	string get_host_name(bool *res = NULL) const;
+	/// hash function
+	virtual size_t get_hash() const;
+	/// match against IP address
+	virtual int match_against(const hostaddress& ha) const;
+        /// match against network prefix
+	virtual int match_against(const netaddress& na) const;
+protected:
+	/// IPv4 flag
+	bool ipv4flag;
+	/// set subtype and IPv4 flag
+	virtual void set_subtype(bool ipv4);
+	/// IP buffer
+	/** I in protected and NOT private scope because subclasses have to
+	 * (de)serialize it.
+	 */
+	union {
+		/// IPv4 address
+		struct in_addr ipv4addr;
+		/// IPv6 address
+		struct in6_addr ipv6addr;
+	}; // end union
+public:
+	/// clear IP buffer (sets IP address to undefined/any and deletes any outstring)
+	void clear_ip();
+private:
+	/// pointer to IP string representation
+	mutable char *outstring;
+}; // end hostaddress
+
+inline ostream &operator<<(ostream &out, const hostaddress &addr) {
+     return out << addr.get_ip_str();
+}
+
+inline
+hostaddress::hostaddress(const struct in6_addr& ipv6addr)
+  : address(IPv6HostAddress),
+    ipv4flag(false),
+    ipv6addr(ipv6addr),
+    outstring(NULL)
+{ set_subtype(false); }
+
+
+/// ========================================================
+/// IP Application Address
+/// ========================================================
+/** Consists of a IP Host Address and a port number. */
+class appladdress : public hostaddress {
+    public:
+	virtual appladdress* new_instance() const;
+	virtual appladdress* copy() const;
+	virtual bool operator==(const address& ie) const;
+
+	/// hash function
+	virtual size_t get_hash() const;
+
+    protected:
+	/// set subtype and IPv4 flag
+	virtual void set_subtype(bool ipv4);
+
+    public:
+	/// constructor
+	appladdress();
+	/// copy constructor
+	appladdress(const appladdress& app);
+	///constructor for use as Unix Domain Address
+	appladdress(string socket);
+	///constructor for use to specify a explicit socket number (used when no addressing for peer can be derived)
+	appladdress(int socket);
+        /// constructor from hostaddress, protocol ID and port
+	appladdress(const hostaddress& h, protocol_t prot, port_t p);
+	/// constructor from sockaddr_in6 sockaddr
+	appladdress(const sockaddr_in6& sockaddr,  protocol_t prot);
+	/// constructor from hostaddress, protocol name and port
+	appladdress(const hostaddress& h, const char* pname, port_t p, bool *res = NULL);
+	/// constructor from string, protocol ID and port
+	appladdress(const char* str, protocol_t prot, port_t p, bool *res = NULL);
+	/// constructor from string, protocol name and port
+	appladdress(const char* str, const char* pname, port_t p, bool *res = NULL);
+	/// constructor from string, protocol name and port name
+	appladdress(const char* str, const char* pname, const char* portname, bool *res = NULL);
+	/// assignment
+	appladdress& operator=(const appladdress& app);
+        /// virtual destructor
+        virtual ~appladdress() {};
+
+
+	/// are they equivalent
+        ///virtual bool equiv(const appladdress& h) const { return hostaddress::equiv(h); }
+
+	/// set port
+	port_t set_port(port_t p);
+	/// set port
+	port_t set_port(const char* pname, bool *res = NULL);
+	/// set port
+	port_t set_port(const string& pname, bool *res = NULL);
+	/// get port
+	port_t get_port() const;
+
+	/// get sockaddr_in6
+	void get_sockaddr(struct sockaddr_in6& sockaddr) const;
+	/// get port name
+	string get_port_name(bool *res = NULL) const;
+	/// set protocol by ID
+	protocol_t set_protocol(protocol_t p);
+	/// set protocol by name
+	protocol_t set_protocol(const char* pname, bool *res = NULL);
+	/// set protocol by name
+	protocol_t set_protocol(const string& pname, bool *res = NULL);
+	/// get protocol ID
+	protocol_t get_protocol() const;
+	/// get protocol name
+	string get_protocol_name(bool *res = NULL) const;
+	/// get prefix
+	inline
+	uint8 get_prefix() const {
+	    return prefix;
+	}
+
+	/// set prefix
+	inline
+	void set_prefix(uint8 prfx) {
+	    prefix=prfx;
+	}
+
+	/// set IP TTL
+	inline
+	void set_ip_ttl(uint16 ttl) {
+	    ip_ttl = ttl;
+	}
+
+
+	/// unset IP TTL
+	inline
+	void unset_ip_ttl() {
+	    ip_ttl = 0;
+	}
+
+
+	/// get IP TTL, if == 0, no IP TTL should be set
+	inline
+	uint16 get_ip_ttl() const {
+	return ip_ttl;
+	}
+
+
+	/// set RAO value
+	inline
+	void set_rao(uint16 value) {
+	    rao_presence = true;
+	    rao = value;
+	}
+
+	/// unset RAO value
+	inline
+	void unset_rao() {
+	    rao_presence = false;
+	    rao = 0;
+	}
+
+	/// get RAO value
+	inline
+	uint16 get_rao() const {
+	    return rao;
+	}
+
+
+	/// test if RAO present
+	inline
+	bool rao_present() const {
+	return rao_presence;
+	}
+
+	/// set outgoing Interface index
+	inline
+	void set_if_index(uint16 value) {
+	if_index = value;
+	}
+
+	/// get outgoing Interface index
+	inline
+	uint16 get_if_index() const {
+	    return if_index;
+	}
+
+	/// unset outgoing Interface index
+	inline
+	void unset_if_index() {
+	    if_index = 0;
+	}
+
+
+
+
+
+    private:
+	protocol_t proto;
+	port_t port;
+	uint8 prefix;
+
+	uint16 rao;
+	uint16 ip_ttl;
+	bool rao_presence;
+	uint16 if_index;
+
+    }; // end appladdress
+
+
+inline
+appladdress::appladdress(const sockaddr_in6& sockaddr, protocol_t prot)
+    : hostaddress(sockaddr.sin6_addr), proto(prot), port(ntohs(sockaddr.sin6_port)), rao(0), ip_ttl(0), rao_presence(false), if_index(0)
+{
+  //Log(DEBUG_LOG,LOG_NORMAL,"address","address constructor called for sockaddr_in6");
+}
+
+/** Constructor sets address type and clears port sets prefix to 32 (ipv4). */
+inline
+appladdress::appladdress() : hostaddress(),
+			     proto(0),
+			     port(0),
+			     prefix(32),
+     			     rao(0),
+			     ip_ttl(0),
+			     rao_presence(false),
+			     if_index(0)
+
+{
+  //Log(DEBUG_LOG,LOG_NORMAL,"address","address constructor called for bool ipv4=" << ipv4);
+  set_subtype(ipv4flag);
+} // end constructor
+
+inline
+appladdress::appladdress(const appladdress& app) : hostaddress(app),
+						   proto(app.proto),
+						   port(app.port),
+						   prefix(app.prefix),
+						   rao(app.rao),
+						   ip_ttl(app.ip_ttl),
+						   rao_presence(app.rao_presence),
+						   if_index(app.if_index)
+
+{
+    //Log(DEBUG_LOG,LOG_NORMAL,"appladdress", "Copy address constructor called for appladdress& app:" << app);
+    //DLog("appladdress", "UDSsocket copied: " << uds_socket);
+  //DLog("appladdress", "ip_ttl: " << ip_ttl << " if_index: " << if_index);
+
+
+    set_subtype(ipv4flag);
+} // end copy constructor
+
+/** Initialize with the given host address, protocol ID and port number. */
+inline
+appladdress::appladdress(const hostaddress& h, protocol_t prot, port_t p)
+    : hostaddress(h),
+      proto(prot),
+      port(p),
+      prefix(0),
+      rao(0),
+      ip_ttl(0),
+      rao_presence(false),
+      if_index(0)
+{
+  //Log(DEBUG_LOG,LOG_NORMAL,"address","address constructor called for (const hostaddress& h, protocol_t prot, port_t p)");
+
+  set_subtype(ipv4flag);
+} // end constructor(hostaddress,prot,port)
+
+/** Initialize with the given host address, protocol name and port number.
+ * If no protocol ID can be found in the protocol database, it is set to 0.
+ */
+inline
+appladdress::appladdress(const hostaddress& h, const char* pname, port_t p, bool *res)
+  : hostaddress(h),
+    proto(tsdb::getprotobyname(pname,res)),
+    port(p),
+    prefix(0),
+    rao(0),
+    ip_ttl(0),
+    rao_presence(false),
+    if_index(0)
+
+{
+  //Log(DEBUG_LOG,LOG_NORMAL,"address","address constructor called for (const hostaddress& h, const char* pname, port_t p, bool *res)");
+
+    set_subtype(ipv4flag);
+} // end constructor(hostaddress,pname,port)
+
+/** Initialize from string, protocol ID and port.
+ * If the string does not contain a vaild IP address, it is set to all 0 by
+ * the hostaddress constructor.
+ */
+inline
+appladdress::appladdress(const char* str, protocol_t prot, port_t p, bool *res)
+  : hostaddress(str,res),
+    proto(prot),
+    port(p),
+    prefix(0),
+    rao(0),
+    ip_ttl(0),
+    rao_presence(false),
+    if_index(0)
+{
+    set_subtype(ipv4flag);
+} // end constructor(string,prot,port)
+
+/** Initialize from string, protocol name and port.
+ * If the string does not contain a vaild IP address, it is set to all 0 by
+ * the hostaddress constructor.
+ * If no protocol ID can be found in the protocol database, it is set to 0.
+ */
+inline
+appladdress::appladdress(const char* str, const char* pname, port_t p, bool *res)
+  : hostaddress(str,res),
+    port(p),
+    prefix(0),
+    rao(0),
+    ip_ttl(0),
+    rao_presence(false),
+    if_index(0)
+{
+  //Log(DEBUG_LOG,LOG_NORMAL,"address","address constructor called for (const char* str, const char* pname, port_t p, bool *res)");
+
+    register bool tmpres = false;
+    proto = tsdb::getprotobyname(pname,&tmpres);
+    if (res) *res = ((*res) && tmpres);
+    set_subtype(ipv4flag);
+} // end constructor(string,pname,port)
+
+/** Initialize from string, protocol name and port name.
+ * If the string does not contain a vaild IP address, it is set to all 0 by
+ * the hostaddress constructor.
+ * If no protocol ID can be found in the protocol database, it is set to 0.
+ * If no port number can be found in the service database, it is set to 0.
+ */
+inline
+appladdress::appladdress(const char* str, const char* pname, const char* portname, bool *res)
+    : hostaddress(str,res),
+      prefix(0),
+      rao(0),
+      ip_ttl(0),
+      rao_presence(false),
+      if_index(0)
+{
+  //Log(DEBUG_LOG,LOG_NORMAL,"address","address constructor called for (const char* str, const char* pname, const char* portname, bool *res)");
+
+    bool res1 = false;
+    bool res2 = false;
+    proto = tsdb::getprotobyname(pname,&res1);
+    port = tsdb::get_portnumber(portname,proto,&res2);
+    if (res) *res = ((*res) && res1 && res2);
+    set_subtype(ipv4flag);
+    prefix = 0;
+} // end constructor(string,pname,portname)
+
+/** Assigns the given application address by using hostaddress::operator=(). */
+inline
+appladdress&
+appladdress::operator=(const appladdress& app)
+{
+	hostaddress::operator=(app);
+	proto = app.proto;
+	port = app.port;
+	prefix = app.prefix;
+	ip_ttl = app.ip_ttl;
+	rao_presence = app.rao_presence;
+	rao = app.rao;
+	if_index = app.if_index;
+	return *this;
+} // end operator=
+
+
+/** Set port and return old value. */
+inline
+port_t appladdress::set_port(port_t p) {
+	register port_t op = port;
+	port = p;
+	return op;
+} // end set_port
+
+
+
+/** Set port and return old value.
+ * If the port name is not found in the service database, port is set to 0.
+ */
+inline
+port_t appladdress::set_port(const char* pname, bool *res) {
+	register port_t op = port;
+	port = tsdb::get_portnumber(pname,proto,res);
+	return op;
+} // end set_port
+
+/** Set port and return old value.
+ * If the port name is not found in the service database, port is set to 0.
+ */
+inline
+port_t appladdress::set_port(const string& pname, bool *res) {
+	register port_t op = port;
+	port = tsdb::get_portnumber(pname,proto,res);
+	return op;
+} // end set_port
+
+inline
+port_t appladdress::get_port() const { return port; }
+
+inline
+string appladdress::get_port_name(bool *res) const {
+	return tsdb::get_portname(port,proto,res);
+} // end get_port_name
+
+/** Set protocol ID and return old value. */
+inline
+protocol_t appladdress::set_protocol(protocol_t p) {
+	register protocol_t o = proto;
+	proto = p;
+	return o;
+} // end set_protocol
+
+/** Set protocol ID and return old value.
+ * If no protocol ID can be found in the protocol database, it is set to 0.
+ */
+inline
+protocol_t appladdress::set_protocol(const char* pname, bool *res) {
+	register protocol_t o = proto;
+	proto = tsdb::getprotobyname(pname,res);
+	return o;
+} // end set_protocol
+
+/** Set protocol ID and return old value.
+ * If no protocol ID can be found in the protocol database, it is set to 0.
+ */
+inline
+protocol_t appladdress::set_protocol(const string& pname, bool *res) {
+	register protocol_t o = proto;
+	proto = tsdb::getprotobyname(pname,res);
+	return o;
+} // end set_protocol
+
+inline
+protocol_t appladdress::get_protocol() const { return proto; }
+
+inline
+string appladdress::get_protocol_name(bool *res) const {
+	return tsdb::getprotobynumber(proto,res);
+} // end get_protocol_name
+
+inline
+size_t appladdress::get_hash() const {
+	uint32 tmp = (proto<<16)+port;
+	return (hostaddress::get_hash() ^ tmp);
+} // end get_hash
+
+inline
+void
+appladdress::get_sockaddr(struct sockaddr_in6& sa) const
+{
+  if (!ipv4flag)
+  {
+    sa.sin6_family= PF_INET6;
+    sa.sin6_port  = htons(port);
+    sa.sin6_addr  = ipv6addr;
+  }
+}
+
+/// Network Prefix (or net address)
+/** Holds an IP address and a prefix length in bits. */
+class netaddress : public hostaddress {
+/***** inherited from IE ****/
+public:
+	virtual netaddress* new_instance() const;
+	virtual netaddress* copy() const;
+	virtual bool operator==(const address& ie) const;
+
+	/// convert to iPv6
+	virtual void convert_to_ipv6();
+	/// hash function
+	virtual size_t get_hash() const;
+	virtual int match_against(const netaddress& na) const;
+protected:
+	/// set subtype and IPv4 flag
+	virtual void set_subtype(bool ipv4);
+/***** new members *****/
+public:
+	/// constructor
+	netaddress();
+	/// copy constructor
+	netaddress(const netaddress& na);
+	/// constructor from hostaddress and prefix length
+	netaddress(const hostaddress& h, prefix_length_t len = 128);
+	/// constructor from string
+	netaddress(const char* str, bool *res = NULL);
+	/// constructor from string and prefix length
+	netaddress(const char* str, prefix_length_t len, bool *res = NULL);
+	/// assignment
+	netaddress& operator=(const netaddress& na);
+	/// assignment
+	netaddress& operator=(const hostaddress& ha);
+
+	// set prefix length
+	prefix_length_t set_pref_len(prefix_length_t len);
+	// get prefix length
+	prefix_length_t get_pref_len() const;
+	/// comparison for prefixmap
+	bool operator<(const netaddress& na) const;
+
+	int rdx_cmp(const netaddress *na, int *pos) const;
+private:
+	prefix_length_t prefix_length;
+}; // end netaddress
+
+inline ostream &operator<<(ostream &out, const netaddress &addr) {
+     return out << addr.get_ip_str() << "/" << (int)addr.get_pref_len();
+}
+
+/// Unix Domain Socket Address
+/** This class can hold a Unix Domain Socket Address OR a Socket Number. */
+class udsaddress : public address {
+
+  public:
+    virtual udsaddress* new_instance() const;
+    virtual udsaddress* copy() const;
+    virtual bool operator==(const address& ie) const;
+
+    /// constructor
+    udsaddress() : address(UDSAddress) { uds_socket = ""; socknum=0;};
+    /// copy constructor
+    udsaddress(const udsaddress& h) : address(UDSAddress) { uds_socket = string(h.uds_socket.c_str()); socknum = h.socknum; };
+    /// assignment
+    udsaddress& operator=(const udsaddress& uds) {
+	uds_socket = string(uds.uds_socket);
+	socknum = uds.socknum;
+	return *this;
+    };
+    /// constructor from string
+    udsaddress(string sockstring): address(UDSAddress) { uds_socket = string(sockstring.c_str()); socknum=0; };
+    /// constructor from int
+    udsaddress(int num): address(UDSAddress) { socknum = num; uds_socket=""; };
+    /// constructor from both
+    udsaddress(string sockstring, int num): address(UDSAddress) { socknum = num; uds_socket=string(sockstring.c_str()); };
+    /// destructor
+    virtual ~udsaddress() {};
+
+    /// hash function
+    virtual size_t get_hash() const;
+
+private:
+    /// uds socket string
+    string uds_socket;
+    /// socket number
+    int socknum;
+
+public:
+
+/** Set UDS socket path. */
+inline
+void set_udssocket(string socket) {
+    uds_socket = socket;
+} // end set_uds socket path
+
+
+/** Get UDS socket path. */
+inline
+const string get_udssocket() const {
+    return uds_socket;
+} // end get_udspath
+
+
+/** Set Socket Number */
+inline
+void set_socknum(int socket) {
+    socknum = socket;
+} // end set_socknum
+
+/** Get Socket Number */
+inline
+const int get_socknum() const {
+    return socknum;
+} // end get_socknum
+
+
+
+}; // end udsaddress
+
+template <typename _dT>
+class RadixTrie {
+public:
+	typedef _dT	data_type;
+
+	struct node {
+		node(netaddress *k, data_type *d) : key(k), data(d) {
+			left = right = this;
+			index = 0;
+		}
+		~node() {
+			if (data)
+				delete data;
+			if (key)
+				delete key;
+			if (left != 0 && left->index > index)
+				delete left;
+			if (right != 0 && right->index > index)
+				delete right;
+		}
+		node			*left;
+		node			*right;
+		netaddress		*key;
+		data_type		*data;
+		int			 index;
+	};
+
+	RadixTrie() {
+		netaddress *def;
+		def = new netaddress("0.0.0.0", (prefix_length_t)0);
+		v4head = new node(def, 0);
+		def = new netaddress("::", (prefix_length_t)0);
+		v6head = new node(def, 0);
+	}
+
+	~RadixTrie() {
+		delete v4head;
+		delete v6head;
+	}
+
+	node *insert(netaddress &key, data_type &dat) {
+		node *a, *b, *c, *n, *m;
+		int cmp, pos = 0;
+
+		c = a = key.is_ipv4() ? v4head : v6head;
+
+		// search the tree as long as there are bits left in key
+		while (key.get_pref_len() > a->index) {
+
+			// compare key to key in node a from position a->index
+			pos = a->index - 1;
+			cmp = key.rdx_cmp(a->key, &pos);
+			if (pos < 0)
+				abort();
+
+			// in case of a perfect match
+			if ((cmp == 0) &&
+			    (a->key->get_pref_len() == key.get_pref_len())) {
+			    // replace data in node
+				if (a->data)
+					delete a->data;
+				a->data = &dat;
+				return a;
+			}
+
+			if (cmp == 0)
+				break;
+
+			// select node to continue the search based on the
+			// first different bit between a and key
+			b = cmp < 0 ? a->left : a->right;
+
+			// we reached a dead end
+			if (b->index <= a->index)
+				break;
+
+			// the first difference was before a's bitmask ended
+			// we must not make any more progress
+			if (pos <= a->key->get_pref_len())
+				break;
+
+			c = a;
+			a = b;
+		}
+
+		// first check if a and key share a common prefix
+		if ((key.get_pref_len() == a->key->get_pref_len()) ||
+		   (pos > a->index && pos <= a->key->get_pref_len())) {
+		   	int opos = pos;
+
+		   	// make sure we didn't just miss the perfect match
+			pos = a->index;
+			cmp = key.rdx_cmp(a->key, &pos);
+			if (cmp == 0 &&
+			    (a->key->get_pref_len() == key.get_pref_len())) {
+			    // replace data in node
+				if (a->data)
+					delete a->data;
+				a->data = &dat;
+				return a;
+			}
+
+		   	// create a node with that prefix
+		   	pos = opos;
+			n = new node(new netaddress(key), 0);
+			n->key->set_pref_len(pos - 1);
+
+			// hook it to the previous node(c)
+			pos = c->index;
+			cmp = n->key->rdx_cmp(c->key, &pos);
+			n->index = pos;
+			if (n->index <= c->index) {
+				cout << "DEAD NODE INSERTION!!!" << endl;
+				abort();
+			}
+			if (cmp < 0) {
+				if (c->left != a) {
+					cout << "TREE CORRUPTION!!!" << endl;
+					abort();
+				}
+				c->left = n;
+			} else {
+				if (c->right != a) {
+					cout << "TREE CORRUPTION!!!" << endl;
+					abort();
+				}
+				c->right = n;
+			}
+
+			// hook the current node(a) to the common prefix
+			// node(n)
+			pos = n->index;
+			cmp = a->key->rdx_cmp(n->key, &pos);
+			a->index = pos;
+			if (a->index <= n->index) {
+				cout << "DEAD NODE INSERTION!!!" << endl;
+				abort();
+			}
+			if (cmp < 0)
+				n->left = a;
+			else
+				n->right = a;
+
+			// create a new node(m) for the insert
+			m = new node(new netaddress(key), &dat);
+			// hook node(m) to the common prefix node(n)
+			pos = n->index;
+			cmp = m->key->rdx_cmp(n->key, &pos);
+			m->index = pos;
+			if (cmp < 0) {
+				if (n->left == a) {
+					cout << "OVERWRITE!!!" << endl;
+					abort();
+				}
+				n->left = m;
+			} else {
+				if (n->right == a) {
+					cout << "OVERWRITE!!!" << endl;
+					abort();
+				}
+				n->right = m;
+			}
+
+			return m;
+		}
+
+		// c is a prefix of key, key is a prefix of a
+		if (a->index >= pos) {
+			// create a new node for the key
+			n = new node(new netaddress(key), &dat);
+			// hook it to the previous node(c)
+			n->index = pos;
+			if (n->index <= c->index) {
+				cout << "DEAD NODE INSERTION!!!" << endl;
+				abort();
+			}
+			if (cmp < 0) {
+				if (c->left != a) {
+					cout << "TREE CORRUPTION!!!" << endl;
+					abort();
+				}
+				c->left = n;
+			} else {
+				if (c->right != a) {
+					cout << "TREE CORRUPTION!!!" << endl;
+					abort();
+				}
+				c->right = n;
+			}
+
+			// hook the current node(a) to the newly created
+			// node(n)
+			pos = n->index;
+			cmp = a->key->rdx_cmp(n->key, &pos);
+			a->index = pos;
+			if (a->index <= c->index) {
+				cout << "DEAD NODE INSERTION!!!" << endl;
+				abort();
+			}
+			if (cmp < 0)
+				n->left = a;
+			else
+				n->right = a;
+
+			return n;
+		}
+
+		// reached a deadend, simply add a new node
+		n = new node(new netaddress(key), &dat);
+		n->index = pos;
+		if (n->index <= a->index) {
+			cout << "DEAD NODE INSERTION!!!" << endl;
+			abort();
+		}
+		if (b->index <= a->index) {
+			if (cmp < 0)
+				a->left = n;
+			else
+				a->right = n;
+		} else {
+			cout << "TREE CORRUPTION!!!" << endl;
+			abort();
+		}
+
+		return n;
+	}
+
+	node *lookup_node(netaddress &key, bool lpfm = true,
+	    bool with_data = true) {
+		node *a, *b, *c, *lpfn;
+		int cmp, pos = 0;
+
+		lpfn = 0;
+		c = b = a = key.is_ipv4() ? v4head : v6head;
+		if (lpfm) {
+			if (!with_data)
+				lpfn = a;
+			else if (a->data)
+				lpfn = a;
+		}
+
+		// search the tree as long as there are bits left in key
+		while (key.get_pref_len() > a->index) {
+
+			// compare key to key in node a from pos
+			pos--;
+			cmp = key.rdx_cmp(a->key, &pos);
+
+			// all of key consumed
+			if (cmp == 0) {
+				// key is less specific than a
+				if (key.get_pref_len() <
+				    a->key->get_pref_len())
+					return lpfm ? lpfn : NULL;
+
+				// key is an exact match for a
+				if (key.get_pref_len() >=
+				    a->key->get_pref_len()) {
+					if (!with_data)
+						return a;
+					if (a->data)
+						return a;
+					return lpfm ? lpfn : NULL;
+				}
+			}
+
+			// all of a consumed -> a is a prefix of key
+			if (pos > a->key->get_pref_len()) {
+				if (!with_data)
+					lpfn = a;
+				else if (a->data)
+					lpfn = a;
+			}
+
+			// select node to continue the search based on the
+			// first different bit between a and key
+			b = cmp < 0 ? a->left : a->right;
+
+			// we reached a dead end
+			if (b->index <= a->index)
+				break;
+
+			c = a;
+			a = b;
+		}
+
+		return lpfm ? lpfn : NULL;
+	}
+
+	data_type *lookup(netaddress &key, bool lpfm = true) {
+		node *n = lookup_node(key, lpfm);
+
+		return n ? n->data : NULL;
+	}
+
+	bool remove(netaddress &key) {
+		node *n = lookup_node(key);
+
+		if (n && n->data) {
+			delete n->data;
+			n->data = NULL;
+		}
+
+		return (n != 0);
+	}
+
+	bool remove_all(netaddress &key) {
+		node *n = lookup_node(key, false, false);
+
+		if (n == 0)
+			return false;
+
+		if (n->data) {
+			delete n->data;
+			n->data = NULL;
+		}
+
+		if (n->left->index > n->index) {
+			delete n->left;
+			n->left = n;
+		}
+		if (n->right->index > n->index) {
+			delete n->right;
+			n->right = n;
+		}
+
+		return true;
+	}
+
+	void print() {
+		cout << "v4_TREE: " << endl;
+		print_node(v4head);
+		cout << "v6_TREE: " << endl;
+		print_node(v6head);
+	}
+
+	void print_node(node *x, bool decent = true) {
+		if (x && x->key) {
+			cout << "node: " << x << " key: " <<  *x->key;
+			if (x->data != 0)
+				cout << " data: " << x->data;
+			else
+				cout << " data: NULL";
+			cout << " index: " << x->index << endl;
+			cout << "\tleft: " << x->left << " right: " << x->right << endl;
+			if (decent) {
+				if (x->left->index > x->index)
+					print_node(x->left);
+				if (x->right->index > x->index)
+					print_node(x->right);
+			}
+		}
+	}
+
+private:
+	struct node *v4head;
+	struct node *v6head;
+};
+
+
+/*
+ * AddressList
+ */
+
+class AddressList {
+public:
+	class AddrProperty {
+		public:
+			AddrProperty(const char *name) {
+				pname = new string(name);
+			}
+			~AddrProperty() {
+				delete pname;
+			};
+
+			string *pname;
+	};
+
+	// Default properties, N.B. Ignore will remove all other properties
+	static AddrProperty *LocalAddr_P;
+	static AddrProperty *ConfiguredAddr_P;
+
+private:
+	// This is special
+	static AddrProperty *IgnoreAddr_P;
+	static AddrProperty *AnyAddr_P;
+
+public:
+	struct ltstr {
+		bool operator()(const char* s1, const char* s2) const
+		{ return strcmp(s1, s2) < 0; }
+	};
+	struct ltna {
+		bool operator()(const netaddress &s1, const netaddress &s2)
+		    const {
+		    	if (s1.is_ipv4() != s2.is_ipv4())
+		    		return (s1.is_ipv4());
+			int cmp, pos = 0;
+			cmp = s1.rdx_cmp(&s2, &pos);
+			return (cmp < 0);
+		}
+
+	};
+	typedef set<char *, ltstr>	iflist_t;
+	typedef set<netaddress, ltna>	addrlist_t;
+
+	AddressList();
+	~AddressList();
+
+	// Configure by interfaces
+	// Return a list of all local interfaces, which are monitored
+	iflist_t *get_interfaces();
+	// Begin interface list (otherwise the following have no effect)
+	// If start_empty is true use an empty list, otherwise add all
+	// currently configured interfaces
+	bool by_interface(bool start_empty = true);
+	// Add interface to monitoring
+	bool add_interface(char *name);
+	// Remove interface from monitoring
+	bool del_interface(char *name);
+
+	// Manage properties
+	// If 'all' is true operate on all matching addresses as well
+	bool add_property(netaddress &na, AddrProperty *p = ConfiguredAddr_P,
+	    bool propagate = true);
+	bool del_property(netaddress &na, AddrProperty *p = ConfiguredAddr_P,
+	    bool propagate = true);
+	inline bool purge_properties(netaddress &na, bool prop = true) {
+		return del_property(na, AnyAddr_P, prop);
+	};
+	bool add_host_prop(const char *name, AddrProperty *p = ConfiguredAddr_P);
+	bool del_host_prop(const char *name, AddrProperty *p = ConfiguredAddr_P);
+	inline bool purge_host_prop(const char *name) {
+		return del_host_prop(name, AnyAddr_P);
+	}
+
+	// Special property
+	bool ignore(netaddress &na, bool propagate = true);
+	bool unignore(netaddress &na, bool propagate = true);
+	bool ignore_bogons(void);
+	bool ignore_locals(void);
+	bool ignore_loopback(void);
+
+	// Check if the given address has the given property
+	bool addr_is(netaddress &na, AddrProperty *prop);
+	bool addr_is(const hostaddress &ha, AddrProperty *prop) {
+		netaddress na(ha);
+		return addr_is(na, prop);
+	}
+	// Check if the given address is in a network with the given property
+	bool addr_is_in(netaddress &na, AddrProperty *prop);
+	bool addr_is_in(const hostaddress &ha, AddrProperty *prop) {
+		netaddress na(ha);
+		return addr_is_in(na, prop);
+	}
+
+	addrlist_t *get_addrs(AddrProperty *prop = LocalAddr_P);
+	netaddress *get_first(AddrProperty *p = LocalAddr_P, bool IPv4 = true);
+
+	netaddress *get_src_addr(const netaddress &dest, uint32_t *prefs);
+private:
+	typedef map<AddrProperty *, bool>	propmap_t;
+	typedef RadixTrie<propmap_t>		addr2prop_t;
+
+	iflist_t *interfaces;
+	addr2prop_t prop_trie;
+
+	// Backends for public functions
+	void getifaddrs_iflist(iflist_t &list);
+	bool getifaddrs_is_local(netaddress &na);
+	void getifaddrs_get_addrs(addrlist_t &list);
+
+	void bequeath(addr2prop_t::node *head, AddrProperty *p,
+	    bool add = true);
+	void collect(addr2prop_t::node *head, AddrProperty *p,
+	    addrlist_t &list);
+	addr2prop_t::node *collect_first(addr2prop_t::node *head,
+	    AddrProperty *p);
+};
+
+inline ostream &operator<<(ostream &out, const AddressList::AddrProperty &prop) {
+	return out << *prop.pname;
+}
+
+
+/************************************* inline methods ***********************************/
+
+inline
+size_t
+hostaddress::get_hash() const
+{
+	return (ipv6addr.s6_addr32[0] ^ ipv6addr.s6_addr32[1] ^ ipv6addr.s6_addr32[2] ^ ipv6addr.s6_addr32[3]);
+} // end get_hash
+
+/***** new in hostaddress *****/
+
+
+/** Initialize a hostaddress object.
+ * This calls virtual member set_subtype and therefore sets subtype in all
+ * derived class which overwrite this member function correctly.
+ */
+inline
+hostaddress::hostaddress()
+	: address(IPv6HostAddress),
+	  ipv4flag(false),
+	  outstring(NULL)
+{
+  clear_ip();
+  set_subtype(false);
+} // end constructor hostaddress
+
+
+/** Assign h to this object. */
+inline
+hostaddress&
+hostaddress::operator=(const hostaddress& h) {
+	address::operator=(h);
+	this->set_ip(h);
+	if (outstring)
+	  delete outstring;
+        outstring= 0;
+	return *this;
+} // end operator=
+
+/** Copy constructor for hostaddress objects */
+inline
+hostaddress::hostaddress(const hostaddress& h) :
+  address(h),
+  outstring(NULL)
+{
+  this->set_ip(h);
+
+  //Log(DEBUG_LOG,LOG_NORMAL,"hostaddress","hostaddress constructor called for const hostaddress& h:"); // << h << " outstring:" << static_cast<void*>(outstring) << " h.outstring:" << static_cast<void*>(h.outstring));
+
+} // end copy constructor hostaddress
+
+/** Check if this is an IPv4 address. */
+inline
+bool
+hostaddress::is_ipv4() const {
+	return ipv4flag;
+} // end is_ipv4
+
+/** Check if this is an IPv6 address. */
+inline
+bool
+hostaddress::is_ipv6() const {
+	return (!ipv4flag);
+} // end is_ipv6
+
+/** Check if this is a 6to4 mapped address. */
+inline
+bool
+hostaddress::is_mapped_ip() const
+{
+  return (ipv4flag) ? false : IN6_IS_ADDR_V4MAPPED(ipv6addr.s6_addr);
+} // end is_mapped_ip
+
+inline
+bool
+hostaddress::set_ip(const string& str) { return set_ip(str.c_str()); }
+
+inline
+/** Delete outstring if it exists. */
+hostaddress::~hostaddress() {
+	if (outstring)
+	{
+	  delete[] outstring;
+	  outstring= 0;
+	}
+} // end destructor hostaddress
+
+/** Set IPv4 or IPv6 from string or leave object unchanged.
+ * This changes object type.
+ * @return true on success.
+ */
+inline
+bool
+hostaddress::set_ip(const char *str)
+{
+  return (!str) ? false :
+                 ( strchr(str,':') ? set_ipv6(str) : set_ipv4(str)); 	// which IP version?
+
+} // end set_ipv
+
+
+/** Lookup the host name associated with the current IP address. */
+inline
+string hostaddress::get_host_name(bool *res) const
+{
+  return  ipv4flag ? tsdb::get_hostname(ipv4addr,res) : tsdb::get_hostname(ipv6addr,res);
+} // end get_host_name
+
+/***** inherited from hostaddress *****/
+
+/** Set subtype and IPv4 flag. This does NOT clear the outstring buffer.
+ * Use clear_ip().
+ */
+inline
+void
+appladdress::set_subtype(bool ipv4)
+{
+	ipv4flag = ipv4;
+	subtype = (ipv4) ?  IPv4ApplAddress : IPv6ApplAddress;
+} // end set_subtype
+
+inline
+prefix_length_t netaddress::get_pref_len() const { return prefix_length; }
+
+inline
+size_t netaddress::get_hash() const {
+	return (hostaddress::get_hash() ^ prefix_length);
+} // end get_hash
+
+inline
+int
+netaddress::match_against(const netaddress& na) const
+{
+	// compare prefix lengths
+  return (prefix_length<na.prefix_length) ? -1 : hostaddress::match_against(na);
+} // end match_against
+
+
+inline
+ostream &operator<<(ostream &out, const appladdress &addr) {
+     if (addr.is_mapped_ip()) return out << "[IPv4-mapped address]: "  << addr.get_ip_str() << ":" << (int)addr.get_port() << ", " << addr.get_protocol_name();
+    return out << "[IP address]: " << addr.get_ip_str() << ":" << (int)addr.get_port() << ", " << addr.get_protocol_name();
+}
+
+inline
+ostream &operator<<(ostream &out, const udsaddress &addr) {
+    if (addr.get_socknum()) return out << "[Socketnumber]: " << addr.get_socknum();
+    return out << "[Unix Domain Socket]: " << addr.get_udssocket();
+}
+
+
+
+
+
+
+inline
+size_t udsaddress::get_hash() const {
+    size_t tmp2 = 1;
+	for (unsigned int i = 0; i<uds_socket.size(); i++) {
+	    tmp2 = tmp2 * (int) uds_socket[i];
+	}
+	return (tmp2 ^ socknum);
+} // end get_hash
+
+
+
+} // end namespace protlib
+
+/*********************************** hash functions ***********************************/
+
+namespace __gnu_cxx {
+/// hostaddress hasher
+template <> struct hash<protlib::hostaddress> {
+	inline size_t operator()(const protlib::hostaddress& addr) const { return addr.get_hash(); }
+}; // end hostaddress hasher
+
+/// appladdress hasher
+template <> struct hash<protlib::appladdress> {
+	inline size_t operator()(const protlib::appladdress& addr) const { return addr.get_hash(); }
+}; // end appladdress hasher
+
+/// udsaddress hasher
+template <> struct hash<protlib::udsaddress> {
+	inline size_t operator()(const protlib::udsaddress& addr) const { return addr.get_hash(); }
+}; // end udsaddress hasher
+
+
+
+
+/// netaddress hasher
+template <> struct hash<protlib::netaddress> {
+	inline size_t operator() (const protlib::netaddress& addr) const { return addr.get_hash(); }
+}; // end netaddress hasher
+
+} // end namespace __gnu_cxx
+
+
+namespace std {
+
+/// hostaddress equal_to
+template <> struct equal_to<protlib::hostaddress> {
+	inline bool operator()(const protlib::hostaddress& addr1, const protlib::hostaddress& addr2) const { return addr1.equiv(addr2); }
+}; // end hostaddress equal_to
+
+/// appladdress equal_to
+template <> struct equal_to<protlib::appladdress> {
+	inline bool operator()(const protlib::appladdress& addr1, const protlib::appladdress& addr2) const { return addr1.equiv(addr2); }
+}; // end appladdress equal_to
+
+/// netaddress equal_to
+template <> struct equal_to<protlib::netaddress> {
+	inline bool operator()(const protlib::netaddress& addr1, const protlib::netaddress& addr2) const { return addr1.equiv(addr2); }
+
+}; // end netaddress equal_to
+
+} // end namespace std
+#endif // PROTLIB__ADDRESS_H
Index: /source/ariba/communication/modules/transport/protlib/assocdata.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/assocdata.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/assocdata.h	(revision 2378)
@@ -0,0 +1,104 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file assocdata.h
+/// association data for signaling transport connnections
+/// -- AssocData structure to store data of a signaling associaton
+/// -- i.e., a socket-based signaling transport connection
+/// ----------------------------------------------------------
+/// $Id: assocdata.h 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/assocdata.h $
+// ===========================================================
+//
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+#ifndef ASSOC_DATA_H
+#define ASSOC_DATA_H
+
+#include "address.h"
+
+namespace protlib {
+
+/**
+  * @ingroup transport
+  * @{
+  */
+
+typedef int socketfd_t; ///< socket type interface
+typedef unsigned int associd_t; /// SCTP lib interface
+
+/// association data, used to keep all necessary information
+/// (socket, peer address, shutdown, touched) about a single connection
+struct AssocData {
+  AssocData(socketfd_t socketfd,
+	    const appladdress& peeraddress,
+	    const appladdress& ownaddress):
+    socketfd(socketfd),
+    assoc(0),
+    peer(peeraddress),
+    ownaddr(ownaddress),
+    thread_ID(0),
+    num_of_out_streams(0),
+    shutdown(false),
+    touched(true)
+  {};
+
+  AssocData(associd_t ass, const appladdress& ap, const appladdress& oa, uint32 streams)
+    : socketfd(0),
+      assoc(ass),
+      peer(ap),
+      ownaddr(oa),
+      thread_ID(0),
+      num_of_out_streams(streams),
+      shutdown(false),
+      touched(true)
+  {};
+
+  AssocData(associd_t ass, const char* apstr, protocol_t proto, port_t port, uint32 streams, bool& res)
+    : socketfd(0),
+      assoc(ass),
+      peer(apstr,proto,port,&res),
+      thread_ID(0),
+      num_of_out_streams(streams),
+      shutdown(false),
+      touched(true)
+  {};
+
+
+  const socketfd_t socketfd; ///< socket of signaling transport connection
+  const associd_t assoc; ///< required for SCTP
+
+  const appladdress peer; ///< address of the signaling peer
+  const appladdress ownaddr; ///< own endpoint address of the signaling connection
+
+  pthread_t thread_ID; ///< related receiver thread
+
+  const uint32 num_of_out_streams; ///< required for SCTP
+
+  // shutdown: connection is being shutdown, shutdown
+  // is not complete yet
+  bool shutdown;
+  // this is required for a second changce algorithm when cleaning up unused connections
+  bool touched;
+}; // end AssocData
+
+//@}
+
+} // end namespace protlib
+#endif
Index: /source/ariba/communication/modules/transport/protlib/assocdata_uds.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/assocdata_uds.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/assocdata_uds.h	(revision 2378)
@@ -0,0 +1,95 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file assocdata_uds.h
+/// association data for Unix Domain transport connnections
+/// -- AssocData structure to store data of a signaling associaton
+/// -- i.e., a socket-based signaling transport connection
+//
+/// ----------------------------------------------------------
+/// $Id: assocdata_uds.h 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/assocdata_uds.h $
+// ===========================================================
+//
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+#ifndef ASSOC_DATA_UDS_H
+#define ASSOC_DATA_UDS_H
+
+#include "address.h"
+
+
+namespace protlib {
+
+/** @ingroup transport
+  * @{
+  */
+
+typedef int socketfd_t; ///< socket type interface
+typedef unsigned int associd_t; /// SCTP lib interface
+
+/// association data, used to keep all necessary information
+/// (socket, peer address, shutdown, touched) about a single connection
+struct AssocDataUDS {
+  AssocDataUDS(socketfd_t socketfd,
+	    const udsaddress& peeraddress,
+	    const udsaddress& ownaddress):
+    socketfd(socketfd),
+    assoc(0),
+    peer(peeraddress),
+    ownaddr(ownaddress),
+    thread_ID(0),
+    num_of_out_streams(0),
+    shutdown(false),
+    touched(true)
+  {};
+
+  AssocDataUDS(associd_t ass, const udsaddress& ap, const udsaddress& oa, uint32 streams)
+    : socketfd(0),
+      assoc(ass),
+      peer(ap),
+      ownaddr(oa),
+      thread_ID(0),
+      num_of_out_streams(streams),
+      shutdown(false),
+      touched(true)
+  {};
+
+  const socketfd_t socketfd; ///< socket of signaling transport connection
+  const associd_t assoc; ///< required for SCTP
+
+  const udsaddress peer; ///< address of the signaling peer
+  const udsaddress ownaddr; ///< own endpoint address of the signaling connection
+
+  pthread_t thread_ID; ///< related receiver thread
+
+  const uint32 num_of_out_streams; ///< required for SCTP
+
+  // shutdown: connection is being shutdown, shutdown
+  // is not complete yet
+  bool shutdown;
+  // this is required for a second changce algorithm when cleaning up unused connections
+  bool touched;
+}; // end AssocDataUDS
+
+//@}
+
+} // end namespace protlib
+#endif
Index: /source/ariba/communication/modules/transport/protlib/cleanuphandler.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/cleanuphandler.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/cleanuphandler.h	(revision 2378)
@@ -0,0 +1,109 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file cleanuphandler.h
+/// preprocessor macros to install cleanup handlers for threads
+/// ----------------------------------------------------------
+/// $Id: cleanuphandler.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/cleanuphandler.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+/** @ingroup thread
+ *
+ * This header file defines a preprocessor macro to 
+ * install cleanup handlers.
+ *
+ * This cannot be done without macros because the pthread library also uses
+ * macros for cleanup.
+ * References to a common base class of all lockable classes also are not
+ * useful because they are casted to void* and cannot be casted back
+ * correctly after that in all cases, especially when pointers are 
+ * changed while casting. This happens when casting around in a type 
+ * hierarchy.
+ */
+
+#ifndef CLEANUP_HANDLER_H
+#define CLEANUP_HANDLER_H
+
+#include <pthread.h>
+
+namespace protlib { 
+
+/** @addtogroup thread Threads
+ * @{
+ */
+
+/// install cleanup handler
+/** This macro installs a cleanup handler
+ * and does some type casting.
+ * Use uninstall_cleanup(execute) or an apropriate unlock routine to unlock
+ * the mutex and uninstall the handler.
+ * @param f pointer to a cleanup handler routine. 
+ * This is casted to void (*routine)(void *)
+ * @param m cleanup handler argument, normally a pointer to the mutex.
+ * This is casted to void*.
+ */
+#define install_cleanup(f,m) pthread_cleanup_push((void (*)(void *)) f, (void *) m)
+
+/// install cleanup handler for mutex
+/** Calls install_cleanup and uses pthread_mutex_unlock as cleanup handler.
+ * @param m pointer to the mutex.
+ */
+#define install_cleanup_mutex(m) install_cleanup(pthread_mutex_unlock,m)
+
+/// lock mutex and install cleanup handler
+/** @param m mutex
+ */
+#define install_cleanup_mutex_lock(m) install_cleanup_mutex(m) pthread_mutex_lock(m)
+
+/// Lock thread and install cleanup handler
+/** @param ttype class name of thread object
+ * @param tp pointer to thread object
+ */
+#define install_cleanup_thread_lock(ttype,tp) install_cleanup(call_unlock<ttype>,tp) tp->lock()
+
+/// uninstall cleanup handler
+/** This uninstalls a cleanup handler and optionally executes it.
+ * @param exec 0 or 1
+ */
+#define uninstall_cleanup(exec) pthread_cleanup_pop(exec)
+
+/// unlock template
+/** This function calls the unlock method of an object.
+ * @param pobj pointer to the locked object.
+ */
+template <class T> void call_unlock(void* pobj) { 
+	T* t;
+	t = static_cast<T*>(pobj);
+	t->unlock();
+} // end call_unlock<T>
+
+/// call void function
+/** This function calls a function of type void f(void). */
+inline void call_void_fun(void (*f)()) { 
+	f();
+} // end call_void_fun
+
+//@}
+
+} // end namespace protlib
+#endif
Index: /source/ariba/communication/modules/transport/protlib/configuration.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/configuration.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/configuration.cpp	(revision 2378)
@@ -0,0 +1,604 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file configuration.cpp
+/// A configuration file parser
+/// ----------------------------------------------------------
+/// $Id: configuration.cpp 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/configuration.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+#include <iostream>
+#include <sstream>
+
+#include "configuration.h"
+
+
+using namespace natfw;
+
+
+// only used internally
+class parse_error : public std::exception {
+  public:
+        parse_error(const std::string &msg) throw () : msg(msg) { }
+	virtual ~parse_error() throw () { }
+
+        std::string get_msg() const throw () { return msg; }
+
+  private:
+        std::string msg;
+};
+
+
+/**
+ * Constructor.
+ */
+configuration::configuration(config_entry rules[]) {
+	for (unsigned i=0; rules[i].type != config_entry::T_END; i++)
+		values[ rules[i].key ] = rules[i];
+}
+
+
+/**
+ * Load a configuration file.
+ *
+ * If there's a parse error or the file can't be opened, a config_error
+ * exception is thrown.
+ *
+ * @param filename the file to load
+ */
+void configuration::load(const std::string &filename) throw (config_error) {
+
+	std::ifstream in(filename.c_str());
+
+	if ( ! in )
+		throw config_error("cannot open file `" + filename + "'");
+
+	try {
+		this->load(in);
+	}
+	catch ( config_error &e ) {
+		in.close();
+		throw;
+	}
+	catch ( ... ) {
+		in.close();
+		throw config_error("unknown exception thrown");
+	}
+
+	in.close();
+}
+
+
+/**
+ * Load configuration data from a stream.
+ *
+ * If there is a parse error, a config_error exception is thrown. This method
+ * will read until end of file. It is up to the caller to close the stream.
+ *
+ * @param in_stream the input stream to read data from
+ */
+void configuration::load(std::istream &in_stream) throw (config_error) {
+	using namespace std;
+
+	for (int line = 1; in_stream; line++) {
+		string buf;
+		string key;
+
+		getline(in_stream, buf);
+
+		stringstream in(buf);
+
+		// skip leading whitespace
+		strip_leading_space(in);
+
+		// skip empty lines and comments
+		if ( in.peek() == -1 || in.peek() == '#' )
+			continue;
+
+		// read the key
+		in >> key;
+		if ( key == "")
+			throw config_error("parse error", line);
+
+		if ( values.find(key) == values.end() )
+			throw config_error("invalid key `" + key + "'", line);
+
+		// skip space between key and '='
+		strip_leading_space(in);
+
+		char c = in.get();
+		if ( c != '=' )
+			throw config_error("parse error", line);
+
+		// skip space between '=' and value
+		strip_leading_space(in);
+
+		// no value for this key, we ignore it altogether
+		if ( in.peek() == -1 )
+			continue;
+
+		try {
+			parse_and_assign(key, in);
+		}
+		catch ( parse_error &e ) {
+			throw config_error(e.get_msg(), line);
+		}
+	}
+
+	if ( ! in_stream.eof() )
+		throw config_error("stream error");
+
+	// check if all required config settings are set.
+	for ( c_iter i = values.begin(); i != values.end(); i++ ) {
+		const config_entry &e = i->second;
+
+		if ( e.required && ! e.defined )
+			throw config_error(
+				"key `" + e.key + "' required but not set");
+	}
+}
+
+
+/**
+ * Write the configuration data to a stream.
+ *
+ * If there is a write error, a config_error exception is thrown. This method
+ * doesn't close the stream after writing. It is up to the caller to do that.
+ *
+ * @param out the output stream to read data from
+ */
+void configuration::dump(std::ostream &out) throw (config_error) {
+	using namespace std;
+
+	out << "# Configuration dump" << endl;
+
+	for ( c_iter i = values.begin(); i != values.end(); i++ ) {
+		const config_entry &e = i->second;
+
+		out << e.key << " = ";
+
+		if ( ! e.defined ) {
+			out << endl;
+			continue;
+		}
+
+		switch ( e.type ) {
+			case config_entry::T_BOOL:
+				out << e.bool_value << endl;
+				break;
+			case config_entry::T_INT:
+				out << e.int_value << endl;
+				break;
+			case config_entry::T_FLOAT:
+				out << e.float_value << endl;
+				break;
+			case config_entry::T_STR:
+				write_string(out, e.str_value);
+				out << endl;
+				break;
+			case config_entry::T_IPv4:
+				out << e.ipv4_value << endl;
+				break;
+			case config_entry::T_IPv6:
+				out << e.ipv6_value << endl;
+				break;
+			case config_entry::T_IPv4_LIST: // fall-through
+			case config_entry::T_IPv6_LIST:
+				dump_address_list(out, e.address_list);
+				out << endl;
+				break;
+			default:
+				assert( false );
+		}
+	}
+}
+
+
+void configuration::dump_address_list(std::ostream &out,
+		const std::list<hostaddress> &addresses) const {
+
+	typedef std::list<hostaddress>::const_iterator addr_iter;
+
+	for ( addr_iter i = addresses.begin(); i != addresses.end(); i++ )
+		out << *i << " ";
+}
+
+
+/**
+ * Test if the configuration contains the given value.
+ *
+ * @param key the name of the key
+ * @return true, if the configuraiton has that key
+ */
+bool configuration::is_defined(const std::string &key) const throw () {
+	c_iter i = values.find(key);
+
+	if ( values.find(key) == values.end() )
+		return false;
+	else
+		return i->second.defined;
+}
+
+
+/**
+ * Get a string configuration value.
+ *
+ * @param key the name of the key
+ * @return the value from the configuration
+ */
+std::string configuration::get_string(const std::string &key) const throw () {
+	c_iter i = values.find(key);
+	assert( i != values.end() );
+	assert( i->second.type == config_entry::T_STR );
+
+	return i->second.str_value;
+}
+
+
+/**
+ * Get a boolean configuration value.
+ *
+ * @param key the name of the key
+ * @return the value from the configuration
+ */
+bool configuration::get_bool(const std::string &key) const throw () {
+	c_iter i = values.find(key);
+	assert( i != values.end() );
+	assert( i->second.type == config_entry::T_BOOL );
+
+	return i->second.bool_value;
+}
+
+
+/**
+ * Get an integer configuration value.
+ *
+ * @param key the name of the key
+ * @return the value from the configuration
+ */
+int configuration::get_int(const std::string &key) const throw () {
+	c_iter i = values.find(key);
+	assert( i != values.end() );
+	assert( i->second.type == config_entry::T_INT );
+
+	return i->second.int_value;
+}
+
+
+/**
+ * Get a floating point configuration value.
+ *
+ * @param key the name of the key
+ * @return the value from the configuration
+ */
+float configuration::get_float(const std::string &key) const throw () {
+	c_iter i = values.find(key);
+	assert( i != values.end() );
+	assert( i->second.type == config_entry::T_FLOAT );
+
+	return i->second.float_value;
+}
+
+
+/**
+ * Get an IPv4 hostaddress configuration value.
+ *
+ * @param key the name of the key
+ * @return the value from the configuration
+ */
+hostaddress configuration::get_ipv4_address(
+		const std::string &key) const throw () {
+
+	c_iter i = values.find(key);
+	assert( i != values.end() );
+	assert( i->second.type == config_entry::T_IPv4 );
+
+	return i->second.ipv4_value;
+}
+
+
+/**
+ * Get an IPv6 hostaddress configuration value.
+ *
+ * @param key the name of the key
+ * @return the value from the configuration
+ */
+hostaddress configuration::get_ipv6_address(
+		const std::string &key) const throw () {
+
+	c_iter i = values.find(key);
+	assert( i != values.end() );
+	assert( i->second.type == config_entry::T_IPv6 );
+
+	return i->second.ipv6_value;
+}
+
+
+/**
+ * Get a list of IPv4 hostaddress objects.
+ *
+ * @param key the name of the key
+ * @return the list of values from the configuration
+ */
+std::list<hostaddress> configuration::get_ipv4_address_list(
+		const std::string &key) const throw () {
+
+	c_iter i = values.find(key);
+	assert( i != values.end() );
+	assert( i->second.type == config_entry::T_IPv4_LIST );
+
+	return i->second.address_list;
+}
+
+
+/**
+ * Get a list of IPv6 hostaddress objects.
+ *
+ * @param key the name of the key
+ * @return the list of values from the configuration
+ */
+std::list<hostaddress> configuration::get_ipv6_address_list(
+		const std::string &key) const throw () {
+
+	c_iter i = values.find(key);
+	assert( i != values.end() );
+	assert( i->second.type == config_entry::T_IPv6_LIST );
+
+	return i->second.address_list;
+}
+
+
+void configuration::strip_leading_space(std::istream &in) const {
+	while ( in && ( in.peek() == ' ' || in.peek() == '\t' ) )
+		in.get();
+}
+
+
+// Parse the given buffer and assign the value to the config entry
+void configuration::parse_and_assign(const std::string &key, std::istream &in) {
+
+	switch ( values[key].type ) {
+		case config_entry::T_BOOL:
+			values[key].bool_value = parse_bool(in);
+			break;
+		case config_entry::T_INT:
+			values[key].int_value = parse_int(in);
+			break;
+		case config_entry::T_FLOAT:
+			values[key].float_value = parse_float(in);
+			break;
+		case config_entry::T_STR:
+			values[key].str_value = parse_string(in);
+			break;
+		case config_entry::T_IPv4:
+			values[key].ipv4_value = parse_ipv4_address(in);
+			break;
+		case config_entry::T_IPv6:
+			values[key].ipv6_value = parse_ipv6_address(in);
+			break;
+		case config_entry::T_IPv4_LIST:
+			values[key].address_list = parse_ipv4_address_list(in);
+			break;
+		case config_entry::T_IPv6_LIST:
+			values[key].address_list = parse_ipv6_address_list(in);
+			break;
+		default:
+			assert( false );
+			throw parse_error("invalid value"); // not reached
+	}
+
+	// no exception thrown until now, so parsing was successful
+	values[key].defined = true;
+}
+
+
+// Write the string to the stream, adding quotation marks and escape sequences
+void configuration::write_string(
+		std::ostream &out, const std::string &str) const {
+
+	std::stringstream stream(str);
+
+	out << '"';
+
+	char c;
+	while ( stream.get(c) ) {
+		switch ( c ) {
+			case '\\':	// fallthrough
+			case '"':	out << '\\' << c; break;
+			default:	out << c;
+		}
+	}
+
+	out << '"';
+}
+
+
+// Matches pattern "[^"]*"\s*
+std::string configuration::parse_string(std::istream &in) const {
+
+	if ( in.get() != '"' )
+		throw parse_error("string doesn't start with a quotation mark");
+
+	bool escape = false;
+	std::string tmp;
+	char c;
+
+	while ( in.get(c) ) {
+		if ( escape ) {
+			if ( c == '\\' || c == '"' )
+				tmp += c;
+			else
+				throw parse_error("invalid escape sequence");
+
+			escape = false;
+		}
+		else {
+			if ( c == '"' )
+				break;
+			else if ( c == '\\' )
+				escape = true;
+			else
+				tmp += c;
+		}
+	}
+
+	// we should be on the closing quotation mark
+	if ( c != '"' )
+		throw parse_error("unterminated string");
+
+	skip_rest_of_line(in);
+
+	return tmp;
+}
+
+
+hostaddress configuration::parse_ipv4_address(std::istream &in) const {
+	std::string word;
+	in >> word;
+
+	bool success;
+	hostaddress addr(word.c_str(), &success);
+
+	if ( success || ! addr.is_ipv4() )
+		return addr;
+	else
+		throw parse_error("invalid IPv4 address");
+
+	skip_rest_of_line(in);
+
+	return addr;
+}
+
+
+hostaddress configuration::parse_ipv6_address(std::istream &in) const {
+	std::string word;
+	in >> word;
+
+	bool success;
+	hostaddress addr(word.c_str(), &success);
+
+	if ( success || ! addr.is_ipv6() )
+		return addr;
+	else
+		throw parse_error("invalid IPv6 address");
+
+	skip_rest_of_line(in);
+
+	return addr;
+}
+
+std::list<hostaddress> configuration::parse_ipv4_address_list(
+		std::istream &in) const {
+
+	std::list<hostaddress> result;
+
+	std::string tmp;
+	while ( in >> tmp ) {
+		bool success;
+		hostaddress addr(tmp.c_str(), &success);
+
+		if ( success && addr.is_ipv4() )
+			result.push_back(addr);
+		else
+			throw parse_error("invalid IPv4 address `" + tmp + "'");
+	}
+
+	return result;
+}
+
+std::list<hostaddress> configuration::parse_ipv6_address_list(
+		std::istream &in) const {
+
+	std::list<hostaddress> result;
+
+	std::string tmp;
+	while ( in >> tmp ) {
+		bool success;
+		hostaddress addr(tmp.c_str(), &success);
+
+		if ( success && addr.is_ipv6() )
+			result.push_back(addr);
+		else
+			throw parse_error("invalid IPv6 address `" + tmp + "'");
+	}
+
+	return result;
+}
+
+int configuration::parse_int(std::istream &in) const {
+	int tmp = -1;
+
+	in >> tmp;
+
+	if ( ! in.good() && ! in.eof() )
+		throw parse_error("parsing integer failed");
+
+	skip_rest_of_line(in);
+
+	return tmp;
+}
+
+
+float configuration::parse_float(std::istream &in) const {
+	float tmp = 0.0;
+
+	in >> tmp;
+
+	if ( ! in.good() && ! in.eof() )
+		throw parse_error("parsing float failed");
+
+	skip_rest_of_line(in);
+
+	return tmp;
+}
+
+
+bool configuration::parse_bool(std::istream &in) const {
+	std::string tmp;
+	bool value;
+
+	in >> tmp;
+
+	if ( tmp == "true" )
+		value = true;
+	else if ( tmp == "false" )
+		value = false;
+	else
+		throw parse_error("parsing boolean failed");
+
+	skip_rest_of_line(in);
+
+	return value;
+}
+
+
+// throw an exception if the rest of the line doesn't only contain whitespace
+void configuration::skip_rest_of_line(std::istream &in) const {
+	char c;
+	while ( in.get(c) ) {
+		if ( c != ' ' && c != '\t' )
+			throw parse_error("junk after value");
+	}
+}
+
+
+// EOF
Index: /source/ariba/communication/modules/transport/protlib/configuration.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/configuration.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/configuration.h	(revision 2378)
@@ -0,0 +1,179 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file configuration.h
+/// Handling of simple (key, value) configuration files
+/// ----------------------------------------------------------
+/// $Id: configuration.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/configuration.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+#ifndef NATFW__CONFIG_H
+#define NATFW__CONFIG_H
+
+#include <fstream>
+#include <map>
+#include <list>
+#include <exception>
+
+#include "address.h"
+
+namespace natfw {
+  using protlib::hostaddress;
+
+
+/**
+ * An exception to be thrown if an invalid configuration is read.
+ */
+class config_error : public std::exception {
+  public:
+	config_error(const std::string &msg="Unspecified configuration error",
+			int line=-1) throw () : msg(msg), line(line) { }
+	virtual ~config_error() throw () { }
+
+	std::string get_msg() const throw () { return msg; }
+	int get_line() const throw () { return line; }
+
+  private:
+	std::string msg;
+	int line;
+};
+
+inline std::ostream &operator<<(std::ostream &os, const config_error &err) {
+	if ( err.get_line() > 0 )
+		return os << err.get_msg() << " at line " << err.get_line();
+	else
+		return os << err.get_msg();
+}
+
+
+/**
+ * The specification of a configuration entry.
+ *
+ * This specifies the name of the key, the value type, and optionally an
+ * initial default value.
+ */
+class config_entry {
+  public:
+	enum type_t {
+		T_BOOL, T_INT, T_FLOAT, T_STR, T_IPv4, T_IPv6,
+		T_IPv4_LIST, T_IPv6_LIST, T_END
+	};
+
+	config_entry(std::string key, type_t type, bool required=true)
+		: key(key), type(type), required(required) { }
+
+	config_entry(std::string key, bool value)
+		: key(key), type(T_BOOL), bool_value(value) { }
+
+	config_entry(std::string key, int value)
+		: key(key), type(T_INT), int_value(value) { }
+
+	config_entry(std::string key, float value)
+		: key(key), type(T_FLOAT), float_value(value) { }
+
+	config_entry(std::string key, std::string value)
+		: key(key), type(T_STR), str_value(value) { }
+
+	config_entry() : type(T_END) { }
+
+  private:
+	std::string key;
+	type_t type;
+	bool required;
+	bool defined;
+
+	bool bool_value;
+	int int_value;
+	float float_value;
+	std::string str_value;
+	hostaddress ipv4_value;
+	hostaddress ipv6_value;
+	std::list<hostaddress> address_list; // for both IPv4 and IPv6
+
+	friend class configuration;
+};
+
+
+/**
+ * A class for handling simple configuration files.
+ *
+ * The configuration consists of (key, value) pairs, where both key and value
+ * are strings.
+ *
+ * A configuration file is line-oriented and has the following format:
+ *   [space] key [space] = [space] value [space] EOL
+ *
+ * Value can be a boolean value, an integer, a float, an IP address (either
+ * IPv4 or IPv6), or a string. String values have to be quoted using double
+ * quotes. If a double quote should appear in the string, you have to quote it
+ * using a backslash. A backslash in turn has to be quoted using another
+ * backslash.
+ *
+ * Lines starting with '#' and empty lines are ignored.
+ */
+class configuration {
+  public:
+	configuration(config_entry defaults[]);
+
+	void load(const std::string &filename) throw (config_error);
+	void load(std::istream &in) throw (config_error);
+	void dump(std::ostream &out) throw (config_error);
+
+	bool is_defined(const std::string &key) const throw ();
+
+	std::string get_string(const std::string &key) const throw ();
+	bool get_bool(const std::string &key) const throw ();
+	int get_int(const std::string &key) const throw ();
+	float get_float(const std::string &key) const throw ();
+	hostaddress get_ipv4_address(const std::string &key) const throw ();
+	hostaddress get_ipv6_address(const std::string &key) const throw ();
+
+	std::list<hostaddress> get_ipv4_address_list(
+		const std::string &key) const throw ();
+	std::list<hostaddress> get_ipv6_address_list(
+		const std::string &key) const throw ();
+
+  private:
+	typedef std::map<std::string, config_entry>::const_iterator c_iter;
+	std::map<std::string, config_entry> values;
+
+	void strip_leading_space(std::istream &in) const;
+	void skip_rest_of_line(std::istream &in) const;
+	void parse_and_assign(const std::string &key, std::istream &in);
+
+	bool parse_bool(std::istream &in) const;
+	int parse_int(std::istream &in) const;
+	float parse_float(std::istream &in) const;
+	std::string parse_string(std::istream &in) const;
+	hostaddress parse_ipv4_address(std::istream &in) const;
+	hostaddress parse_ipv6_address(std::istream &in) const;
+	std::list<hostaddress> parse_ipv4_address_list(std::istream &in) const;
+	std::list<hostaddress> parse_ipv6_address_list(std::istream &in) const;
+	void write_string(std::ostream &out, const std::string &str) const;
+	void dump_address_list(std::ostream &out,
+		const std::list<hostaddress> &addresses) const;
+};
+
+
+} // namespace natfw
+
+#endif // NATFW__CONFIG_H
Index: /source/ariba/communication/modules/transport/protlib/connectionmap.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/connectionmap.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/connectionmap.cpp	(revision 2378)
@@ -0,0 +1,153 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file connectionmap.cpp
+/// stores connection related data
+/// ----------------------------------------------------------
+/// $Id: connectionmap.cpp 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/connectionmap.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+#include "connectionmap.h"
+#include "logfile.h"
+
+namespace protlib {
+  using namespace log;
+
+/** @ingroup tptcp
+ * @ingroup network
+ * @{
+ */
+
+
+/***** class ConnectionMap *****/
+
+/** @class ConnectionMap connectionmap.h
+    The class ConnectionMap saves all required information about
+    currently existing connections. Its methods allow to check for
+    connections and return, if possible, the data associated
+    with the connection.
+*/
+
+
+/** @returns true if data is not NULL, if there is not already
+ * an entry for data and if  
+ * it is inserted into the internal hash maps.
+ * 
+ */
+bool ConnectionMap::insert(AssocData* assoc) 
+{
+  if (assoc) 
+  {
+    if ( (assoc->socketfd && lookup(assoc->socketfd)) || 
+	 (assoc->assoc && lookup(assoc->assoc)) ||
+	 lookup(assoc->peer)) return false;
+    else 
+    {
+      if (assoc->socketfd)
+	ass2data[assoc->socketfd] = assoc;
+      else
+      if (assoc->assoc)
+	ass2data[assoc->assoc] = assoc;
+      else
+	Log(ERROR_LOG,LOG_NORMAL,"ConnectionMap","insertion failed, both socketfd and associd are 0");
+
+      addr2data[assoc->peer] = assoc;
+      return true;
+    } // end if already in map
+  } else return false;
+} // end insert
+
+/** @returns a pointer to the AssocData object or NULL.
+ * @param socketfd socket file descriptor
+ */
+
+AssocData* ConnectionMap::lookup(socketfd_t socketfd) const 
+{
+	const_ass2data_it_t hit= ass2data.find(socketfd);
+	if (hit!=ass2data.end()) return hit->second;
+	else return NULL;
+} // end lookup
+
+AssocData* ConnectionMap::lookup(associd_t associd) const 
+{
+	const_ass2data_it_t hit= ass2data.find(associd);
+	if (hit!=ass2data.end()) return hit->second;
+	else return NULL;
+} // end lookup
+
+/** @returns a pointer to the AssocData object or NULL.
+ * @param addr IP-adress + port
+ *
+ */
+AssocData* ConnectionMap::lookup(const appladdress& addr) const 
+{
+	const_addr2data_it_t hit= addr2data.find(addr);
+	if (hit!=addr2data.end()) return hit->second;
+	else return NULL;
+} // end lookup
+
+/** @returns true if the AssocData-object with socketfd
+ * could be deleted
+ * @param socketfd socket file descriptor
+ */
+bool ConnectionMap::erase(socketfd_t socketfd) {
+	bool res = true;
+	AssocData* d = lookup(socketfd);
+	if (d) {
+		if (!ass2data.erase(d->socketfd)) res = false;
+		if (!addr2data.erase(d->peer)) res = false;
+		delete d; // AssocData is deleted
+		return res;
+	} else return false;
+} // end erase
+
+/** 
+ * could be deleted
+ * @param associd association id
+ * @returns true if the AssocData-object with associd
+ */
+bool ConnectionMap::erase(associd_t associd) {
+	bool res = true;
+	AssocData* d = lookup(associd);
+	if (d) {
+		if (!ass2data.erase(d->assoc)) res = false;
+		if (!addr2data.erase(d->peer)) res = false;
+		delete d; // AssocData is deleted
+		return res;
+	} else return false;
+} // end erase
+
+/*
+ *
+ */
+void ConnectionMap::clear() {
+	const_ass2data_it_t hit;
+	for (hit=ass2data.begin();hit!=ass2data.end();hit++) {
+		if (hit->second) delete hit->second;
+	} // end for hit
+	ass2data.clear();
+	addr2data.clear();
+} // end clear
+
+
+} // end namespace protlib
+/// @}
Index: /source/ariba/communication/modules/transport/protlib/connectionmap.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/connectionmap.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/connectionmap.h	(revision 2378)
@@ -0,0 +1,105 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file connectionmap.h
+/// maintains connection mapping of application addresses to sockets and vice versa
+/// ----------------------------------------------------------
+/// $Id: connectionmap.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/connectionmap.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+#ifndef CONNECTION_MAP_H
+#define CONNECTION_MAP_H
+
+#include "assocdata.h"
+#include <ext/hash_map>
+
+namespace protlib {
+
+/* @class ConnectionMap 
+ * maintains connection mapping of application addresses to sockets and vice versa
+ * @ingroup network
+ * @{
+ */
+class ConnectionMap {
+	public:
+		// a constructor may be needed here in this class
+		/// Insert a new AssocData element into the ConnectionMap
+		bool insert(AssocData* assoc);
+		/// Search for existing connections to this specific socket
+		AssocData* lookup(socketfd_t socketfd) const;
+		/// Search for existing connections to this specific assoc id
+		AssocData* lookup(associd_t associd) const;
+		///Search for existing connections to this address
+		AssocData* lookup(const appladdress& addr) const;
+		/// Erase the AssocData-element associated with this socket
+		bool erase(socketfd_t socketfd);
+		/// Erase the AssocData-element associated with this socket
+		bool erase(associd_t associd);
+		/// Erase the AssocData-element
+		bool erase(AssocData* assoc);
+		/// clear all
+		void clear();
+		/// get number of records
+		size_t get_size() const;
+	private:
+		// this hash_map uses the standard hashfunction on the first entry, int
+		
+		// only typedefs
+		typedef hash_map<socketfd_t ,AssocData*> ass2data_t;
+		typedef ass2data_t::const_iterator const_ass2data_it_t;
+		typedef hash_map<appladdress,AssocData*> addr2data_t;
+		typedef addr2data_t::const_iterator const_addr2data_it_t;
+
+		// internal hashmaps
+		ass2data_t ass2data; ///< map: socket fd to association data
+		addr2data_t addr2data; ///< map: (application) address to association data
+	public:
+		/// connection map iterator
+		typedef const_ass2data_it_t const_it_t;
+		const_it_t begin() const;
+		const_it_t end() const;
+}; // end class ConnectionMap
+
+inline
+size_t 
+ConnectionMap::get_size() const { return ass2data.size(); }
+
+inline
+ConnectionMap::const_it_t ConnectionMap::begin() const {
+	return ass2data.begin();
+} // end begin
+
+inline
+ConnectionMap::const_it_t ConnectionMap::end() const {
+	return ass2data.end();
+} // end end
+
+inline
+bool 
+ConnectionMap::erase(AssocData* assoc) {
+  return assoc ? erase(assoc->socketfd) : false;
+} // end erase
+
+//@}
+
+} // end namespace protlib
+#endif
Index: /source/ariba/communication/modules/transport/protlib/connectionmap_uds.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/connectionmap_uds.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/connectionmap_uds.cpp	(revision 2378)
@@ -0,0 +1,153 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file connectionmap_uds.cpp
+/// stores network connection related data
+/// ----------------------------------------------------------
+/// $Id: connectionmap_uds.cpp 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/connectionmap_uds.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+#include "connectionmap_uds.h"
+#include "logfile.h"
+
+namespace protlib {
+  using namespace log;
+
+/** @ingroup tptcp
+ * @ingroup network
+ * @{
+ */
+
+
+/***** class ConnectionMapUDS *****/
+
+/** @class ConnectionMapUDS connectionmap.h
+    The class ConnectionMapUDS saves all required information about
+    currently existing connections. Its methods allow to check for
+    connections and return, if possible, the data associated
+    with the connection.
+*/
+
+
+/** @returns true if data is not NULL, if there is not already
+ * an entry for data and if  
+ * it is inserted into the internal hash maps.
+ * 
+ */
+bool ConnectionMapUDS::insert(AssocDataUDS* assoc) 
+{
+  if (assoc) 
+  {
+    if ( (assoc->socketfd && lookup(assoc->socketfd)) || 
+	 (assoc->assoc && lookup(assoc->assoc)) ||
+	 lookup(assoc->peer)) return false;
+    else 
+    {
+      if (assoc->socketfd)
+	ass2data[assoc->socketfd] = assoc;
+      else
+      if (assoc->assoc)
+	ass2data[assoc->assoc] = assoc;
+      else
+	Log(ERROR_LOG,LOG_NORMAL,"ConnectionMapUDS","insertion failed, both socketfd and associd are 0");
+
+      addr2data[assoc->peer] = assoc;
+      return true;
+    } // end if already in map
+  } else return false;
+} // end insert
+
+/** @returns a pointer to the AssocDataUDS object or NULL.
+ * @param socketfd socket file descriptor
+ */
+
+AssocDataUDS* ConnectionMapUDS::lookup(socketfd_t socketfd) const 
+{
+	const_ass2data_it_t hit= ass2data.find(socketfd);
+	if (hit!=ass2data.end()) return hit->second;
+	else return NULL;
+} // end lookup
+
+AssocDataUDS* ConnectionMapUDS::lookup(associd_t associd) const 
+{
+	const_ass2data_it_t hit= ass2data.find(associd);
+	if (hit!=ass2data.end()) return hit->second;
+	else return NULL;
+} // end lookup
+
+/** @returns a pointer to the AssocDataUDS object or NULL.
+ * @param addr IP-adress + port
+ *
+ */
+AssocDataUDS* ConnectionMapUDS::lookup(const udsaddress& addr) const 
+{
+	const_addr2data_it_t hit= addr2data.find(addr);
+	if (hit!=addr2data.end()) return hit->second;
+	else return NULL;
+} // end lookup
+
+/** @returns true if the AssocDataUDS-object with socketfd
+ * could be deleted
+ * @param socketfd socket file descriptor
+ */
+bool ConnectionMapUDS::erase(socketfd_t socketfd) {
+	bool res = true;
+	AssocDataUDS* d = lookup(socketfd);
+	if (d) {
+		if (!ass2data.erase(d->socketfd)) res = false;
+		if (!addr2data.erase(d->peer)) res = false;
+		delete d; // AssocDataUDS is deleted
+		return res;
+	} else return false;
+} // end erase
+
+/** 
+ * erase an association
+ * @param associd - association identifier
+ * @returns true if the AssocDataUDS-object with associd could be deleted
+ */
+bool ConnectionMapUDS::erase(associd_t associd) {
+	bool res = true;
+	AssocDataUDS* d = lookup(associd);
+	if (d) {
+		if (!ass2data.erase(d->assoc)) res = false;
+		if (!addr2data.erase(d->peer)) res = false;
+		delete d; // AssocDataUDS is deleted
+		return res;
+	} else return false;
+} // end erase
+
+/*
+ *
+ */
+void ConnectionMapUDS::clear() {
+	const_ass2data_it_t hit;
+	for (hit=ass2data.begin();hit!=ass2data.end();hit++) {
+		if (hit->second) delete hit->second;
+	} // end for hit
+	ass2data.clear();
+	addr2data.clear();
+} // end clear
+
+
+} // end namespace protlib
+/// @}
Index: /source/ariba/communication/modules/transport/protlib/connectionmap_uds.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/connectionmap_uds.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/connectionmap_uds.h	(revision 2378)
@@ -0,0 +1,106 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file connectionmap_uds.h
+/// maintains connection mapping of application addresses to 
+/// UNIX domain sockets and vice versa
+/// ----------------------------------------------------------
+/// $Id: connectionmap_uds.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/connectionmap_uds.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+#ifndef CONNECTION_MAP_UDS_H
+#define CONNECTION_MAP_UDS_H
+
+#include "assocdata_uds.h"
+#include <ext/hash_map>
+
+namespace protlib {
+
+/* @class ConnectionMap 
+ * maintains connection mapping of application addresses to sockets and vice versa
+ * @ingroup network
+ * @{
+ */
+class ConnectionMapUDS {
+	public:
+		// a constructor may be needed here in this class
+		/// Insert a new AssocDataUDS element into the ConnectionMapUDS
+		bool insert(AssocDataUDS* assoc);
+		/// Search for existing connections to this specific socket
+		AssocDataUDS* lookup(socketfd_t socketfd) const;
+		/// Search for existing connections to this specific assoc id
+		AssocDataUDS* lookup(associd_t associd) const;
+		///Search for existing connections to this address
+		AssocDataUDS* lookup(const udsaddress& addr) const;
+		/// Erase the AssocDataUDS-element associated with this socket
+		bool erase(socketfd_t socketfd);
+		/// Erase the AssocDataUDS-element associated with this socket
+		bool erase(associd_t associd);
+		/// Erase the AssocDataUDS-element
+		bool erase(AssocDataUDS* assoc);
+		/// clear all
+		void clear();
+		/// get number of records
+		size_t get_size() const;
+	private:
+		// this hash_map uses the standard hashfunction on the first entry, int
+		
+		// only typedefs
+		typedef hash_map<socketfd_t ,AssocDataUDS*> ass2data_t;
+		typedef ass2data_t::const_iterator const_ass2data_it_t;
+		typedef hash_map<udsaddress,AssocDataUDS*> addr2data_t;
+		typedef addr2data_t::const_iterator const_addr2data_it_t;
+
+		// internal hashmaps
+		ass2data_t ass2data; ///< map: socket fd to association data
+		addr2data_t addr2data; ///< map: (application) address to association data
+	public:
+		/// connection map iterator
+		typedef const_ass2data_it_t const_it_t;
+		const_it_t begin() const;
+		const_it_t end() const;
+}; // end class ConnectionMapUDS
+
+inline
+size_t 
+ConnectionMapUDS::get_size() const { return ass2data.size(); }
+
+inline
+ConnectionMapUDS::const_it_t ConnectionMapUDS::begin() const {
+	return ass2data.begin();
+} // end begin
+
+inline
+ConnectionMapUDS::const_it_t ConnectionMapUDS::end() const {
+	return ass2data.end();
+} // end end
+
+inline
+bool 
+ConnectionMapUDS::erase(AssocDataUDS* assoc) {
+  return assoc ? erase(assoc->socketfd) : false;
+} // end erase
+
+//@}
+
+} // end namespace protlib
+#endif
Index: /source/ariba/communication/modules/transport/protlib/eclock_gettime.c
===================================================================
--- /source/ariba/communication/modules/transport/protlib/eclock_gettime.c	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/eclock_gettime.c	(revision 2378)
@@ -0,0 +1,78 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file eclock_gettime.c
+/// emulates a clock_gettime call for systems not having it
+/// ----------------------------------------------------------
+/// $Id: eclock_gettime.c 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/fastqueue/eclock_gettime.c $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @addtogroup fastqueue Fast Queue
+ * @{
+ */
+
+
+
+#include <sys/time.h>
+#include <unistd.h>
+
+/* struct timezone tz = { 0, DST_NONE }; */
+static struct timeval tv;
+typedef int             clockid_t;
+
+/* syntax for clock_gettime:
+   int clock_gettime (clockid_t clock_id, struct timespec *tp);
+
+   to supply it include the following (because of speed):
+   extern int eclock_gettime(struct timespec *tp);
+   #define clock_gettime(clock_id, tspec) eclock_gettime(tspec)
+*/
+
+int eclock_gettime(struct timespec *tp)
+{
+  /* DESCRIPTION
+
+  The clock_gettime function returns the current time (in seconds and
+  nanoseconds) for the specified clock.  The clock_settime function sets the
+  specified clock. The CLOCK_REALTIME clock measures the amount of time
+  elapsed since 00:00:00:00 January 1, 1970 Greenwich Mean Time (GMT), other-
+  wise known as the Epoch. Time values  that fall between two non-negative
+  integer multiples of the resolution are truncated down to the smaller mul-
+  tiple of the resolution.
+
+  */
+  if (gettimeofday(&tv, 0) == 0)
+  {
+#ifdef DEBUG
+    if (tp)
+#endif
+    {
+      tp->tv_sec= tv.tv_sec;
+      tp->tv_nsec= tv.tv_usec*1000;
+      return 0;
+    }
+  }
+  else
+    return -1;
+}
+
+//@}
Index: /source/ariba/communication/modules/transport/protlib/fastqueue.c
===================================================================
--- /source/ariba/communication/modules/transport/protlib/fastqueue.c	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/fastqueue.c	(revision 2378)
@@ -0,0 +1,650 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file fastqueue.c
+/// a simple FIFO queue with mutexes for use with pthreads
+/// ----------------------------------------------------------
+/// $Id: fastqueue.c 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/fastqueue/fastqueue.c $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+/** @addtogroup fastqueue Fast Queue
+ * @{
+ */
+
+/** @file
+ * Fast and thread-safe queue.
+ */
+
+/******************************************************************************
+ * fastqueue.c -- a simple FIFO queue with mutexes for use with pthreads      *
+ * -------------------------------------------------------------------------- *
+ * written by Roland Bless 1995                                               *
+ * all operations enqueue,dequeue are done in O(1) which means constant time  *
+ ******************************************************************************/
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <string.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+                       /**** module interface ****/
+#include "fastqueue.h"
+
+                  /*************** defines *****************/
+#define qerr(errnr)      fprintf(stderr,"queue.c: %s\n",queue_errmsg[errnr])
+
+#ifdef __linux__
+
+// not needed for Linux
+//#define pthread_mutexattr_settype pthread_mutexattr_setkind_np
+
+#define PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_TIMED_NP
+#define PRI_OTHER_MIN  PRI_FG_MIN_NP
+#define PRI_OTHER_MAX  PRI_FG_MAX_NP
+#define PRI_FG_MIN_NP  8
+#define PRI_FG_MAX_NP  15
+
+#define CLOCK_REALTIME 0
+#define NSEC_PER_SEC   1000000000
+extern int eclock_gettime(struct timespec *tp);
+#define clock_gettime(clock_id, tspec) eclock_gettime(tspec)
+
+#elif _DECTHREADS_VERSION < 314126L
+
+#define pthread_mutexattr_settype pthread_mutexattr_settype_np
+#define PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_NORMAL_NP
+#define PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK_NP
+#endif
+                 /*************** typedefs *****************/
+
+enum {
+       QERR_NONE,
+       QERR_NOMEM,
+       QERR_MUTEXINIT,
+       QERR_MUTEXLOCK,
+       QERR_MUTEXUNLOCK,
+       QERR_MUTEXDESTROY,
+       QERR_QEMPTY,
+       QERR_QINVALID,
+       QERR_QNOTEMPTY,
+       QERR_CONDINIT,
+       QERR_CONDWAIT,
+       QERR_CONDSIGNAL,
+       QERR_CONDDESTROY
+};
+
+const 
+char *const queue_errmsg[]=
+{
+  "all ok",
+  "can't get enough memory",
+  "initializing mutex",
+  "locking mutex",
+  "unlocking mutex",
+  "destroying mutex",
+  "queue empty",
+  "invalid queueobject",
+  "destroying queue - queue not empty",
+  "initializing queue condition variable",
+  "waiting on condition",
+  "signalling condition",
+  "destroying condition"
+};
+
+
+
+queue_t *create_queue(const char* name)
+/* initialization routine for a queue.
+ * returns: NULL if an error occured, or a queue-object which is actually
+ *          a queueheader structure
+ * arguments: none
+ */
+{
+  queue_t *queuehead;
+
+  /* Allocate memory for queue head */
+  if ((queuehead= (queue_t *) malloc(sizeof(queue_t)))!=NULL)
+  {
+    /* Set mutex kind */
+    pthread_mutexattr_init(&queuehead->mutex_attr);
+#ifdef _DEBUG
+    pthread_mutexattr_settype(&queuehead->mutex_attr,PTHREAD_MUTEX_ERRORCHECK);
+#else
+    pthread_mutexattr_settype(&queuehead->mutex_attr,PTHREAD_MUTEX_NORMAL);
+#endif
+    /* use PTHREAD_MUTEX_ERRORCHECK or PTHREAD_MUTEX_ERRORCHECK_NP for testing */
+
+    /* Initialize mutex */
+    if (pthread_mutex_init(&queuehead->mutex, &queuehead->mutex_attr)==0)
+    {
+      /* Create Condition variable for command queue */
+      if (pthread_cond_init(&queuehead->cond, NULL)==0)
+      {
+        queuehead->nr_of_elements= 0UL;
+        queuehead->exp_nr_of_elements= 0UL;
+        queuehead->exp_enabled = 0;
+        queuehead->first_block= (queue_elblock_t *) malloc(sizeof(queue_elblock_t));
+        queuehead->exp_first_block= (queue_elblock_t *) malloc(sizeof(queue_elblock_t));
+        if ((queuehead->first_block == NULL) || (queuehead->exp_first_block == NULL))
+           qerr(QERR_NOMEM);
+        else
+	{
+          queuehead->first_block->read=  0;
+          queuehead->first_block->write= 0;
+          queuehead->first_block->next_block= NULL;          
+          queuehead->last_block= queuehead->first_block;
+          queuehead->exp_first_block->read=  0;
+          queuehead->exp_first_block->write= 0;
+          queuehead->exp_first_block->next_block= NULL;          
+          queuehead->exp_last_block= queuehead->exp_first_block;
+          if (name)
+          {
+            if (strlen(name) <= MAX_QUEUENAME_LENGTH)
+              strcpy(queuehead->name, name);
+            else
+            {
+              memcpy(queuehead->name, name, MAX_QUEUENAME_LENGTH);
+              queuehead->name[MAX_QUEUENAME_LENGTH + 1] = '\0';
+            }
+          }
+          else
+            queuehead->name[0] = '\0';
+          /* Now it's simple to enqueue elements, esp. the first one */
+        }
+//#ifdef QUEUELEN
+        queuehead->queue_maxlength= 0;
+//#endif
+      }
+      else
+        qerr(QERR_CONDINIT);
+    }
+    else /* error during initialize */
+      qerr(QERR_MUTEXINIT);
+  }
+  else
+    qerr(QERR_NOMEM);
+
+  return queuehead;
+}
+
+int enqueue_element_signal(queue_t *queuehead, void *element)
+{
+  return enqueue_element_expedited_signal(queuehead,element,0);
+}
+
+int enqueue_element_expedited_signal(queue_t *queuehead, void *element, int exp)
+/* add a new element into the queue. Memory for the element must be
+ * allocated anywhere else. This routine signals other waiting threads.
+ * returns: -1 if an error occured, or 0 is action could be performed
+ * arguments: pointer to queue_t object, pointer to an element
+ */
+{
+  queue_elblock_t *newelement, *lastblockp;
+
+  if (queuehead==NULL)
+  {
+    qerr(QERR_QINVALID);
+    return -1;
+  }
+
+  if (pthread_mutex_lock(&queuehead->mutex)!=0)
+  {
+    qerr(QERR_MUTEXLOCK);
+    return -1;
+  }
+  /* begin critical section */
+
+  if (exp && queuehead->exp_enabled) exp = 1; else exp = 0;
+  /* Allocate new element structure when necessary */
+  /* Note: queuehead->last_block must always contain a valid value */
+  lastblockp = (exp ? (queuehead->exp_last_block) : (queuehead->last_block));
+  if (lastblockp->write == ELEMENT_BLOCKSIZE)
+  { /* last block is full, so allocate a new block */
+    if ((newelement= (queue_elblock_t *) malloc(sizeof(queue_elblock_t)))==NULL)
+    {
+      qerr(QERR_NOMEM);
+      return -1;
+    }
+
+    /* initialize new structure */
+    newelement->element[0]= element;
+    newelement->read      = 0;
+    newelement->write     = 1;
+    newelement->next_block= NULL;
+    
+    /* append new element to the end */
+    lastblockp->next_block= newelement;
+    /* new element becomes last element */
+    if (exp) queuehead->exp_last_block = newelement; 
+    else queuehead->last_block = newelement; 
+  }
+  else /* last block was not full */
+  { 
+    lastblockp->element[lastblockp->write]= element;
+    lastblockp->write++;
+  }
+  
+  if (exp) queuehead->exp_nr_of_elements++;
+  queuehead->nr_of_elements++;
+//#ifdef QUEUELEN
+    if (queuehead->nr_of_elements > queuehead->queue_maxlength)
+       queuehead->queue_maxlength= queuehead->nr_of_elements;
+//#endif
+  /* Condition should be set while mutex is locked. 
+     Recommended by libc manual.
+  */
+  if (pthread_cond_signal(&queuehead->cond)!=0)
+     qerr(QERR_CONDSIGNAL);
+  /* end critical section */
+  if (pthread_mutex_unlock(&queuehead->mutex)!=0)
+  {
+    qerr(QERR_MUTEXUNLOCK);
+    return -1;
+  }
+  // see above
+//  if (pthread_cond_signal(&queuehead->cond)!=0)
+//     qerr(QERR_CONDSIGNAL);
+
+  return 0;
+}
+
+
+void *dequeue_element_wait(queue_t *queuehead)
+/* wait for the queue to contain an element.
+ * if it contains an element return and remove it.
+ * returns: NULL if an error occured, the pointer to the element otherwise
+ * arguments: pointer to queue_t object
+ */
+{
+  void       *element;
+  queue_elblock_t *blockp;
+  int exp = 0;
+  element= NULL;
+  int retcode= 0;
+
+  if (queuehead != NULL)
+  {
+    /* Wait for an element in the queue */
+    /* Before waiting on a condition, the associated mutex must be locked */
+    if (pthread_mutex_lock(&queuehead->mutex)!=0)
+    {
+      qerr(QERR_MUTEXLOCK); return NULL;
+    }
+
+    while(queuehead->nr_of_elements==0) /* while there is no work to do, wait */
+    { /* for a safe state the predicate must be checked in a loop! */
+      /* cond_wait() unlocks the mutex and might return sometimes without
+         getting a signal! */
+      if ((retcode= pthread_cond_wait(&queuehead->cond, &queuehead->mutex)) != 0)
+      {
+         if (retcode!=EINTR && retcode!=ETIMEDOUT)
+	 {
+	   qerr(QERR_CONDWAIT);
+	 }
+      }
+    }
+
+    /* begin critical section */
+    exp = (queuehead->exp_nr_of_elements!=0);
+    blockp = (exp ? (queuehead->exp_first_block) : (queuehead->first_block));
+    if (blockp != NULL)
+    {
+      /* get the first element */
+      element= blockp->element[blockp->read];
+      blockp->read++;
+
+      if (blockp->next_block == NULL) /* this is the last block */
+      {
+        if (blockp->read == blockp->write) 
+        { /* block is completely dequeued, so reset values */
+          /* the last block always remains allocated! */
+          blockp->read=  0;
+          blockp->write= 0;
+        }
+      }
+      else /* this is not the last block */
+      {
+        /* if block was completely dequeued, remove it */
+        if (blockp->read == ELEMENT_BLOCKSIZE)
+        {
+          if (exp) queuehead->exp_first_block= blockp->next_block;
+          else queuehead->first_block= blockp->next_block;
+          free(blockp);
+        }
+      }
+      if (exp) queuehead->exp_nr_of_elements--;
+      queuehead->nr_of_elements--;
+    }
+    else
+      qerr(QERR_QEMPTY);
+
+    /* end critical section */
+    if (pthread_mutex_unlock(&queuehead->mutex)!=0)
+    {
+      qerr(QERR_MUTEXUNLOCK);
+      return NULL;
+    }
+  }
+  else
+    qerr(QERR_QINVALID);
+
+  return element;
+}
+
+void *dequeue_element_timedwait(queue_t *queuehead, const struct timespec *tspec)
+/* wait for the queue to contain an element.
+ * if it contains an element return and remove it.
+ * returns: NULL if an error occured, the pointer to the element otherwise
+ * arguments: pointer to queue_t object
+ *            tpsec is the time interval to wait (not an absolute time!)
+ */
+{
+  void       *element;
+  queue_elblock_t *blockp;
+  int result;
+  struct timespec abs_tspec;
+  int exp = 0;
+  element= NULL;
+
+  if (queuehead != NULL)
+  {
+    /* Wait for an element in the queue */
+    /* Before waiting on a condition, the associated mutex must be locked */
+    if (pthread_mutex_lock(&queuehead->mutex)!=0)
+    {
+      qerr(QERR_MUTEXLOCK); return NULL;
+    }
+
+    while(queuehead->nr_of_elements==0) /* while there is no work to do, wait */
+    { /* for a safe state the predicate must be checked in a loop! */
+      /* cond_wait() unlocks the mutex and might return sometimes without
+         getting a signal! */
+      clock_gettime(CLOCK_REALTIME, &abs_tspec);
+      abs_tspec.tv_nsec+= tspec->tv_nsec;
+      abs_tspec.tv_sec+= tspec->tv_sec;
+      if (abs_tspec.tv_nsec >= NSEC_PER_SEC)
+      {
+        abs_tspec.tv_nsec%= NSEC_PER_SEC;
+        abs_tspec.tv_sec++;
+      };
+
+      if ((result = pthread_cond_timedwait(&queuehead->cond,
+                                           &queuehead->mutex, &abs_tspec))!=0)
+      {
+	if ( (result != ETIMEDOUT) && (result != EINTR) && (result != EINVAL) ) 
+        {
+	  qerr(QERR_CONDWAIT);
+	} 
+        else 
+        { /* timeout */
+	  if (pthread_mutex_unlock(&queuehead->mutex)!=0) 
+          {
+	    qerr(QERR_MUTEXUNLOCK);
+	    return NULL;
+	  } 
+	  return NULL;
+	}
+      }
+    }
+
+    /* begin critical section */
+    exp = (queuehead->exp_nr_of_elements!=0);
+    blockp = (exp ? (queuehead->exp_first_block) : (queuehead->first_block));
+    if (blockp != NULL)
+    {
+      /* get the first element */
+      element= blockp->element[blockp->read];
+      blockp->read++;
+
+      if (blockp->next_block == NULL) /* this is the last block */
+      {
+        if (blockp->read == blockp->write) 
+        { /* block is completely dequeued, so reset values */
+          /* the last block always remains allocated! */
+          blockp->read=  0;
+          blockp->write= 0;
+        }
+      }
+      else /* this is not the last block */
+      {
+        /* if block was completely dequeued, remove it */
+        if (blockp->read == ELEMENT_BLOCKSIZE)
+        {
+          if (exp) queuehead->exp_first_block= blockp->next_block;
+          else queuehead->first_block= blockp->next_block;
+          free(blockp);
+        }
+      }
+      if (exp) queuehead->exp_nr_of_elements--;
+      queuehead->nr_of_elements--;
+    }
+    else
+      qerr(QERR_QEMPTY);
+
+    /* end critical section */
+    if (pthread_mutex_unlock(&queuehead->mutex)!=0)
+    {
+      qerr(QERR_MUTEXUNLOCK);
+      return NULL;
+    }
+  }
+  else
+    qerr(QERR_QINVALID);
+
+  return element;
+}
+
+int destroy_queue(queue_t *queuehead)
+/* destroys the queue and frees all resources, except the elements!
+ * the queue must be empty to destroy it.
+ * returns: -1 if an error occured, 0 otherwise
+ * arguments: pointer to queue_t object
+ */
+{
+  if (queuehead!=NULL)
+  {
+    /* queue not empty? */
+    if (queuehead->nr_of_elements != 0)
+      qerr(QERR_QNOTEMPTY);
+    else
+    {
+      /* destroy condition variable */
+      if (pthread_cond_destroy(&queuehead->cond)!=0) qerr(QERR_CONDDESTROY);
+      /* destroy mutex */
+      if (pthread_mutex_destroy(&queuehead->mutex)!=0) qerr(QERR_MUTEXDESTROY);
+      
+      pthread_mutexattr_destroy(&queuehead->mutex_attr);
+
+      /* free memory for queuehead */
+#ifdef QUEUELEN
+      fprintf(stderr,"queue.c: length of queue (%s) growed up to %lu elements\n",
+              queuehead->name, queuehead->queue_maxlength);
+#endif      
+      free(queuehead->exp_last_block);
+      free(queuehead->last_block);
+      free(queuehead);
+    }
+
+    return 0;
+  }
+  else
+    qerr(QERR_QINVALID);
+
+  return -1;
+}
+
+void *dequeue_element_nonblocking(queue_t *queuehead)
+/* if queue contains an element return and remove it.
+ * returns: NULL if an error occured or queue was empty, the pointer to
+ * the element otherwise.
+ * arguments: pointer to queue_t object
+ */
+{
+  void       *element;
+  queue_elblock_t *blockp;
+  int exp = 0;
+  element= NULL;
+
+  if (queuehead != NULL)
+  {
+    if (pthread_mutex_lock(&queuehead->mutex)!=0)
+    {
+      qerr(QERR_MUTEXLOCK); return NULL;
+    }
+
+    /* begin critical section */
+
+    if (queuehead->nr_of_elements==0) 
+    { 
+      if (pthread_mutex_unlock(&queuehead->mutex)!=0) qerr(QERR_MUTEXUNLOCK);
+      return NULL;
+    }
+
+    exp = (queuehead->exp_nr_of_elements!=0);
+    blockp = (exp ? (queuehead->exp_first_block) : (queuehead->first_block));
+    if (blockp != NULL)
+    {
+      /* get the first element */
+      element= blockp->element[blockp->read];
+      blockp->read++;
+
+      if (blockp->next_block == NULL) /* this is the last block */
+      {
+        if (blockp->read == blockp->write) 
+        { /* block is completely dequeued, so reset values */
+          /* the last block always remains allocated! */
+          blockp->read=  0;
+          blockp->write= 0;
+        }
+      }
+      else /* this is not the last block */
+      {
+        /* if block was completely dequeued, remove it */
+        if (blockp->read == ELEMENT_BLOCKSIZE)
+        {
+          if (exp) queuehead->exp_first_block= blockp->next_block;
+          else queuehead->first_block= blockp->next_block;
+          free(blockp);
+        }
+      }
+      if (exp) queuehead->exp_nr_of_elements--;
+      queuehead->nr_of_elements--;
+    }
+    else
+      qerr(QERR_QEMPTY);
+
+    /* end critical section */
+    if (pthread_mutex_unlock(&queuehead->mutex)!=0)
+    {
+      qerr(QERR_MUTEXUNLOCK);
+      return NULL;
+    }
+  }
+  else
+    qerr(QERR_QINVALID);
+
+  return element;
+}
+
+unsigned long queue_nr_of_elements(queue_t *queuehead)
+/** Get number fo elements in queue. */
+{
+  unsigned long result = 0;
+
+  if (queuehead != NULL)
+  {
+    if (pthread_mutex_lock(&queuehead->mutex)!=0)
+    {
+      qerr(QERR_MUTEXLOCK);
+      return 0;
+    }
+    /* begin critical section */
+
+    result = queuehead->nr_of_elements; 
+
+    /* end critical section */
+    if (pthread_mutex_unlock(&queuehead->mutex)!=0) qerr(QERR_MUTEXUNLOCK);
+  }
+  else
+    qerr(QERR_QINVALID);
+
+  return result;
+}
+
+int queue_is_expedited_enabled(queue_t *queuehead)
+/** Get exp_enabled flag. */
+{
+  int result = 0;
+
+  if (queuehead != NULL)
+  {
+    if (pthread_mutex_lock(&queuehead->mutex)!=0)
+    {
+      qerr(QERR_MUTEXLOCK);
+      return 0;
+    }
+    /* begin critical section */
+
+    result = queuehead->exp_enabled; 
+
+    /* end critical section */
+    if (pthread_mutex_unlock(&queuehead->mutex)!=0) qerr(QERR_MUTEXUNLOCK);
+  }
+  else
+    qerr(QERR_QINVALID);
+
+  return result;
+}
+
+int queue_enable_expedited(queue_t *queuehead, int exp)
+/** Set exp_enabled flag and return old value. */
+{
+  int result = 0;
+
+  if (queuehead != NULL)
+  {
+    if (pthread_mutex_lock(&queuehead->mutex)!=0)
+    {
+      qerr(QERR_MUTEXLOCK);
+      return 0;
+    }
+    /* begin critical section */
+
+    result = queuehead->exp_enabled; 
+    if (exp) queuehead->exp_enabled = 1;
+    else queuehead->exp_enabled = 0;
+
+    /* end critical section */
+    if (pthread_mutex_unlock(&queuehead->mutex)!=0) qerr(QERR_MUTEXUNLOCK);
+  }
+  else
+    qerr(QERR_QINVALID);
+
+  return result;
+}
+
+//@}
Index: /source/ariba/communication/modules/transport/protlib/fastqueue.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/fastqueue.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/fastqueue.h	(revision 2378)
@@ -0,0 +1,95 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file fastqueue.h
+/// Fast and thread-safe queue to send/receive messages between 
+/// POSIX threads
+/// ----------------------------------------------------------
+/// $Id: fastqueue.h 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/fastqueue/fastqueue.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** 
+ * @ingroup fastqueue Fast Queue
+ * @{
+ */
+
+/** @file
+ * Fast and thread-safe queue to send/receive messages between POSIX threads
+ * This can be used as a port for a thread to receive messages (from any thread).
+ * The implementations allows for arbitrary long queues, but queues grow by
+ * element blocks containing ELEMENT_BLOCKSIZE elements. This avoids frequent
+ * malloc/free operations.
+ */
+
+#ifndef QUEUE_TYPE
+#define QUEUE_TYPE
+
+#include <pthread.h>
+
+#define ELEMENT_BLOCKSIZE    64
+#define MAX_QUEUENAME_LENGTH 32
+
+
+/* queue element block type */
+typedef struct queue_elblock_struct
+  {
+    void *element[ELEMENT_BLOCKSIZE];
+    int read, write;
+    struct queue_elblock_struct *next_block;
+  }
+queue_elblock_t;
+
+
+typedef struct queue_struct
+  {
+    pthread_mutex_t mutex;
+    pthread_mutexattr_t mutex_attr;
+    pthread_cond_t cond;
+
+    unsigned long nr_of_elements;
+    unsigned long exp_nr_of_elements;
+    int exp_enabled;
+    queue_elblock_t *first_block;
+    queue_elblock_t *last_block;
+    queue_elblock_t *exp_first_block;
+    queue_elblock_t *exp_last_block;
+//#ifdef QUEUELEN
+    unsigned long queue_maxlength;
+//#endif
+    char name[MAX_QUEUENAME_LENGTH +1];
+  }
+queue_t;
+
+extern queue_t *create_queue (const char *name);
+extern int enqueue_element_signal (queue_t * queuehead, void *element);
+extern int enqueue_element_expedited_signal (queue_t * queuehead, void *element, int exp);
+extern void *dequeue_element_wait (queue_t * queuehead);
+extern void *dequeue_element_timedwait(queue_t *queuehead, const struct timespec *tspec);
+extern int destroy_queue (queue_t * queuehead);
+extern void *dequeue_element_nonblocking(queue_t * queuehead);
+extern unsigned long queue_nr_of_elements(queue_t *queue);
+extern int queue_is_expedited_enabled(queue_t *queue);
+extern int queue_enable_expedited(queue_t *queue, int exp);
+
+#endif
+
+//@}
Index: /source/ariba/communication/modules/transport/protlib/fqueue.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/fqueue.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/fqueue.cpp	(revision 2378)
@@ -0,0 +1,216 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file fqueue.cpp
+/// wrapper class for fastqueue
+/// ----------------------------------------------------------
+/// $Id: fqueue.cpp 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/fqueue.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+#include "fqueue.h"
+#include "stdio.h"
+#include "logfile.h"
+
+#include <string>
+
+namespace protlib {
+
+/** @addtogroup fastqueue Fast Queue
+ * @{
+ */
+
+  using namespace log;
+
+/**
+ * Constructor.
+ *
+ * Initialize a FastQueue with a queue name and enable/disable expedited
+ * data.
+ *
+ * @param qname the queue's name, or NULL
+ * @param exp if true, expedited data support is enabled
+ */
+FastQueue::FastQueue(const char *qname, bool exp)
+    : queue_name((qname == 0) ? "" : (char*)qname), shutdownflag(false)
+{
+  if ((queue = create_queue(qname)) == NULL)
+  {
+    Log(ERROR_LOG, LOG_ALERT, "FastQueue", "Could not create queue " << queue_name);
+    throw FQError();
+  } else queue_enable_expedited(queue,exp);
+}
+
+
+/**
+ * Add a message to the queue.
+ *
+ * If exp is true and the queue allows expedited data, the message will
+ * pass all normal messages in the queue and thus will be delivered earlier.
+ * If there are other expedited messages in the queue already, it will be
+ * added after the already existing expedited messages.
+ *
+ * This method may fail (and return false) if the queue is in shutdown mode,
+ * there is a problem aquiring locks, or some other threading problem.
+ *
+ * In case the queue is deleted before this message has been removed, this
+ * message is deleted using the delete operator. Because of this, the same
+ * message may only appear once in a queue.
+ * 
+ * @param element a pointer to the message to add
+ * @param exp true if this is expedited data
+ * 
+ * @return true if the element was enqueued successfully
+ */
+bool FastQueue::enqueue(message *element, bool exp)
+{
+  if (shutdownflag) return false;
+  if (enqueue_element_expedited_signal(queue, (void*)element, exp) < 0)
+  {
+    Log(ERROR_LOG, LOG_ALERT, "FastQueue", "Could not enqueue element in queue " << queue_name);
+    return false;
+  }
+  return true;
+}
+
+
+/**
+ * Wait for a message for a given time.
+ *
+ * If no message arrives in the given time period, NULL is returned.
+ *
+ * @param msec the time to wait in milliseconds
+ *
+ * @return the message, or NULL
+ */
+message *FastQueue::dequeue_timedwait(const long int msec)
+{
+  struct timespec tspec = {0,0};
+  tspec.tv_sec = msec/1000;
+  tspec.tv_nsec = (msec%1000)*1000000;
+  return (message*)dequeue_element_timedwait(queue, &tspec);
+}
+
+
+/**
+ * Destructor.
+ * 
+ * Destroys the queue. All messages which are still in the queue are deleted
+ * using the delete operator.
+ */
+FastQueue::~FastQueue()
+{
+  if (queue) 
+  {
+    cleanup();
+    if ((destroy_queue(queue)) < 0)
+    {
+      Log(ERROR_LOG, LOG_ALERT, "FastQueue", "Could not destroy queue " << queue_name);
+    }
+  }
+  DLog("FastQueue", "~FastQueue() - done for queue " << queue_name);
+}
+
+/**
+ * Test if the queue is empty.
+ *
+ * @return true if the queue is empty
+ */
+bool FastQueue::is_empty() const
+{
+  if (queue_nr_of_elements(queue)==0)
+    return true;
+  else
+    return false;
+}
+
+
+/**
+ * Return the number of messages in the queue.
+ *
+ * @return the number of enqueued messages
+ */
+unsigned long FastQueue::size() const
+{
+  return queue_nr_of_elements(queue);
+}
+
+
+/**
+ * Test if expedited message support is enabled.
+ * 
+ * @return true if expedited message support is enabled
+ */
+bool FastQueue::is_expedited_enabled() const
+{
+  if (queue_is_expedited_enabled(queue))
+    return true;
+  else
+    return false;
+}
+
+/**
+ * Enable or disable expedited messages.
+ *
+ * This also returns the previous value of this flag.
+ *
+ * @return true, if expedited messages were previously enabled, false otherwise
+ */
+bool FastQueue::enable_expedited(bool exp)
+{
+  if (queue_enable_expedited(queue,exp))
+    return true;
+  else
+    return false;
+}
+
+
+/**
+ * Disable enqueueing of new messages.
+ *
+ * A queue in shutdown mode does not accept messages any more.
+ */
+void FastQueue::shutdown() { shutdownflag = true; }
+
+
+/**
+ * Put queue into shutdown mode and delete all stored messages..
+ *
+ * @return the number of messages that were in the queue
+ */
+unsigned long FastQueue::cleanup()
+{
+  unsigned long count = 0;
+  message* m = NULL;
+  shutdownflag = true;
+  while (!is_empty())
+    if ((m = dequeue(false))) {
+      delete m;
+      m = NULL;
+      count++;
+    }
+  return count;
+}
+
+//@}
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/fqueue.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/fqueue.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/fqueue.h	(revision 2378)
@@ -0,0 +1,148 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file fqueue.h
+/// a wrapper class for fastqueue C implementation
+/// ----------------------------------------------------------
+/// $Id: fqueue.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/fqueue.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+/** @ingroup fastqueue
+ *
+ */
+
+#ifndef __FQUEUE_H__
+#define __FQUEUE_H__
+
+#include <string>
+
+#include "protlib_types.h"
+#include "messages.h"
+
+extern "C" {
+#include"fastqueue.h"
+}
+
+namespace protlib {
+
+/** @addtogroup fastqueue Fast Queue
+ * @{
+ */
+
+// declared in messages.h
+class message;
+
+
+/** 
+ * A fast message queue.
+ *
+ * This is a fast and thread-safe message queue with expedited data
+ * support. It is an object oriented wrapper around fastqueue.c.
+ * The queue grows dynamically and has no built-in entry limit.
+ */
+class FastQueue {
+public:
+	/// FastQueue error
+	class FQError{};
+	/// constructor
+	FastQueue(const char *qname = 0, bool exp = false);
+	/// destructor
+	~FastQueue();
+	/// enqueue message
+	bool enqueue(message *element, bool exp = false);
+	/// dequeue message
+	message *dequeue(bool blocking = true);
+	/// dequeue message, timed wait
+	message *dequeue_timedwait(const struct timespec &tspec);
+	/// dequeue message, timed wait
+	message *dequeue_timedwait(const long int msec);
+	/// is queue empty
+	bool is_empty() const;
+	/// get number of enqueued messages
+	unsigned long size() const;
+	/// is expedited data support enabled
+	bool is_expedited_enabled() const;
+	/// enable/disable expedited data
+	bool enable_expedited(bool exp);
+	/// shutdown queue, do not accept messages
+	void shutdown();
+	/// delete stored messages
+	unsigned long cleanup();
+	/// Return the name of the queue.
+	const char* get_name() const { return queue_name.c_str(); }
+private:
+	/// C fastqueue
+	queue_t *queue;
+	/// name of the queue, also stored in the queue_t
+	string queue_name;
+	/// accept or reject messages
+	bool shutdownflag;
+};
+
+
+/**
+ * Remove the first message from the queue.
+ *
+ * Messages are removed in the same order they were added to the queue (FIFO).
+ * If the expedited messages feature is enabled, there's an exception to
+ * this rule: Expedited messages are always removed before all other messages.
+ * The FIFO condition still holds among expedited messages, however.
+ *
+ * If blocking is set, wait infinitely for a message. If set to false,
+ * return immediately if the queue is empty. In this case, NULL is returned.
+ *
+ * @param blocking if true, block until a message arrives
+ *
+ * @return the message, or NULL
+ */
+inline
+message *
+FastQueue::dequeue(bool blocking)
+{
+  return static_cast<message*>(blocking ? 
+			       dequeue_element_wait(queue) :
+			       dequeue_element_nonblocking(queue));
+}
+
+
+/**
+ * Wait for a message for a given time.
+ *
+ * If no message arrives in the given time period, NULL is returned.
+ *
+ * @param tspec the time to wait
+ *
+ * @return the message, or NULL
+ */
+inline
+message *
+FastQueue::dequeue_timedwait(const struct timespec& tspec)
+{
+  return (message*)dequeue_element_timedwait(queue, &tspec);
+}
+
+//@}
+
+} // end namespace protlib
+
+#endif 
Index: /source/ariba/communication/modules/transport/protlib/ie.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/ie.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/ie.cpp	(revision 2378)
@@ -0,0 +1,696 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file ie.cpp
+/// information elements for the protocol, IE manager singleton
+/// ----------------------------------------------------------
+/// $Id: ie.cpp 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/ie.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+/** @ingroup ie
+ * This file defines the base class of all information elements, the
+ * information elements for the GIST protocol and an IE manager singleton
+ * object.
+ * Although the IEs are closely related to the structure of GIST messages,
+ * they may be used in other contexts as well because of the coding shemes.
+ */
+
+#include "ie.h"
+#include "logfile.h"
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <sstream>
+#include <iomanip>
+
+namespace protlib {
+  using namespace log;
+
+
+
+/** @addtogroup ie Information Elements
+ * @{
+ */
+
+/***** class IE *****/
+
+/** Constructor. Sets category of IE. */
+IE::IE(uint16 category) : category(category) {}
+
+IE::IE(const IE& n) : category(n.category) {}
+
+/** Get the category of the IE. */
+uint16 IE::get_category() const {
+	return category;
+} // end get_category
+
+/** Check arguments of IE deserialization member functions.
+ * Additionally, bread is set to 0.
+ */ 
+bool IE::check_deser_args(coding_t cod, IEErrorList& errorlist, uint32 &bread) const {
+	bread = 0;
+	// check coding
+	if (!supports_coding(cod)) {
+	  Log(ERROR_LOG,LOG_NORMAL, "IE", "IE::check_deser_args(): IE " << get_ie_name() << " does not support coding " << cod );
+	  catch_bad_alloc(errorlist.put(new IEError(IEError::ERROR_CODING)));
+	  return false;
+	} // end if cod
+	return true;
+} // end check_deser_args()
+
+/** Check arguments of IE serialization member functions.
+ * Additionally, wbytes is set to 0.
+ */ 
+void IE::check_ser_args(coding_t cod, uint32 &wbytes) const {
+	wbytes = 0;
+	// check IE state
+	if (!check()) {
+		IEError err(IEError::ERROR_INVALID_STATE);
+		Log(ERROR_LOG,LOG_NORMAL, "IE", "IE::check_ser_args() for IE " << get_ie_name() << ", error: " << err.getstr());
+		throw err;
+	} // end if !check()
+	// check coding
+	if (!supports_coding(cod)) {
+		IEError err(IEError::ERROR_CODING);
+		Log(ERROR_LOG,LOG_NORMAL, "IE", "IE::check_ser_args() for IE " << get_ie_name() << ", error: " << err.getstr() << ", coding: " << cod);
+		throw err;
+	} // end if cod
+	return;
+} // end check_ser_args()
+
+
+/** Print the content of the IE, default behaviour is to print its name.
+ * Level and indent control how much space is inserted after a newline.
+ * If name points to a string, this string is printed before the
+* get_ie_name().
+ */
+ostream& IE::print(ostream& os, uint32 level, const uint32 indent, const char* name) const {
+	os<<setw(level*indent)<<"";
+	if (name && (*name!=0)) os<<name<<" ";
+	os<<"<"<<get_ie_name()<<">";
+	return os;
+} // end print
+
+istream& IE::input(istream& is, bool istty, uint32 level, const uint32 indent, const char* name) {
+  Log(ERROR_LOG,LOG_NORMAL, "IE", "IE " << get_ie_name() << "::input not yet implemented");
+  if (istty) {
+    cout<<setw(level*indent)<<"";
+    if (name && (*name!=0)) cout<<name<<" ";
+    cout<<"<"<<get_ie_name()<<">: Input not yet implemented."<<endl;
+  } // end if istty
+  return is;
+} // end input
+
+/** Print the IE to a string using print() and stringstream. */
+string IE::to_string(const char* name) const {
+	ostringstream os;
+	print(os,0,3,name);
+	return os.str();
+} // end to_string
+
+/** Log and throw a nomem_error */
+void IE::throw_nomem_error() const {
+	try {
+	  Log(ERROR_LOG,LOG_CRIT, "IE", "Not enough memory for IE " << get_ie_name());
+	} catch(...) {}
+	throw IEError(IEError::ERROR_NO_MEM);
+} // end throw_nomem_error
+
+/** Set all pointers to external data to NULL.
+ * By default this does nothing because there are no pointers.
+ */
+void IE::clear_pointers() {}
+
+
+/***** class IEError *****/
+
+/// IEError strings
+const char* IEError::err_str[] = {
+	"Error while registering IE. Either pointer to IE is NULL or registered IE already.",
+	"IE coding scheme is not supported by this function.",
+	"IE category is not supported by this function or in the applied coding scheme.",
+	"IE Manager instance does not exist (possible mem alloc problem?)",
+	"NetMsg too short for (de)serialization.",
+	"IE is in invalid state.",
+	"Wrong/unexpected IE type.",
+	"Wrong/unexpected IE subtype.",
+	"Wrong IE length.",
+	"Not enough memory to allocate IE.",
+	"Too big for this protocol implementation.",
+	"Unknown error code for this error class.",
+	"Wrong or unknown protocol version.",
+	"Unexpected object",
+	"PDU syntax error",
+	"PDU Object set failed (wrong index)",
+	"Protocol Specific Error"
+};
+
+
+/**
+ * Constructor.
+ *
+ * Initialize an IEError object by setting the error code.
+ *
+ * @warning Don't instantiate IEError. Use a child class instead!
+ *
+ * @param error the kind of error this exception represents
+ */
+IEError::IEError(error_t error) : ProtLibException(err_str[error]), err(error) {
+	// nothing to do
+}
+
+
+IEError::IEError(std::string msg) throw ()
+		: ProtLibException(msg), err(ERROR_UNKNOWN_ERRORCODE) {
+
+	// nothing to do
+}
+
+
+/**
+ * Destructor.
+ *
+ * This has only been defined to prevent compiler warnings.
+ */
+IEError::~IEError() throw () {
+	// nothing to do
+}
+
+
+/**
+ * Returns an error message.
+ *
+ * Note: what() returns more useful messages.
+ *
+ * @return the error message
+ */
+const char* IEError::getstr() const {
+	return err_str[err];
+}
+
+
+/***** class PDUSyntaxError *****/
+
+/**
+ * Constructor.
+ *
+ * @deprecated This constructor shouldn't be used for new code.
+ *
+ * @param msg an error message describing the problem
+ */
+PDUSyntaxError::PDUSyntaxError(const char* msg)
+		: IEError(IEError::ERROR_PDU_SYNTAX),
+		  coding(coding), category(0), type(0), subtype(0),
+		  errorpos(0), message(msg) {
+
+	ostringstream ost;
+	ost << "[coding " << coding << ", cat " << category << ", type " << type
+		<< ", subtype " << subtype << "] " << message;
+
+	error_msg = ost.str();
+}
+
+
+/**
+ * Constructor.
+ *
+ * @param coding the protocol version
+ * @param category the IE's category
+ * @param type the IE's type
+ * @param subtype the IE's subtype
+ * @param pos the position in the NetMsg at which the problem was discovered
+ * @param msg a message describing the problem
+ */
+PDUSyntaxError::PDUSyntaxError(IE::coding_t coding, uint16 category,
+		uint16 type, uint16 subtype, uint32 pos, const char *msg)
+		: IEError(IEError::ERROR_PDU_SYNTAX),
+		  coding(coding), category(category), type(type),
+		  subtype(subtype), errorpos(pos), message(msg) {
+
+	ostringstream ost;
+	ost << "[coding " << coding << ", cat " << category << ", type " << type
+		<< ", subtype " << subtype << "] " << message;
+
+	error_msg = ost.str();
+}
+
+
+/***** class IEMsgTooShort *****/
+
+/**
+ * Constructor.
+ *
+ * @param coding the protocol version
+ * @param category the IE's category
+ * @param pos the position in the NetMsg at which the problem was discovered
+ */
+IEMsgTooShort::IEMsgTooShort(IE::coding_t coding, uint16 category, uint32 pos) 
+		: IEError(ERROR_MSG_TOO_SHORT),
+		  coding(coding), category(category), errorpos(pos) {
+
+	ostringstream ost;
+	ost << "[coding " << coding << ", cat " << category
+		<< ", pos" << errorpos << IEError::getstr();
+
+	error_msg = ost.str();
+}
+
+
+/***** class IEWrongVersion *****/
+
+/**
+ * Constructor.
+ *
+ * @param coding the protocol version
+ * @param category the IE's category
+ * @param pos the position in the NetMsg at which the problem was discovered
+ */
+IEWrongVersion::IEWrongVersion(IE::coding_t coding, uint16 category, uint32 pos)
+		: IEError(ERROR_WRONG_VERSION),
+		  coding(coding), category(category), errorpos(pos) {
+
+	ostringstream ost;
+	ost << "[coding " << coding << ", cat " << category
+		<< ", pos" << errorpos << IEError::getstr();
+
+	error_msg = ost.str();
+}
+
+
+/***** class IEWrongType *****/
+
+/**
+ * Constructor.
+ *
+ * @deprecated This constructor should not be used for new code.
+ *
+ * @param coding the protocol version
+ * @param category the IE's category
+ * @param pos the position in the NetMsg at which the problem was discovered
+ */
+IEWrongType::IEWrongType(IE::coding_t coding, uint16 category, uint32 pos) 
+		: IEError(ERROR_WRONG_TYPE), coding(coding),
+		  category(category), type(0), errorpos(pos) {
+
+	ostringstream ost;
+	ost << "[coding " << coding << ", cat " << category << ", type " << type
+		<< ", pos" << errorpos << IEError::getstr();
+
+	error_msg = ost.str();
+}
+
+
+/**
+ * Constructor.
+ *
+ * @param coding the protocol version
+ * @param category the IE's category
+ * @param type the IE's type
+ * @param pos the position in the NetMsg at which the problem was discovered
+ */
+IEWrongType::IEWrongType(IE::coding_t coding, uint16 category, uint16 type,
+		uint32 pos) 
+		: IEError(ERROR_WRONG_TYPE), coding(coding),
+		  category(category), type(type), errorpos(pos) {
+
+	ostringstream ost;
+	ost << "[coding " << coding << ", cat " << category << ", type " << type
+		<< ", pos" << errorpos << IEError::getstr();
+
+	error_msg = ost.str();
+}
+
+
+/***** class IEWrongSubtype *****/
+
+/**
+ * Constructor.
+ *
+ * @deprecated This constructor should not be used for new code.
+ *
+ * @param coding the protocol version
+ * @param category the IE's category
+ * @param type the IE's type
+ * @param pos the position in the NetMsg at which the problem was discovered
+ */
+IEWrongSubtype::IEWrongSubtype(IE::coding_t coding, uint16 category,
+		uint16 type, uint32 pos) 
+		: IEError(ERROR_WRONG_SUBTYPE), coding(coding),
+		  category(category), type(type), subtype(0), errorpos(pos) {
+
+	ostringstream ost;
+	ost << "[coding " << coding << ", cat " << category << ", type " << type
+		<< ", subtype " << subtype << ", pos" << errorpos
+		<< IEError::getstr();
+
+	error_msg = ost.str();
+}
+
+
+/**
+ * Constructor.
+ *
+ * @param coding the protocol version
+ * @param category the IE's category
+ * @param type the IE's type
+ * @param subtype the IE's subtype
+ * @param pos the position in the NetMsg at which the problem was discovered
+ */
+IEWrongSubtype::IEWrongSubtype(IE::coding_t coding, uint16 category,
+		uint16 type, uint16 subtype, uint32 pos) 
+		: IEError(ERROR_WRONG_SUBTYPE),
+		  coding(coding), category(category), type(type),
+		  subtype(subtype), errorpos(pos) {
+
+	ostringstream ost;
+	ost << "[coding " << coding << ", cat " << category << ", type " << type
+		<< ", subtype " << subtype << ", pos" << errorpos
+		<< IEError::getstr();
+
+	error_msg = ost.str();
+}
+
+
+/***** class IEWrongLength *****/
+
+/**
+ * Constructor.
+ *
+ * The category, type and subtype parameters refer to the IE throwing the
+ * exception.
+ *
+ * @param coding the protocol version
+ * @param category the IE's category
+ * @param type the IE's type
+ * @param subtype the IE's subtype
+ * @param pos the position in the NetMsg at which the problem was discovered
+ */
+IEWrongLength::IEWrongLength(IE::coding_t coding, uint16 category, uint16 type,
+		uint16 subtype, uint32 pos) 
+		: IEError(ERROR_WRONG_LENGTH),
+		  coding(coding), category(category), type(type),
+		  subtype(subtype), errorpos(pos) {
+
+	ostringstream ost;
+	ost << "[coding " << coding << ", cat " << category << ", type " << type
+		<< ", subtype " << subtype << ", pos" << errorpos
+		<< IEError::getstr();
+
+	error_msg = ost.str();
+}
+
+
+/***** class IETooBigForImpl *****/
+
+/**
+ * Constructor.
+ *
+ * @param coding the protocol version
+ * @param category the IE's category
+ * @param pos the position in the NetMsg at which the problem was discovered
+ */
+IETooBigForImpl::IETooBigForImpl(IE::coding_t coding, uint16 category,
+		uint32 pos) 
+		: IEError(ERROR_TOO_BIG_FOR_IMPL),
+		  coding(coding), category(category), errorpos(pos) {
+
+	ostringstream ost;
+	ost << "[coding " << coding << ", cat " << category
+		<< ", pos" << errorpos << IEError::getstr();
+
+	error_msg = ost.str();
+}
+
+
+/***** class IEProtocol *****/
+
+/**
+ * Constructor.
+ *
+ * @param coding the protocol version
+ * @param category the IE's category
+ * @param pos the position in the NetMsg at which the problem was discovered
+ */
+IEProtocolSpecific::IEProtocolSpecific(IE::coding_t coding, uint16 category,
+		uint32 pos) 
+		: IEError(ERROR_PROT_SPECIFIC),
+		  coding(coding), category(category), errorpos(pos) {
+
+	ostringstream ost;
+	ost << "[coding " << coding << ", cat " << category
+		<< ", pos" << errorpos << IEError::getstr();
+
+	error_msg = ost.str();
+}
+
+
+/***** class IEErrorList *****/
+
+/** Insert IE Error into list. */
+void IEErrorList::put(IEError* iee) {
+	if (iee) queue.push_front(iee);
+} // end put
+
+/** Get and remove IE Error from the list. 
+ * Returns NULL if list is empty.
+ */
+IEError* IEErrorList::get() {
+	register IEError* iee;
+	if (queue.empty()) return NULL;
+	else {
+		iee = queue.back();
+		queue.pop_back();
+		return iee;
+	} // end if
+} // end get
+
+/** Is the IE error list empty? */
+bool IEErrorList::is_empty() const {
+	return queue.empty();
+} // end is_empty
+
+/** clear IE error list and destroy all stored IE error objects. */
+void IEErrorList::clear() {
+	queueit_t qit;
+	// delete IEError objects in queue
+	for (qit=queue.begin();qit!=queue.end();++qit)
+		if (*qit) delete *qit;
+	// clear queue
+	queue.clear();		
+} // end clear
+
+/** Destroy IEError list and all IEError objects in it. */
+IEErrorList::~IEErrorList() {
+	if (!queue.empty()) {
+	  Log(DEBUG_LOG,LOG_CRIT, "IE", "Destroying non-empty IEErrorList, deleting IEError objects.");
+	  clear();
+	} // end if not empty
+} // end ~IEErrorList
+
+
+/***** class IEManager *****/
+
+
+/**
+ * Constructor.
+ */
+IEManager::IEManager() {
+	// nothing to do
+}
+
+
+/**
+ * Destructor.
+ *
+ * All registered IEs are deleted.
+ */
+IEManager::~IEManager() {
+	// iterator shortcuts
+	typedef category_map_t::const_iterator c_iter;
+
+	/*
+	 * Walk through all registered IEs and delete them.
+	 */
+	int num_deleted = 0;
+
+	for (c_iter i = registry.begin(); i != registry.end(); i++) {
+		IE *ie = i->second;
+
+		if ( ie != NULL ) {
+			delete ie;
+			num_deleted++;
+		}
+	}
+
+	DLog("IEManager", "Deleted " << num_deleted << " IEs");
+}
+
+
+/** 
+ * Register an Information Element.
+ *
+ * Make the IE object passed as the argument register itself with this
+ * IEManager. See IE's register_ie() method for the rules.
+ *
+ * This method exists for convenience only, please see the other register_ie()
+ * method for details.
+ *
+ * @param ie pointer to IE (NULL is not allowed)
+ */
+void IEManager::register_ie(const IE* ie) {
+	if ( ie == NULL )
+		throw IEError(IEError::ERROR_REGISTER);
+
+	return ie->register_ie(this);
+}
+
+
+/**
+ * Register an Information Element.
+ *
+ * Register an IE for the given category, type and subtype. It is not allowed
+ * to register more than one IE for a (category, type, subtype) triple.
+ *
+ * It is @em very important that each IE instance is registered only once.
+ * If a class can handle multiple (category, type, subtype) triples, one
+ * instance per triple has to be registered.
+ * 
+ * There is no way to unregister an IE. All registered IEs will be deleted
+ * by IEManager's destructor.
+ *
+ * @param category category of the IE
+ * @param type IE type
+ * @param subtype IE subtype
+ * @param ie the IE to register (NULL is not allowed)
+ */
+void IEManager::register_ie(uint16 category, uint16 type, uint16 subtype,
+		const IE* ie) {
+
+	// for logging
+	ostringstream triple;
+	triple << "(" << category << ", " << type << ", " << subtype << ")";
+
+	if ( ie == NULL )
+		throw IEError(IEError::ERROR_REGISTER);
+
+	IE_Key key(category, type, subtype);
+
+	// don't allow overwriting
+	if ( registry[key] != NULL ) {
+		ERRLog("IEManager",
+			"An IE is already " << "registered for " << triple);
+		return;
+	}
+
+
+	try {
+		registry[key] = const_cast<IE *>(ie);
+	}
+	catch ( ... ) {
+		ERRLog("IEManager", "Cannot register IE for " << triple);
+
+		throw IEError(IEError::ERROR_REGISTER);
+	}
+
+	// We made it so far, this means success.
+	DLog("IEManager",
+		"Registered IE " << ie->get_ie_name() << " for " << triple);
+}
+
+
+/**
+ * Create a new instance.
+ *
+ * Creates a new instance using the appropriate registered IE. The definition
+ * of @em appropriate depends on lookup_ie().
+ *
+ * Note that some old IEManager child classes called this method lookup().
+ * This old lookup() method should not be confused with lookup_ie().
+ *
+ * @param category category of the IE
+ * @param type IE type
+ * @param subtype IE subtype
+ * @return a new instance, or NULL if no matching IE is found
+ */
+IE *IEManager::new_instance(uint16 category, uint16 type, uint16 subtype) {
+	IE *ie = lookup_ie(category, type, subtype);
+
+	if ( ie )
+		return ie->copy();
+	else
+		return NULL;
+}
+
+
+/**
+ * Return a registered IE.
+ *
+ * Returns a registered IE instance. It does @em not create a new instance,
+ * it is really an instance you registered earlier. Use new_instance() if
+ * you need new instances!
+ *
+ * This method is an extension point that can be used, for example, to return
+ * "default" IEs if no matching IE is found in the registry.
+ *
+ * @param category category of the IE
+ * @param type IE type
+ * @param subtype IE subtype
+ * @return a registered instance, or NULL if no matching IE is found
+ */
+IE *IEManager::lookup_ie(uint16 category, uint16 type, uint16 subtype) {
+	return registry[IE_Key(category, type, subtype)];
+}
+
+
+/**
+ * Throw an exception and log it.
+ */
+void IEManager::throw_nomem_error() const {
+	try {
+		ERRLog("IEManager", "Out of memory.");
+	}
+	catch ( ... ) {
+		// There's no way to handle this!
+	}
+
+	throw IEError(IEError::ERROR_NO_MEM);
+}
+
+
+/***** operator<< and >> *****/
+
+/** Print the given IE to the ostream using level=0 and indent=3. */
+ostream& operator<<(ostream& os, const IE& ie) {
+	ie.print(os,0,3);
+	return os;
+} // end operator<<
+
+istream& operator>>(istream& is, IE& ie) {
+	ie.input(is,isatty(0),0,3);
+	return is;
+} // end operator>>
+
+//@}
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/ie.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/ie.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/ie.h	(revision 2378)
@@ -0,0 +1,500 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file ie.h
+/// Basic information elements (PDUs and PDU objects)
+/// ----------------------------------------------------------
+/// $Id: ie.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/ie.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+/** @ingroup ie
+ * @todo Use objectpool by deriving classes from class poolobject and
+ * linking executables against objectpool.o or including objectpool.o into
+ * libie.a.
+ *
+ * This header file defines the base class of all information elements, the
+ * information elements for the protocol and an IE manager object.
+ *
+ * For performance only pointers are exchanged. The copy member function is
+ * the way to duplicate an IE. It does much the same as a copy constructor
+ * but returns not the IE but a pointer to it. If the IE contains pointers,
+ * their target objects are copied too.
+ */
+
+#ifndef _PROTLIB__IE_H_
+#define _PROTLIB__IE_H_
+
+#include <ext/hash_map>
+#include <deque>
+#include <string>
+#include <iostream>
+#include <map>
+
+#include "protlib_types.h"
+#include "network_message.h"
+
+namespace protlib {
+
+
+
+/** @addtogroup ie Information Elements
+ * @{
+ */
+
+/// Catch bad_alloc and call throw_nomem_error
+#define catch_bad_alloc(x) try { x; } catch(bad_alloc) { throw_nomem_error(); }
+
+// forward declarations
+class IEManager;
+class IEErrorList;
+class IEError;
+
+/** Abstract Information Element (IE) interface
+ */
+class IE {
+public:
+	virtual ~IE() { }
+
+	friend class IEManager;
+	/// IE coding sheme
+	/** All coding shemes have to be listed here. Each IE should support at
+	 * least one listed coding sheme. This is used when serializing or
+	 * deserializing from a NetMsg object to (de)code the IE in the right way.
+	 * Note that coding schemes and protocol version are not the same.
+	 * There could also be a coding sheme to (de)code IEs e.g. for router
+	 * configuration.
+	 */
+	enum coding_t {
+	  nslp_v1     = 1,
+	  protocol_v1 = 1,
+	  protocol_v2 = 2,
+	  nslp_v2     = 3,
+	  nslp_v2_yoda = 4
+	}; // end coding_t
+protected:
+	/// contructor
+	IE(uint16 category);
+	/// copy constructor
+	IE(const IE& n);
+public:
+	/// get a new instance of the IE
+	virtual IE* new_instance() const = 0;
+	/// copy an IE
+	virtual IE* copy() const = 0;
+	/// deserialization
+	virtual IE* deserialize(NetMsg& msg, coding_t coding, IEErrorList& errorlist, uint32& bread, bool skip = true) = 0;
+	/// serialize
+	virtual void serialize(NetMsg& msg, coding_t coding, uint32& wbytes) const = 0;
+protected:
+	/// check arguments for deserialization
+	bool check_deser_args(coding_t cod, IEErrorList& errorlist, uint32 &bread) const;
+	/// check arguments for serialization
+	void check_ser_args(coding_t cod, uint32 &wbytes) const;
+public:
+	/// IE consistency check
+	virtual bool check() const = 0;
+	/// check if IE supports coding sheme
+	virtual bool supports_coding(coding_t c) const = 0;
+	/// IE serialized size
+	virtual size_t get_serialized_size(coding_t coding) const = 0;
+	/// get category
+	uint16 get_category() const;
+	/// equality
+	virtual bool operator==(const IE& ie) const = 0;
+	/// not equal
+	inline bool operator!=(const IE& ie) const { return (!(*this==ie)); }
+	/// get IE name
+	/** This is mainly for error reporting. */
+	virtual const char* get_ie_name() const = 0;
+	/// print to a ostream
+	virtual ostream& print(ostream& os, uint32 level, const uint32 indent, const char* name = NULL) const;
+	/// get a string representing the IE content
+	string to_string(const char* name = 0) const;
+	/// input from an istream
+	/** Attention: No checking, no warnings. This is ONLY for testing. */
+	virtual istream& input(istream& is, bool istty, uint32 level, const uint32 indent, const char* name = NULL);
+	/// clear all pointer fields
+	virtual void clear_pointers();
+protected:
+	/// register this IE
+	virtual void register_ie(IEManager *iem) const = 0;
+	/// IE category
+	const uint16 category;
+	/// throw a NO_MEM exception
+	void throw_nomem_error() const;
+}; // end class IE
+
+
+
+/**
+ * IE Error base class.
+ *
+ * This is the base for all exceptions thrown during serialize() and
+ * deserialize().
+ *
+ * @warning New code should use the exceptions derived from this class.
+ * This class should be abstract but isn't for compatibility reasons.
+ */
+class IEError : public ProtLibException {
+  public:
+	/// IE error code - common parsing errors
+	enum error_t {
+		ERROR_REGISTER,
+		ERROR_CODING,
+		ERROR_CATEGORY,
+		ERROR_NO_IEMANAGER,
+		ERROR_MSG_TOO_SHORT,
+		ERROR_INVALID_STATE,
+		ERROR_WRONG_TYPE,
+		ERROR_WRONG_SUBTYPE,
+		ERROR_WRONG_LENGTH,
+		ERROR_NO_MEM,
+		ERROR_TOO_BIG_FOR_IMPL,
+		ERROR_UNKNOWN_ERRORCODE,
+		ERROR_WRONG_VERSION,
+		ERROR_UNEXPECTED_OBJECT,
+		ERROR_PDU_SYNTAX,
+		ERROR_OBJ_SET_FAILED,
+		ERROR_PROT_SPECIFIC
+	}; // end error_t
+
+	const error_t err;
+
+	IEError(error_t e);
+	virtual ~IEError() throw ();
+
+	virtual const char *getstr() const;
+
+  protected:
+	IEError(std::string msg) throw ();
+
+  private:
+	static const char* err_str[];
+};
+
+
+/**
+ * Syntax error during deserialization.
+ *
+ * This exception is thrown if a syntax error is detected during
+ * deserialization.
+ */
+class PDUSyntaxError : public IEError {
+  public:
+	PDUSyntaxError(const char* msg); // deprecated!
+	PDUSyntaxError(IE::coding_t coding, uint16 category, uint16 type,
+			uint16 subtype, uint32 pos, const char *msg = "");
+	virtual ~PDUSyntaxError() throw () { }
+
+	const IE::coding_t coding;
+	const uint16 category;
+	const uint16 type;
+	const uint16 subtype;
+	const uint32 errorpos;
+	const string message;
+};
+
+
+/**
+ * NetMsg is too short to serialize/deserialize.
+ *
+ * This exception is typically thrown if a NetMsg ended unexpectedly
+ * which indicates a truncated message. It may also be thrown if a
+ * NetMsg is too short to hold a serialized IE object.
+ */
+class IEMsgTooShort : public IEError {
+  public:
+	IEMsgTooShort(IE::coding_t coding, uint16 category, uint32 pos);
+	virtual ~IEMsgTooShort() throw () { }
+
+	const IE::coding_t coding;
+	const uint16 category;
+	const uint32 errorpos;
+};
+
+
+/**
+ * Wrong protocol version.
+ *
+ * This exception is thrown in case of a version conflict, like a
+ * deserialize() method not being able to handle a coding.
+ */
+class IEWrongVersion : public IEError {
+  public:
+	IEWrongVersion(IE::coding_t coding, uint16 category, uint32 pos);
+	virtual ~IEWrongVersion() throw () { }
+
+	const IE::coding_t coding;
+	const uint16 category;
+	const uint32 errorpos;
+};
+
+
+/**
+ * Invalid IE type.
+ *
+ * Typically thrown if deserialize() fails because there is no matching IE
+ * registered with the IEManager.
+ */
+class IEWrongType : public IEError {
+  public:
+	// The first constructor is deprecated!
+	IEWrongType(IE::coding_t coding, uint16 category, uint32 pos);
+	IEWrongType(IE::coding_t coding, uint16 category, uint16 type,
+			uint32 pos);
+	virtual ~IEWrongType() throw () { }
+
+	const IE::coding_t coding;
+	const uint16 category;
+	const uint16 type;
+	const uint32 errorpos;
+};
+
+
+/**
+ * Invalid IE subtype.
+ *
+ * Typically thrown if deserialize() fails because there is no matching IE
+ * registered with the IEManager.
+ */
+class IEWrongSubtype : public IEError {
+  public:
+	// The first constructor is deprecated!
+	IEWrongSubtype(IE::coding_t coding, uint16 category, uint16 type,
+			uint32 pos);
+	IEWrongSubtype(IE::coding_t coding, uint16 category, uint16 type,
+			uint16 subtype, uint32 pos);
+	virtual ~IEWrongSubtype() throw () { }
+
+	const IE::coding_t coding;
+	const uint16 category;
+	const uint16 type;
+	const uint16 subtype;
+	const uint32 errorpos;
+};
+
+
+/**
+ * An invalid length field was read.
+ *
+ * This exception is thrown if a length field inside a NetMsg has a wrong
+ * length (either too long or too short, but makes no sense). Note that
+ * this overlaps with IEMsgTooShort in some cases.
+ */
+class IEWrongLength : public IEError {
+  public:
+	IEWrongLength(IE::coding_t coding, uint16 category, uint16 type,
+			uint16 subtype, uint32 pos);
+	virtual ~IEWrongLength() throw () { }
+
+	const IE::coding_t coding;
+	const uint16 category;
+	const uint16 type;
+	const uint16 subtype;
+	const uint32 errorpos;
+};
+
+
+/**
+ * Some entity is too big for this implementation.
+ *
+ * This exception is thrown if an operation can't be performed because
+ * of some implementation limit.
+ */
+class IETooBigForImpl : public IEError {
+  public:
+	IETooBigForImpl(IE::coding_t coding, uint16 category, uint32 pos);
+	virtual ~IETooBigForImpl() throw () { }
+
+	const IE::coding_t coding;
+	const uint16 category;
+	const uint32 errorpos;
+};
+
+
+/**
+ * Protocol Specific Error
+ *
+ * This exception is thrown if a protocol specific error
+ * occurred.
+ */
+class IEProtocolSpecific : public IEError {
+  public:
+	IEProtocolSpecific(IE::coding_t coding, uint16 category, uint32 pos);
+	virtual ~IEProtocolSpecific() throw () { }
+
+	const IE::coding_t coding;
+	const uint16 category;
+	const uint32 errorpos;
+};
+
+
+/// IE error list
+/** This represents a list of IE errors. */
+class IEErrorList {
+public:
+	/// put an IEError on the list
+	void put(IEError* iee);
+	/// get and remove next IEError
+	IEError* get();
+	/// is list empty
+	bool is_empty() const;
+	/// clear list
+	void clear();
+	/// destructor
+	~IEErrorList();
+private:
+	/// internal queue type
+	typedef deque<IEError*> queue_t;
+	/// queue iterator type
+	typedef queue_t::iterator queueit_t;
+	/// IEError storage
+	queue_t queue;
+}; // end IEErrorList
+
+
+/**
+ * Represents a (category, type, subtype) tuple.
+ *
+ * Used internally by IEManager.
+ */
+class IE_Key {
+  public:
+	inline IE_Key(uint16 category, uint16 type, uint16 subtype)
+		: category(category), type(type), subtype(subtype) { }
+
+	inline bool operator==(const IE_Key &other) const {
+		return category == other.category && type == other.type
+			&& subtype == other.subtype;
+	}
+
+	inline uint16 get_category() const { return category; }
+	inline uint16 get_type() const { return type; }
+	inline uint16 get_subtype() const { return subtype; }
+
+  private:
+	uint16 category;
+	uint16 type;
+	uint16 subtype;
+};
+
+struct hash_IE_Key {
+	inline size_t operator()(const protlib::IE_Key &k) const {
+		return (k.get_category() << 16)
+			| ( k.get_type() ^ k.get_subtype() );
+	}
+};
+
+
+/** 
+ * A registry and factory for IEs.
+ *
+ * Each IE has to register at the IE Manager. The IEManager then provides
+ * methods to deserialize IEs from or serialize IEs to a NetMsg object.
+ * IEManager is abstract and thus can't be instantiated.
+ *
+ * In contrast to earlier implementations, IEManager itself is no longer a
+ * singleton. Inheriting from singletons is a tricky business in C++ (and
+ * much easier in Java) because static methods can't be virtual. Because
+ * of this, multiple badly implemented child classes were unable to coexist
+ * in a single program.
+ *
+ * The following has to be done in each protocol to use IEManager and
+ * create a protocol-specific singleton (called PROT_IEManager):
+ *
+ *   - Inherit from IEManager.
+ *   - Make the constructor private.
+ *   - Provide a "private: static PROT_IEManager *inst" attribute.
+ *   - Provide a "public: static PROT_IEManager *instance()" method.
+ *   - Provide a "public: static void clear()" method.
+ *   - Define your own category_t with categories appropriate for your protocol.
+ * 
+ * An example implementation can be found in the QSPEC code. Please note that
+ * old code (r286 and earlier) won't compile because of interface changes.
+ * The ability to register "default" IEs that are returned if no more specific
+ * IE is found has been removed because it depended on coding_t. If derived
+ * IEManagers need this functionality, they have to override lookup_ie().
+ * 
+ */
+class IEManager {
+
+  public:
+	virtual ~IEManager();
+
+	virtual void register_ie(const IE *ie);
+	virtual void register_ie(uint16 category, uint16 type, uint16 subtype,
+			const IE *ie);
+
+	virtual IE *new_instance(uint16 category, uint16 type, uint16 subtype);
+
+	virtual void serialize(IE &ie, NetMsg &msg, IE::coding_t coding,
+			uint32 &bytes_written) const;
+
+	virtual IE *deserialize(NetMsg &msg, uint16 category,
+			IE::coding_t coding, IEErrorList& errorlist,
+			uint32 &bytes_read, bool skip = true) = 0;
+
+  protected:
+	IEManager();
+
+	virtual IE *lookup_ie(uint16 category, uint16 type, uint16 subtype);
+
+	virtual void throw_nomem_error() const;
+
+  private:
+	typedef hash_map<IE_Key, IE *, hash_IE_Key> category_map_t;
+
+	category_map_t registry;
+};
+
+
+/** This mainly calls the serialize member function of the given IE.
+ * @param ie pointer to an IE
+ * @param msg NetMsg object that will hold the serialized IE.
+ * @param coding IE coding sheme
+ * @param wbytes number of output bytes
+ */
+inline
+void IEManager::serialize(IE& ie, NetMsg& msg, IE::coding_t coding, uint32& wbytes) const {
+	ie.serialize(msg,coding,wbytes);
+} // end serialize
+
+
+/// print an IE to an ostream
+ostream& operator<<(ostream& os, const IE& ie);
+
+/// input operator
+istream& operator>>(istream& is, IE& ie);
+
+/// round uint32 up
+/** Adds up the given uint32 to fit a 32-bit or 4-byte border. */
+inline uint32 round_up4(uint32 i) {
+	if (i%4) i = i-(i%4)+4;
+	return i;
+} // end round_up4
+
+//@}
+
+} // end namespace protlib
+
+#endif // _PROTLIB__IE_H_
Index: /source/ariba/communication/modules/transport/protlib/llhashers.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/llhashers.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/llhashers.h	(revision 2378)
@@ -0,0 +1,59 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file llhashers.h
+/// hash functions for long longs
+/// ----------------------------------------------------------
+/// $Id: llhashers.h 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/llhashers.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+#ifndef PROTLIB_LL_HASHERS_H
+#define PROTLIB_LL_HASHERS_H
+
+
+/** @addtogroup hashers Hash function objects
+ *
+ * This file contains definitions of hash functions 
+ * for long long (64 bit integers)
+ *
+ * @{
+ */
+
+namespace __gnu_cxx {
+
+/// long long int hasher
+template <> struct hash<long long> {
+	inline size_t operator()(long long i) const { return (size_t)i; }
+}; // end long long hasher
+
+/// unsigned long long int hasher
+template <> struct hash<unsigned long long> {
+	inline size_t operator()(unsigned long long i) const { return (size_t)i; }
+}; // end unsigned long long hasher
+
+} // end namespace __gnu_cxx
+
+
+//@}
+
+#endif
Index: /source/ariba/communication/modules/transport/protlib/logfile.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/logfile.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/logfile.cpp	(revision 2378)
@@ -0,0 +1,187 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file logfile.cpp
+/// Implementation of a logging stream
+/// ----------------------------------------------------------
+/// $Id: logfile.cpp 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/logfile.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+#include "logfile.h"
+#include <iostream>
+#include <iomanip>
+#include <new>
+
+#include <time.h>
+#include <sys/time.h> // gettimeofday
+
+namespace protlib {
+
+using namespace std;
+
+  namespace log {
+
+const char *const ANSIcolorcode[]= {
+  "[0m",  // clear, off; reset; clears all colors and styles (to white on black)
+  "[1m",  // bold_on		
+  "[3m",  // italics_on	
+  "[4m",  // underline_on	
+  "[7m",  // inverse_on	
+  "[9m",  // strikethrough_on	
+  "[22m", // bold_off		
+  "[23m", // italics_off	
+  "[24m", // underline_off	
+  "[27m", // inverse_off	
+  "[29m", // strikethrough_off
+  "[30m", // black  		
+  "[31m", // red    		
+  "[32m", // green  		
+  "[33m", // yellow 		
+  "[34m", // blue   		
+  "[35m", // magenta		
+  "[36m", // cyan   		
+  "[37m", // white  		
+  "[39m", // default		
+  "[40m", // bg_black  	
+  "[41m", // bg_red    	
+  "[42m", // bg_green  	
+  "[43m", // bg_yellow 	
+  "[44m", // bg_blue   	
+  "[45m", // bg_magenta	
+  "[46m", // bg_cyan   	
+  "[47m", // bg_white  	
+  "[49m"  // bg_default       
+};
+
+const char* color[num_colors+1];
+
+const char *const logclass_str[]=
+{
+  " ZERO  ",
+  "*ERROR*",
+  "WARNING",
+  " EVENT ",
+  " INFO  ",
+  " DEBUG ",
+  " EXPERT"
+};
+
+
+const char *const logseveritylevel_str[]=
+  {
+    "EMERG ",
+    "ALERT ",
+    "CRITIC",
+    "LEVEL3",
+    "NORMAL",
+    "LEVEL5",
+    "LEVEL6",
+    "LEVEL7",
+    "UNIMP ",
+    "LEVEL9",
+    "LEVELA",
+    "LEVELB",
+    "LEVELC",
+    "LEVELD",
+    "LEVELE",
+    "-ALL- "
+  };
+
+
+/** set logging destination to new filename
+ * @return true if logfile could be opened for given name
+ */
+bool
+logfile::set_dest(const char* filename, bool quiet)
+{
+  // lock everything
+  pthread_mutex_lock(&logmutex); 
+
+  if (logstream && !quiet)
+  {
+    (*logstream) << color[blue] << timenow() << '[' << getpid() << "] Redirecting Log output to \"" << filename << '\"' << endl;
+    (*logstream) << color[blue] << timenow() 
+		 << '[' << getpid() << "] <<<<<<<<<<<<<<<<<<<<<<<< *** LOG  STOP *** <<<<<<<<<<<<<<<<<<<<<<<<" 
+		 << color[off] << endl;
+  }
+
+  // delete old stream
+  if (logstream!= &cout)
+    delete logstream;
+
+  // allocate new stream
+  if (strlen(filename))
+    logstream= new(nothrow) ofstream(filename);
+  else
+    logstream= &cout;
+
+  pthread_mutex_unlock(&logmutex); 
+
+  if (!logstream)
+  {
+    cerr << "Could not open logfile " << filename << endl;
+    return false;
+  }
+  else
+  {
+    (*logstream) << color[blue] << timenow() 
+		 << '[' << getpid() << "] >>>>>>>>>>>>>>>>>>>>>>>> *** LOG START *** >>>>>>>>>>>>>>>>>>>>>>>>" 
+		 << color[off] << endl;
+  }
+  return true;
+}
+
+
+ostream&
+logfile::logstart(logclass_t logclass, loglevel_t severity_level, 
+		  const string& modname,
+		  const char* file, 
+		  const char* func, 
+		  int line)
+{  
+  // lock logstream for writing, must be unlocked by logfile.end()
+  int mtxlck_ret= 0;
+  if ( (mtxlck_ret= pthread_mutex_lock(&logmutex)) )
+  {
+    cerr << color[red] << "logfile::logstart() ERROR while locking mutex - return code:" << mtxlck_ret << "/" << strerror(mtxlck_ret) << endl;
+  }
+
+  if ( logstream )
+  {
+    (*logstream) << (logclass==ERROR_LOG ? color[bold_on] : "")
+                 << (logclass==WARNING_LOG ? color[magenta] : 
+		     (logclass==ERROR_LOG ? color[red] : color[off])
+		    )
+                 << timenow()
+		 << '-' << getpid() << (logclass!=ERROR_LOG ? '-' : '*')
+		 << color[bold_on] << logclass_str[logclass>>4] << (logclass==ERROR_LOG ? color[bold_on] : color[bold_off])
+		 << (logclass!=ERROR_LOG ? '/' : '*') << hex << severity_level << dec
+		 << ": " << color[bold_on] << left << setfill(' ') << setw(15) << modname << color[bold_off] << right << " " << color[off];
+  }
+  
+  return (*logstream);
+}
+
+
+  } // end namespace log
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/logfile.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/logfile.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/logfile.h	(revision 2378)
@@ -0,0 +1,386 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file logfile.h
+/// Implementation of a logging stream
+/// ----------------------------------------------------------
+/// $Id: logfile.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/logfile.h $
+// ===========================================================
+//
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+#ifndef _logfile_h_
+#define _logfile_h_
+
+
+//#define _NO_LOGGING
+
+#include <fstream> // file stream
+#include <iostream>
+
+#include <string.h>
+#include <pthread.h>
+#include <sys/time.h>
+#include <stdio.h> // sprintf
+#include <unistd.h> // getpid
+
+#include "protlib_types.h"
+
+namespace protlib {
+
+  using namespace std;
+/** @addtogroup log Logging
+ * @{
+ */
+
+namespace log {
+
+    static const pthread_mutex_t initlogmutex=
+#ifdef _DEBUG
+  // PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; // use this for debugging, it will return errors on potential deadlock situations
+  PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+#else // should be recursive mutex because sometimes error log output sometimes occurs
+  // while objects contents are logged
+  PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; // PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+#undef ERROR_LOG
+#undef WARNING_LOG
+#undef EVENT_LOG
+#undef INFO_LOG
+#undef DEBUG_LOG
+#undef LOG_TYPES
+
+#undef LOG_ALL
+#undef LOG_EMERG
+#undef LOG_ALERT
+#undef LOG_CRIT
+#undef LOG_NORMAL
+#undef LOG_UNIMP
+
+
+enum logclass_t
+{
+  ERROR_LOG= 0x10,
+  WARNING_LOG= 0x20,
+  EVENT_LOG= 0x30,
+  INFO_LOG=  0x40,
+  DEBUG_LOG= 0x50,
+  EVERY_LOG= 0xF0,
+  LOG_TYPES= 5
+};
+
+
+enum loglevel_t
+{
+  LOG_EMERG=  0,
+  LOG_ALERT=  1,
+  LOG_CRIT=   2,
+  LOG_NORMAL= 4,
+  LOG_UNIMP=  8,
+  LOG_ALL=   15
+};
+
+// colors
+
+enum color_t
+{
+clear,
+bold_on,
+italics_on,
+underline_on,
+inverse_on,
+strikethrough_on,
+bold_off,
+italics_off,
+underline_off,
+inverse_off,
+strikethrough_off,
+black,
+red,
+green,
+yellow,
+blue,
+magenta,
+cyan,
+white,
+fg_default,
+bg_black,
+bg_red,
+bg_green,
+bg_yellow,
+bg_blue,
+bg_magenta,
+bg_cyan,
+bg_white,
+bg_default,
+num_colors,
+off=0};
+
+extern const char* color[];
+extern const char *const ANSIcolorcode[];
+
+
+#define  ERRLog(mname, logstring) Log(ERROR_LOG, LOG_NORMAL, mname, logstring)
+#define  ERRCLog(mname, logstring) Log(ERROR_LOG, LOG_CRIT, mname, logstring)
+#define  EVLog(mname, logstring) Log(EVENT_LOG, LOG_NORMAL, mname, logstring)
+#define  WLog(mname, logstring) Log(WARNING_LOG, LOG_NORMAL, mname, logstring)
+#define  ILog(mname, logstring) Log(INFO_LOG, LOG_NORMAL, mname, logstring)
+#define  DLog(mname, logstring) Log(DEBUG_LOG, LOG_NORMAL, mname, logstring)
+
+
+#ifndef _NO_LOGGING
+
+// Log(lclass, llevel, mname, logstring)
+// lclass: logclass, llevel: severitylevel, mname: module or methodname,
+// logstring: things to log in stream notation
+#define  Log(lclass, llevel, mname, logstring) do {			\
+  if ( protlib::log::DefaultLog.should_log(lclass, llevel) ) {		\
+    using protlib::log::DefaultLog;					\
+    DefaultLog.logstart(lclass, llevel, mname) << logstring;		\
+    DefaultLog.logend();						\
+  }									\
+} while ( false )
+
+#define  LogS(lclass, llevel, mname, logstring) do {			\
+  if ( protlib::log::DefaultLog.should_log(lclass, llevel) ) {		\
+    protlib::log::DefaultLog.logstart(lclass, llevel, mname,		\
+	__FILE__, __FUNCTION__, __LINE__) << logstring;			\
+    protlib::log::DefaultLog.logend();					\
+  }									\
+} while ( false )
+
+#else
+
+#define  Log(logclass, loglevel, mname, logstring)
+#define  LogS(logclass, loglevel, mname, logstring)
+
+#endif
+
+class logfile
+{
+ private:
+  ostream* logstream;
+  pthread_mutex_t logmutex;
+
+  unsigned char logfilter[LOG_TYPES];
+
+  bool usecolors;
+  bool quiet_start;
+
+  const char* timenow();
+
+ public:
+
+  logfile(const char* filename="", bool usecolors= true, bool quietstart=false);
+  ~logfile();
+
+  bool set_dest(const char* filename, bool quiet=false);
+  void set_filter(logclass_t logclass, uint8 severitylevel);
+  bool should_log(logclass_t logclass, loglevel_t severitylevel);
+
+
+  ostream& logstart(logclass_t logclass, loglevel_t severity_level,
+		    const string& modname,
+		    const char* file="",
+		    const char* func="",
+		    int line=0);
+  void coloron() { usecolors=true; for (int i= 0; i<num_colors; i++) {color[i]= ANSIcolorcode[i]; } }
+  void coloroff() { usecolors=false; for (int i= 0; i<num_colors; i++) {color[i]= ""; } }
+
+  void logend();
+}; // end class logfile
+
+extern
+
+inline
+logfile::logfile(const char* filename,  bool usecolors, bool quietstart)
+  : logstream(0),
+    logmutex(initlogmutex),
+    usecolors(usecolors),
+    quiet_start(quietstart)
+{
+  for (int i= 0; i< LOG_TYPES; i++)
+    logfilter[i]= LOG_ALL;
+
+  if (strlen(filename))
+    logstream= new(nothrow) ofstream(filename);
+  else
+    logstream= &cout;
+
+  if (!logstream)
+  {
+    cerr << "Could not open logfile " << filename << endl;
+  }
+  else
+  {
+    pthread_mutex_lock(&logmutex);
+
+    // if enable colors, use ANSI code,
+    // if disable colors, so replace all strings with "";
+    for (int i= 0; i<num_colors; i++)
+    {
+      color[i]= (usecolors ? ANSIcolorcode[i] : "");
+    }
+
+    if (!quiet_start && logstream)
+    {
+      (*logstream) << color[blue] << timenow()
+		   << '[' << getpid() << "] >>>>>>>>>>>>>>>>>>>>>>>> *** LOG START *** >>>>>>>>>>>>>>>>>>>>>>>>"
+		   << color[off] << endl;
+    }
+    pthread_mutex_unlock(&logmutex);
+  }
+}
+
+
+inline
+logfile::~logfile()
+{
+  if (logstream)
+  {
+    pthread_mutex_lock(&logmutex);
+
+    if ( ! quiet_start )
+	(*logstream) << color[blue] << timenow() << '[' << getpid()
+	<< "] <<<<<<<<<<<<<<<<<<<<<<<< *** LOG  STOP *** <<<<<<<<<<<<<<<<<<<<<<<<"
+	<< color[off] << endl;
+    pthread_mutex_unlock(&logmutex);
+
+    // destroy mutex
+    pthread_mutex_destroy(&logmutex);
+
+    // delete if allocated stream
+    if (logstream!= &cout)
+      delete logstream;
+
+    logstream= 0;
+  }
+}
+
+
+
+inline
+void
+logfile::set_filter(logclass_t logclass, uint8 severity_level)
+{
+  uint8 logclass_index= (logclass>>4)-1;
+  if (logclass_index < LOG_TYPES)
+    logfilter[logclass_index]=  severity_level;
+}
+
+inline
+bool
+logfile::should_log(logclass_t logclass, loglevel_t severity_level)
+{
+  return severity_level <= logfilter[(logclass>>4)-1];
+}
+
+
+/**
+ * returns current time in static char array
+ * @return pointer to static character array that contains current time
+ */
+inline
+const char* logfile::timenow()
+{
+  static time_t t;
+  static struct timeval now;
+  static char timestr[32]= "";
+  static char msecstr[6];
+
+  gettimeofday(&now,NULL);
+  t= now.tv_sec;
+  strftime(timestr, sizeof(timestr)-sizeof(msecstr), "%Y-%m-%d %H:%M:%S.", localtime(&t));
+  snprintf(msecstr,sizeof(msecstr),"%03lu",now.tv_usec/1000UL);
+  strcat(timestr,msecstr);
+  return timestr;
+}
+
+inline
+void logfile::logend()
+{
+  if (logstream)
+  {
+    (*logstream) << color[off] << endl;
+  }
+
+  pthread_mutex_unlock(&logmutex);
+}
+
+
+extern logfile& DefaultLog;
+//@}
+
+} // end namespace log
+
+} // end namespace protlib
+
+
+
+
+
+/**
+ * returns current time in static char array
+ * @return pointer to static character array that contains current time
+ */
+inline
+const char* log_timenow(char* module, char* event)
+{
+
+    //static pthread_mutex_t timestampmutex= PTHREAD_MUTEX_INITIALIZER;
+
+
+
+    //pthread_mutex_lock(&timestampmutex);
+
+
+    static time_t t;
+    //static struct timeval now;
+    static char timestr[128]= "";
+    //static char msecstr[8];
+
+    struct timespec tp;
+
+    clock_gettime(CLOCK_REALTIME, &tp);
+
+    //gettimeofday(&now,NULL);
+    t= tp.tv_sec;
+
+    //bringing down the range to under 1 hour
+    //write out microseconds
+
+    //printf("%ld\n", tp.tv_nsec);
+    //printf("%ld\n", t % 3600);
+
+    sprintf(timestr, "%05ld%06ld - ", t % 3600, tp.tv_nsec/1000L);
+    //snprintf(msecstr,sizeof(msecstr),"%06lu",tp.tv_nsec/1000000UL);
+    strcat(timestr,module);
+    strcat(timestr," - ");
+    strcat(timestr,event);
+
+    //pthread_mutex_unlock(&timestampmutex);
+
+    return timestr;
+}
+
+
+
+#endif
Index: /source/ariba/communication/modules/transport/protlib/messages.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/messages.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/messages.cpp	(revision 2378)
@@ -0,0 +1,205 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file messages.cpp
+/// These messages are sent internally between threads (modules)
+/// ----------------------------------------------------------
+/// $Id: messages.cpp 3013 2008-05-15 16:12:27Z roehricht $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/messages.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup messages
+ * These messages are sent internally between threads (modules).
+ */
+
+#include "messages.h"
+//#include "context.h"
+#include "queuemanager.h"
+#include "cleanuphandler.h"
+#include "threadsafe_db.h"
+
+namespace protlib {
+
+/** @addtogroup messages Internal Messages
+ * @{
+ */
+
+/***** class message *****/
+
+/** This array contains printable names of messages sources. */
+const char* const message::qaddr_string[] = {
+	"UNKNOWN",
+	"TransportProtocol",
+	"TimerModule",
+	"Coordination (ext)",	// external
+	"Coordination (int)",	// internal
+	"Signaling",
+	"Policy",
+	"ResourceModule",
+	"Routing",
+	"Accounting",
+	"RouterConfiguration",
+	"TPoverSCTP",
+	"TPoverTCP",
+	"TPoverTLS_TCP",
+	"TPoverUDP",
+	"TPoverQueryEncapsulation",
+	"QNSLP-TimerProc",
+	"QNSLP-Coordinator",
+	"QNSLP-Signaling",
+	"APPL-QNSLP-Signaling",
+	"QNSLP-APPL-Signaling",
+	"GUI",
+	"API-0",
+	"API-1",
+	"API-2",
+	"API-3",
+	"API-4",
+	"API-5",
+	"API-6",
+	"API-7",
+	"API Wrapper Input (from TP)",
+	"TPoverUDS",
+	"QoS NSLP Client API over UDS",
+	"(INVALID)"
+}; // end qaddr_string
+
+/** This array contains printable names of message types. */
+const char* const message::type_string[] = {
+	"TPMsg",
+	"TimerMsg",
+	"SignalingMsg",
+	"ContextMsg",
+	"InfoMsg",
+	"RoutingMsg",
+	"APIMsg"
+}; // end type_string
+
+/** Set message type, source ID and source queue.
+ * Set message ID to id if possible, otherwise generate a new ID.
+ */
+message::message(type_t t, qaddr_t s, id_t id) 
+: type(t), source(s) {
+	if ((!id) || (!set_id(id))) new_id();
+} // end constructor
+
+/** Destructor does nothing for this class. */
+message::~message() {}
+
+message::id_t message::get_id() const { return msg_id; }
+
+message::id_t message::set_id(id_t id) {
+	if (!id) {
+		new_id();
+		return 0;
+	} else {
+		msg_id = id;
+		return id;
+	} // end if id
+} // end set_id
+
+/** Generate an unused ID. */
+message::id_t message::new_id() {
+	msg_id = 0;
+	while (!msg_id) msg_id = tsdb::get_new_id64();;
+	return msg_id;
+} // end new_id
+
+/** Get the message type. */
+message::type_t message::get_type() const { return type; }
+
+FastQueue* message::get_source_queue() const {
+	return QueueManager::instance()->get_queue(source);
+} // end get_source_queue
+
+message::qaddr_t message::get_source() const {
+	return source;
+} // end get_source
+
+/** Set source ID and return old value. */
+message::qaddr_t message::set_source(qaddr_t s) {
+	register qaddr_t os = source;
+	source = s;
+	return os;
+} // end set_source
+
+/** Returns a pointer to a string containing a printable name of the message 
+ * source.
+ */
+const char* message::get_qaddr_name() const {
+	return qaddr_string[source];
+} // end get_source_name
+
+/** Get the name of the given source. */
+const char* message::get_qaddr_name(qaddr_t s) {
+	return qaddr_string[s];
+} // end get_source_name
+
+/** Send this message to destqueue.
+ * @returns false if destqueue is NULL or queue does not accept the message.
+ */
+bool message::send(qaddr_t src, FastQueue* destqueue, bool exp) {
+	if (!destqueue) return false;
+	source = src;
+	return destqueue->enqueue(this,exp);
+} // end send
+
+/** Send this message.
+ * @returns false if destination queue cannot be found or queue does not accept the message.
+ */
+bool message::send(qaddr_t src, qaddr_t dest, bool exp) {
+	FastQueue* destqueue = QueueManager::instance()->get_queue(dest);
+	if (!destqueue) return false;
+	source = src;
+	return destqueue->enqueue(this,exp);
+} // end send
+
+/** Send this message.
+ * @returns false if destination queue cannot be found or queue does not accept the message.
+ */
+bool message::send_to(qaddr_t dest, bool exp) {
+	FastQueue* destqueue = QueueManager::instance()->get_queue(dest);
+	if (destqueue) return destqueue->enqueue(this,exp);
+	else return false;
+} // end send_to
+
+bool message::send_to(FastQueue* destqueue, bool exp) {
+	if (destqueue) return destqueue->enqueue(this,exp);
+	else return false;
+} // end send_to
+
+/** Send back this message.
+ * @returns false if destination queue cannot be found or queue does not accept the message.
+ */
+bool message::send_back(qaddr_t from, bool exp) {
+	FastQueue* destqueue = QueueManager::instance()->get_queue(source);
+	if (!destqueue) return false;
+	source = from;
+	return destqueue->enqueue(this,exp);
+} // end send_back
+
+/** Set all pointer fields to NULL. */
+void message::clear_pointers() {}
+
+
+//@}
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/messages.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/messages.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/messages.h	(revision 2378)
@@ -0,0 +1,192 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file messages.h
+/// internal messages sent between modules and other components
+/// ----------------------------------------------------------
+/// $Id: messages.h 3013 2008-05-15 16:12:27Z roehricht $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/messages.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+/** @ingroup messages
+ * @file
+ * These messages are sent between modules and other DRM components.
+ */
+
+#ifndef _PROTLIB__MESSAGE_H_
+#define _PROTLIB__MESSAGE_H_
+
+#include <pthread.h>
+#include <ext/hash_set>
+
+#include "protlib_types.h"
+#include "fqueue.h"
+
+namespace protlib {
+
+/** @addtogroup messages Internal Messages
+ * @{
+ */
+
+// class FastQueue is declared in fqueue.h
+class FastQueue;
+
+// class Context is declared in context.h
+class Context;
+
+/// internal messages
+/** Base class of all internal drm messages passed between modules. */
+class message {
+public:
+	/// message type
+	/** Each subclass of class message has its own unique type. */
+	enum type_t {
+		type_transport,
+		type_timer,
+		type_signaling,
+		type_context,
+		type_info,
+		type_routing,
+		type_API
+	}; // end type_t
+
+	/// source ID
+	/** Identifies the module which sent the message.
+	 *  If you add an id here, please add also the corresponding string in qaddr_string
+	 */
+	enum qaddr_t {
+		qaddr_unknown, // used as return value in NSLPtable.get_address() if there is no address found
+		qaddr_transport,
+		qaddr_timer,
+		qaddr_coordination,
+		qaddr_coordination_internal,
+		qaddr_signaling,
+		qaddr_policy,
+		qaddr_resource,
+		qaddr_routing,
+		qaddr_accounting,
+		qaddr_router_config,
+		qaddr_tp_over_sctp,
+		qaddr_tp_over_tcp,
+		qaddr_tp_over_tls_tcp,
+		qaddr_tp_over_udp,
+		qaddr_tp_queryencap,
+		qaddr_qos_nslp_timerprocessing,
+		qaddr_qos_nslp_coordination,
+		qaddr_qos_nslp_signaling,
+		qaddr_appl_qos_signaling,
+		qaddr_qos_appl_signaling,
+		qaddr_gui,
+		qaddr_api_0,
+		qaddr_api_1,
+		qaddr_api_2,
+		qaddr_api_3,
+		qaddr_api_4,
+		qaddr_api_5,
+		qaddr_api_6,
+		qaddr_api_7,
+		qaddr_api_wrapper_input,
+		qaddr_tp_over_uds,
+		qaddr_uds_appl_qos	// receives messages from an external client via UDS
+	}; // end qaddr_t
+
+	/// message ID
+	/** Each message has an ID.
+	 * Message IDs are not unique, you can use the same ID e.g. for request
+	 * and response. You cannot use an unused message ID, you can just reuse
+	 * an already used ID. ID 0 sets an unused ID.
+	 * Since id_t is 64-bit long, you can send 10^10 messages per seconds
+	 * for over 30 years without reusing an ID.
+	 */
+	typedef gp_id_t id_t;
+	/// constructor
+	message(type_t t, qaddr_t s = qaddr_unknown, id_t id = 0);
+	/// destructor
+	virtual ~message();
+	/// get ID
+	id_t get_id() const;
+	/// set ID or generate a new one
+	id_t set_id(id_t id);
+	/// get new ID
+	id_t new_id();
+	/// get message type
+	type_t get_type() const;
+	/// get source module queue
+	FastQueue *get_source_queue() const;
+	/// get source ID
+	qaddr_t get_source() const;
+	/// set source ID
+	qaddr_t set_source(qaddr_t s);
+	/// get name of message source
+	const char* get_qaddr_name() const;
+	/// get source name
+	static const char* get_qaddr_name(qaddr_t s);
+	/// get name of message type
+	const char* get_type_name() const { return type_string[type]; }
+	/// get type name
+	static const char* get_type_name(type_t t) { return type_string[t]; }
+	/// send the message to a queue
+	bool send(qaddr_t src, FastQueue* destqueue, bool exp = false);
+	/// send the message
+	bool send(qaddr_t src, qaddr_t dest, bool exp = false);
+	// @{
+	/// send the message to dest
+	bool send_to(qaddr_t dest, bool exp = false);
+	bool send_to(FastQueue* destqueue, bool exp = false);
+	// @}
+	/// send the message back
+	bool send_back(qaddr_t from, bool exp = false);
+	//@{
+	/// send or delete the message
+	void send_or_delete(qaddr_t src, qaddr_t dest, bool exp = false) {	if (!send(src,dest,exp)) delete this; }
+	void send_to_or_delete(qaddr_t dest, bool exp = false) { if (!send_to(dest,exp)) delete this; }
+	void send_back_or_delete(qaddr_t src, bool exp = false) { if (!send_back(src,exp)) delete this; }
+	//@}
+	/// clear all pointers
+	virtual void clear_pointers();
+private:
+	const type_t type;
+	qaddr_t source;
+	id_t msg_id;
+ 	/// printable message source names
+	static const char* const qaddr_string[];
+ 	/// printable message typee names
+	static const char* const type_string[];
+}; // end class message
+
+
+
+//@}
+
+} // end namespace protlib
+
+namespace __gnu_cxx {
+
+/// message pointer hasher
+/** Hash value is the address of the object pointed to. */
+template <> struct hash<protlib::message*> {
+	inline size_t operator()(protlib::message* m) const { return (size_t)m; }
+}; // end msgp_hash
+
+} // end namespace __gnu_cxx
+
+#endif // _PROTLIB__MESSAGE_H_
Index: /source/ariba/communication/modules/transport/protlib/network_message.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/network_message.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/network_message.cpp	(revision 2378)
@@ -0,0 +1,672 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file network_message.cpp
+/// generic class for network messages represented as byte stream
+/// ----------------------------------------------------------
+/// $Id: network_message.cpp 3247 2008-07-28 20:54:54Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/network_message.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup networkmsg
+ * This is a generic class for network messages,
+ * represented as a byte stream (buffer containing bytes).
+ */
+
+#include <netinet/in.h> 
+#include <string.h>
+#include <cctype>
+#include <fstream>
+#include <ostream>
+#include <sstream>
+#include <iomanip>
+
+#include "network_message.h"
+
+#include "logfile.h" // only required for color definitions
+
+namespace protlib {
+
+
+  using namespace protlib::log;
+/** @addtogroup networkmsg Network Messages
+ * @{
+ */
+
+/** @param e error code */
+NetMsgError::NetMsgError(error_t e) : err(e) {}
+
+const char* NetMsgError::getstr() const { return errstr[err]; }
+
+/** NetMsg error strings */
+const char* const NetMsgError::errstr[] = 
+{
+    "Network message too long.",
+    "Not enough memory to allocate network message.",
+    "Operation not valid because of pointer position in NetMsg buffer.",
+    "NULL pointer argument in call to NetMsg constructor.",
+    "Invalid start offset.",
+    "NetMsg buffer too short.",
+    "Invalid buffer size: zero"
+}; // end network message error strings
+
+/** Maximum size of a network message. This is set to 128000 to prevent
+ * very large messages.
+ */
+const uint32 NetMsg::max_size = 128000;
+
+/** Creates a network message object of the desired size if possible.
+ * @param s buffer size.
+ */
+NetMsg::NetMsg(uint32 s) {
+  if (s>max_size) throw NetMsgError(NetMsgError::ERROR_TOO_LONG);
+  if (s==0) throw NetMsgError(NetMsgError::ERROR_INVALID_BUFSIZE);
+  buf = new(nothrow) uchar[s];
+  if (!buf) throw NetMsgError(NetMsgError::ERROR_NO_MEM);
+  memset(buf,0,s);
+  buf_len = s;
+  pos = buf;
+  buf_end = buf+(s-1);
+} // end constructor
+
+/** Creates a network message object of the desired size if possible.
+ * @param b pointer to a buffer to initialize the NetMsg.
+ * @param s buffer size
+ * @param copy copy the buffer or use the buffer without copying.
+ */
+NetMsg::NetMsg(uchar *b, uint32 s, bool copy) {
+  if (s>max_size) throw NetMsgError(NetMsgError::ERROR_TOO_LONG);
+  if (s==0) throw NetMsgError(NetMsgError::ERROR_INVALID_BUFSIZE);
+  if (copy) {
+    buf = new(nothrow) uchar[s];
+    if (!buf) throw NetMsgError(NetMsgError::ERROR_NO_MEM);
+    memcpy(buf,b,s);
+  } else {
+    buf=b;
+    if (!buf) throw NetMsgError(NetMsgError::ERROR_NULL_POINTER);
+  } // end if copy
+  buf_len = s;
+  pos = buf;
+  buf_end = buf+(s-1);
+} // end constructor
+
+NetMsg::NetMsg(const NetMsg& n) {
+  buf_len = n.buf_len;
+  if (buf_len == 0)
+    throw NetMsgError(NetMsgError::ERROR_INVALID_BUFSIZE);
+
+  buf = new(nothrow) uchar[buf_len];
+  if (!buf) throw NetMsgError(NetMsgError::ERROR_NO_MEM);
+  memcpy(buf,n.buf,buf_len);
+  pos = buf+(n.pos-n.buf);
+  buf_end = buf+(buf_len-1);
+} // end copy constructor
+
+/** Frees the message buffer. */
+NetMsg::~NetMsg() {
+  if (buf) { delete[] buf; buf= 0; }
+} // end destructor
+
+/** @return the size of the network message buffer. */
+uint32 NetMsg::get_size() const {
+   return buf_len;
+} // end get_size
+
+/** Returns the number of bytes left, that is the number of bytes from the 
+ * current position to the end of the buffer.
+ */
+uint32 NetMsg::get_bytes_left() const {
+  if (buf<=pos) 
+  {
+    if (pos<=buf_end) 
+      return (buf_end-pos)+1; 
+    else 
+      return 0;
+  } 
+  else /// should never happen
+    throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end get_size
+
+/** Returns the offset of the buffer pointer. 
+ * Note that an offset of buf_len means that the pointer is one byte behind
+ * the end of the buffer. This means that you reached the buffer end.
+ * This leads to a get-pos result of buf_len.
+ */
+uint32 NetMsg::get_pos() const {
+  if ((buf<=pos) && (pos<=(buf_end+1))) 
+    return (pos-buf);
+  else 
+    throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end get_pos
+
+/** Move pointer to the given offset. 
+ * @param p pointer offset 
+ * @note if p==buf_len then the pointer is one byte behind the buffer end.
+ * This is correct and signals that all data has been read from the buffer.
+ */
+NetMsg& NetMsg::set_pos(uint32 p) {
+  if (p<=buf_len) 
+  {
+    pos = buf+p;
+    return *this;
+  } 
+  else 
+    throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end set_pos
+
+/** Move pointer relative to current position.
+ * @param rp offset relative to current position. 
+ */
+NetMsg& NetMsg::set_pos_r(int32 rp) 
+{
+  if (((pos+rp)>=buf) && ((pos+rp)<=(buf_end+1))) {
+    pos += rp;
+  } 
+  else 
+    throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+  return *this;
+} // end set_pos_r
+
+/** Set current position to buffer start. */
+NetMsg& NetMsg::to_start() {
+  pos=buf;
+  return *this;
+} // end to_start
+
+/** Copy n bytes into NetMsg buffer.
+ * @param b source
+ * @param n number of bytes to copy
+ */
+uint32 NetMsg::copy_from(const uchar *b, uint32 n) {
+  return copy_from(b,0,n);
+} // end copy_from
+
+/** Copy bytes into NetMsg buffer.
+ * @param b source
+ * @param start offset of first byte to copy
+ * @param n number of bytes to copy
+ */
+uint32 NetMsg::copy_from(const uchar *b, uint32 start, uint32 n) {
+  if ((n+start)>buf_len) throw NetMsgError(NetMsgError::ERROR_TOO_SHORT);
+  // TH: I BELIEVE THIS IS WRONG !!
+  //memmove(buf,b+start,n);
+  memmove(buf+start,b,n);
+  return n;
+} // end copy_from
+
+/** Copy n bytes from NetMsg buffer into b. If the NetMsg buffer is smaller
+ * than n, less bytes are copied. 
+ * @param b destination buffer
+ * @param n number of bytes to be copied
+ * @return number of copied bytes
+ */
+uint32 NetMsg::copy_to(uchar *b, uint32 n) const {
+  try {
+    return copy_to(b,0,n);
+  } catch(NetMsgError& e) {
+    // ERROR, should not happen
+  } // end try-catch
+  return 0;
+} // end copy_to
+
+/** Copy n bytes from NetMsg buffer into b. If the NetMsg buffer is smaller
+ * than n, less bytes are copied. 
+ * @param b destination buffer
+ * @param start offset into NetMsg buffer
+ * @param n number of bytes to be copied
+ * @return number of copied bytes
+ */
+uint32 NetMsg::copy_to(uchar *b, uint32 start, uint32 n) const {
+  if (start>=buf_len) throw NetMsgError(NetMsgError::ERROR_INVALID_START_OFFSET);
+  if ((n+start)>buf_len) n=buf_len-start;
+  memmove(b,buf+start,n);
+  return n;
+} // end copy_to
+
+/** returns a pointer to the NetMsg buffer. */
+uchar* NetMsg::get_buffer() const {
+	return buf;
+} // end get_buffer
+
+
+
+/** Decode an uint8 integer.
+ * @param move determines if current position in buffer is changed or not.
+ */
+uint8 NetMsg::decode8(bool move) {
+  register uint8 i;
+  if (pos<=buf_end) 
+  {
+    i = *pos;
+    if (move) pos+=1;
+  } 
+  else 
+    throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+  
+  return i;
+} // end decode uint8
+
+/** Decode an uint16 integer.
+ * @param move determines if current position in buffer is changed or not.
+ */
+uint16 NetMsg::decode16(bool move) {
+  register uint16 i;
+  if ((pos+1)<=buf_end) {
+    i = ntohs(*((uint16*)pos));
+    if (move) pos+=2;
+  } 
+  else 
+    throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+  return i;
+} // end decode uint16
+
+/** Decode an uint32 integer.
+ * @param move determines if current position in buffer is changed or not.
+ */
+uint32 NetMsg::decode32(bool move) {
+  register uint32 i;
+  if ((pos+3)<=buf_end) {
+    i = ntohl(*((uint32*)pos));
+    if (move) pos+=4;
+  } 
+  else 
+    throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+  return i;
+} // end decode uint32
+
+/** Decode an uint64 integer.
+ * @param move determines if current position in buffer is changed or not.
+ */
+uint64 NetMsg::decode64(bool move) {
+  uint64 hi = 0;
+  uint64 lo = 0;
+  uint64 res = 0;
+  uint32* p = (uint32*)pos;
+  if ((pos+7)<=buf_end) {
+    hi = ntohl(*p);
+    lo = ntohl(*(p+1));
+    res = (hi<<32)+lo;
+    if (move) pos+=8;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+  return res;
+} // end decode uint64
+
+/** Decode an uint128 integer.
+ * @param move determines if current position in buffer is changed or not.
+ */
+uint128 NetMsg::decode128(bool move) {
+  uint32 word1, word2, word3, word4;
+  uint128 res;
+  word1 = NetMsg::decode32();
+  word2 = NetMsg::decode32();
+  word3 = NetMsg::decode32();
+  word4 = NetMsg::decode32();
+  res.w1 = word1;
+  res.w2 = word2;
+  res.w3 = word3;
+  res.w4 = word4;
+
+  return res;
+} // end decode uint128
+
+/** Encode an uint8 integer.
+ * @param i an uint8
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::encode8(uint8 i, bool move) {
+  if (pos<=buf_end) {
+    *pos = i;
+    if (move) pos+=1;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end encode uint8
+
+/** Encode an uint16 integer.
+ * @param i an uint16
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::encode16(uint16 i, bool move) {
+  if ((pos+1)<=buf_end) {
+    *((uint16*)pos) = htons(i);
+    if (move) pos+=2;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end encode uint16
+
+/** Encode an uint32 integer.
+ * @param i an uint32
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::encode32(uint32 i, bool move) {
+  if ((pos+3)<=buf_end) {
+    *((uint32*)pos) = htonl(i);
+    if (move) pos+=4;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end encode uint32
+
+/** Encode an uint64 integer.
+ * @param i an uint64
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::encode64(uint64 i, bool move) {
+	uint32 hi = 0;
+	uint32 lo = 0;
+	uint32* p = (uint32*)pos;
+	if ((pos+7)<=buf_end) {
+		lo = i;
+		hi = (i>>32);
+		*p = htonl(hi);
+		*(p+1) = htonl(lo);
+		if (move) pos+=8;
+	} else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end encode uint64
+
+/** Encode an uint128 integer.
+ * @param i an uint128
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::encode128(uint128 i, bool move) {
+  encode32(i.w1);
+  encode32(i.w2);
+  encode32(i.w3);
+  encode32(i.w4);
+} // end encode uint128
+
+/** Decode uchars.
+ * @param c pointer to uchar array
+ * @param len uchar array size
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::decode(uchar *c, uint32 len, bool move) {
+  if ((pos+(len-1))<=buf_end) {
+    memmove(c,pos,len);
+    if (move) pos+=len;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end decode uchars
+
+/** Encode uchars.
+ * @param c pointer to uchar array
+ * @param len uchar array size
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::encode(const uchar *c, uint32 len, bool move) {
+  if ((pos+(len-1))<=buf_end) {
+    memmove(pos,c,len);
+    if (move) pos+=len;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end encode uchars
+
+/** Decode string.
+ * @param s string reference
+ * @param len number of bytes to decode
+ * @param move determines if current position in buffer is changed or not.
+ * @return string length.
+ */
+uint32 NetMsg::decode(string& s, uint32 len, bool move) {
+  if (len==0) {
+    s.clear();
+    return 0;
+  } else if ((pos+(len-1))<=buf_end) {
+    s.clear();
+    s.assign((const char*)pos,0,len);
+    if (move) pos+=len;
+    return s.length();
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end decode string
+
+/** Encode string.
+ * @param s string reference
+ * @param move determines if current position in buffer is changed or not.
+ */
+uint32 NetMsg::encode(const string& s, bool move) {
+  uint32 len = s.length();
+  if ((pos+(len-1))<=buf_end) {
+    memmove(pos,s.c_str(),len);
+    if (move) pos+=len;
+    return len;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end encode string
+
+/** Decode an IPv4 address. 
+ * @param in reference to in_addr
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::decode(struct in_addr& in, bool move) {
+  //in.s_addr = decode32(move);
+  if ((pos+3)<=buf_end) {
+    in.s_addr = *((uint32*)pos);
+    if (move) pos+=4;
+  } 
+  else 
+    throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end decode(in_addr)
+
+/** Encode an IPv4 address. 
+ * @param in reference to const in_addr
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::encode(const struct in_addr& in, bool move) {
+  //encode32(in.s_addr,move);
+  if ((pos+3)<=buf_end) {
+    *((uint32*)pos) = in.s_addr;
+    if (move) pos+=4;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end encode(in_addr)
+
+/** Decode an IPv6 address. 
+ * @param in reference to in6_addr
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::decode(struct in6_addr& in, bool move) {
+  if ((pos+15)<=buf_end) {
+    memmove(in.s6_addr,pos,16);
+    if (move) pos+=16;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end decode(in6_addr)
+
+/** Encode an IPv6 address. 
+ * @param in reference to const in6_addr
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::encode(const struct in6_addr& in, bool move) {
+  if ((pos+15)<=buf_end) {
+    memmove(pos,in.s6_addr,16);
+    if (move) pos+=16;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end encode(in6_addr)
+
+
+
+
+
+
+/** Truncates the buffer at the current position and sets the current
+ * position to buffer start.
+ * @return new buffer size.
+ */
+uint32 NetMsg::truncate() {
+  if ((pos>=buf) && (pos<=(buf_end+1))) {
+    buf_len = (pos-buf);
+    buf_end = pos-1;
+    to_start();
+  } else {
+    throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+  } // end if buf
+  return buf_len;
+} // end truncate
+
+/** Truncates the buffer at given offset. */
+uint32 NetMsg::truncate(uint32 t) {
+  set_pos(t);
+  return truncate();
+} // end truncate
+
+/** Set padding bytes to 0.
+ * @param len padding length
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::padding(uint32 len, bool move) {
+  if (len==0) return;
+  else if ((pos+(len-1))<=buf_end) {
+    memset(pos,0,len);
+    if (move) pos+=len;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end padding
+
+/** Two network messages are equal if their buffers and states are equal. */
+bool NetMsg::operator==(const NetMsg& n) const 
+{
+  // buffer size equal
+  if (buf_len==n.buf_len) 
+  {
+    // empty buffers are considered equal
+    if ((buf==NULL) && (n.buf==NULL)) 
+      return true; 
+    else 
+    if (buf && n.buf) 
+    {
+      // compare buffer content 
+      if (memcmp(buf,n.buf,buf_len)==0) 
+      {
+	// last check: position must be equal
+	return ((pos-buf)==(n.pos-n.buf));
+      } 
+      else 
+	return false;
+    } 
+    else 
+      return false;
+  } 
+  else 
+    return false;
+} // end operator==
+
+/** Decode NetMsg.
+ * @param m NetMsg reference
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::decode(NetMsg& m, bool move) {
+  uint32 len = m.get_size();
+  if ((pos+(len-1))<=buf_end) {
+    // copy buffer
+    m.to_start();
+    memmove(m.buf,pos,len);
+    if (move) pos+=len;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end decode NetMsg
+
+/** Encode NetMsg.
+ * @param m NetMsg reference
+ * @param len length of data to encode
+ * @param move determines if current position in buffer is changed or not.
+ */
+void NetMsg::encode(const NetMsg& m, uint32 len, bool move) {
+  if ((pos+(len-1))<=buf_end) {
+    memmove(pos,m.buf,len);
+    if (move) pos+=len;
+  } else throw NetMsgError(NetMsgError::ERROR_INVALID_POS);
+} // end encode NetMsg
+
+
+/** hex of dump buffer contents
+ * if startpos is 0, the beginning of the buffer is used
+ */
+ostream& 
+NetMsg::hexdump(ostream& os, uchar *startpos, uint32 length) const
+{
+  if (length==0) 
+    length=buf_len;
+
+  if (startpos == 0)
+    startpos= buf;
+
+  ios_base::fmtflags flags = os.flags();	// save stream flags
+
+  os << color[blue] << "[dump: start=" << static_cast<void *>(startpos) << ", length:" << length;
+  if (startpos > buf_end)
+    return os << "ERROR: start position behind last buffer byte ]" << color[clear] << endl;
+  else
+  if (startpos < buf)
+    return os << "ERROR: start position before first buffer byte ]" << color[clear] << endl;
+
+  os << endl;
+ 
+  while ( length > 0 && startpos <= buf_end )
+  {
+    os << setw(4) << startpos-buf << ": ";
+
+    // alphanumeric characters are printed directly
+    for (uint8 index=0; index <= 3; index++) {
+	if ( startpos+index <= buf_end ) {
+	    uchar c = *(startpos+index);
+	    os << ( isalnum(c) ? static_cast<char>(c) : '.');
+	}
+	else
+	    os << ' ';
+    }
+
+    os << " : " << hex << noshowbase;
+
+    // dump hex numbers
+    for (uint8 index=0; index <= 3; index++) {
+	if ( startpos+index <= buf_end )
+	    os << setw(2) << setfill('0')
+		<< static_cast<unsigned short>(*(startpos+index)) << ' ';
+	else
+	    os << "   ";
+    }
+
+    os << setfill(' ') << "       ";
+
+    // print in base 2
+    for (uint8 index=0; index <= 3 && (startpos+index <= buf_end); index++)
+    {
+	unsigned short val = static_cast<unsigned short>(*(startpos+index));
+
+	for (int i=7; i >= 0; i--)
+	    os << ((val >> i) & 1);
+
+	os << ' ';
+    }
+
+    startpos += 4;
+    length = ( length >= 4 ) ? length-4 : 0;
+
+    // reset formatting
+    os.width(0);
+    os << dec << setfill(' ') << endl;
+  }
+
+  os.setf(flags);		// reset stream flags
+
+  return os << ']' << color[clear] << endl;
+}
+
+ostream& operator<<(ostream& os, NetMsg& msg)
+{ 
+ 
+  ostringstream hexdumpstr;
+  msg.hexdump(hexdumpstr);
+  return os << hexdumpstr.str();
+  
+}
+
+//@}
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/network_message.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/network_message.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/network_message.h	(revision 2378)
@@ -0,0 +1,182 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file network_message.h
+/// generic class for network messages (PDUs coming from/going to network)
+/// ----------------------------------------------------------
+/// $Id: network_message.h 3247 2008-07-28 20:54:54Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/network_message.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+/** @ingroup networkmsg
+ *
+ * This is a generic class for network messages. 
+ * A network message consists of a number of bytes.
+ * There are no access member functions. So the user has full control over
+ * the buffer.
+ */
+ 
+#ifndef _PROTLIB__NETWORK_MESSAGE_H_
+#define _PROTLIB__NETWORK_MESSAGE_H_
+
+#include <netinet/in.h>
+#include <string>
+#include <ostream>
+
+#include "protlib_types.h"
+
+namespace protlib {
+
+/** @addtogroup networkmsg Network Messages
+ * @ingroup network
+ * @{
+ */
+
+class NetMsgError : public ProtLibException {
+public:
+	enum error_t {
+		ERROR_TOO_LONG,
+		ERROR_NO_MEM,
+		ERROR_INVALID_POS,
+		ERROR_NULL_POINTER,
+		ERROR_INVALID_START_OFFSET,
+		ERROR_TOO_SHORT,
+		ERROR_INVALID_BUFSIZE
+	};
+	NetMsgError(error_t e);
+	const char * getstr() const;
+	virtual const char *what() const throw() { return getstr(); }
+	const error_t err;
+private:
+	static const char* const errstr[];
+}; // end NetMsgError
+
+/// network message
+/** This class is used to exchange data between signalling and transport
+* protocol.
+*/
+class NetMsg {
+public:
+	static const uint32 max_size;
+	/// constructor
+	NetMsg(uint32 s);
+	/// constructor
+	NetMsg(uchar *b, uint32 s, bool copy = true);
+	/// copy constructor
+	NetMsg(const NetMsg& n);
+	/// destructor
+	~NetMsg();
+	/// get buffer size
+	uint32 get_size() const;
+	/// get bytes left until buffer ends
+	uint32 get_bytes_left() const;
+	/// get pointer offset
+	uint32 get_pos() const;
+	/// move pointer to offset
+	NetMsg& set_pos(uint32 p);
+	/// move pointer relative
+	NetMsg& set_pos_r(int32 rp);
+	/// set pointer to beginning
+	NetMsg& to_start();
+	/// copy into NetMsg buffer
+	uint32 copy_from(const uchar *b, uint32 n);
+	/// copy into NetMsg buffer
+	uint32 copy_from(const uchar *b, uint32 start, uint32 end);
+	/// copy from NetMsg buffer
+	uint32 copy_to(uchar *b, uint32 n) const;
+	/// copy from NetMsg buffer
+	uint32 copy_to(uchar *b, uint32 start, uint32 n) const;
+	/// get pointer to buffer
+	uchar* get_buffer() const;
+	/// decode uint8
+	uint8 decode8(bool move = true);
+	/// decode uint16
+	uint16 decode16(bool move = true);
+	/// decode uint32
+	uint32 decode32(bool move = true);
+	/// decode uint64
+	uint64 decode64(bool move = true);
+	/// decode uint128
+	uint128 decode128(bool move = true);
+	/// encode uint8
+	void encode8(uint8 i, bool move = true);
+	/// encode uint16
+	void encode16(uint16 i, bool move = true);
+	/// encode uint32
+	void encode32(uint32 i, bool move = true);
+	/// encode uint64
+	void encode64(uint64 i, bool move = true);
+	/// encode uint128
+	void encode128(uint128 i, bool move = true);
+	/// decode uchars
+	void decode(uchar *c, uint32 len, bool move = true);
+	/// encode uchars
+	void encode(const uchar *c, uint32 len, bool move = true);
+	/// decode string
+	uint32 decode(string& s, uint32 len, bool move = true);
+	/// encode string
+	uint32 encode(const string& s, bool move = true);
+	/// decode IPv4
+	void decode(struct in_addr& in, bool move = true);
+	/// encode IPv4
+	void encode(const struct in_addr& in, bool move = true);
+	/// decode IPv6
+	void decode(struct in6_addr& in, bool move = true);
+	/// encode IPv6
+	void encode(const struct in6_addr& in, bool move = true);
+        /// truncate buffer
+	uint32 truncate();
+	/// truncate buffer
+	uint32 truncate(uint32 t);
+	/// apply padding
+	void padding(uint32 len, bool move = true);
+	/// test for equality
+	bool operator==(const NetMsg& n) const;
+	/// encode a NetMsg into this NetMsg
+	void encode(const NetMsg& m, uint32 len, bool move = true);
+	/// decode a NetMsg from this NetMsg
+	void decode(NetMsg& m, bool move = true);
+	/// print a raw hexdump of the buffer
+	ostream& hexdump(ostream& os, uchar *startpos=0, uint32 length=0) const;
+
+private:
+	/// buffer for data
+	uchar *buf;
+	/// buffer size
+	uint32 buf_len;     
+	/// current reading/writing position
+	uchar *pos;
+	/// buffer end
+	/** Ponter to the last byte of the buffer. */	
+	uchar *buf_end;
+};
+
+inline std::ostream &operator<<(std::ostream &out, const NetMsg &msg) {
+	msg.hexdump(out);
+	return out;
+}
+
+//@}
+
+} // namespace protlib
+
+#endif // _PROTLIB__NETWORK_MESSAGE_H_
Index: /source/ariba/communication/modules/transport/protlib/protlib_types.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/protlib_types.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/protlib_types.h	(revision 2378)
@@ -0,0 +1,170 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file protlib_types.h
+/// This file contains various typedefs
+/// ----------------------------------------------------------
+/// $Id: protlib_types.h 3064 2008-07-02 08:05:18Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/protlib_types.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+// ----------------------------------------*- mode: C++; -*--
+// protlib_types.h - various typedefs
+// ----------------------------------------------------------
+// $Id: protlib_types.h 3064 2008-07-02 08:05:18Z bless $
+// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/protlib_types.h $
+// ==========================================================
+//                      
+// (C)opyright, all rights reserved by
+// - Institute of Telematics, University of Karlsruhe (TH)
+// ==========================================================
+
+/**
+ * @ingroup types
+ *
+ */
+
+#ifndef PROTLIB__TYPES_H
+#define PROTLIB__TYPES_H
+
+#include <iostream>
+#include <fstream>
+#include <exception>
+
+#include <cassert>
+
+#include <netinet/in.h> // required for IPPROTO constants
+
+#include <sys/types.h>
+
+// What's this used for? If if it's not needed, please delete it.
+#define _THREADS
+
+
+namespace protlib {
+  using namespace std;
+  using namespace __gnu_cxx;
+
+/**
+ * @addtogroup types Type Definitions
+ * @{
+ */
+ 
+/**
+ * The abstract base class for all exceptions thrown by protlib.
+ */
+class ProtLibException : public std::exception {
+  public:
+	virtual ~ProtLibException() throw() { }
+
+	/**
+	 * Get a printable string representation of the error.
+	 *
+	 * @warning Note that the data this pointer refers to still belongs
+	 * to the exception object. It is only valid as long as the exception
+	 * object exists.
+	 *
+	 * @return the error message
+	 */
+	virtual const char *what() const throw() { return error_msg.c_str(); }
+
+	/**
+	 * Deprecated: Use what() instead.
+	 */
+	virtual const char *getstr() const { return what(); }
+
+
+  protected:
+	ProtLibException() throw() { }
+	ProtLibException(std::string msg) throw() : error_msg(msg) { }
+
+	std::string error_msg;
+};
+
+inline ostream& operator<<(ostream& os, const ProtLibException &err) {
+	return os << err.what();
+}
+
+
+typedef unsigned char       uchar;
+
+typedef char                int8;
+typedef unsigned char       uint8;
+
+typedef short int           int16;
+typedef unsigned short int  uint16;
+
+// the following types depend on the platform
+// since types.h tries to figure out the correct sizes already
+// we will not replicate the stuff here. Note that on 64-bit
+// platforms usually int == 32-bit, long == 64-bit
+
+typedef int32_t             int32;
+typedef u_int32_t           uint32;
+
+typedef int64_t             int64;
+typedef u_int64_t           uint64;
+
+
+class uint128 {
+public:
+	uint32 w1;
+	uint32 w2;
+	uint32 w3;
+	uint32 w4;
+  uint128() : w1(0),w2(0),w3(0),w4(0) {};
+  uint128(uint32 w1, uint32 w2, uint32 w3, uint32 w4) : w1(w1),w2(w2),w3(w3),w4(w4) {}; 
+  bool operator==(const uint128& val) const { return w1==val.w1 && w2==val.w2 && w3==val.w3 && w4==val.w4; }
+};
+
+
+/// Network prefix length.
+typedef uint8 prefix_length_t;
+
+/// Protocol number, as it is given in an IP header.
+typedef uint8 protocol_t;
+
+/** these are pseudo protocol IDs in order to being able to perform
+ * multiplexing based on on address object alone
+ * currently used for Query encapsulation and TLS/TCP
+ * this should be changed in the future, probably by using an additional
+ * attribute in the appladdress object 
+ **/
+const protocol_t prot_tls_tcp    = 254;
+const protocol_t prot_query_encap= 255;
+const protocol_t prot_tcp        = IPPROTO_TCP;
+const protocol_t prot_udp        = IPPROTO_UDP;
+const protocol_t prot_sctp       = IPPROTO_SCTP;
+
+/// Port number, as given in TCP or UDP headers.
+typedef uint16 port_t;
+
+/// A general purpose ID type.
+typedef uint64 gp_id_t;
+
+/// Catch everything, do nothing.
+#define catch_all(x) try { x; } catch(...) { }
+
+// @}
+
+} // namespace protlib
+
+#endif // PROTLIB__TYPES_H
Index: /source/ariba/communication/modules/transport/protlib/queuemanager.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/queuemanager.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/queuemanager.cpp	(revision 2378)
@@ -0,0 +1,212 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file queuemanager.cpp
+/// queuemanager which records queues and message source IDs
+/// ----------------------------------------------------------
+/// $Id: queuemanager.cpp 2774 2007-08-08 12:32:08Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/queuemanager.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup queuemanager
+ *
+ */
+#include <stdexcept>
+
+#include "queuemanager.h"
+#include "logfile.h"
+
+namespace protlib { 
+
+/** @addtogroup queuemanager Queue Manager
+ * \ingroup fastqueue
+ * @{
+ */
+
+using namespace log;
+
+/***** class QueueManagerError *****/
+
+QueueManagerError::QueueManagerError(error_t e) : err(e) {}
+
+const char* QueueManagerError::getstr() const { return errstr[err]; }
+
+const char* const QueueManagerError::errstr[] = {
+	"Unable to create QueueManager.",
+	"Cannot register FastQueue. No memory or registered queue more than once."
+}; // end errstr
+
+/***** class QueueManager *****/
+
+/** Return QueueManager singleton. */
+QueueManager* QueueManager::instance() {
+	if (!inst) {
+		// try to create singleton
+		inst = new(nothrow) QueueManager();
+		if (!inst) {
+		  Log(INFO_LOG,LOG_NORMAL, "QueueManager" ,"Cannot created QueueManager singleton.");
+		  throw QueueManagerError(QueueManagerError::ERROR_NO_QUEUE_MANAGER);
+		} else {
+		  Log(DEBUG_LOG,LOG_NORMAL, "QueueManager", "Just created QueueManager singleton.");
+		} // end if not inst
+	} // end if not inst
+	return inst;
+} // end QueueManager
+
+/**
+ * Delete the QueueManager singleton object.
+ *
+ * After a call to clear references to that object become invalid and must
+ * be updated by a call to instance().
+ */
+void QueueManager::clear() {
+
+	if (inst) {
+		QueueManager *tmp = inst;
+		inst = 0;
+		DLog("QueueManager", "Destroying QueueManager singleton ...");
+		delete tmp;
+	}
+
+	DLog("QueueManager", "The QueueManager singleton has been destroyed");
+}
+
+
+/**
+ * Register a queue.
+ *
+ * This registers a FastQueue for the given message source ID with the
+ * QueueManager.
+ *
+ * The registered queue (and all its entries) is deleted as soon as the
+ * QueueManager is deleted. Because of this, a queue may only be registered
+ * once.
+ *
+ * @param fq pointer to an already allocated fastqueue 
+ * @param s  message source ID
+ */
+void QueueManager::register_queue(FastQueue* fq, message::qaddr_t s) {
+  pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+  // expand array if necessary
+  if (((uint32)s)>=queue_arr.capacity()) {
+    Log(DEBUG_LOG,LOG_NORMAL, "QueueManager", "expanding queue array from " << s << " to " << s+5);
+    // get more memory
+    queue_arr.reserve(s+5);
+    while (queue_arr.size()<queue_arr.capacity()) queue_arr.push_back(NULL);
+  } // end get more memory
+  
+  if (queue_arr[s]) 
+  {
+    // queue already exists
+    Log(ERROR_LOG,LOG_CRIT, "QueueManager", "A queue for " << s << " is already  registered");
+    throw QueueManagerError(QueueManagerError::ERROR_REGISTER);
+  } // end if queue exists
+  else 
+  {
+    // register queue
+    if (fq)
+    {
+      queue_arr[s] = fq;
+    }
+    else
+    {
+      Log(ERROR_LOG,LOG_CRIT, "QueueManager", "Cannot register queue for " << s);
+      throw QueueManagerError(QueueManagerError::ERROR_REGISTER);
+    }
+  } // end else no queue exists
+  pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+} // end register_queue
+
+
+void 
+QueueManager::unregister_queue(message::qaddr_t s) 
+{
+  pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+  try {
+	  queue_arr.at(s) = 0;
+  }
+  catch ( std::out_of_range ) {
+	/*
+	 * Nothing to do, queue has probably already been unregistered,
+	 * probably by calling QueueManager::clear().
+	 */
+  }
+  pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+}
+
+FastQueue* QueueManager::get_queue(message::qaddr_t s) const {
+	FastQueue* fq = NULL;
+	pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+	if (((uint32)s)<queue_arr.size()) {
+		fq = queue_arr[s];
+	} else {
+		fq = NULL;
+	} // end if
+	pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+	return fq;
+} // end get
+
+QueueManager* QueueManager::inst = NULL;
+
+/**
+ * Constructor.
+ */
+QueueManager::QueueManager() : queue_arr(QueueManager::INITIAL_ARRAY_SIZE) {
+	pthread_mutexattr_t mutex_attr;
+
+	pthread_mutexattr_init(&mutex_attr);
+
+#ifdef _DEBUG
+	pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_ERRORCHECK);
+#else
+	pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_NORMAL);
+#endif
+
+	pthread_mutex_init(&mutex, &mutex_attr);
+
+	pthread_mutexattr_destroy(&mutex_attr); // doesn't affect mutex
+}
+
+
+/**
+ * Destructor.
+ *
+ * Delete this object and all FastQueue objects that are still registered.
+ */
+QueueManager::~QueueManager() {
+
+	pthread_mutex_lock(&mutex);
+
+	// count queues which are still registered
+	for ( qm_array_it_t i = queue_arr.begin(); i != queue_arr.end(); i++) 
+		if ( *i != 0 )
+			WLog("QueueManager",
+				"~QueueManager(): queue " << (*i)->get_name()
+				<< " has not been unregistered");
+
+	pthread_mutex_unlock(&mutex);
+
+	pthread_mutex_destroy(&mutex);
+}
+
+//@}
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/queuemanager.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/queuemanager.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/queuemanager.h	(revision 2378)
@@ -0,0 +1,121 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file queuemanager.h
+/// This is the queuemanager which records queues and message source IDs
+/// ----------------------------------------------------------
+/// $Id: queuemanager.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/queuemanager.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup queuemanager
+ *
+ * This is the queuemanager which records queues and message source IDs.
+ */
+
+#ifndef QUEUE_MANAGER_H
+#define QUEUE_MANAGER_H
+
+#include "protlib_types.h"
+#include "cleanuphandler.h"
+
+#include <vector>
+
+#include "fqueue.h"
+#include "messages.h"
+
+namespace protlib { 
+
+/** @addtogroup queuemanager Queue Manager
+ * \ingroup fastqueue
+ * @{
+ */
+
+/// QueueManager errors
+class QueueManagerError : public ProtLibException {
+public:
+	/// error codes
+	enum error_t {
+		ERROR_NO_QUEUE_MANAGER,
+		ERROR_REGISTER
+	}; // end error_t
+	const error_t err;
+	/// constructor
+	QueueManagerError(error_t e);
+	virtual const char* getstr() const;
+	virtual const char *what() const throw() { return getstr(); }
+private:
+	/// QueueManager error strings
+	static const char* const errstr[];
+}; // end class QueueManagerError
+
+
+/**
+ * The Queue Manager singleton.
+ *
+ * The QueueManager manages several FastQueue objects. A queue is registered
+ * with the manager using a simple (key, value) scheme. The key is of type
+ * message:qaddr_t, and the value is a FastQueue object.
+ *
+ * You can send messages to a registered queue using the message::send_to(dest)
+ * method, where dest has to be the message::qaddr_t which has been used for
+ * registering the queue.
+ *
+ * This class is used as a singleton, so there will usually be only one
+ * object of this class.
+ */
+class QueueManager {
+public:
+	/// return QueueManager singleton instance
+	static QueueManager* instance();
+	/// clear QueueManager 
+	static void clear();
+	/// register a queue
+	void register_queue(FastQueue* fq, message::qaddr_t s);
+	/// deregister a queue
+	void unregister_queue(message::qaddr_t s);
+
+	/// get queue
+	FastQueue* get_queue(message::qaddr_t s) const;
+private:
+	/// QueueManager instance
+	static QueueManager* inst;
+	/// constructor
+	QueueManager();
+	/// Destruktor
+	~QueueManager();
+	/// QueueManager array
+	typedef vector<FastQueue*> qm_array_t;
+	/// QueueManager array iterator
+	typedef qm_array_t::iterator qm_array_it_t;
+	/// array
+	qm_array_t queue_arr;
+	/// locking
+	mutable pthread_mutex_t mutex;
+
+	static const size_t INITIAL_ARRAY_SIZE = 128;
+};
+
+//@}
+
+} // end namespace protlib
+
+#endif
Index: /source/ariba/communication/modules/transport/protlib/setuid.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/setuid.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/setuid.cpp	(revision 2378)
@@ -0,0 +1,172 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file setuid.cpp
+/// Change effective user ID in a thread-safe way.
+/// ----------------------------------------------------------
+/// $Id: setuid.cpp 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/setuid.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup tssetuid
+ *
+ * Thread-safe setuid support for linux. 
+ * Change effective user ID in a thread-safe way.
+ *
+ * tsdb::init() must be called before calling setuid::init().
+ */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+
+#include "setuid.h"
+#include "threadsafe_db.h"
+#include "cleanuphandler.h"
+#include "logfile.h"
+
+
+namespace protlib { 
+
+/** @addtogroup tssetuid Thread-safe setuid program support
+ * @{
+ */
+
+  using namespace log;
+
+void setuid::init() {
+	if (is_init) {
+	  Log(ERROR_LOG,LOG_CRIT, "setuid", "Tried to initialize setuid although already initialized.");
+	} else {
+		pthread_mutex_init(&mutex,NULL);
+		count = 0;
+		file_userid = ::geteuid();
+		real_userid = ::getuid();
+		is_setuid = (real_userid!=file_userid);
+		file_username = tsdb::get_username(file_userid);
+		real_username = tsdb::get_username(real_userid);
+		is_init = true;
+		if (is_setuid) {
+		  Log(INFO_LOG,LOG_CRIT, "setuid", "Setuid-bit is set, euid is " << file_userid << " " << file_username << ", realuid is " << real_userid << " " << real_username << ". Turning off setuid as soon as possible");
+		  count = 1;
+		  off();
+		} else {
+		  Log(INFO_LOG,LOG_CRIT, "setuid", "Setuid-bit is not set or euid and ruid are equal. setuid::on() and setuid::off() will do nothing");
+		} // end if is_setuid
+	} // end if is_init
+} // end init
+
+void setuid::end() {
+	if (is_init) {
+		is_init = false;
+		pthread_mutex_destroy(&mutex);
+		count = 0;
+		// turn off setuid
+		if (is_setuid) {
+		  Log(INFO_LOG,LOG_CRIT, "setuid", "setuid::end() turn off setuid. Switching (maybe permamently) to " << real_userid << " " << real_username << " using setuid()");
+		  ::setuid(real_userid);
+		} // end if is_setuid
+	} else {
+	  Log(ERROR_LOG,LOG_CRIT, "setuid", "Tried to end setuid although not initialized.");
+	} // end if is_init
+} // end end
+
+void setuid::on() {
+	if (is_setuid) {
+		if (is_init) {
+			pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+			if (count==0) {
+			  Log(INFO_LOG,LOG_CRIT, "setuid", "setuid::on(): setting euid to " << file_userid << " " << file_username);
+			  int status;
+                          #ifdef _POSIX_SAVED_IDS
+			  status = seteuid(file_userid);
+				#else
+					status = setreuid(real_userid,file_userid);
+				#endif
+				if (status<0) {
+				  Log(ERROR_LOG,LOG_ALERT, "setuid", "setuid::on(): error " << strerror(errno));
+				} else count++;
+			} else {
+			  Log(INFO_LOG,LOG_CRIT, "setuid", "setuid::on(): setuid already on");
+			  count++;
+			} // end if count
+			pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+		} else {
+		  Log(ERROR_LOG,LOG_CRIT, "setuid", "Tried to use setuid although not initialized.");
+		} // end if is_init
+	} // end if is_setuid
+} // end on
+
+void setuid::off() {
+	if (is_setuid) {
+		if (is_init) {
+			pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+			if (count==1) {
+				int status;
+				#ifdef _POSIX_SAVED_IDS
+					status = seteuid(real_userid);
+				#else
+					status = setreuid(file_userid,real_userid);
+				#endif
+				if (status<0) {
+				  Log(ERROR_LOG,LOG_ALERT, "setuid", "setuid::off(): error " << strerror(errno));
+				} else {
+				  count = 0;
+				  Log(INFO_LOG,LOG_CRIT, "setuid", "setuid::off(): set euid to " << real_userid << " " << real_username);
+				} // end if count
+			} else if (count==0) {
+			  Log(INFO_LOG,LOG_CRIT, "setuid", "setuid::off(): setuid already off");
+			} else {
+			  Log(INFO_LOG,LOG_CRIT, "setuid", "setuid::off(): setuid still on");
+			  count--;
+			} // end if count
+			pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+		} else {
+		  Log(ERROR_LOG,LOG_CRIT, "setuid", "Tried to use setuid although not initialized.");
+		} // end if is_init
+	} // end if is_setuid
+} // end off
+
+bool setuid::is_init = false;
+
+pthread_mutex_t setuid::mutex =
+#ifdef _DEBUG
+    PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+#else
+    PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+uint32 setuid::count = 0;
+
+uid_t setuid::file_userid = 65534;
+
+string setuid::file_username = "nobody";
+
+uid_t setuid::real_userid = 65534;
+
+string setuid::real_username = "nobody";
+
+bool setuid::is_setuid = true; // important!
+
+//@}
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/setuid.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/setuid.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/setuid.h	(revision 2378)
@@ -0,0 +1,94 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file setuid.h
+/// Change effective user ID in a thread-safe way
+/// ----------------------------------------------------------
+/// $Id: setuid.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/setuid.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup tssetuid
+ *
+ * Thread-safe setuid support for linux. 
+ * Change effective user ID in a thread-safe way.
+ *
+ * tsdb::init() must be called before calling setuid::init().
+ */
+
+#ifndef THREADSAFE_SETUID_H
+#define THREADSAFE_SETUID_H
+
+#include <sys/types.h>
+#include <pthread.h>
+#include <string>
+
+#include "protlib_types.h"
+#include "cleanuphandler.h"
+
+namespace protlib { 
+
+/** @addtogroup tssetuid Thread-safe setuid program support
+ * @{
+ */
+
+/// Thread-safe setuid
+/** This class provieds class methods for changing the effective user ID of
+ * the current process.
+ */
+class setuid {
+public:
+	/// initialize setuid 
+	static void init();
+	/// cleanup setuid resources
+	static void end();
+	/// turn on setuid mode
+	static void on();
+	/// turn off setuid mode
+	static void off();
+private:
+	/// init state
+	static bool is_init;
+	/// setuid mutex
+	static pthread_mutex_t mutex;
+	/// setuid counter
+	static uint32 count;
+	/// file user ID
+	static uid_t file_userid;
+	/// file user name
+	static string file_username;
+	/// real user ID
+	static uid_t real_userid;
+	/// real user name
+	static string real_username;
+	/// are we using setuid?
+	static bool is_setuid;
+}; // end class setuid
+
+/// Turn on setuid mode and install cleanup handler.
+#define BEGIN_SETUID_MODE protlib::setuid::on(); install_cleanup(call_void_fun,protlib::setuid::off)
+#define END_SETUID_MODE uninstall_cleanup(1)
+
+//@}
+
+} // end namespace protlib
+
+#endif
Index: /source/ariba/communication/modules/transport/protlib/testqueue.c
===================================================================
--- /source/ariba/communication/modules/transport/protlib/testqueue.c	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/testqueue.c	(revision 2378)
@@ -0,0 +1,121 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file testqueue.c
+/// Testing fastqueue.
+/// ----------------------------------------------------------
+/// $Id: testqueue.c 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/fastqueue/testqueue.c $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+/**
+ * @ingroup fastqueue
+ * @{
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <pthread.h> /* Headers for POSIX-Threads */
+#include <time.h>    /* needed for getting Timestamps */
+
+#include "fastqueue.h"
+
+#define error_check(status,string) \
+        if (status==-1) perror(string);
+
+#define MAXELEMENTS 10000
+
+                         /*** global variables ***/
+pthread_t       producer_thread,             /* Thread Objects (sim. to TCB) */
+                consumer_thread;
+
+float           queuetime, porttime;
+
+
+/** both queues must be created before monitor tasks are started **/
+queue_t       *consumer_cmdq;     /** queue for consumertask **/
+struct timespec ts_start,ts_end;
+int status;              /* Hold status from pthread_ calls */
+
+void *producertask(void * argp)
+{
+  long i;
+  fprintf(stderr,"QUEUETEST started. Please wait.\n");
+  clock_gettime(CLOCK_REALTIME,&ts_start);
+  for (i=1; i<=MAXELEMENTS; i++)
+      enqueue_element_signal(consumer_cmdq, (void *) i);
+
+  return NULL;
+}
+
+void *consumertask(void * argp)
+{
+  long j;
+  /** test queue **/
+  while ((j= (int) dequeue_element_wait(consumer_cmdq))<MAXELEMENTS);
+
+  clock_gettime(CLOCK_REALTIME,&ts_end);  
+  queuetime= ts_end.tv_sec-ts_start.tv_sec +
+             (ts_end.tv_nsec-ts_start.tv_nsec)*1E-9;
+  fprintf(stderr,"QUEUETEST stopped (%d elements): %gs\n",MAXELEMENTS,queuetime);
+  return NULL;
+}
+
+int
+main(int argc, char **argv)
+{
+  void *exit_value;        /* for pthread_join */
+
+  fprintf(stderr,"<program start>\n");
+  /** create a queue **/
+  if ((consumer_cmdq= create_queue("testqueue"))==NULL) exit(1);
+
+  /** Start Threads **/
+  status= pthread_create(&consumer_thread,
+                         NULL,
+                         consumertask,
+                         NULL);
+  error_check(status,"fatal: cannot create consumertask");
+
+  status= pthread_create(&producer_thread,
+                         NULL,
+                         producertask,
+                         NULL);
+  error_check(status,"fatal: cannot create producertask");
+
+  /** wait for threads to end **/
+  status= pthread_join(producer_thread, &exit_value);
+  error_check(status,"pthread_join");
+
+  status= pthread_join(consumer_thread, &exit_value);
+  error_check(status,"pthread_join");
+
+  /** destroy all queues **/
+  status= destroy_queue(consumer_cmdq);
+  error_check(status,"destroying consumer queue");
+
+  fprintf(stderr,"<program exited normally>\n");
+   return 0;
+}
+/**** end of source ****/
+
+//@}
Index: /source/ariba/communication/modules/transport/protlib/threads.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/threads.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/threads.cpp	(revision 2378)
@@ -0,0 +1,315 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file threads.cpp
+/// A Thread class for POSIX threads
+/// ----------------------------------------------------------
+/// $Id: threads.cpp 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/threads.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+#include <sys/time.h>
+
+#include "threads.h"
+
+
+namespace protlib {
+   using namespace log;
+
+/** @addtogroup thread Threads
+ * @{
+ */
+
+
+/** This is the default sleep time and can be used as default value in
+ * constructors.
+ */
+uint32 ThreadParam::default_sleep_time = 5;
+
+
+/**
+ * Initializes a ThreadParam object with a default wait time and a 
+ * a thread (group) name string.
+ *
+ * @param wait wait time between stopping and aborting the thread inside
+ *    ThreadStarter::abort_processing
+ * @param n name of the threads.
+ * @param minc minimal number of threads
+ * @param maxc maximal number of threads
+ */
+ThreadParam::ThreadParam(uint32 wait, const char *n, uint32 minc, uint32 maxc) 
+		: sleep_time(wait), name(n ? n : "UNKNOWN"),
+		  min_count(minc), max_count(maxc) {
+
+	  assert( minc > 0 );
+	  assert( maxc >= minc );
+}
+
+
+/**
+ * Constructor.
+ *
+ * @param p thread parameters
+ * @param create_queue if true, create one internal queue
+ * @param exp_allow if true, allow reception of expedited messages on the queue
+ */
+Thread::Thread(const ThreadParam &p, bool create_queue, bool exp_allow)
+	: running_threads(0), started_threads(0), state(STATE_INIT), tparam(p),
+	  fq(create_queue ? new FastQueue(p.name.c_str(), exp_allow) : 0) {
+
+	pthread_mutexattr_t mutex_attr;
+
+	pthread_mutexattr_init(&mutex_attr);
+
+#ifdef _DEBUG
+	pthread_mutexattr_settype(&mutex_attr,PTHREAD_MUTEX_ERRORCHECK);
+#else
+	pthread_mutexattr_settype(&mutex_attr,PTHREAD_MUTEX_NORMAL);
+#endif
+
+	pthread_mutex_init(&mutex, &mutex_attr);
+	pthread_cond_init(&cond,NULL);
+
+	pthread_mutexattr_destroy(&mutex_attr);
+}
+
+
+/**
+ * Destructor.
+ *
+ * Currently throws an exception if there are still running threads.
+ */
+Thread::~Thread() {
+	if ( get_running_threads() )
+		throw ThreadError(ThreadError::ERROR_STILL_RUNNING);
+
+	delete fq; // delete queue, no-op if fq is NULL
+
+	pthread_cond_destroy(&cond);
+	pthread_mutex_destroy(&mutex);
+}
+
+
+/**
+ * Called for each thread when processing is started.
+ *
+ * The thread must not be locked because this is done inside this method.
+ * Cancellation is enabled and set to synchronous mode. So you only need to
+ * install cleanup handlers when there is a cancellation point between
+ * calls to lock() and unlock().
+ */
+void *Thread::start_processing() {
+
+	lock();
+
+	switch (state) {
+		case STATE_INIT: 
+			state=STATE_RUN;
+			break;
+		case STATE_RUN:
+			break;
+		case STATE_STOP:
+		case STATE_ABORT:
+			unlock();
+			return NULL;
+	}
+
+	inc_running_threads();
+	inc_started_threads();
+
+	int thread_num = get_started_threads();
+
+	unlock();
+
+	/*
+	 * Catch exceptions for logging, but don't rethrow them as this would
+	 * lead to undefined behaviour (probably crashing the ThreadStarter).
+	 *
+	 * All exceptions should be handled in main_loop(), it is a programming
+	 * error if they are propagated up to this point!
+	 */
+	try {
+		main_loop(thread_num);
+	}
+	catch ( ProtLibException &e ) {
+		ERRLog("Threads", "Unhandled ProtLibException in thread "
+			<< tparam.name << ", num " << thread_num << ", error ["
+			<< e.getstr() << ']');
+	}
+	catch ( bad_alloc & ) {
+		ERRLog("Threads", tparam.name << ", num " << thread_num
+			<< ": [out of memory]");
+	}
+	catch ( ... ) {
+		ERRLog("Threads", "Unhandled non-ProtLibException in thread "
+			<< tparam.name << ", num " << thread_num);
+	}
+
+	lock();
+	dec_running_threads();
+	unlock();
+
+	return NULL;
+}
+
+
+/**
+ * Called when the thread is asked to stop processing.
+ *
+ * The thread object may do some cleanup or work on until it has completed
+ * a task.
+ *
+ * @param do_lock if true the thread mutex is used
+ */
+void Thread::stop_processing(bool do_lock) {
+	if ( do_lock )
+		lock();
+
+	if (state==STATE_RUN) {
+		state = STATE_STOP;
+		signal_cond();
+	}
+
+	if ( do_lock )
+		unlock();
+}
+
+
+/**
+ * This is called just before a running thread is killed.
+ *
+ * @param do_lock if true the thread mutex is used
+ */
+void Thread::abort_processing(bool do_lock) {
+	if ( do_lock )
+		lock();
+
+	if ( state == STATE_RUN  ||  state == STATE_STOP ) {
+		state = STATE_ABORT;
+		signal_cond();
+	}
+
+	if ( do_lock )
+		unlock();
+}
+
+
+/**
+ * Checks whether there is still a running thread. 
+ *
+ * @param do_lock if true the thread mutex is used
+ */
+bool Thread::is_running(bool do_lock) {
+
+	if ( do_lock )
+		lock();
+
+	bool res = ( get_running_threads() > 0 );
+
+	if ( do_lock )
+		unlock();
+
+	return res;
+}
+
+
+/**
+ * Wait for the condition.
+ *
+ * @param sec relative time (seconds)
+ * @param nsec relative time (nanoseconds)
+ * @return 0, ETIMEDOUT or EINTR.
+ */
+int Thread::wait_cond(int32 sec, int32 nsec) {
+	struct timeval tv;
+	struct timespec ts;
+
+	if ( sec < 0 )
+		sec = 0;
+	if ( nsec < 0 )
+		nsec = 0;
+
+	gettimeofday(&tv, NULL);
+	ts.tv_sec = tv.tv_sec+sec;
+	ts.tv_nsec = tv.tv_usec*1000+nsec;
+
+	// TODO: This is weird.
+	while ( ts.tv_nsec > 1000000000) {
+		ts.tv_sec++;
+		ts.tv_nsec -= 1000000000;
+	}
+
+	if ( ts.tv_sec < 0 )
+		ts.tv_sec = 0;
+	if ( ts.tv_nsec < 0 )
+		ts.tv_nsec = 0;
+
+	return pthread_cond_timedwait(&cond, &mutex, &ts);
+}
+
+
+/**
+ * Returns the thread's state.
+ *
+ * @param do_lock if true the thread mutex is used
+ * @return the thread's current state
+ *
+ * @see enum state_t for more information on what a thread state is.
+ */
+Thread::state_t Thread::get_state(bool do_lock) {
+	if ( do_lock )
+		lock();
+
+	state_t s = state;
+
+	if ( do_lock )
+		unlock();
+
+	return s;
+}
+
+/// get time of day as timespec
+void Thread::get_time_of_day(struct timespec& ts) {
+	struct timeval tv;
+	gettimeofday(&tv,NULL);
+	ts.tv_sec = tv.tv_sec;
+	ts.tv_nsec = tv.tv_usec*1000;
+}
+
+const char* ThreadError::getstr() const {
+	return errstr[(int)err];
+}
+
+const char* const ThreadError::errstr[] = {
+	"Cannot create POSIX Threads.",
+	"Thread is running.",
+	"Thread is going to stop.",
+	"Thread is aborting.",
+	"Still running threads left.",
+	"ThreadStarter is not initialized correctly."
+	"Internal ThreadStarter or Thread error.",
+	"Thread has not been started yet."
+};
+
+//@}
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/threads.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/threads.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/threads.h	(revision 2378)
@@ -0,0 +1,567 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file threads.h
+/// Thread support functions (classes thread and threadstarter) based on POSIX threads
+/// ----------------------------------------------------------
+/// $Id: threads.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/threads.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+/**
+ * Classes to support multi-threaded programming.
+ *
+ * @ingroup thread
+ *
+ * A Thread module class must inherit from Thread. Several instances may run
+ * simultaneously but they share exactly one module object. So you must take
+ * care of this fact when writing the module code and use locks accordingly.
+ *
+ * Use lock(), unlock(), wait_cond() and signal_cond() the way you would use
+ * the corresponding POSIX thread functions.
+ *
+ * Use the ThreadStarter template class to create threads.
+ */
+
+#ifndef PROTLIB__THREADS_H
+#define PROTLIB__THREADS_H
+
+#include <pthread.h>
+#include <signal.h>
+#include <sys/times.h>
+#include <string>
+
+#include "protlib_types.h"
+#include "logfile.h"
+#include "fqueue.h"
+
+namespace protlib {
+  using namespace log;
+
+/** @addtogroup thread Threads
+ * @{
+ */
+
+
+/**
+ * Call the method start_processing of a Thread instance.
+ *
+ * @param thread_object a Thread instance
+ */
+template <class T> void *thread_starter(void *thread_object) {
+
+	pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+	pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
+
+	(static_cast<T*>(thread_object))->start_processing();
+	return NULL;
+}
+
+
+/**
+ * Base class for thread object parameters.
+ *
+ * This is used by ThreadStarter to extract and store overall data like the
+ * sleep time and is also accessible to the thread object.
+ */
+class ThreadParam {
+  public:
+	ThreadParam();
+	ThreadParam(uint32 wait, const char* name,
+		uint32 minc=1, uint32 maxc=(uint32)-1);
+
+	static uint32 default_sleep_time;
+	/// sleep time
+	const uint32 sleep_time;
+	const std::string name;
+	/// minimum thread count
+	const uint32 min_count;
+	/// maximum thread count
+	const uint32 max_count;
+};
+
+
+/**
+ * This exception will be thrown if there is some trouble with threading.
+ */
+class ThreadError : public ProtLibException {
+  public:
+	enum error_t {
+		ERROR_THREAD_CREATION, ERROR_RUNNING, ERROR_STOPPING,
+		ERROR_ABORTING, ERROR_STILL_RUNNING, ERROR_UNINITIALIZED,
+		ERROR_INTERNAL, ERROR_NOT_STARTED
+	};
+
+	ThreadError(error_t e) : err(e) { }
+	virtual ~ThreadError() throw () { }
+
+	virtual const char* getstr() const;
+	virtual const char *what() const throw() { return getstr(); }
+	const error_t err;
+
+  protected:
+	static const char* const errstr[];
+};
+
+
+/**
+ * Abstract interface for thread modules.
+ *
+ * Don't confuse this Thread class with POSIX threads. A Thread class only
+ * provides a main_loop method which will be executed by one or more POSIX
+ * threads simultaneously. The Thread instance provides a central point for
+ * all those POSIX threads to store data. Don't forget to lock() the Thread
+ * instance to avoid race conditions if you want to access and/or modify
+ * the data.
+ */
+class Thread {
+  public:
+	Thread(const ThreadParam& p,
+		bool create_queue=true, bool exp_allow=true);
+	virtual ~Thread();
+
+	void *start_processing();
+	void stop_processing(bool do_lock=true);
+	void abort_processing(bool do_lock=true);
+
+	bool is_running(bool do_lock=true);
+
+	virtual void main_loop(uint32 thread_num) = 0;
+
+	void lock();
+	void unlock();
+
+	void signal_cond();
+	void broadcast_cond();
+	void wait_cond();
+	int wait_cond(const struct timespec& ts);
+	int wait_cond(int32 sec, int32 nsec=0);
+
+	/**
+	* State of a thread.
+	*
+	* The state of a thread does not really tell whether there are threads
+	* active or not. It only represents a state in the life cycle of a 
+	* thread object.
+	*/
+	enum state_t {
+		STATE_INIT, STATE_RUN, STATE_STOP, STATE_ABORT
+	};
+
+	state_t get_state(bool do_lock=true);
+	FastQueue* get_fqueue() { return fq; }
+
+	static void get_time_of_day(struct timespec& ts);
+
+  private:
+	/// This counter records the number of threads running on this object.
+	uint32 running_threads;
+
+	/// This counter records the number of started threads.
+	uint32 started_threads;
+
+	/** 
+	* Thread-global mutex.
+	*
+	* This mutex is used to lock the thread object when data common to all
+	* threads on this object is modified.
+	*/
+	pthread_mutex_t mutex;
+
+	/// thread object condition
+	pthread_cond_t cond;
+
+	/// thread state
+	state_t state;
+
+	/// Thread parameters.
+	const ThreadParam tparam;
+
+	/// The input queue where threads can get messages from.
+	FastQueue* fq;
+
+	void inc_running_threads();
+	void dec_running_threads();
+	uint32 get_running_threads() const;
+	void inc_started_threads();
+	uint32 get_started_threads() const;
+};
+    
+
+inline void Thread::lock() {
+	if ( pthread_mutex_lock(&mutex) != 0 ) {
+		ERRLog(tparam.name, "Error while locking mutex");
+	}
+}
+
+inline void Thread::unlock() {
+	int ret = pthread_mutex_unlock(&mutex);
+	assert( ret == 0 );
+}
+
+inline void Thread::signal_cond() {
+	pthread_cond_signal(&cond);
+}
+
+inline void Thread::broadcast_cond() {
+	pthread_cond_broadcast(&cond);
+}
+
+inline void Thread::wait_cond() {
+	pthread_cond_wait(&cond,&mutex);
+}
+
+
+/**
+ * @param ts absolute time
+ * @return 0, ETIMEDOUT or EINTR.
+ */
+inline int Thread::wait_cond(const struct timespec& ts) {
+	return pthread_cond_timedwait(&cond, &mutex, &ts);
+}
+
+
+inline void Thread::inc_running_threads() {
+	running_threads++;
+}
+
+inline void Thread::dec_running_threads() {
+	assert( running_threads > 0 );
+	running_threads--;
+}
+
+inline uint32 Thread::get_running_threads() const {
+	return running_threads;
+}
+
+inline void Thread::inc_started_threads() {
+	started_threads++;
+}
+
+inline uint32 Thread::get_started_threads() const {
+	return started_threads;
+}
+
+
+/**
+ * A template class used to start threads.
+ *
+ * Note that the ThreadStarter template class is not thread-safe yet, so it
+ * may only be accessed by one thread at a time.
+ */
+template <class T, class TParam> class ThreadStarter {
+  public:
+	ThreadStarter(uint32 count, const TParam& param);
+	~ThreadStarter();
+
+	void start_processing();
+	void stop_processing();
+	bool sleepuntilstop();		// deprecated!
+	void wait_until_stopped();
+	void abort_processing(bool kill=false);
+
+	/// get a pointer to the thread object
+	inline T *get_thread_object() { return &thread_object; }
+
+	/// Are all threads finished: TODO
+	inline bool is_running() const { return thread_object.is_running(); }
+
+  private:
+	/// The Thread object on which the threads run.
+	T thread_object;
+
+	/// For debugging, the name of the thread as given by TParam.
+	const TParam thread_param;
+
+	/// Contains the handles of all pthreads that we created.
+	std::vector<pthread_t> pthreads;
+};
+
+
+/**
+ * Constructor.
+ *
+ * @param count the number of threads to start
+ * @param param thread parameters
+ */
+template <class T, class TParam>
+ThreadStarter<T, TParam>::ThreadStarter(uint32 count, const TParam& param)
+		: thread_object(param), thread_param(param), pthreads(count) {
+
+	// TODO: fix all Thread subclasses that use an invalid count!
+	if ( count < param.min_count )
+		count = param.min_count;
+	else if ( count > param.max_count )
+		count = param.max_count;
+
+	assert( count >= param.min_count && count <= param.max_count );
+
+	pthreads.resize(count); // TODO: remove
+}
+
+
+/**
+ * Destructor.
+ *
+ * This cancels all running threads if there are still some.
+ */
+template <class T, class TParam> ThreadStarter<T, TParam>::~ThreadStarter() {
+
+	if ( thread_object.is_running() ) {
+		catch_all(stop_processing());
+		sleepuntilstop();
+		catch_all(abort_processing(true));
+	}
+}
+
+
+/**
+ * Start the threads.
+ */
+template <class T, class TParam>
+void ThreadStarter<T, TParam>::start_processing() {
+
+	thread_object.lock();
+
+	/*
+	 * Check if this is a fresh Thread. If it is or was already running,
+	 * we have detected a programming error.
+	 */
+	if ( thread_object.is_running(false) ) {
+		thread_object.unlock();
+
+		ERRLog("Threads", "start_processing(): " << thread_param.name
+			<< " is already running");
+
+		throw ThreadError(ThreadError::ERROR_INTERNAL);
+	}
+
+
+	/*
+	 * Create the requested number of threads.
+	 */
+	int res;
+	pthread_attr_t attr;
+	pthread_attr_init(&attr);
+	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+	for (unsigned i = 0; i < pthreads.size(); i++) {
+		// Create a posix thread. It will start running immediately.
+		res = pthread_create(&pthreads[i], &attr,
+					&thread_starter<T>, &thread_object);
+
+		if ( res != 0 ) {
+			thread_object.unlock();
+			ERRLog("Threads", "pthread_create() failed starting a "
+				<< "thread for " << thread_param.name);
+
+			throw ThreadError(ThreadError::ERROR_THREAD_CREATION);
+		}
+	}
+
+	ILog("Threads", pthreads.size() << " " << thread_param.name
+		<< " thread(s) sucessfully created");
+
+	pthread_attr_destroy(&attr); // has no effect on the created threads
+
+	thread_object.unlock();
+}
+
+
+/**
+ * Ask all threads to stop (politely).
+ */
+template <class T, class TParam>
+void ThreadStarter<T, TParam>::stop_processing() {
+
+	thread_object.lock();
+
+	typename T::state_t state = thread_object.get_state(false);
+
+	switch (state) {
+
+	  case T::STATE_INIT:
+		thread_object.unlock();
+		DLog("Threads", "Thread " << thread_param.name
+			<< " has not been started yet.");
+		throw ThreadError(ThreadError::ERROR_NOT_STARTED);
+		break;
+
+	  case T::STATE_RUN:
+		thread_object.stop_processing(false);
+		thread_object.unlock();
+
+		ILog("Threads", "Thread(s) "
+			<< thread_param.name << " asked to stop");
+		break;
+
+	  case T::STATE_STOP:
+		thread_object.unlock();
+		DLog("Threads", "Thread(s) "
+			<< thread_param.name << " is already in state stop.");
+		throw ThreadError(ThreadError::ERROR_STOPPING);
+		break;
+
+	  case T::STATE_ABORT:
+		//thread_object.unlock();
+		DLog("Threads", "Thread "
+			<< thread_param.name << " is in state abort.");
+		//throw ThreadError(ThreadError::ERROR_ABORTING);
+		break;
+
+	  default:
+		assert( false ); // unknown state
+
+	}
+}
+
+
+/**
+ * Wait for the thread to stop running (DEPRECATED).
+ *
+ * Sleeps until all threads have stopped running but not longer than
+ * sleep_time seconds.
+ *
+ * This method is deprecated because it suffers from a race condition:
+ * If none of the pthreads created in start_processing() has been run yet,
+ * then this method returns immediately. Use wait_until_stopped() instead.
+ *
+ * @return true if the threads have stopped
+ *
+ * @see ThreadParam
+ */
+template <class T, class TParam>
+bool ThreadStarter<T, TParam>::sleepuntilstop() {
+	
+	for (uint32 i = 0; thread_object.is_running()
+			&& i < thread_param.sleep_time; i++)
+		sleep(1);
+
+	return ( thread_object.is_running() ? false : true );
+}
+
+
+/**
+ * Wait until all threads have stopped running.
+ *
+ * Threads that haven't been running yet (state IDLE) are not considered
+ * as stopped!
+ */
+template <class T, class TParam>
+void ThreadStarter<T, TParam>::wait_until_stopped() {
+
+	DLog("Threads",
+		"Waiting for Thread " << thread_param.name << " to stop");
+
+	Thread::state_t state = thread_object.get_state(false);
+
+	while ( state == Thread::STATE_INIT || thread_object.is_running() ) {
+		sleep(1);
+		state = thread_object.get_state(false);
+	}
+
+	DLog("Threads", "Thread " << thread_param.name << " has stopped");
+}
+
+
+/**
+ * Stop and kill the threads.
+ *
+ * @param kill kill the threads if they do not stop. 
+ */
+template <class T, class TParam>
+void ThreadStarter<T, TParam>::abort_processing(bool kill) {
+
+	thread_object.lock();
+
+	switch ( thread_object.get_state(false) ) {
+
+	  case T::STATE_INIT:
+		thread_object.unlock();
+		DLog("Threads", "Thread "
+			<< thread_param.name << " has not been started yet.");
+		throw ThreadError(ThreadError::ERROR_NOT_STARTED);
+		break;
+
+	  case T::STATE_ABORT: 
+		if ( ! kill ) {
+			//thread_object.unlock();
+			DLog("Threads", "Thread " << thread_param.name
+				<< " is already in state abort.");
+
+			//throw ThreadError(ThreadError::ERROR_ABORTING);
+		}
+		break;
+
+	  default:
+		break;
+	}
+
+	if ( thread_object.is_running(false) ) {
+		thread_object.stop_processing(false); 
+		// unlock and sleep so the threads have a chance to stop.
+		thread_object.unlock();
+		sleepuntilstop();
+		thread_object.lock();
+	}
+
+	thread_object.abort_processing(false);
+
+	// unlock and let the thread abort
+	thread_object.unlock();
+	sleepuntilstop();
+	thread_object.lock();
+
+	if ( thread_object.is_running(false) ) {
+		// unlock and maybe kill
+		thread_object.unlock();
+		if (kill) {
+			for (unsigned i = 0; i < pthreads.size(); i++) 
+				pthread_cancel( pthreads[i] );
+
+			sleepuntilstop();
+
+			for (unsigned i = 0; i < pthreads.size(); i++) 
+				pthread_kill(pthreads[i], 9);
+
+			ILog("Threads", pthreads.size() << " thread(s) "
+				<< thread_param.name << " killed");
+		} else {
+			ILog("Threads", pthreads.size() << " thread(s) "
+				<< thread_param.name << " refused to abort");
+
+			throw ThreadError(ThreadError::ERROR_STILL_RUNNING);
+		}
+
+	} else {
+		thread_object.unlock();
+		ILog("Threads", pthreads.size() << " thread(s) "
+			<< thread_param.name << " have terminated");
+	}
+}
+
+
+//@}
+
+} // namespace protlib
+
+#endif // PROTLIB__THREADS_H
Index: /source/ariba/communication/modules/transport/protlib/threadsafe_db.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/threadsafe_db.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/threadsafe_db.cpp	(revision 2378)
@@ -0,0 +1,358 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file threadsafe_db.cpp
+/// Thread-safe access for some resolving functions (netdb)...
+/// ----------------------------------------------------------
+/// $Id: threadsafe_db.cpp 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/threadsafe_db.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup netdb
+ *
+ * As the reentrant functions for netdb access seem not portable, I decided to 
+ * write some wrappers for those functions I need. This is not 
+ * object-oriented because the NetDB would be another singleton object and
+ * I only want some wrapper functions.
+ */
+
+#include <netdb.h>
+#include <pwd.h>
+#include <netinet/in.h>
+#include <cerrno>
+
+#include "threadsafe_db.h"
+#include "cleanuphandler.h"
+#include "logfile.h"
+
+namespace protlib { 
+
+/** @addtogroup netdb Thread-safe DB
+ * @{
+ */
+
+  using namespace log;
+
+bool tsdb::is_init = false;
+bool tsdb::resolvenames = true;
+pthread_mutex_t tsdb::mutex = 
+#ifdef _DEBUG
+    PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
+#else
+    PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+
+uint32 tsdb::id32 = 1;
+uint64 tsdb::id64 = 1;
+
+protocol_t tsdb::udp_id= 17;
+protocol_t tsdb::tcp_id= 6;
+protocol_t tsdb::sctp_id= 132;
+
+
+void 
+tsdb::init(bool noresolving) 
+{
+  if (is_init) 
+  {
+    Log(ERROR_LOG,LOG_NORMAL, "Threadsafe_DB", "Tried to initialize tstdb although already initialized.");
+  } else 
+  {
+    pthread_mutex_init(&mutex,NULL);
+    is_init = true;
+
+    // initialize frequently used protocol constants
+    udp_id= tsdb::getprotobyname("udp");
+    tcp_id= tsdb::getprotobyname("tcp");
+    sctp_id= tsdb::getprotobyname("sctp");
+
+    resolvenames=!noresolving;
+    if (!resolvenames) 
+      Log(INFO_LOG,LOG_NORMAL,"Threadsafe_DB"," ** Disabled reverse name lookups - addresses will not be resolved to names **");
+  } // end if is_init
+} // end init
+  
+void tsdb::end() {
+	if (is_init) {
+		is_init = false;
+		pthread_mutex_destroy(&mutex);
+	} else {
+	  Log(ERROR_LOG,LOG_NORMAL, "Threadsafe_DB", "Tried to end tstdb although not initialized.");
+	} // end if is_init
+} // end end
+
+uint32 tsdb::get_new_id32() {
+	uint32 res = 0;
+	if (is_init) {
+		pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+		res = id32++;
+		pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+	} else {
+	  Log(ERROR_LOG,LOG_NORMAL, "Threadsafe_DB", "Tried to access tsdb although not initialized.");
+	} // end if is_init
+	return res;
+} // end get_new_id32
+
+uint64 tsdb::get_new_id64() {
+	uint64 res = 0;
+	if (is_init) {
+		pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+		res = id64++;
+		pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+	} else {
+	  Log(ERROR_LOG,LOG_NORMAL, "Threadsafe_DB", "Tried to access tsdb although not initialized.");
+	} // end if is_init
+	return res;
+} // end get_new_id64
+
+string tsdb::getprotobynumber(protocol_t proto, bool *res) {
+	string str;
+	if (is_init) 
+	{
+		pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+		struct protoent* entry = ::getprotobynumber(proto);
+
+		if (res) *res = (entry!=NULL);
+		if (entry) 
+		  str = entry->p_name;
+		else 
+		  str = "UNKNOWN";
+
+		pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+	} 
+	else 
+	{
+	  Log(ERROR_LOG,LOG_NORMAL, "Threadsafe_DB", "Tried to access tsdb although not initialized.");
+	  if (res) *res = false;
+	  str = "";
+	} // end if is_init
+	return str;
+} // end getprotobynumber
+
+protocol_t tsdb::getprotobyname(const string &pname, bool *res) {
+	return getprotobyname(pname.c_str(),res);
+} // end getprotobyname
+
+protocol_t tsdb::getprotobyname(const char* pname, bool *res) {
+	register protocol_t pnum;
+	struct protoent* entry = NULL;
+	if (is_init) {
+		pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+		if (pname) entry = ::getprotobyname(pname);
+		if (res) *res = (entry!=NULL);
+		if (entry) pnum = entry->p_proto;
+		else pnum = 0;
+		pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+	} else {
+	  Log(ERROR_LOG,LOG_NORMAL, "Threadsafe_DB", "Tried to access tsdb although not initialized.");
+	  if (res) *res = false;
+	  pnum = 0;
+	} // end if is_init
+	return pnum;
+} // end getprotobyname
+
+string tsdb::get_username(uid_t uid, bool *res) {
+	string str;
+	if (is_init) {
+		pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+		struct passwd* entry = ::getpwuid(uid);
+		if (res) *res = (entry!=NULL);
+		if (entry) str = entry->pw_name;
+		else str = "UNKNOWN";
+		pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+	} else {
+	  Log(ERROR_LOG,LOG_NORMAL, "Threadsafe_DB", "Tried to access tsdb although not initialized.");
+	  if (res) *res = false;
+	  str = "";
+	} // end if is_init
+	return str;
+} // end get_username
+
+uid_t tsdb::get_userid(const char* uname, bool *res) {
+	register uid_t uid;
+	struct passwd* entry = NULL;
+	if (is_init) {
+		pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+		if (uname) entry = ::getpwnam(uname);
+		if (res) *res = (entry!=NULL);
+		if (entry) uid = entry->pw_uid;
+		else uid = 0;
+		pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+	} else {
+	  Log(ERROR_LOG,LOG_NORMAL, "Threadsafe_DB", "Tried to access tsdb although not initialized.");
+	  if (res) *res = false;
+	  uid = 0;
+	} // end if is_init
+	return uid;
+} // end get_userid
+
+uid_t tsdb::get_userid(const string& uname, bool *res) {
+	return get_userid(uname.c_str(),res);
+} // end get_userid
+
+string tsdb::get_portname(port_t port, protocol_t prot, bool *res) {
+	string str;
+	if (is_init) {
+		bool tmpres = true;
+		string pname = getprotobynumber(prot,&tmpres);
+		if (tmpres) {
+			pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+			struct servent* entry = ::getservbyport(htons(port),pname.c_str());
+			if (res) *res = (entry!=NULL);
+			if (entry) str = entry->s_name;
+			else str = "UNKNOWN";
+			pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+		} else {
+			if (res) *res = false;
+			str = "UNKNOWN";
+		} // end if tmpres
+	} else {
+	  Log(ERROR_LOG,LOG_NORMAL, "Threadsafe_DB", "Tried to access tsdb although not initialized.");
+	  if (res) *res = false;
+	  str = "";
+	} // end if is_init
+	return str;
+} // end get_portname
+
+port_t tsdb::get_portnumber(const char* pname, protocol_t prot, bool *res) {
+	register port_t pnum;
+	struct servent* entry = NULL;
+	if (is_init) {
+		bool tmpres = true;
+		string protoname = getprotobynumber(prot,&tmpres);
+		if (tmpres) {
+			pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+			if (pname) entry = ::getservbyname(pname,protoname.c_str());
+			if (res) *res = (entry!=NULL);
+			if (entry) pnum = ntohs(entry->s_port);
+			else pnum = 0;
+			pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+		} else {
+			if (res) *res = false;
+			pnum = 0;
+		} // end if tmpres
+	} else {
+	  Log(ERROR_LOG,LOG_NORMAL, "Threadsafe_DB", "Tried to access tsdb although not initialized.");
+	  if (res) *res = false;
+	  pnum = 0;
+	} // end if is_init
+	return pnum;
+} // end get_portnumber
+
+port_t tsdb::get_portnumber(const string& pname, protocol_t prot, bool *res) {
+	return get_portnumber(pname.c_str(),prot,res);
+} // end get_portnumber
+
+
+string 
+tsdb::get_hostname(const struct sockaddr* sa, bool *res) 
+{
+  string str;
+  static char tmpbuf[NI_MAXHOST];
+
+  if (is_init) 
+  {
+    pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+    if (resolvenames)
+    {
+      int resultval= getnameinfo(sa,sizeof(struct sockaddr),
+				 tmpbuf,sizeof(tmpbuf),
+				 0,0, // services
+				 0);  // flags
+      
+      if (res) *res = (resultval==0);
+      if (resultval==0)
+      { // success
+	str= tmpbuf; // this should copy the buffer contents
+      }
+      else
+      {
+	str = "UNKNOWN";
+	if (resultval==EAI_AGAIN || errno==EAI_AGAIN)
+	{
+	  Log(INFO_LOG,LOG_NORMAL, "Threadsafe_DB", "Temporary failure in name lookup. Try again later.");
+	}
+	else
+	  Log(INFO_LOG,LOG_NORMAL, "Threadsafe_DB", "Name lookup failed -" << strerror(errno));
+
+	if (res) *res= false;
+      }
+    }
+    else
+    {
+      str= "disabled";
+      if (res) *res= false;
+    }
+    pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+  }
+  else 
+  {
+    Log(ERROR_LOG,LOG_NORMAL, "Threadsafe_DB", "Tried to access tsdb although not initialized.");
+    if (res) *res = false;
+    str = "";
+  } // end if is_init
+  return str;
+} // ent get_hostname(in_addr)
+
+
+
+/** lookup of hostname for an ipv4 address
+ *  @param in ipv4 address structure
+ *  @param res returns true if name lookup was successful, otherwise false
+ *
+ *  @return in case that resolving is enabled it returns the host name corresponding to the given address or "UNKNOWN", 
+ *           otherwise it returns "disabled"
+ */
+string 
+tsdb::get_hostname(const in_addr& in, bool *res) 
+{
+  struct sockaddr_in sa={
+    AF_INET,
+    0,
+    in
+  };
+  return get_hostname(reinterpret_cast<const sockaddr*>(&sa),res);
+}
+
+/** lookup of hostname for ipv6 address
+ *  @param in ipv6 address structure
+ *  @param res returns true if name lookup was successful, otherwise false
+ *
+ *  @return in case that resolving is enabled it returns the host name corresponding to the given address or "UNKNOWN", 
+ *           otherwise it returns "disabled"
+ */
+string 
+tsdb::get_hostname(const in6_addr& in, bool *res) 
+{
+  struct sockaddr_in6 sa={
+    AF_INET6,
+    0, // transport layer port #
+    0, // IPv6 flow information
+    in,
+    0  // scope id (new in RFC2553)
+  };
+  return get_hostname(reinterpret_cast<const sockaddr*>(&sa),res);
+} // ent get_hostname(in6_addr)
+
+//@}
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/threadsafe_db.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/threadsafe_db.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/threadsafe_db.h	(revision 2378)
@@ -0,0 +1,122 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file threadsafe_db.h
+/// Thread-safe netdb access
+/// ----------------------------------------------------------
+/// $Id: threadsafe_db.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/threadsafe_db.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup netdb
+ *
+ * Thread-safe netdb access for linux.
+ *
+ * As the reentrant functions for netdb access seem not portable, I decided to 
+ * write some wrappers for those functions I need. This is not 
+ * object-oriented because the NetDB would be another singleton object and
+ * I only want some wrapper functions.
+ */
+
+#ifndef THREADSAFE_DB_H
+#define THREADSAFE_DB_H
+
+#include <sys/types.h>
+#include <pthread.h>
+#include <netinet/in.h>
+#include <string>
+
+#include "protlib_types.h"
+
+namespace protlib { 
+
+/** @addtogroup netdb Thread-safe DB
+ * @{
+ */
+
+/// Thread-safe DB
+/** This class provides class methods for accessing the protocol database
+ * and maybe other services from netdb.h in a thread-safe way.
+ */
+class tsdb {
+private:
+	/// init state
+	static bool is_init;
+	/// enable/disable name resolving via DNS
+	static bool resolvenames;
+
+	/// netdb mutex
+	static pthread_mutex_t mutex;
+	// @{
+	/// last used IDs
+	static uint32 id32;
+	static uint64 id64;
+	// @}
+
+	// standard protocol ids
+	static protocol_t udp_id;
+	static protocol_t tcp_id;
+	static protocol_t sctp_id;
+
+public:
+	/// initialize netdb
+	static void init(bool noresolving= false);
+	/// cleanup netdb resources
+	static void end();
+	/// get new 32bit-ID
+	static uint32 get_new_id32();
+	/// get new 64bit-ID
+	static uint64 get_new_id64();
+	/// get protocol name by number
+	static string getprotobynumber(protocol_t proto, bool *res = NULL);
+	/// get protocol number by name
+	static protocol_t getprotobyname(const string &pname, bool *res = NULL);
+	/// get protocol number by name
+	static protocol_t getprotobyname(const char* pname, bool *res = NULL);
+	/// get frequently used protocol numbers
+	static protocol_t get_udp_id()  { return udp_id; }
+	static protocol_t get_tcp_id()  { return tcp_id; } 
+	static protocol_t get_sctp_id() { return sctp_id; } 
+	
+	/// get user name
+	static string get_username(uid_t uid, bool *res = NULL);
+	/// get user ID
+	static uid_t get_userid(const char* uname, bool *res = NULL);
+	/// get user ID
+	static uid_t get_userid(const string& uname, bool *res = NULL);
+	/// get port name
+	static string get_portname(port_t port, protocol_t prot, bool *res = NULL);
+	/// get port number
+	static port_t get_portnumber(const char* pname, protocol_t prot, bool *res = NULL);
+	/// get port number
+	static port_t get_portnumber(const string& pname, protocol_t prot, bool *res = NULL);
+	/// lookup host name
+	static string get_hostname(const struct sockaddr* sa, bool *res);
+	static string get_hostname(const in_addr& in, bool *res = NULL);
+	static string get_hostname(const in6_addr& in, bool *res = NULL);
+
+}; // end class tsdb
+
+//@}
+
+} // end namespace protlib
+
+#endif
Index: /source/ariba/communication/modules/transport/protlib/timer.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/timer.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/timer.cpp	(revision 2378)
@@ -0,0 +1,550 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file timer.cpp
+/// Software timer interface
+/// ----------------------------------------------------------
+/// $Id: timer.cpp 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/timer.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup timer 
+ * You can create a software timer and attach a callback object to it.
+ * Timers are only accessed through their TimerManager and timer ID.
+ * timer managers are thread-safe.
+ *
+ * Timers are stored in an ordered list to ease checking for elapsed timers.
+ * Additionally, their IDs are kept in a hash_map, so a pointer to a
+ * timer object can be obtained very fast.
+ */
+
+//#define DEBUG_TIMER
+
+#include <errno.h>
+
+#include "cleanuphandler.h"
+#include "timer.h"
+#include "logfile.h"
+
+namespace protlib {
+
+/** @addtogroup timer Timer
+ * @{
+ */
+
+  using namespace log;
+
+static inline 
+void 
+normalize_timespec(struct timespec& ts) 
+{
+  while (ts.tv_nsec>=1000000000) {
+    ts.tv_sec++;
+    ts.tv_nsec -= 1000000000;
+  } // end while
+  if (ts.tv_sec<0) ts.tv_sec = 0;
+  if (ts.tv_nsec<0) ts.tv_nsec = 0;
+} // end normalize
+
+/**
+ *  fills in timespec with sec+msec, msec may be larger than 999!
+ */
+static inline 
+void 
+fill_timespec(struct timespec& ts, int32 sec, int32 msec) 
+{
+  if (sec<0) sec = 0;
+  if (msec<0) msec = 0;
+  ts.tv_sec = sec + (msec/1000);
+  ts.tv_nsec = (msec%1000)*1000000;
+  normalize_timespec(ts);
+} // end fill_timespec
+
+static inline 
+void 
+add_timespecs(struct timespec& ts1, struct timespec& ts2, struct timespec& res) {
+  res.tv_sec = ts1.tv_sec + ts2.tv_sec;
+  res.tv_nsec = ts1.tv_nsec + ts2.tv_nsec;
+  normalize_timespec(res);
+} // end add_timespecs
+
+static inline void gettimeofday_timespec(struct timespec& ts) {
+	struct timeval now = {0,0};
+	gettimeofday(&now,NULL);
+	ts.tv_sec = now.tv_sec;
+	ts.tv_nsec = now.tv_usec*1000;
+} // end gettimeofday_timespec
+
+/** Initialize a TimerManager object. */
+TimerManager::TimerManager() 
+{
+  pthread_mutexattr_init(&mutex_attr);
+#ifdef _DEBUG
+  pthread_mutexattr_settype(&mutex_attr,PTHREAD_MUTEX_ERRORCHECK);
+#else
+  pthread_mutexattr_settype(&mutex_attr,PTHREAD_MUTEX_NORMAL);
+#endif
+
+  pthread_mutex_init(&mutex,&mutex_attr);
+  pthread_cond_init(&cond,NULL);
+
+  Log(DEBUG_LOG,LOG_NORMAL, "Timer", "Creating TimerManager");
+} // end constructor TimerManager
+
+/** Destroy TimerManager. */
+TimerManager::~TimerManager() {
+#ifndef _NO_LOGGING
+	int num = cleanup();
+#else
+	cleanup();
+#endif
+	DLog("Timer", "Destroying TimerManager with " << num << " timers");
+	pthread_cond_destroy(&cond);
+	pthread_mutex_destroy(&mutex);
+	pthread_mutexattr_destroy(&mutex_attr);
+} // end destructor TimerManager
+
+/** Start a timer relative to current time.
+ * @return ID of the new timer.
+ */
+timer_id_t 
+TimerManager::start_relative(TimerCallback* tc, int32 sec, int32 msec, timer_callback_param_t tcp) 
+{
+  struct timespec timeofday = {0,0};
+  struct timespec reltime = {0,0};
+  struct timespec alarm = {0,0};
+  timer *t = NULL;
+  timer_id_t result = 0;
+  fill_timespec(reltime,sec,msec);
+  // calculate absolute alarm time
+  gettimeofday_timespec(timeofday);
+  add_timespecs(timeofday,reltime,alarm);	
+  // begin critical section
+  pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+  // start timer
+  t = new(nothrow) timer(alarm,tc,tcp);
+  if (t) {
+    result = t->id;
+    // insert into list
+    insert_into_list(t);
+    // insert into hash
+    hashmap[result] = t;
+    // wake up threads
+    pthread_cond_signal(&cond);
+  } else {
+    Log(ERROR_LOG,LOG_CRIT, "Timer", "TimerManager::start_relative() is unable to create timer object");
+  } // end if t
+  // end critical section
+  pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+  return result;
+} // end start_relative
+
+/** Start an absolute timer.
+ * @return ID of the new timer.
+ */
+timer_id_t 
+TimerManager::start_absolute(TimerCallback* tc, int32 sec, int32 msec, timer_callback_param_t tcp) {
+  struct timespec alarm = {0,0};
+  timer *t = NULL;
+  timer_id_t result = 0;
+  fill_timespec(alarm,sec,msec);
+  // begin critical section
+  pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+  // start timer
+  t = new(nothrow) timer(alarm,tc,tcp);
+  if (t) {
+    result = t->id;
+    // insert into list
+    insert_into_list(t);
+    // insert into hash
+    hashmap[result] = t;
+    // wake up threads
+    pthread_cond_signal(&cond);
+  } else {
+    Log(ERROR_LOG,LOG_CRIT, "Timer", "TimerManager::start_absolute() is unable to create timer object");
+  } // end if t
+  // end critical section
+  pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+  return result;
+} // end start_absolute
+
+/** Restart a timer and set the alarm relative to the current time.
+ * The timer must exist and go off in the future.
+ * @return true on success, false otherwise.
+ */
+bool 
+TimerManager::restart_relative(timer_id_t id, int32 sec, int32 msec) 
+{
+  struct timespec timeofday = {0,0};
+  struct timespec reltime = {0,0};
+  struct timespec alarm = {0,0};
+  timer *t = NULL;
+  bool result = false;
+  timer_hashmap_it_t hit;
+  fill_timespec(reltime,sec,msec);
+  // calculate absolute alarm time
+  gettimeofday_timespec(timeofday);
+  add_timespecs(timeofday,reltime,alarm);	
+  // begin critical section
+  pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+  // try to get timer with given ID
+  if ((hit=hashmap.find(id))!=hashmap.end()) t = hit->second; else t = NULL;
+  if (t) {
+    // delete from list, set new alarm and insert
+    delete_from_list(t);
+    t->time = alarm;
+    insert_into_list(t);
+    // wake up threads
+    pthread_cond_signal(&cond);
+    result = true;
+  } else {
+    Log(DEBUG_LOG,LOG_NORMAL, "Timer", "TimerManager::restart_relative() is unable to restart timer " << id);
+  } // end if t
+  pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+  return result;
+} // end restart_relative
+
+
+/** Restart a timer and set the alarm to an absolute time.
+ * The timer must exist and go off in the future.
+ * @return true on success, false otherwise.
+ */
+bool 
+TimerManager::restart_absolute(timer_id_t id, int32 sec, int32 msec) 
+{
+  struct timespec alarm = {0,0};
+  timer *t = NULL;
+  bool result = false;
+  timer_hashmap_it_t hit;
+  fill_timespec(alarm,sec,msec);
+  // begin critical section
+  pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+  // try to get timer with given ID
+  if ((hit=hashmap.find(id))!=hashmap.end()) t = hit->second; else t = NULL;
+  if (t) {
+    // delete from list, set new alarm and insert
+    delete_from_list(t);
+    t->time = alarm;
+    insert_into_list(t);
+    // wake up threads
+    pthread_cond_signal(&cond);
+    result = true;
+  } else {
+    Log(DEBUG_LOG,LOG_NORMAL, "Timer", "TimerManager::restart_relative() is unable to restart timer " << id);
+  } // end if t
+  pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+  return result;
+} // end restart_absolute
+
+/** Stop the given timer. */
+bool TimerManager::stop(timer_id_t id) 
+{
+  timer *t = NULL;
+  bool result = false;
+  timer_hashmap_it_t hit;
+  // begin critical section
+  pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+  if ((hit=hashmap.find(id))!=hashmap.end()) {
+    t = hit->second;
+    // erase from hashmap
+    hashmap.erase(hit);
+  } else t = NULL;
+  // delete from list if t exists
+  if (t) {
+    delete_from_list(t);
+    // wake up threads
+    pthread_cond_signal(&cond);
+    result = true;
+  } else {
+    Log(DEBUG_LOG,LOG_NORMAL, "Timer", "TimerManager::stop() is unable to stop timer " << id);
+  } // end if t
+  pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+  return result;
+} // end stop
+
+/** Check if timers have elapsed and call their callbacks.
+ * @return the number of elapsed timers. 
+ */
+uint32 
+TimerManager::check_timers() 
+{
+  timer *elapsed;
+  pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+  elapsed = collect_elapsed();
+  pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+	return process_elapsed();
+} // end check_timers
+
+/** Like check_timers() but waits msec milliseconds for a timer to elapse. */
+uint32 
+TimerManager::check_timers_wait(int32 msec) 
+{
+  struct timespec now = {0,0};
+  struct timespec reltime = {0,0};
+  struct timespec abstime = {0,0};
+  timer* elapsed;
+  int wait_res = 0;
+  fill_timespec(reltime,0,msec);
+  gettimeofday_timespec(now);
+  // calculate timespec for pthread_cond_timedwait()
+  add_timespecs(now,reltime,abstime);
+  timer maxwait(abstime,NULL,NULL,false);
+  // begin critical section
+  pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+  // look for elapsed timers until timeout
+  elapsed = collect_elapsed();
+  while ((!elapsed) && (wait_res!=ETIMEDOUT)) {
+    // neither timeout nor elapsed timers
+    // if there is a timer in the list, wait until it elapses.
+    // otherwise wait abstime.
+    if (first() && ((*first())<=maxwait)) abstime = first()->time;
+    else abstime = maxwait.time;
+    // wait for condition or timeout
+    wait_res = pthread_cond_timedwait(&cond,&mutex,&abstime);
+#ifdef DEBUG_TIMER
+    Log(DEBUG_LOG,LOG_NORMAL, "Timer", "TimerManager::check_timers_wait() - timedwait returned " << wait_res << ":" << strerror(wait_res));
+#endif
+    elapsed = collect_elapsed();
+#ifdef DEBUG_TIMER
+    if (elapsed)
+      Log(DEBUG_LOG,LOG_NORMAL, "Timer", "TimerManager::check_timers_wait() - collect_elapsed() returned " <<  elapsed->id);
+#endif
+  } // end while !elapsed and !wait_res
+  // end critical section
+  pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+  // now either timeout, cancellation or elapsed timers
+  return process_elapsed();
+} // end check_timers_wait
+
+/** Stop all timers. */
+uint32 
+TimerManager::stop_all() 
+{
+  uint32 result = 0;
+  pthread_mutex_lock(&mutex); // install_cleanup_mutex_lock(&mutex);
+  result = cleanup();
+  if (result) {
+    // wake up threads
+    pthread_cond_signal(&cond);
+  } // end if result
+  pthread_mutex_unlock(&mutex); // uninstall_cleanup(1);
+  return result;
+} // end stop_all_timers
+
+/** Stop all timers without locking the mutex.
+ * So this can be called safely inside the TimerManager constructor.
+ */
+uint32 
+TimerManager::cleanup() 
+{
+  uint32 num = 0;
+  // clear hashmap
+  hashmap.clear();
+  
+  // delete all timers
+  timer *curr= 0;
+  while (!active_timerlist.empty())
+  {
+    if ( (curr= active_timerlist.front()) != 0 )
+    {
+      delete curr;
+      active_timerlist.pop_front();
+      num++;
+    }
+  } // end while
+  return num;
+} // end cleanup
+
+/** Insert a timer object into the timer list.
+ * Timers are stored in an ordered list, so when checking for elapsed timers
+ * it's enough to check timers beginning at the front end until one is
+ * still running.
+ */
+inline 
+void 
+TimerManager::insert_into_list(timer *t) 
+{
+  timerlist_t::iterator listiter= active_timerlist.begin();
+  while(listiter != active_timerlist.end())
+  {
+    if ( *listiter ) 
+    {
+      // if current element is greater than *t, leave the loop
+      if (!( *(*listiter) <= *t ))
+	break;
+      
+    }
+    listiter++;
+  } // end for
+  active_timerlist.insert(listiter,t);
+
+
+#ifdef DEBUG_TIMER
+	Log(DEBUG_LOG,LOG_NORMAL, "Timer", "TimerManager::insert_into_list() - inserting timer " << t->id << " list now:");
+#endif
+
+#ifdef DEBUG_TIMER
+  for(timerlist_t::iterator listpiter= active_timerlist.begin();
+      listpiter != active_timerlist.end();
+      listpiter++)
+  {
+    Log(DEBUG_LOG,LOG_NORMAL, "Timer", "TimerManager::insert_into_list() - timer list, timer#: " << (*listpiter ? (*listpiter)->id : 0));
+  }
+#endif
+
+} // end insert_into_list
+
+/** Delete a timer from the ordered timer list. 
+ * The timer object is NOT freed because it may be needed for executing its
+ * callback or for restarting.
+ * The timer objects must be linked correctly, no checking is done.
+ */
+void 
+TimerManager::delete_from_list(timer *t) {
+
+  if (!t) return;
+
+#ifdef DEBUG_TIMER
+  Log(DEBUG_LOG,LOG_NORMAL, "Timer", "TimerManager::delete_from_list() - deleting timer " << t->id);
+#endif
+  timerlist_t::iterator listiter= find(active_timerlist.begin(),active_timerlist.end(),t);
+  if ( listiter != active_timerlist.end() )
+      active_timerlist.erase(listiter);
+#ifdef DEBUG_TIMER
+  if (first()) 
+    Log(DEBUG_LOG,LOG_NORMAL, "Timer", "TimerManager::delete_from_list() - first timer now " << (first() ? first()->id : 0) );
+#endif
+} // end delete_from_list
+
+/** Collect all elapsed timers in the elapsed_timerlist and delete them already
+ * from the hashmap. The timers are deleted in process_elapsed().
+ * You must lock the TimerManager mutex before collecting timers.
+ * When timers have elapsed, the condition is signaled.
+ */
+TimerManager::timer* 
+TimerManager::collect_elapsed() 
+{	
+  struct timespec tod;
+  gettimeofday_timespec(tod);
+  timer now(tod,NULL,NULL,false);
+
+  timerlist_t::iterator currentit = active_timerlist.begin();
+  timer* curr= first();
+#ifdef DEBUG_TIMER
+  if (curr)
+    Log(DEBUG_LOG,LOG_NORMAL, "Timer", "TimerManager::collect_elapsed() - first timer is " << curr->id);
+#endif
+
+  // search the last timer in list <= now
+  while (curr && ((*curr)<=now)) 
+  { // current timer is already elapsed
+    hashmap.erase(curr->id);
+#ifdef DEBUG_TIMER
+    Log(DEBUG_LOG,LOG_NORMAL, "Timer", "TimerManager::collect_elapsed() - deleted elapsed timer " << curr->id);
+#endif
+    // remember it in elapsed list
+    elapsed_timerlist.push_back(curr);
+    // delete it from the active timer list
+    currentit= active_timerlist.erase(currentit);
+
+    curr= (currentit != active_timerlist.end()) ? *currentit : 0;
+  } // end while
+  // List is ordered, so all timers before currentit are elapsed.
+
+  timer* elapsed = elapsed_timerlist.empty() ? 0 : elapsed_timerlist.front();
+
+  // wake up threads
+  if (elapsed) pthread_cond_signal(&cond);
+  
+  return elapsed;
+} // end collect_elapsed
+
+/** Process a list of timers by executing the callback routines and deleting
+ * the timer objects. They are NOT deleted from the TimerManager hashmap.
+ * The mutex should not be locked when callbacks are executed, because 
+ * it is unpossible to start a new timer inside a callback routine when
+ * the mutex is still locked.
+ * @see collect_elapsed()
+ */
+uint32 TimerManager::process_elapsed() 
+{
+  uint32 num = 0;
+  timer *tmp = NULL;
+
+  // for every elapsed timer (list should be prepared by collect_elapsed) do_callback()
+  for (timerlist_t::iterator elapsed_it= elapsed_timerlist.begin();
+       elapsed_it != elapsed_timerlist.end();
+       elapsed_it= elapsed_timerlist.erase(elapsed_it))
+  {
+    // invoke callback function on elapsed timer
+    if ( (tmp = *elapsed_it) != 0)
+    {
+      tmp->do_callback();
+      // when callback is finished, delete the stuff
+      delete tmp;
+      num++;
+    }
+    // get next elapsed timer
+  } // end for
+  return num;
+} // end process_elapsed
+
+/** Initialize a timer.
+ * If get_id is set (default) the timer gets a unique ID, otherwise the ID
+ * of the timer is 0.
+ */
+TimerManager::timer::timer(struct timespec& ts, TimerCallback* tc, timer_callback_param_t tcp, bool get_id) :
+  id (0),
+  time(ts),
+  callback(tc),
+  param(tcp)
+{
+  if (get_id) while (id==0) id = next_id++;
+} // end constructor timer
+
+/** This holds the timer ID of the next timer. */
+timer_id_t TimerManager::timer::next_id = 1;
+
+/** Check which timer goes off eralier. 
+ * The timespec structores of the timers are expected to have correct
+ * format.
+ */
+inline 
+bool 
+TimerManager::timer::operator<=(const timer& t) {
+  if (time.tv_sec == t.time.tv_sec) {
+    // Seconds are equal, it depends on nanoseconds.
+    return (time.tv_nsec <= t.time.tv_nsec);
+  } else {
+    // Seconds are not equal, nanoseconds do not matter.
+    return (time.tv_sec < t.time.tv_sec);
+  }
+} // end operator<=
+
+inline 
+void 
+TimerManager::timer::do_callback() {
+  callback->timer_expired(id,param);
+} // end do_callback
+
+//@}
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/timer.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/timer.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/timer.h	(revision 2378)
@@ -0,0 +1,162 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file timer.h
+/// Basic TimerManager class
+/// ----------------------------------------------------------
+/// $Id: timer.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/timer.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+// ----------------------------------------*- mode: C++; -*--
+// timer.h - Software Timer interface
+// ----------------------------------------------------------
+// $Id: timer.h 2549 2007-04-02 22:17:37Z bless $
+// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/timer.h $
+// ==========================================================
+//                      
+// Institute of Telematics, University of Karlsruhe (TH)
+// ==========================================================
+/** @ingroup timer 
+ * @file
+ * Software Timer interface
+ *
+ * You can create a software timer and attach a callback object to it.
+ * Timers are only accessed through their timer manager and thtimer ID.
+ * timer managers are thread-safe.
+ */
+
+#ifndef _PROTLIB__TIMER_H_
+#define _PROTLIB__TIMER_H_
+
+#include <pthread.h>
+#include <sys/time.h>
+#include <list>
+#include <ext/hash_map>
+
+#include "protlib_types.h"
+#include "llhashers.h"
+
+namespace protlib {
+
+/** @addtogroup timer Timer
+ * @{
+ */
+
+/// timer ID
+/** Each timer of a timer manager has a unique timer ID. */
+typedef uint64 timer_id_t;
+
+/// timer callback parameter
+typedef void* timer_callback_param_t;
+
+/// Timer Callback
+/** When a timer goes off, a callback is called. Each class that wants to
+ * receive timer events must inherit from TimerCallback. 
+ */
+class TimerCallback {
+public:
+	virtual ~TimerCallback() { }
+
+	/// callback member function
+   /** @param id timer ID
+    * @param param additional callback parameter.
+	 */
+	virtual void timer_expired(timer_id_t id, timer_callback_param_t param) = 0;
+};
+
+/// Timer Manager
+/** Creates, sets, resets, stops, checks and deletes timers. */
+class TimerManager {
+public:
+	/// constructor
+	TimerManager();
+	/// destructor
+        ~TimerManager();
+	/// start relative timer
+	timer_id_t start_relative(TimerCallback* tc, int32 sec, int32 msec = 0, timer_callback_param_t tcp = NULL);
+	/// start absolute timer
+	timer_id_t start_absolute(TimerCallback* tc, int32 sec, int32 msec = 0, timer_callback_param_t tcp = NULL);
+	/// restart relative timer
+	bool restart_relative(timer_id_t id, int32 sec, int32 msec = 0);
+	/// restart absolute timer
+	bool restart_absolute(timer_id_t id, int32 sec, int32 msec = 0);
+	/// stop timer
+	bool stop(timer_id_t id);
+	/// check for elapsed timers
+	uint32 check_timers();
+	/// check for elapsed timers or wait for next timer event.
+	uint32 check_timers_wait(int32 msec);
+	/// stop all timers
+	uint32 stop_all();
+private:
+	/// timer item
+	struct timer {
+		timer_id_t id;
+		struct timespec time;
+		TimerCallback* callback;
+		timer_callback_param_t param;
+		timer(struct timespec& ts, TimerCallback* tc, timer_callback_param_t tcp, bool get_id = true);
+		// compare two timers
+		bool operator<=(const timer& t);
+		/// execute callback
+		void do_callback();
+		/// timer ID counter
+		static timer_id_t next_id;
+	}; // end struct timer
+	/// timer manager hashmap
+	typedef hash_map<timer_id_t,timer*> timer_hashmap_t;
+	/// hashmap iterator
+	typedef timer_hashmap_t::iterator timer_hashmap_it_t;
+        /// timer list type
+        typedef list<timer*> timerlist_t;
+
+	/// cleanup hashmap and list
+	uint32 cleanup();
+	/// insert into list
+	void insert_into_list(timer* t);
+	/// delete timer from list
+	void delete_from_list(timer *t);
+	/// collect elapsed timers
+	timer* collect_elapsed();
+	/// process elapsed timers
+	uint32 process_elapsed();
+	/// timer manager mutex
+	pthread_mutex_t mutex;
+	/// timer manager mutex attributes
+        pthread_mutexattr_t mutex_attr;
+
+	/// timer manager condition
+	pthread_cond_t cond;	
+        /// sorted timer list (should be replaced by a heap for performance reasons...)
+        timerlist_t active_timerlist;
+        /// elapsed timer list
+        timerlist_t elapsed_timerlist;
+	/// return first element of active timer list 
+        timer* first() { return active_timerlist.empty() ? 0 : active_timerlist.front(); }
+	timer_hashmap_t hashmap;
+};
+
+//@}
+
+} // end namespace protlib
+
+#endif // _PROTLIB__TIMER_H_
Index: /source/ariba/communication/modules/transport/protlib/timer_module.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/timer_module.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/timer_module.cpp	(revision 2378)
@@ -0,0 +1,589 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file timer_module.cpp
+/// timer module that maintains timers and triggers messages
+/// ----------------------------------------------------------
+/// $Id: timer_module.cpp 2756 2007-08-06 12:51:39Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/timer_module.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup timermodule
+ * The timer module provides a way for other modules to set timers via a
+ * message and receive a message back on their queue when the timer goes
+ * off.
+ */
+
+#include <sstream>
+
+#include "timer_module.h"
+#include "queuemanager.h"
+#include "logfile.h"
+#include "cleanuphandler.h"
+
+namespace protlib {
+
+/** @addtogroup timermodule Timer Module
+ * @{
+ */
+
+  using namespace log;
+
+/***** class TimerMsg *****/
+
+TimerMsg::TimerMsg(qaddr_t s, bool s_err)
+  : message(type_timer,s),
+    time_sec(0),
+    time_msec(0),
+    action(ac_ignore),
+    param1(NULL),
+    param2(NULL),
+    ok(true),
+    send_error(s_err),
+    relative(true)
+{
+  // Log(DEBUG_LOG,LOG_NORMAL,"TimerMsg","TimerMsg constructor. msgid:" << get_id());
+} // end TimerMsg
+
+/** Destructor, does nothing. */
+TimerMsg::~TimerMsg() {}
+
+
+/** Set result flag and get old value.
+ * You should not set this, this is done by the timer module.
+ */
+bool TimerMsg::set_ok(bool r) {
+	register bool old = ok;
+	ok = r;
+	return old;
+} // end set_ok
+
+/** Prepare message to start an absolute timer. */
+bool TimerMsg::start_absolute(int32 sec, int32 msec, param_t p1, param_t p2) {
+	return start(false,sec,msec,p1,p2);
+} // end start_absolute
+
+/** Prepare message to start a relative timer. */
+bool TimerMsg::start_relative(int32 sec, int32 msec, param_t p1, param_t p2) {
+	return start(true,sec,msec,p1,p2);
+} // end start_relative
+
+bool TimerMsg::start(bool rel, int32 sec, int32 msec, param_t p1, param_t p2) {
+	time_sec = (sec<=0)?0:sec;
+	time_msec = (msec<=0)?0:msec;
+	param1 = p1;
+	param2 = p2;
+	action = ac_start;
+	relative = rel;
+	ok = true;
+	return true;
+} // end start
+
+/** Restart an absolute timer. */
+bool TimerMsg::restart_absolute(id_t id, int32 sec, int32 msec) {
+	return restart(false,id,sec,msec);
+} // end restart_absolute
+
+/** Restart a relative timer. */
+bool TimerMsg::restart_relative(id_t id, int32 sec, int32 msec) {
+	return restart(true,id,sec,msec);
+} // end restart_relative
+
+/** restart timer 
+ * please note that this method actually overwrites the id of the message(!)
+ */
+bool TimerMsg::restart(bool rel, id_t id, int32 sec, int32 msec) {
+	relative = rel;
+	if (id && set_id(id)) {
+		time_sec = (sec<=0)?0:sec;
+		time_msec = (msec<=0)?0:msec;
+		action = ac_restart;
+		ok = true;
+	} else {
+		time_sec = 0;
+		time_msec = 0;
+		action = ac_ignore;
+		ok = false;
+	} // end if id
+	return ok;
+} // end restart
+
+/** Stop a timer. */
+bool TimerMsg::stop(id_t id) {
+	relative = false;
+	time_sec = 0;
+	time_msec = 0;
+	param1 = param2 = NULL;
+	if (id && set_id(id)) {
+		action = ac_stop;
+		ok = true;
+	} else {
+		action = ac_ignore;
+		ok = false;
+	} // end if id
+	return ok;
+} // end stop
+
+/** Stop all running timers. */
+bool TimerMsg::stop_all() {
+	relative = false,
+	time_sec = 0;
+	time_msec = 0;
+	param1 = param2 = NULL;
+	action = ac_stop_all;
+	ok = true;
+	return true;
+} // end stop_all
+
+/** Prepare message for sending it back as a reply message from the
+ * TimerModule when its timer expires.
+ */
+bool TimerMsg::set_elapsed() {
+	send_error = false;
+	action = ac_elapsed;
+	ok = true;
+	return ok;
+} // end set_elapsed
+
+bool TimerMsg::get_send_error() const {
+	return send_error;
+} // end get_send_error
+
+/** Set send_error flag and return old value. */
+bool TimerMsg::set_send_error(bool f) {
+	register bool o = send_error;
+	send_error = f;
+	return o;
+} // end set_send_error
+
+TimerMsg::param_t TimerMsg::get_param1() const { return param1; }
+
+TimerMsg::param_t TimerMsg::get_param2() const { return param2; }
+
+void TimerMsg::get_params(param_t& p1, param_t& p2) const {
+	p1 = param1;
+	p2 = param2;
+} // end get_params
+
+bool TimerMsg::is_absolute() const { return (!relative); }
+
+bool TimerMsg::is_relative() const { return relative; }
+
+/***** struct TimerModuleParam *****/
+
+/** @param sleep_time default sleep time
+ * @param sua send messages until aborted or just until stopped
+ * @param see send error messages as expedited data
+ * @param sre send reply messages as expedited data
+ */
+TimerModuleParam::TimerModuleParam(uint32 sleep_time, bool sua, bool see, bool sre)
+	: ThreadParam(sleep_time, "TimerModule", 2), send_until_abort(sua),
+	source(message::qaddr_timer), 
+	send_error_expedited(see), send_reply_expedited(sre) {
+	// nothing more to do
+} // end constructor TimerModuleParam
+
+/***** class TimerModule *****/
+
+/** Set parameters. */
+TimerModule::TimerModule(const TimerModuleParam& p) 
+	: Thread(p), timerparam(p) {
+	tmap.clear();
+	// register queue
+	QueueManager::instance()->register_queue(get_fqueue(),p.source);
+	DLog(timerparam.name, "Creating TimerModule object");
+} // end constructor TimerModule
+
+/** Stop all running timers. */
+TimerModule::~TimerModule() {
+	stop_all_timers();
+	DLog(timerparam.name, "Destroying TimerModule object");
+	QueueManager::instance()->unregister_queue(timerparam.source);
+
+} // end destructor TimerModule
+
+/** Devide Threads in thos which process the queue and those which process
+ * expired timers.
+ */
+void TimerModule::main_loop(uint32 nr) {
+  Log(INFO_LOG,LOG_NORMAL, timerparam.name, "Starting " << timerparam.name << " thread #" << nr << ", " << ((nr%2) ? "processing input queue" : "processing timer callbacks"));
+
+  if (nr%2) process_queue();
+  else process_elapsed_timers();
+
+  Log(INFO_LOG,LOG_NORMAL, timerparam.name,"Thread #" << nr << " stopped");
+} // end main_loop
+
+/** Wait for incomming mesages and evaluate message action.
+ * Messages are accepted until the module is asked to stop.
+ *
+ * The module mutex inherited from the Thread base class is locked here, so all
+ * called member functions are called inside a critical section if necessary.
+ */
+void TimerModule::process_queue() {
+  uint32 wait = timerparam.sleep_time*1000;
+  message* msg = NULL;
+  TimerMsg* tmsg = NULL;
+  FastQueue* fq = QueueManager::instance()->get_queue(message::qaddr_timer);
+  bool opresult = false;
+  if (!fq) {
+    Log(ERROR_LOG,LOG_ALERT, timerparam.name," cannot find input queue");
+    return;
+  } // end if not fq
+  // wait for messages
+  while (get_state()==STATE_RUN) {
+    msg = fq->dequeue_timedwait(wait);
+    if (msg) {
+      if (msg->get_type()==message::type_timer) {
+	tmsg = dynamic_cast<TimerMsg*>(msg);
+	if (tmsg) {
+	  // begin critical section
+	  lock(); // install_cleanup_thread_lock(TimerModule,this);
+	  if (tmsg->is_ok()) {
+	    // evaluate action
+	    switch (tmsg->get_action()) {
+	      case TimerMsg::ac_ignore:
+		      // do nothing
+		Log(DEBUG_LOG,LOG_UNIMP, timerparam.name,"received message with action set to ignore");
+		opresult = true;
+		break;
+	      case TimerMsg::ac_start:
+		opresult = start_timer(tmsg);
+		break;
+	      case TimerMsg::ac_restart:
+		opresult = restart_timer(tmsg);
+		break;
+	      case TimerMsg::ac_stop:
+		opresult = stop_timer(tmsg);
+		break;
+	      case TimerMsg::ac_stop_all:
+		opresult = stop_all_timers();
+		break;
+	      default:
+		ERRLog(timerparam.name, "Wrong action " << tmsg->get_action() << " in message from " << tmsg->get_qaddr_name() << " to " << message::get_qaddr_name(timerparam.source) );
+		
+		opresult = false;
+	    } // end switch get_action
+	  } else {
+	      Log(DEBUG_LOG,LOG_UNIMP, timerparam.name,"received message in invalid state, mid " << tmsg->get_id() );
+	    opresult = false;
+	  } // if tmsg->is_ok()
+	  // error handling, message disposing
+	  send_error_or_dispose(tmsg,opresult);
+	  // end critical section
+	  unlock(); // uninstall_cleanup(1);
+	} else {
+	  Log(ERROR_LOG,LOG_ALERT, timerparam.name, "Cannot cast message from " << msg->get_qaddr_name() << " of type " << msg->get_type_name() << " to TimerMsg");
+	  delete msg;
+	} // end if tmsg
+      } else {
+	ERRLog(timerparam.name,"received message that is not of type_timer from " << msg->get_qaddr_name() << ", type was " << msg->get_type_name());
+	delete msg;
+      } // end if type
+    } // end if msg
+  } // end while running
+} // end process_queue
+
+/** Check if timers expired and send reply messages.
+ * Reply messages are sent until the module is asked to abort if
+ * the flag send_until_abort is set true. Otherwise no messages are sent
+ * after a stop request.
+ */
+void TimerModule::process_elapsed_timers() {
+	state_t end_state;
+	uint32 num = 0;
+	uint32 sleeptime = timerparam.sleep_time*1000;
+	if (timerparam.send_until_abort) end_state = STATE_ABORT;
+	else end_state = STATE_STOP;
+	while(get_state()!=end_state) {
+		num = tm.check_timers_wait(sleeptime);
+		if (num) {
+		  Log(DEBUG_LOG,LOG_UNIMP, timerparam.name,"got " << num << " elapsed timer(s)");
+		} // end if num
+	} // end while state
+} // end process_elapsed_timers
+
+/** Starts a timer and stores its ID and the reply message in the hash maps. */
+bool TimerModule::start_timer(TimerMsg* m) {
+	timer_id_t tid = 0;
+	bool res = true;
+	message::id_t mid = m->get_id();
+	bool relative = m->is_relative();
+	int32 sec = 0;
+	int32 msec = 0;
+	if (mid) {
+	  // lookup timer ID in map
+	  if ((tid=tmap.lookup_tid(mid))) {
+	    ERRLog(timerparam.name, m->get_qaddr_name() << " tried to start a timer with mid " << mid << ", but there is already a timer " << tid);
+	    res = false;
+	  } else {
+	    // start timer
+	    m->get_time(sec,msec);
+	    if (relative) tid = tm.start_relative(this,sec,msec,NULL);
+	    else tid = tm.start_absolute(this,sec,msec,NULL);
+	    if (tid) {
+	      // insert in map
+	      tmap.insert(tid,m);
+	      // timer successfully started
+	      Log(EVENT_LOG,LOG_UNIMP, timerparam.name, "Timer " << tid << " (" << sec << "s " << msec << "ms) started for " 
+		                                         << m->get_qaddr_name() << " with mid " << mid);
+	      res = true;
+	    } else {
+	      // timer not started
+	      ERRLog(timerparam.name, "TimerManager in " << timerparam.name << " is unable to start a timer for " << m->get_qaddr_name());
+	      res = false;
+	    } // end if tid
+	  } // end if lookup repmsg
+	} else {
+	  ERRLog(timerparam.name, m->get_qaddr_name() << " tried to start a timer with message ID 0");
+	  res = false;
+	} // end if repmsg
+	return res;
+} // end start_timer
+
+/** Restarts a timer and stores its ID and the reply message in the hash maps. */
+bool TimerModule::restart_timer(TimerMsg* m) {
+	timer_id_t tid = 0;
+	bool res = true;
+	message::id_t mid = m->get_id();
+	bool relative = m->is_relative();
+	TimerMsg* repmsg = NULL;
+	int32 sec = 0;
+	int32 msec = 0;
+	if (mid) {
+	  // lookup timer_id and reply message for mid in map
+	  tid = tmap.lookup_tid(mid);
+	  repmsg = tmap.lookup_msg(tid);
+	  if (tid && repmsg) {
+	    // restart timer
+	    m->get_time(sec,msec);
+	    if (relative) res = tm.restart_relative(tid,sec,msec);
+	    else res = tm.restart_absolute(tid,sec,msec);
+	    if (res) {
+	      // modify reply message
+	      repmsg->restart(relative,mid,sec,msec);
+	      // timer successfully restarted
+	      DLog(timerparam.name, "Timer " << tid << ", mid " << mid << " restarted for " << m->get_qaddr_name());
+	    } else {
+	      // timer not restarted
+	      ERRLog(timerparam.name, "TimerManager in " << timerparam.name << " is unable to restart a timer for " << m->get_qaddr_name() << ", mid " << mid);
+	    } // end if res
+	  } else {
+	    if (tid) ERRLog(timerparam.name, m->get_qaddr_name() << " tried to restart a timer with mid " << mid << ": or no reply message for timer found");
+	    if (repmsg)  ERRLog(timerparam.name, m->get_qaddr_name() << " tried to restart timer with mid " << mid << ": timer not found");
+	    if ((!repmsg) & (!tid)) ERRLog(timerparam.name, m->get_qaddr_name() << " tried to restart timer with mid " << mid << ": neither timer nor reply message found");
+	    res = false;
+	  } // end if tid
+	} else {
+	  ERRLog(timerparam.name, m->get_qaddr_name() << " tried to restart a timer with an invalid message ID");
+	  res = false;
+	} // end if repmsg
+	return res;
+} // end restart_timer
+
+/** Stop a timer and remove its ID and reply message from the hash maps. */
+bool TimerModule::stop_timer(TimerMsg* m) {
+	timer_id_t tid = 0;
+	bool res = true;
+	message::id_t mid = m->get_id();
+	if (mid) {
+		// lookup timer_id for mid in map
+		tid = tmap.lookup_tid(mid);
+		if (tid) {
+			// stop timer
+			res = tm.stop(tid);
+			if (res) {
+				// delete from map
+				tmap.erase(tid,mid,true);
+				// timer stopped
+				DLog(timerparam.name, "Stopped timer " << tid << ", mid " << mid << " for " << m->get_qaddr_name());
+			} else {
+				// timer not stopped
+			  ERRLog(timerparam.name, "TimerManager in " << timerparam.name << " is unable to stop timer " << tid << ", mid " << mid << " for " << m->get_qaddr_name());
+			} // end if tid
+		} else {
+		  ERRLog(timerparam.name, m->get_qaddr_name() << " tried to stop a non-existing timer with mid " << mid);
+		  res = false;
+		} // end if tid
+	} else {
+	  ERRLog(timerparam.name, m->get_qaddr_name() << " tried to stop a timer with an invalid message ID");
+	  res = false;
+	} // end if repmsg
+	return res;
+} // end stop_timer
+
+/** Stop all timers and clear the hash maps. */
+bool TimerModule::stop_all_timers() {
+	uint32 num = 0;
+	// clear map
+	tmap.clear(true);
+	// clear TimerManager
+	num = tm.stop_all();
+	Log(DEBUG_LOG,LOG_UNIMP, timerparam.name,"stopped all timers, num " << num);
+	return true;
+} // end stop_all_timers
+
+/** Send back error message.
+ * If no error is necessary, the message is disposed.
+ * @param m message that is changed to an error message if 
+ *		its flags are set appropriately.
+ * @param ok success or error?
+ */
+void TimerModule::send_error_or_dispose(TimerMsg* m, bool ok) {
+	message::qaddr_t dest;
+	if (!m) return;
+
+#ifndef _NO_LOGGING
+	message::id_t mid = m->get_id();	// only used for logging
+#endif
+
+	// Do we send errors?
+	if ((!ok) && m->get_send_error()) ok = false;
+	else ok = true;
+	if (ok) {
+		// dispose if not a start message
+		if (m->get_action()!=TimerMsg::ac_start) {
+			dest = m->get_source();
+			delete m;
+			//Log(DEBUG_LOG,LOG_UNIMP, timerparam.name,"disposed message " << mid << " from " << message::get_qaddr_name(dest));
+		} // end if dispose message
+	} else {
+		// send error
+		dest = m->get_source();
+		m->set_ok(false);
+		if (m->send(timerparam.source,dest,timerparam.send_error_expedited)) {
+		  Log(DEBUG_LOG,LOG_UNIMP, timerparam.name,"sent error message w/ mid " << mid << " to " << message::get_qaddr_name(dest));
+		} else {
+		  ERRLog(timerparam.name,"cannot send error message w/ mid " << mid << " to " << message::get_qaddr_name(dest) << ", disposing it now");
+		  delete m;
+		} // end if sent error
+	} // end if ok
+} // end send_error_or_dispose
+
+/** This is the callback for the TimerManager used by the TimerModule object.
+ * @param timer timer ID
+ * @param callback_param additional callback parameter.
+ *
+ * The module mutex inherited from the Thread base class is locked here, so all
+ * called member functions are called inside a critical section if necessary.
+ */
+void TimerModule::timer_expired(timer_id_t timer, timer_callback_param_t callback_param) {
+	TimerMsg* msg = NULL;
+	message::qaddr_t dest;
+	message::id_t mid = 0;
+	// begin critical section
+	lock(); // install_cleanup_thread_lock(TimerModule,this);
+	// get reply message
+	msg = tmap.lookup_msg(timer);
+	if (msg) {
+		// store message ID for erasing this record from the map
+		mid = msg->get_id();
+		// send message
+		dest = msg->get_source();
+		if (msg->set_elapsed() && msg->send_back(timerparam.source,timerparam.send_reply_expedited)) {
+		  Log(DEBUG_LOG,LOG_UNIMP, timerparam.name,"sent reply mid " << mid << " for elapsed timer " << timer << " to " << message::get_qaddr_name(dest));
+		} else {
+		  ERRLog(timerparam.name,"cannot send reply mid " << mid << " for elapsed timer " << timer <<" to " << message::get_qaddr_name(dest));
+		  // dispose message
+		  delete msg;
+		} // end if send_back
+	} else {
+		// may be timer has been stopped
+	  DLog(timerparam.name, "TimerModule::timer_expired cannot find reply message for a timer " << timer << ". Maybe the timer has been stopped");
+	} // end if msg
+	// erase (timer,mid) without disposing the reply message
+	tmap.erase(timer,mid,false);
+	// end critical section
+	unlock(); // uninstall_cleanup(1);
+} // end timer_expired
+
+/***** class TimerModule::TimerMap *****/
+
+bool TimerModule::TimerMap::insert(timer_id_t tid, TimerMsg* m) {
+	if (tid && m) {
+		message::id_t mid = m->get_id();
+		tid2mid[tid] = mid;
+		mid2tid[mid] = tid;
+		tid2msg[tid] = m;
+		return true;
+	} else return false;
+} // end insert
+
+/** Returns the message ID of the timer bound to timer ID or 0 if not
+ * found, since every timer must have an ID <> 0.
+ */
+message::id_t TimerModule::TimerMap::lookup_mid(timer_id_t tid) const {
+	const_tid2mid_it_t hit;
+	hit = tid2mid.find(tid);
+	if (hit!=tid2mid.end()) return hit->second;
+	else return 0;
+} // end lookup
+
+/** Returns the timer-ID of the timer bound to the message ID or 0 if not
+ * found, since 0 is never used as a timer ID.
+ */
+timer_id_t TimerModule::TimerMap::lookup_tid(message::id_t mid) const {
+	const_mid2tid_it_t hit;
+	if ((hit=mid2tid.find(mid))!=mid2tid.end()) return hit->second;
+	else return 0;
+} // end lookup
+
+/** Returns the timer message of the timer bound to timer ID or NULL if not
+ * found.
+ */
+TimerMsg* TimerModule::TimerMap::lookup_msg(timer_id_t tid) const {
+	const_tid2msg_it_t hit;
+	hit = tid2msg.find(tid);
+	if (hit!=tid2msg.end()) return hit->second;
+	else return NULL;
+} // end lookup_msg
+
+/** Please be sure that timer ID and message ID are bound to the same timer. 
+ * No checking is done!
+ */
+void TimerModule::TimerMap::erase(timer_id_t tid, message::id_t mid, bool dispose) {
+	TimerMsg* m = NULL;
+	if (tid) {
+		if (dispose) {
+			m = lookup_msg(tid);
+			if (m) delete m;
+		} // end if dispose
+		tid2mid.erase(tid);
+		tid2msg.erase(tid);
+	} // end if tid
+	if (mid) mid2tid.erase(mid);
+} // end erase
+
+void TimerModule::TimerMap::clear(bool dispose) {
+	const_tid2msg_it_t hit;
+	if (dispose) {
+		for (hit=tid2msg.begin();hit!=tid2msg.end();hit++) {
+			if (hit->second) delete hit->second;
+		} // end for hit
+	} // end if dispose
+	tid2mid.clear();
+	tid2msg.clear();
+	mid2tid.clear();
+} // end clear
+
+//@}
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/timer_module.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/timer_module.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/timer_module.h	(revision 2378)
@@ -0,0 +1,266 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file timer_module.h
+/// Timer module (thread) that provides timer management functions
+/// ----------------------------------------------------------
+/// $Id: timer_module.h 2549 2007-04-02 22:17:37Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/timer_module.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+/** @ingroup timermodule
+ * The timer module provides a way for other modules to set timers via a
+ * message and receive a message back on their queue when the timer goes
+ * off.
+ */
+
+#ifndef _PROTLIB__TIMER_MODULE_H
+#define _PROTLIB__TIMER_MODULE_H
+
+#include <ext/hash_map>
+
+#include "messages.h"
+#include "threads.h"
+#include "llhashers.h"
+#include "timer.h"
+
+namespace protlib {
+
+/** @addtogroup timermodule Timer Module
+ * @{
+ */
+
+  static const char *const action_t_str[]=
+    {
+      "ignore",
+      "start",
+      "restart",
+      "stop",
+      "stop all",
+      "elapsed",
+      "unkown"
+    };
+
+/// timer message
+/** This message class is used to control timers managed by the timer
+ * module and for replies when a timer goes off.
+ * Timers are identified by the message ID.
+ */
+class TimerMsg : public message 
+{
+public:
+  /// timer module actions
+  /** Tell the timer module what to do or indicate that a timer elapsed. */
+  enum action_t 
+    {
+      ac_ignore   = 0,
+      ac_start    = 1,
+      ac_restart  = 2,
+      ac_stop     = 3,
+      ac_stop_all = 4,
+      ac_elapsed  = 5
+    }; // end action_t
+
+  /// timer parameter
+  /** This parameter corresponds to the timer parameters in timer.h and
+   * helps managing timers.
+   */
+  typedef timer_callback_param_t param_t;
+  /// constructor
+  TimerMsg(qaddr_t s = qaddr_unknown, bool s_err = false);
+  /// destructor
+  virtual ~TimerMsg();
+  /// get alarm
+  void get_time(int32& sec, int32& msec);
+  /// get action
+  action_t get_action() const;
+  /// get action str
+  const char* get_action_str() const;
+  /// set result
+  bool set_ok(bool r);
+  /// get result
+  bool is_ok();
+  /// start absolute timer
+  bool start_absolute(int32 sec, int32 msec = 0, param_t p1 = NULL, param_t p2 = NULL);
+  /// start relative timer
+  bool start_relative(int32 sec, int32 msec = 0, param_t p1 = NULL, param_t p2 = NULL);
+  /// start timer
+  bool start(bool rel, int32 sec, int32 msec = 0, param_t p1 = NULL, param_t p2 = NULL);
+  /// restart absolute timer
+  bool restart_absolute(id_t id, int32 sec, int32 msec = 0);
+  /// restart relative timer
+  bool restart_relative(id_t id, int32 sec, int32 msec = 0);
+  /// restart timer
+  bool restart(bool rel, id_t id, int32 sec, int32 msec = 0);
+  /// stop timer
+  bool stop(id_t id);
+  /// stop all timers
+  bool stop_all();
+  /// set to elapsed
+  bool set_elapsed();
+  /// get send_error flag
+  bool get_send_error() const;
+  /// set send_error flag
+  bool set_send_error(bool f);
+  /// get timer parameter #1
+  param_t get_param1() const;
+  /// get timer parameter #2
+  param_t get_param2() const;
+  /// get timer parameters
+  void get_params(param_t& p1, param_t& p2) const;
+  /// Is it an absolute or relative timer?
+  bool is_absolute() const;
+  /// Is it an absolute or relative timer?
+  bool is_relative() const;
+ private:
+  int32 time_sec;
+  int32 time_msec;
+  action_t action;
+  param_t param1;
+  param_t param2;
+  bool ok;
+  bool send_error;
+  bool relative;
+}; // end class TimerMsg
+ 
+/** Get alarm time. Please check message action to see if this is an
+ * absolute or relative time.
+ * If this is a expiration notification, the time is absolute.
+ */
+inline
+void 
+TimerMsg::get_time(int32& sec, int32& msec) 
+{
+  sec = time_sec;
+  msec = time_msec;
+} // end get_alarm
+
+/** Get timer message action. There is no way to set the action value, this
+ * is done by start_relative or start_absolute... 
+ */
+inline
+TimerMsg::action_t 
+TimerMsg::get_action() const 
+{
+	return action;
+} // end get_action
+
+inline
+const char*
+TimerMsg::get_action_str() const 
+{
+	return action_t_str[action];
+} // end get_action_str
+
+/** Get result flag. */
+bool 
+inline
+TimerMsg::is_ok() 
+{
+  return ok;
+} // end is_ok
+
+
+/// timer module parameters
+/** This holds the message queue and the default sleep time. */
+struct TimerModuleParam : public ThreadParam 
+{
+  TimerModuleParam(uint32 sleep_time = ThreadParam::default_sleep_time,
+		   bool sua = false, bool ser = true, bool sre = true);
+  /// send messages until abort
+  const bool send_until_abort;
+  const message::qaddr_t source;
+  const bool send_error_expedited;
+  const bool send_reply_expedited;
+}; // end TimerModuleParam
+
+/// timer module class
+/** This is the timer module. */
+class TimerModule : public Thread, public TimerCallback 
+{
+  /***** TimerCallback *****/
+ public:
+  /// callback member function
+  /** @param timer timer ID
+   * @param callback_param additional callback parameter.
+   */
+  virtual void timer_expired(timer_id_t timer, timer_callback_param_t callback_param);
+ public:
+  /// constructor
+  TimerModule(const TimerModuleParam& p);
+  /// destructor
+  virtual ~TimerModule();
+  /// timer module main loop
+  virtual void main_loop(uint32 nr);
+ private:
+  /// wait for incoming messages
+  void process_queue();
+  /// check timers and send messages
+  void process_elapsed_timers();
+  /// start a timer
+  bool start_timer(TimerMsg* m);
+  /// restart a timer
+  bool restart_timer(TimerMsg* m);
+  /// stop a timer
+  bool stop_timer(TimerMsg* m);
+  /// stop all timers
+  bool stop_all_timers();
+  /// send back error
+  void send_error_or_dispose(TimerMsg* m, bool ok);
+  /// timer module parameters
+  TimerManager tm;
+  /// module parameters
+  const TimerModuleParam timerparam;
+  /// timer map
+  /** This stores timer IDs and the corresponding message IDs. */
+  class TimerMap 
+  {
+  public:
+    bool insert(timer_id_t tid, TimerMsg* m);
+    /// lookup message ID
+    message::id_t lookup_mid(timer_id_t tid) const;
+    /// lookup timer ID
+    timer_id_t lookup_tid(message::id_t mid) const;
+    /// lookup message
+    TimerMsg* lookup_msg(timer_id_t tid) const;
+    /// erase record of timer ID and message ID
+    void erase(timer_id_t tid, message::id_t mid, bool dispose = true);
+    /// clear all
+    void clear(bool dispose = true);
+  private:
+    typedef hash_map<message::id_t,timer_id_t> mid2tid_t;
+    typedef mid2tid_t::const_iterator const_mid2tid_it_t;
+    typedef hash_map<timer_id_t,message::id_t> tid2mid_t;
+    typedef tid2mid_t::const_iterator const_tid2mid_it_t;
+    typedef hash_map<timer_id_t,TimerMsg*> tid2msg_t;
+    typedef tid2msg_t::const_iterator const_tid2msg_it_t;
+    mid2tid_t mid2tid;
+    tid2mid_t tid2mid;
+    tid2msg_t tid2msg;
+  } tmap; // end class TimerMap
+}; // end class TimerModule
+
+//@}
+
+} // end namespace protlib
+
+#endif
Index: /source/ariba/communication/modules/transport/protlib/tp.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/tp.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/tp.cpp	(revision 2378)
@@ -0,0 +1,104 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file tp.cpp
+/// generic interface for sending/receiving network messages via a transport protocol 
+/// ----------------------------------------------------------
+/// $Id: tp.cpp 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/tp.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+/** @ingroup transport
+ * This is the interface for sending network messages over a transport 
+ * protocol. You can receive messages through queues.
+ */
+
+#include "tp.h"
+#include "threadsafe_db.h"
+#include "logfile.h"
+
+namespace protlib {
+
+/** @addtogroup transport Transport Protocol
+ * @ingroup network
+ * @{
+ */
+
+  using namespace log;
+
+
+/***** class TP *****/
+
+/** Set ID of the underlying transport protocol, e.g. TCP, SCTP or UDP.
+ * Init is set false here, set to true in constructors of derived classes if
+ * initialization is done.
+ * If the maximum payload is greater than the maximum size of a network
+ * message, it is decreased.
+ */
+TP::TP(protocol_t p, const string& pname, const string& tpn, 
+       const unsigned short common_header_length, 
+       bool (*const getmsglength)(NetMsg& netmsg, uint32& msglen),
+       uint32 mp) 
+	: protocol(p), protoname(pname), tp_name(tpn), 
+	  common_header_length(common_header_length), 
+	  getmsglength(getmsglength),
+	  init(false), 
+	  max_payload((mp<NetMsg::max_size)?mp:(NetMsg::max_size))
+          {}
+
+/** TP destructor does nothing. */
+TP::~TP() { init = false; }
+
+/** Get the ID of the underlying transport protocol. */
+protocol_t TP::get_underlying_protocol() const { return protocol; }
+
+/** Get the name of the underlying transport protocol. */
+string TP::get_underlying_protocol_name() const { return protoname; }
+
+/** Get the name of this TP implementation. */
+string TP::get_tp_name() const { return tp_name; }
+
+uint32 TP::get_max_payload() const { return max_payload; }
+
+/* @param msg NetMsg to send
+ * @param addr destination address
+ * @return true if args are OK.
+ */
+
+void TP::check_send_args(const NetMsg& msg, const address& addr)
+		const {
+  if (!init) {
+    Log(ERROR_LOG,LOG_NORMAL, "TP", "TP::check_send_args: " << tp_name << " not initialized");
+    throw TPErrorArgsNotInit();
+  } // end if not init
+  
+  if ((msg.get_size()==0) || (msg.get_size()>max_payload)) {
+    Log(ERROR_LOG,LOG_NORMAL, "TP", "TP::check_send_args: NetMsg empty or too big. Size: " << msg.get_size() << ", " << tp_name << ", max_payload " << max_payload);
+    throw TPErrorPayload();
+  } // end if too big
+
+} // end check_send_args 
+
+
+//@}
+
+} // end namespace protlib
Index: /source/ariba/communication/modules/transport/protlib/tp.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/tp.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/tp.h	(revision 2378)
@@ -0,0 +1,257 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file tp.h
+/// generic interface for sending/receiving network messages via a transport protocol 
+/// ----------------------------------------------------------
+/// $Id: tp.h 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/tp.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+// ----------------------------------------*- mode: C++; -*--
+// tp.h - generic transport protocol interface module TP
+// ----------------------------------------------------------
+// $Id: tp.h 2872 2008-02-18 10:58:03Z bless $
+// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/tp.h $
+// ==========================================================
+//                      
+// (C)opyright, all rights reserved by
+// - Institute of Telematics, University of Karlsruhe (TH)
+// ==========================================================
+/** @ingroup transport
+ * This is the interface for sending network messages over a transport 
+ * protocol. You can receive messages through queues.
+ */
+
+#ifndef _PROTLIB__TP_H_
+#define _PROTLIB__TP_H_
+
+#include <string.h>
+
+#include "protlib_types.h"
+#include "messages.h"
+#include "network_message.h"
+#include "address.h"
+#include "tperror.h"
+
+namespace protlib {
+
+/** @ingroup transport Transport Protocol
+ * @ingroup network
+ * @{
+ */
+
+
+/// transport protocol base class
+/** This is the interface to all transport protocols.
+ * It is used by the signaling module to send network messages. 
+   // what kinds of messages?
+ * Received messages are delivered through FastQueues.
+ */
+class TP {
+public:
+	/// constructor
+	TP(protocol_t p, const string& pname, const string& tpn, 
+	   const unsigned short common_header_length, 
+	   bool (*const getmsglength)(NetMsg& netmsg, uint32& msglen),
+	   uint32 mp = (uint32)-1);
+
+	/// virtual destructor
+	virtual ~TP() = 0;
+
+	/// send a message, message is deleted after it has been sent
+        /// use_existing_connection indicates whether a new connection will be established
+        /// if required (true means that no connection will be set up if none exists yet)
+	virtual void send(NetMsg* msg, const address& addr, bool use_existing_connection= false) = 0;
+
+	/// terminates an existing signaling association/connection
+	virtual void terminate(const address& addr) = 0;
+
+	/// check send arguments
+	void check_send_args(const NetMsg& msg,
+		const address& addr) const;
+
+	/// get protocol ID
+	protocol_t get_underlying_protocol() const;
+
+	/// get protocol name
+	string get_underlying_protocol_name() const;
+
+	/// get TP name
+	string get_tp_name() const;
+
+	/// is it initialized?
+	bool is_init() const;
+
+	/// get maximum payload
+	uint32 get_max_payload() const;
+protected:
+
+	/// transport protocol ID
+	const protocol_t protocol;
+
+	/// transport protocol name
+	const string protoname;
+
+	/// TP subclass name
+	const string tp_name;
+
+        /// what is the length of the common header
+        const unsigned short common_header_length;
+
+        /// function pointer to a function that figures out the msg length in number of 4 byte words
+        /// it returns false if error occured (e.g., malformed header), result is returned in variable clen_words
+        bool (*const getmsglength) (NetMsg& m, uint32& clen_words);
+
+	/// init state
+	bool init;
+	const uint32 max_payload;
+}; // end class TP
+
+/// transport protcol message
+/** This message class is used to carry received network messages. */
+class TPMsg : public message {
+/***** inherited from message *****/
+public:
+	virtual void clear_pointers();
+/***** new *****/
+public:
+    /// constructor
+    TPMsg(NetMsg* m = NULL, address* peer = NULL, address* ownaddr = NULL, TPError* e = NULL, uint16 oif = 0);
+    /// destructor
+    virtual ~TPMsg();
+    /// get peer address
+    const address* get_peeraddress() const;
+    /// set own address
+    const address* get_ownaddress() const;
+    /// set peer address
+    address* set_peeraddress(address* a);
+    /// set own address
+    address* set_ownaddress(address* a);
+    /// get network message
+    NetMsg* get_message() const;
+    /// set network message
+    NetMsg* set_message(NetMsg* m);
+    /// get TP error
+    TPError* get_error() const;
+    /// set TP error
+    TPError* set_error(TPError* e);
+    /// set Outgoing Interface
+    void set_oif(uint16 iface) { oif=iface; }
+    /// get Outgoing Interface
+    uint16 get_oif() { return oif; }
+
+private:
+    /// peer address
+    address* peeraddr;
+    /// own address
+    address* ownaddr;
+    /// network message
+    NetMsg* msg;
+    TPError* err;
+    /// outgoing interface index
+    uint16 oif;
+}; // end class TPMsg
+
+inline
+bool TP::is_init() const { return init; }
+
+/***** class TPMsg *****/
+
+/***** inherited from message *****/
+
+/** Clear all pointer fields. */
+inline
+void TPMsg::clear_pointers() {
+	peeraddr = NULL;
+	ownaddr = NULL;
+	msg = NULL;
+	err = NULL;
+} // end clear
+
+/***** new in NetMsg *****/
+
+/** Initialize and set message type and source to 'transport'. */
+inline
+TPMsg::TPMsg(NetMsg* m, address* p, address* o, TPError* e, uint16 oif) 
+  : message(type_transport,qaddr_transport),
+    peeraddr(p),
+    ownaddr(o),
+    msg(m),
+    err(e),
+    oif(oif)
+{} // end constructor TPMsg
+
+/** Dispose NetMsg, address, err and then delete TPMsg. */
+inline
+TPMsg::~TPMsg() {
+	if (msg) delete msg;
+	if (peeraddr) delete peeraddr;
+	if (ownaddr) delete ownaddr;
+	if (err) delete err;
+} // end destructor TPMsg
+
+inline
+const address* TPMsg::get_peeraddress() const { return peeraddr; }
+
+inline
+const address* TPMsg::get_ownaddress() const { return ownaddr; }
+
+inline
+address* TPMsg::set_peeraddress(address* peer) {
+  register address* oa = peeraddr;
+  peeraddr = peer;
+  return oa;
+} // end set_address
+
+inline
+address* TPMsg::set_ownaddress(address* o) {
+  register address* oa = ownaddr;
+  ownaddr = o;
+  return oa;
+} // end set_address
+
+inline
+NetMsg* TPMsg::get_message() const { return msg; }
+
+inline
+NetMsg* TPMsg::set_message(NetMsg* m) {
+	register NetMsg* omsg = msg;
+	msg = m;
+	return omsg;
+} // end set_message
+
+inline
+TPError* TPMsg::get_error() const { return err; }
+
+inline
+TPError* TPMsg::set_error(TPError* e) {
+	register TPError* oe = err;
+	err = e;
+	return oe;
+} // end set_error
+
+
+//@}
+
+} // end namespace protlib
+
+#endif
Index: /source/ariba/communication/modules/transport/protlib/tp_over_tcp.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/tp_over_tcp.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/tp_over_tcp.cpp	(revision 2378)
@@ -0,0 +1,1754 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file tp_over_tcp.cpp
+/// TCP-based transport module (includes framing support)
+/// ----------------------------------------------------------
+/// $Id: tp_over_tcp.cpp 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/tp_over_tcp.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+ 
+extern "C"
+{
+  //#define _SOCKADDR_LEN    /* use BSD 4.4 sockets */
+#include <unistd.h>      /* gethostname */
+#include <sys/types.h>   /* network socket interface */
+#include <netinet/in.h>  /* network socket interface */
+#include <netinet/tcp.h> /* for TCP Socket Option */
+#include <sys/socket.h>
+#include <arpa/inet.h>   /* inet_addr */
+
+#include <fcntl.h>
+#include <sys/poll.h>
+}
+
+#include <iostream>
+#include <errno.h>
+#include <string>
+#include <sstream>
+
+#include "tp_over_tcp.h"
+#include "threadsafe_db.h"
+#include "cleanuphandler.h"
+#include "setuid.h"
+#include "queuemanager.h"
+#include "logfile.h"
+
+#include <set>
+
+#define TCP_SUCCESS 0
+#define TCP_SEND_FAILURE 1
+
+const unsigned int max_listen_queue_size= 10;
+
+namespace protlib {
+
+using namespace log;
+
+/** @defgroup tptcp TP over TCP
+ * @ingroup network
+ * @{
+ */
+
+char in6_addrstr[INET6_ADDRSTRLEN+1];
+
+
+/******* class TPoverTCP *******/
+
+
+/** get_connection_to() checks for already existing connections. 
+ *  If a connection exists, it returns "AssocData" 
+ *  and saves it in "connmap" for further use
+ *  If no connection exists, a new connection to "addr"
+ *  is created.
+ */
+AssocData* 
+TPoverTCP::get_connection_to(const appladdress& addr)
+{
+  // get timeout
+  struct timespec ts;
+  get_time_of_day(ts);
+  ts.tv_nsec+= tpparam.sleep_time * 1000000L;
+  if (ts.tv_nsec>=1000000000L)
+  {
+    ts.tv_sec += ts.tv_nsec / 1000000000L;
+    ts.tv_nsec= ts.tv_nsec % 1000000000L;
+  }
+
+  // create a new AssocData pointer, initialize it to NULL
+  AssocData* assoc= NULL;
+  int new_socket;
+  // loop until timeout is exceeded: TODO: check applicability of loop
+  do 
+  {
+    // check for existing connections to addr
+    // start critical section
+    lock(); // install_cleanup_thread_lock(TPoverTCP, this);
+    assoc= connmap.lookup(addr);
+    // end critical section
+    unlock(); // uninstall_cleanup(1);
+    if (assoc) 
+    {
+      // If not shut down then use it, else abort, wait and check again.
+      if (!assoc->shutdown) 
+      {
+	return assoc;
+      }
+      else
+      {
+	// TODO: connection is already in shutdown mode. What now?
+	ERRCLog(tpparam.name,"socket exists, but is already in mode shutdown");
+
+	return 0;
+      }  
+    } //end __if (assoc)__
+    else 
+    {
+      Log(DEBUG_LOG,LOG_UNIMP,tpparam.name,"No existing connection to " 
+	  << addr.get_ip_str() << " port #" << addr.get_port() << " found, creating a new one.");
+    }
+
+    // no connection found, create a new one
+    new_socket = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
+    if (new_socket == -1)
+    {
+      ERRCLog(tpparam.name,"Couldn't create a new socket: " << strerror(errno));
+
+      return 0;
+    }
+
+    // Disable Nagle Algorithm, set (TCP_NODELAY)
+    int nodelayflag= 1;
+    int status= setsockopt(new_socket,
+			   IPPROTO_TCP,
+			   TCP_NODELAY,
+			   &nodelayflag,
+			   sizeof(nodelayflag));
+    if (status)
+    {
+        ERRLog(tpparam.name, "Could not set socket option TCP_NODELAY:" << strerror(errno));
+    }
+    
+    // Reuse ports, even if they are busy
+    int socketreuseflag= 1;
+    status= setsockopt(new_socket,
+			   SOL_SOCKET,
+			   SO_REUSEADDR,
+			   (const char *) &socketreuseflag,
+			   sizeof(socketreuseflag));
+    if (status)
+    {
+        ERRLog(tpparam.name, "Could not set socket option SO_REUSEADDR:" << strerror(errno));
+    }
+
+    struct sockaddr_in6 dest_address;
+    dest_address.sin6_flowinfo= 0;
+    dest_address.sin6_scope_id= 0;
+    addr.get_sockaddr(dest_address);
+      
+    // connect the socket to the destination address
+    int connect_status = connect(new_socket,
+				 reinterpret_cast<const struct sockaddr*>(&dest_address),
+				 sizeof(dest_address));
+
+    // connects to the listening_port of the peer's masterthread    
+    if (connect_status != 0)
+    {
+      ERRLog(tpparam.name,"Connect to " << addr.get_ip_str() << " port #" << addr.get_port() 
+	  << " failed: [" << color[red] << strerror(errno) << color[off] << "]");
+      
+      return 0; // error: couldn't connect
+    }
+
+    
+    struct sockaddr_in6 own_address;
+    socklen_t own_address_len= sizeof(own_address);
+    getsockname(new_socket, reinterpret_cast<struct sockaddr*>(&own_address), &own_address_len);
+
+    
+
+    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name,">>--Connect-->> to " << addr.get_ip_str() << " port #" << addr.get_port() 
+	<< " from " << inet_ntop(AF_INET6,&own_address.sin6_addr,in6_addrstr,INET6_ADDRSTRLEN) 
+	<< " port #" << ntohs(own_address.sin6_port));
+    
+   
+
+   
+    // create new AssocData record (will copy addr)
+    assoc = new(nothrow) AssocData(new_socket, addr, appladdress(own_address,IPPROTO_TCP));
+
+    // if assoc could be successfully created, insert it into ConnectionMap
+    if (assoc) 
+    {
+      bool insert_success= false;
+      // start critical section
+      lock(); // install_cleanup_thread_lock(TPoverTCP, this);
+      // insert AssocData into connection map
+      insert_success= connmap.insert(assoc);
+      // end critical section
+      unlock(); // uninstall_cleanup(1);
+
+      if (insert_success == true) 
+      {
+#ifdef _DEBUG
+	Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, "Connected to " << addr.get_ip_str() << ", port #" << addr.get_port()
+	    << " via socket " << new_socket);
+
+		
+#endif
+
+	// notify master thread to start a receiver thread (i.e. send selfmessage)
+	TPoverTCPMsg* newmsg= new(nothrow)TPoverTCPMsg(assoc, tpparam.source, TPoverTCPMsg::start);
+	if (newmsg)
+	{
+	  newmsg->send_to(tpparam.source);
+	  return assoc;
+	}
+	else
+	  ERRCLog(tpparam.name,"get_connection_to: could not get memory for internal msg");
+      } 
+      else 
+      {
+	// delete data and abort
+	ERRCLog(tpparam.name, "Cannot insert AssocData for socket " << new_socket << ", "<< addr.get_ip_str()
+	    <<", port #" << addr.get_port() << " into connection map, aborting connection");
+		
+	// abort connection, delete its AssocData
+	close (new_socket);
+	if (assoc) 
+	{ 
+	  delete assoc; 
+	  assoc= 0;
+	}
+	return assoc;
+      } // end else connmap.insert			
+      
+    } // end "if (assoc)"
+  } 
+  while (wait_cond(ts)!=ETIMEDOUT);
+
+  return assoc;
+} //end get_connection_to
+
+
+/** terminates a signaling association/connection
+ *  - if no connection exists, generate a warning
+ *  - otherwise: generate internal msg to related receiver thread
+ */
+void
+TPoverTCP::terminate(const address& in_addr)
+{
+#ifndef _NO_LOGGING
+ const char *const thisproc="terminate()   - ";
+#endif
+
+ appladdress* addr = NULL;
+ addr = dynamic_cast<appladdress*>(in_addr.copy());
+
+ if (!addr) return;
+
+  // Create a new AssocData-pointer 
+  AssocData* assoc = NULL;
+
+  // check for existing connections to addr
+
+  // start critical section:
+  // please note if receiver_thread terminated already, the assoc data is not
+  // available anymore therefore we need a lock around cleanup_receiver_thread()
+
+  lock(); // install_cleanup_thread_lock(TPoverTCP, this);
+  assoc= connmap.lookup(*addr);
+  if (assoc) 
+  {
+    EVLog(tpparam.name,thisproc<<"got request to shutdown connection for peer " << addr);
+    // If not shut down then use it, else abort, wait and check again.
+    if (!assoc->shutdown) 
+    {
+      if (assoc->socketfd)
+      {
+	// disallow sending
+	if (shutdown(assoc->socketfd,SHUT_WR))
+	{
+	  ERRLog(tpparam.name,thisproc<<"shutdown (write) on socket for peer " << addr << " returned error:" << strerror(errno));
+	}
+	else
+        {
+	  EVLog(tpparam.name,thisproc<<"initiated closing of connection for peer " << addr << ". Shutdown (write) on socket "<< assoc->socketfd );	  
+	}
+      }
+      assoc->shutdown= true;
+    }
+    else
+      EVLog(tpparam.name,thisproc<<"connection for peer " << addr << " is already in mode shutdown");
+      
+  }
+  else
+    WLog(tpparam.name,thisproc<<"could not find a connection for peer " << *addr);
+
+  stop_receiver_thread(assoc);
+
+  // end critical section
+  unlock(); // uninstall_cleanup(1);
+
+  if (addr) delete addr;
+}
+
+
+/** generates and internal TPoverTCP message to send a NetMsg to the network
+ *  - it is necessary to let a thread do this, because the caller
+ *     may get blocked if the connect() or send() call hangs for a while
+ *  - the sending thread will call TPoverTCP::tcpsend()
+ *  - if no connection exists, creates a new one (unless use_existing_connection is true)
+ *  @note the netmsg is deleted by the send() method when it is not used anymore
+ */
+void
+TPoverTCP::send(NetMsg* netmsg, const address& in_addr, bool use_existing_connection)
+{
+  if (netmsg == NULL) {
+    ERRCLog(tpparam.name,"send() - called without valid NetMsg buffer (NULL)");
+    return;
+  }
+
+  appladdress* addr = NULL;
+  addr= dynamic_cast<appladdress*>(in_addr.copy());
+    
+  if (!addr)
+  {
+    ERRCLog(tpparam.name,"send() - given destination address is not of expected type (appladdress), has type " << (int) in_addr.get_type());
+    return;
+  } 
+
+  // lock due to sendermap access
+  lock();
+    
+  // check for existing sender thread
+  sender_thread_queuemap_t::const_iterator it= senderthread_queuemap.find(*addr);
+    
+  FastQueue* destqueue= 0;
+
+  if (it == senderthread_queuemap.end())
+  { // no sender thread found so far
+
+    // if we already have an existing connection it is save to create a sender thread
+    // since get_connection_to() will not be invoked, so an existing connection will
+    // be used
+    const AssocData* assoc = connmap.lookup(*addr);
+
+    //DLog(tpparam.name,"send() - use_existing_connection:" << (use_existing_connection ? "true" : "false") << " assoc:" << assoc);
+
+    if (use_existing_connection==false || (assoc && assoc->shutdown==false && assoc->socketfd>0))
+    { // it is allowed to create a new connection for this thread
+      // create a new queue for sender thread
+      FastQueue* sender_thread_queue= new FastQueue;
+      create_new_sender_thread(sender_thread_queue);
+      // remember queue for later use
+      
+      //pair<sender_thread_queuemap_t::iterator, bool> tmpinsiterator=
+      senderthread_queuemap.insert( pair<appladdress,FastQueue*> (*addr,sender_thread_queue) );
+      
+      destqueue= sender_thread_queue;
+    }
+  }
+  else
+  { // we have a sender thread, use stored queue from map
+    destqueue= it->second; 
+  }
+    
+  unlock();
+    
+  // send a send_data message to it (if we have a destination queue)
+  if (destqueue)
+  {
+    // both parameters will be freed after message was sent!
+    
+    TPoverTCPMsg* internalmsg= new TPoverTCPMsg(netmsg,new appladdress(*addr));
+    if (internalmsg)
+    {
+      // send the internal message to the sender thread queue
+      internalmsg->send(tpparam.source,destqueue);
+    }
+  }
+  else
+  {
+    if (!use_existing_connection)
+      WLog(tpparam.name,"send() - found entry for address, but no active sender thread available for peer addr:" << *addr << " - dropping data");
+    else
+    {
+      DLog(tpparam.name,"no active sender thread found for peer " << *addr << " - but policy forbids to set up a new connection, will drop data");
+
+    }
+    // cannot send data, so we must drop it
+    delete netmsg;
+  }
+  
+  if (addr) delete addr;
+}
+
+/** sends a NetMsg to the network.
+ *
+ * @param netmsg message to send
+ * @param addr   transport endpoint address
+ *
+ * @note   if no connection exists, creates a new one 
+ * @note   both parameters are deleted after the message was sent
+ */
+void
+TPoverTCP::tcpsend(NetMsg* netmsg, appladdress* addr)
+{                        
+#ifndef _NO_LOGGING
+  const char *const thisproc="sender   - ";
+#endif
+
+  // set result initially to success, set it to failure
+  // in places where these failures occur
+  int result = TCP_SUCCESS;
+  int saved_errno= 0;
+  int ret= 0;
+
+  // Create a new AssocData-pointer 
+  AssocData* assoc = NULL;
+  
+  // tp.cpp checks for initialisation of tp and correctness of
+  // msgsize, protocol and ip,
+  // throws an error if something is not right
+  if (addr) {
+    addr->convert_to_ipv6();
+    check_send_args(*netmsg,*addr);
+  } 
+  else 
+  {
+    ERRCLog(tpparam.name, thisproc << "address pointer is NULL");
+    result= TCP_SEND_FAILURE;
+
+    delete netmsg;
+    delete addr;
+
+    throw TPErrorInternal();
+  }
+
+
+  // check for existing connections, 
+  // if a connection exists, return its AssocData 
+  // and save it in assoc for further use
+  // if no connection exists, create a new one (in get_connection_to()).
+  // Connection is inserted into connection map that must be done
+  // with exclusive access
+  assoc= get_connection_to(*addr);
+
+  if (assoc==NULL || assoc->socketfd<=0)
+  {
+    ERRCLog(tpparam.name, color[red] << thisproc << "no valid assoc/socket data - dropping packet");
+
+    delete netmsg;
+    delete addr;
+    return;
+  }
+
+  if (assoc->shutdown)
+  {
+    Log(WARNING_LOG, LOG_ALERT, tpparam.name, thisproc << "should send message although connection already half closed");
+    delete netmsg;
+    delete addr;
+
+    throw TPErrorSendFailed();
+  }
+
+  uint32 msgsize= netmsg->get_size();
+#ifdef DEBUG_HARD
+  cerr << thisproc << "message size=" << netmsg->get_size() << endl;
+#endif
+
+  const uint32 retry_send_max = 3;
+  uint32 retry_count = 0;
+  // send all the data contained in netmsg to the socket
+  // which belongs to the address "addr"
+  for (uint32 bytes_sent= 0;
+       bytes_sent < msgsize;
+       bytes_sent+= ret)
+  {
+
+#ifdef _DEBUG_HARD
+    for (uint32 i=0;i<msgsize;i++)
+    {
+      cout << "send_buf: " << i << " : "; 
+      if ( isalnum(*(netmsg->get_buffer()+i)) )
+	cout << "'" << *(netmsg->get_buffer()+i) << "' (0x" << hex << (unsigned short) *(netmsg->get_buffer()+i) << dec << ")" ;
+      else
+	cout << "0x" << hex << (unsigned short) *(netmsg->get_buffer()+i) << dec;
+      cout << endl;
+    }
+
+    cout << endl;
+    cout << "bytes_sent: " << bytes_sent << endl;
+    cout << "Message size: " <<  msgsize << endl;
+    cout << "Send-Socket: " << assoc->socketfd << endl;
+    cout << "pointer-Offset. " << netmsg->get_pos() << endl;
+    cout << "vor send " << endl;
+#endif
+
+    retry_count= 0;
+    do 
+    {
+      // socket send
+      ret= ::send(assoc->socketfd, 
+		  netmsg->get_buffer() + bytes_sent,  
+		  msgsize - bytes_sent, 
+		  MSG_NOSIGNAL);
+      
+      // send_buf + bytes_sent
+
+      // Deal with temporary internal errors like EAGAIN, resource temporary unavailable etc.
+      // retry sending
+      if (ret < 0)
+      { // internal error during send occured
+	saved_errno= errno;
+	switch(saved_errno)
+	{
+	  case EAGAIN:  // same as EWOULDBLOCK
+          case EINTR:   // man page says: A signal occurred before any data was transmitted.
+	  case ENOBUFS: //  The output queue for a network interface was full.
+	    retry_count++;
+	    ERRLog(tpparam.name,"Temporary failure while calling send(): " << strerror(saved_errno) << ", errno: " << saved_errno 
+		   << " - retry sending, retry #" << retry_count);
+	    // pace down a little bit, sleep for a while
+	    sleep(1);
+	    break;
+
+	    // everything else should not lead to repetition 
+	  default:
+	    retry_count= retry_send_max;
+	    break;
+	} // end switch
+      } // endif
+      else // leave while
+	break;
+    } 
+    while(retry_count < retry_send_max);
+
+    if (ret < 0) 
+    { // unrecoverable error occured
+      
+      result= TCP_SEND_FAILURE;
+      break;
+    } // end if (ret < 0)
+    else
+    {
+      if (debug_pdu)
+      {
+	ostringstream hexdump;
+	netmsg->hexdump(hexdump,netmsg->get_buffer(),bytes_sent);
+	DLog(tpparam.name,"PDU debugging enabled - Sent:" << hexdump.str());
+      }
+    }
+
+    // continue with send next data block in next for() iteration
+  } // end for
+
+  // *** note: netmsg is deleted here ***
+  delete netmsg;
+  
+  // Throwing an exception within a critical section does not 
+  // unlock the mutex.
+
+  if (result != TCP_SUCCESS)
+  {
+    ERRLog(tpparam.name, thisproc << "TCP error, returns " << ret << ", error : " << strerror(errno));
+    delete addr;
+
+    throw TPErrorSendFailed(saved_errno);
+    
+  }
+  else
+    EVLog(tpparam.name, thisproc << ">>----Sent---->> message (" << msgsize << " bytes) using socket " << assoc->socketfd  << " to " << *addr);
+
+  if (!assoc) {
+    // no connection
+    
+    ERRLog(tpparam.name, thisproc << "cannot get connection to " << addr->get_ip_str() 
+	<< ", port #" << addr->get_port());
+
+    delete addr;
+
+    throw TPErrorUnreachable(); // should be no assoc found
+  } // end "if (!assoc)"
+  
+  // *** delete address ***
+  delete addr;
+}
+  
+/* this thread waits for an internal message that either:
+ * - requests transmission of a packet
+ * - requests to stop this thread
+ * @param argp points to the thread queue for internal messages
+ */
+void 
+TPoverTCP::sender_thread(void *argp)
+{
+#ifndef _NO_LOGGING
+  const char *const methodname="senderthread - ";
+#endif
+
+  message* internal_thread_msg = NULL;
+
+  EVLog(tpparam.name, methodname << "starting as thread <" << pthread_self() << ">");
+
+  FastQueue* fq= reinterpret_cast<FastQueue*>(argp);
+  if (!fq)
+  {
+    ERRLog(tpparam.name, methodname << "thread <" << pthread_self() << "> no valid pointer to msg queue. Stop.");
+    return;
+  }
+
+  bool terminate= false;
+  TPoverTCPMsg* internalmsg= 0;
+  while (terminate==false && (internal_thread_msg= fq->dequeue()) != 0 )
+  {
+    internalmsg= dynamic_cast<TPoverTCPMsg*>(internal_thread_msg);
+    
+    if (internalmsg == 0)
+    {
+      ERRLog(tpparam.name, methodname << "received not an TPoverTCPMsg but a" << internal_thread_msg->get_type_name());      
+    }
+    else
+    if (internalmsg->get_msgtype() == TPoverTCPMsg::send_data)
+    {
+      // create a connection if none exists and send the netmsg
+      if (internalmsg->get_netmsg() && internalmsg->get_appladdr())
+      {
+	try 
+	{
+	  tcpsend(internalmsg->get_netmsg(),internalmsg->get_appladdr());
+	} // end try
+	catch(TPErrorSendFailed& err)
+	{
+	  ERRLog(tpparam.name, methodname << "TCP send call failed - " << err.what() 
+		 << " cause: (" << err.get_reason() << ") " << strerror(err.get_reason()) );
+	} // end catch
+	catch(TPError& err)
+	{
+	  ERRLog(tpparam.name, methodname << "TCP send call failed - reason: " << err.what());
+	} // end catch
+	catch(...)
+	{
+	  ERRLog(tpparam.name, methodname << "TCP send call failed - unknown exception");
+	}
+      }
+      else
+      {
+	ERRLog(tpparam.name, methodname << "problem with passed arguments references, they point to 0");
+      } 
+    }
+    else
+    if (internalmsg->get_msgtype() == TPoverTCPMsg::stop)
+    {
+      terminate= true;
+    }  
+  } // end while
+  
+  EVLog(tpparam.name, methodname << "<" << pthread_self() << "> terminated connection.");
+}
+
+
+/** receiver thread listens at a TCP socket for incoming PDUs 
+ *  and passes complete PDUs to the coordinator. Incomplete
+ *  PDUs due to aborted connections or buffer overflows are discarded.
+ *  @param argp - assoc data and flags sig_terminate and terminated
+ *  
+ *  @note this is a static member function, so you cannot use class variables
+ */
+void 
+TPoverTCP::receiver_thread(void *argp)
+{
+#ifndef _NO_LOGGING
+  const char *const methodname="receiver - ";
+#endif
+
+  receiver_thread_arg_t *receiver_thread_argp= static_cast<receiver_thread_arg_t *>(argp);
+  const appladdress* peer_addr = NULL;
+  const appladdress* own_addr = NULL;
+  uint32 bytes_received = 0;
+  TPMsg* tpmsg= NULL;
+  
+  // argument parsing - start
+  if (receiver_thread_argp == 0)
+  {
+    ERRCLog(tpparam.name, methodname << "No arguments given at start of receiver thread <" << pthread_self() << ">, exiting.");
+
+    return;
+  }
+  else
+  {
+    // change status to running, i.e., not terminated
+    receiver_thread_argp->terminated= false;
+
+#ifdef _DEBUG
+    DLog(tpparam.name, methodname << "New receiver thread <" << pthread_self() << "> started. ");
+#endif
+  }
+
+  int conn_socket= 0;
+  if (receiver_thread_argp->peer_assoc)
+  {
+    // get socket descriptor from arg
+    conn_socket = receiver_thread_argp->peer_assoc->socketfd;
+    // get pointer to peer address of socket (source/sender address of peer) from arg
+    peer_addr= &receiver_thread_argp->peer_assoc->peer;
+    own_addr= &receiver_thread_argp->peer_assoc->ownaddr;
+  }
+  else
+  {
+    ERRCLog(tpparam.name, methodname << "No peer assoc available - pointer is NULL");
+    
+    return;
+  }
+
+  if (peer_addr == 0)
+  {
+    ERRCLog(tpparam.name, methodname << "No peer address available for socket " << conn_socket << ", exiting.");
+    
+    return;
+  }
+  // argument parsing - end
+#ifdef _DEBUG
+  Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname <<
+      "Preparing to wait for data at socket " 
+      << conn_socket << " from " << receiver_thread_argp->peer_assoc->peer);
+#endif
+
+  int ret= 0;
+  uint32 msgcontentlength= 0;
+  bool msgcontentlength_known= false;
+  bool pdu_complete= false; // when to terminate inner loop
+
+  /* maybe use this to create a new pdu, 
+    /// constructor
+    contextlistpdu(type_t t, subtype_t st, uint32 fc, uint32 numobj = 0);
+  */ 
+
+  // activate O_NON_BLOCK  for recv on socket conn_socket
+  // CAVEAT: this also implies non-blocking send()!
+  //fcntl(conn_socket,F_SETFL, O_NONBLOCK);
+    
+  // set options for polling
+  const unsigned int number_poll_sockets= 1; 
+  struct pollfd poll_fd;
+  // have to set structure before poll call
+  poll_fd.fd = conn_socket;
+  poll_fd.events = POLLIN | POLLPRI; 
+  poll_fd.revents = 0;
+
+  int poll_status;
+  bool recv_error= false;
+
+  NetMsg* netmsg= 0;
+  NetMsg* remainbuf= 0;
+  size_t buffer_bytes_left= 0;
+  size_t trailingbytes= 0;
+  bool skiprecv= false;
+  // loop until we receive a terminate signal (read-only var for this thread) 
+  // or get an error from socket read
+  while( receiver_thread_argp->sig_terminate == false )
+  {
+    // Read next PDU from socket or process trailing bytes in remainbuf
+    ret= 0;
+    msgcontentlength= 0;
+    msgcontentlength_known= false;
+    pdu_complete= false;
+    netmsg= 0;
+
+    // there are trailing bytes left from the last receive call
+    if (remainbuf != 0)
+    {
+      netmsg= remainbuf;
+      remainbuf= 0;
+      buffer_bytes_left= netmsg->get_size()-trailingbytes;
+      bytes_received= trailingbytes;
+      trailingbytes= 0;
+      skiprecv= true;
+    }
+    else // no trailing bytes, create a new buffer
+    if ( (netmsg= new NetMsg(NetMsg::max_size)) != 0 )
+    {
+      buffer_bytes_left= netmsg->get_size();
+      bytes_received= 0;
+      skiprecv= false;
+    }
+    else
+    { // buffer allocation failed
+      bytes_received= 0;
+      buffer_bytes_left= 0;
+      recv_error= true;
+    }
+    
+    // loops until PDU is complete
+    // >>>>>>>>>>>>>>>>>>>>>>>>>>> while >>>>>>>>>>>>>>>>>>>>>>>>
+    while (!pdu_complete && 
+	   !recv_error && 
+	   !receiver_thread_argp->sig_terminate)
+    {
+      if (!skiprecv)
+      {
+	// read from TCP socket or return after sleep_time
+	poll_status= poll(&poll_fd, number_poll_sockets, tpparam.sleep_time);
+	
+	if (receiver_thread_argp->sig_terminate)
+	{
+	  Log(EVENT_LOG,LOG_UNIMP,tpparam.name,methodname << "Thread <" << pthread_self() << "> found terminate signal after poll");
+	  // disallow sending
+	  AssocData* myassoc=const_cast<AssocData *>(receiver_thread_argp->peer_assoc);
+	  if (myassoc->shutdown == false)
+	  {
+	    myassoc->shutdown= true;
+	    if (shutdown(myassoc->socketfd,SHUT_WR))
+	    {
+	      if ( errno != ENOTCONN )
+		Log(ERROR_LOG,LOG_UNIMP,tpparam.name,methodname <<"shutdown (write) on socket " << conn_socket << " returned error:" << strerror(errno));
+	    }
+	  }
+	  // try to read do a last read from the TCP socket or return after sleep_time
+	  if (poll_status == 0)
+	  {
+	    poll_status= poll(&poll_fd, number_poll_sockets, tpparam.sleep_time);
+	  }
+	}
+
+	if (poll_fd.revents & POLLERR) // Error condition
+	{
+	  if (errno == 0 || errno == EINTR)
+	  {
+	    EVLog(tpparam.name, methodname << "poll(): " << strerror(errno));
+	  }
+	  else
+	  {
+	    ERRCLog(tpparam.name, methodname << "Poll indicates error: " << strerror(errno));
+	    recv_error= true;
+	  }
+	}
+	
+	if (poll_fd.revents & POLLHUP) // Hung up 
+	{
+	  Log(EVENT_LOG,LOG_CRIT, tpparam.name, methodname << "Poll hung up");
+	  recv_error= true;
+	}
+	
+	if (poll_fd.revents & POLLNVAL) // Invalid request: fd not open
+	{
+	  EVLog(tpparam.name, methodname << "Poll Invalid request: fd not open");
+	  recv_error= true;
+	}
+	
+	// check status (return value) of poll call
+	switch (poll_status)
+	{
+	  case -1:
+	    if (errno == 0 || errno == EINTR)
+	    {
+	      EVLog(tpparam.name, methodname << "Poll status: " << strerror(errno));
+	    }
+	    else
+	    {
+	      ERRCLog(tpparam.name, methodname << "Poll status indicates error: " << strerror(errno) << "- aborting");
+	      recv_error= true;
+	    }
+	    
+	    continue; // next while iteration
+	    break;
+	    
+	  case 0:
+#ifdef DEBUG_HARD
+	    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname << "Poll timed out after " << tpparam.sleep_time << " ms.");
+#endif
+	    continue; // next while iteration
+	    break;
+	    
+	  default:
+#ifdef DEBUG_HARD
+	    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname << "Poll: " << poll_status << " event(s) ocurred, of type " << poll_fd.revents);
+#endif
+	    break;
+	} // end switch
+
+
+	/// receive data from socket buffer (recv will not block)
+	ret = recv(conn_socket, 
+		   netmsg->get_buffer() + bytes_received, 
+		   buffer_bytes_left, 
+		   MSG_DONTWAIT);
+
+	if ( ret < 0 )
+	{
+	  if (errno!=EAGAIN && errno!=EWOULDBLOCK)
+	  {
+	    ERRCLog(tpparam.name, methodname << "Receive at socket " << conn_socket << " failed, error: " << strerror(errno));
+	    recv_error= true;
+	    continue;
+	  }
+	  else
+	  { // errno==EAGAIN || errno==EWOULDBLOCK
+	    // just nothing to read from socket, continue w/ next poll
+	    continue;
+	  }
+	}
+	else
+	{
+	  if (ret == 0)
+	  {
+	    // this means that EOF is reached, 
+	    // other side has closed connection
+	    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname << "Other side (" << *peer_addr << ") closed connection for socket " << conn_socket);
+	    // disallow sending
+	    AssocData* myassoc=const_cast<AssocData *>(receiver_thread_argp->peer_assoc);
+	    if (myassoc->shutdown == false)
+	    {
+	      myassoc->shutdown= true;
+	      if (shutdown(myassoc->socketfd,SHUT_WR))
+	      {
+		if ( errno != ENOTCONN )
+		  Log(ERROR_LOG,LOG_UNIMP,tpparam.name, methodname << "shutdown (write) on socket " << conn_socket << " returned error:" << strerror(errno));
+	      }
+	    }
+	    // not a real error, but we must quit the receive loop
+	    recv_error= true;
+	  }
+	  else
+	  {
+
+	    Log(EVENT_LOG,LOG_UNIMP, tpparam.name, methodname << "<<--Received--<< packet (" << ret << " bytes) at socket " << conn_socket << " from " << *peer_addr);
+	    // track number of received bytes
+	    bytes_received+= ret;
+	    buffer_bytes_left-= ret;
+	  }
+	}
+      } // end if do not skip recv() statement      
+
+      if (buffer_bytes_left < 0) ///< buffer space exhausted now
+      {
+	recv_error= true;
+        Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "during receive buffer space exhausted");
+      }
+
+      if (!msgcontentlength_known) ///< common header not parsed
+      {
+	// enough bytes read to parse common header?
+	if (bytes_received >= common_header_length)
+	{
+	  // get message content length in number of bytes
+	  if (getmsglength(*netmsg, msgcontentlength))
+	    msgcontentlength_known= true;
+	  else
+	  {
+	    ERRCLog(tpparam.name, methodname << "Not a valid protocol header - discarding received packet. received size " << msgcontentlength);
+
+	    ostringstream hexdumpstr;
+	    netmsg->hexdump(hexdumpstr,netmsg->get_buffer(),bytes_received);
+	    DLog(tpparam.name,"dumping received bytes:" << hexdumpstr.str());
+
+	    // reset all counters
+	    msgcontentlength= 0;
+	    msgcontentlength_known= false;
+	    bytes_received= 0;
+	    pdu_complete= false;
+	    continue;
+	  }
+	}
+      } // endif common header not parsed
+
+      // check whether we have read the whole Protocol PDU
+      DLog(tpparam.name, "bytes_received-common_header_length=" << bytes_received-common_header_length << " msgcontentlength: " << msgcontentlength);
+      if (msgcontentlength_known)
+      {
+	if (bytes_received-common_header_length >= msgcontentlength )
+	{
+	  pdu_complete= true;
+	  // truncate buffer exactly at common_header_length+msgcontentlength==PDU size, trailing stuff is handled separately
+	  netmsg->truncate(common_header_length+msgcontentlength);
+
+	  // trailing bytes are copied into new buffer
+	  if (bytes_received-common_header_length > msgcontentlength)
+	  {
+	    WLog(tpparam.name,"trailing bytes - received more bytes ("<<bytes_received<<") than expected for PDU (" << common_header_length+msgcontentlength << ")");
+	    remainbuf= new NetMsg(NetMsg::max_size);
+	    trailingbytes= (bytes_received-common_header_length) - msgcontentlength;
+	    bytes_received= common_header_length+msgcontentlength;
+	    memcpy(remainbuf->get_buffer(),netmsg->get_buffer()+common_header_length+msgcontentlength, trailingbytes);
+	  }
+	}
+	else
+	{ // not enough bytes in the buffer must continue to read from network
+	  skiprecv= false;
+	}
+      } // endif msgcontentlength_known
+    } // end while (!pdu_complete && !recv_error && !signalled for termination)
+    // >>>>>>>>>>>>>>>>>>>>>>>>>>> while >>>>>>>>>>>>>>>>>>>>>>>>
+
+    // if other side closed the connection, we should still be able to deliver the remaining data
+    if (ret == 0)
+    {
+      recv_error= false;
+    }
+
+    // deliver only complete PDUs to signaling module
+    if (!recv_error && pdu_complete)
+    {
+      // create TPMsg and send it to the signaling thread
+      tpmsg = new(nothrow) TPMsg(netmsg, peer_addr->copy(), own_addr->copy());
+      if (tpmsg)
+      {
+	DLog(tpparam.name, methodname << "receipt of PDU now complete, sending msg#" << tpmsg->get_id()
+	     << " to module " <<  message::get_qaddr_name(tpparam.dest));
+      }
+
+      debug_pdu=false;
+
+      if (debug_pdu)
+      {
+	ostringstream hexdump;
+	netmsg->hexdump(hexdump,netmsg->get_buffer(),bytes_received);
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name,"PDU debugging enabled - Received:" << hexdump.str());
+      }
+
+      // send the message if it was successfully created
+      // bool message::send_to(qaddr_t dest, bool exp = false);
+      if (!tpmsg
+	  || (!tpmsg->get_peeraddress())
+	  || (!tpmsg->send(message::qaddr_tp_over_tcp, tpparam.dest))) 
+      {
+	Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "Cannot allocate/send TPMsg");
+	if (tpmsg) delete tpmsg;
+      } // end if tpmsg not allocated or not addr or not sent
+      
+
+    } // end if !recv_error
+    else
+    { // error during receive or PDU incomplete
+      if (bytes_received>0)
+      {
+	Log(WARNING_LOG,LOG_NORMAL, tpparam.name, methodname << "Attention! " << (recv_error? "Receive error, " : "") << (pdu_complete ?  "PDU complete" : "PDU incomplete") << "received bytes: " << bytes_received);
+      }
+
+      if (!pdu_complete && bytes_received>0 && bytes_received<common_header_length)
+      {
+	ostringstream hexdumpstr;
+	netmsg->hexdump(hexdumpstr,netmsg->get_buffer(),bytes_received);
+	Log(DEBUG_LOG,LOG_NORMAL,tpparam.name,"Message too short to be a valid protocol header - dumping received bytes:" << hexdumpstr.str());	
+      }
+      // leave the outer loop
+      /**********************/
+      break;
+      /**********************/
+    } // end else
+
+  } // end while (thread not signalled for termination)
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, methodname << "Thread <" << pthread_self() 
+      << "> shutting down and closing socket " << receiver_thread_argp->peer_assoc->peer);
+
+  // shutdown socket
+  if (shutdown(conn_socket, SHUT_RD))
+  {
+    if ( errno != ENOTCONN )
+      Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "Thread <" << pthread_self() << "> shutdown (read) on socket failed, reason: " << strerror(errno));
+  }
+
+  // close socket
+  close(conn_socket);
+
+  receiver_thread_argp->terminated= true;
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, methodname << "Thread <" << pthread_self() << "> terminated");
+
+#ifdef _DEBUG
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, methodname << "Signaling main loop for cleanup");
+#endif
+  // notify master thread for invocation of cleanup procedure
+  TPoverTCPMsg* newmsg= new(nothrow)TPoverTCPMsg(receiver_thread_argp->peer_assoc);
+  // send message to main loop thread
+  newmsg->send_to(tpparam.source);
+
+}  
+
+
+/** this signals a terminate to a thread and wait for the thread to stop
+ *  @note it is not safe to access any thread related data after this method returned,
+ *        because the receiver thread will initiate a cleanup_receiver_thread() method 
+ *        which may erase all relevant thread data.
+ */
+void 
+TPoverTCP::stop_receiver_thread(AssocData* peer_assoc)
+{
+  // All operations on  recv_thread_argmap and connmap require an already acquired lock
+  // after this procedure peer_assoc may be invalid because it was erased
+
+  // start critical section
+
+  if (peer_assoc == 0)
+    return;
+
+  pthread_t thread_id=  peer_assoc->thread_ID;
+  
+  // try to clean up receiver_thread_arg
+  recv_thread_argmap_t::iterator recv_thread_arg_iter= recv_thread_argmap.find(thread_id);
+  receiver_thread_arg_t* recv_thread_argp=  
+    (recv_thread_arg_iter != recv_thread_argmap.end()) ? recv_thread_arg_iter->second : 0;
+  if (recv_thread_argp)
+  {
+    if (!recv_thread_argp->terminated)
+    {
+      // thread signaled termination, but is not?
+      Log(EVENT_LOG,LOG_NORMAL, tpparam.name,"stop_receiver_thread() - Receiver thread <" << thread_id << "> signaled for termination");
+
+      // signal thread for its termination
+      recv_thread_argp->sig_terminate= true;
+      // wait for thread to join after termination
+      pthread_join(thread_id, 0);
+      // the dying thread will signal main loop to call this method, but this time we should enter the else branch
+      return;
+    }
+  }
+  else
+    Log(ERROR_LOG,LOG_NORMAL, tpparam.name,"stop_receiver_thread() - Receiver thread <" << thread_id << "> not found");
+
+}
+
+
+/** cleans up left over structures (assoc,receiver_thread_arg) from already terminated receiver_thread
+ *  usually called by the master_thread after the receiver_thread terminated
+ * @note clean_up_receiver_thread() should be only called when an outer lock ensures that peer_assoc
+ *       is still valid
+ */
+void 
+TPoverTCP::cleanup_receiver_thread(AssocData* peer_assoc)
+{
+  // All operations on  recv_thread_argmap and connmap require an already acquired lock
+  // after this procedure peer_assoc may be invalid because it was erased
+
+  // start critical section
+
+  if (peer_assoc == 0)
+    return;
+
+  pthread_t thread_id=  peer_assoc->thread_ID;
+  
+  // try to clean up receiver_thread_arg
+  recv_thread_argmap_t::iterator recv_thread_arg_iter= recv_thread_argmap.find(thread_id);
+  receiver_thread_arg_t* recv_thread_argp=  
+    (recv_thread_arg_iter != recv_thread_argmap.end()) ? recv_thread_arg_iter->second : 0;
+  if (recv_thread_argp)
+  {
+    if (!recv_thread_argp->terminated)
+    {
+      // thread signaled termination, but is not?
+      Log(ERROR_LOG,LOG_NORMAL, tpparam.name,"cleanup_receiver_thread() - Receiver thread <" << thread_id << "> not terminated yet?!");
+      return;
+    }
+    else
+    { // if thread is already terminated
+      Log(EVENT_LOG,LOG_NORMAL, tpparam.name,"cleanup_receiver_thread() - Receiver thread <" << thread_id << "> is terminated");
+
+      // delete it from receiver map
+      recv_thread_argmap.erase(recv_thread_arg_iter);
+
+      // then delete receiver arg structure
+      delete recv_thread_argp;
+    }
+  }
+
+  // delete entry from connection map
+
+  // cleanup sender thread
+  // no need to lock explicitly, because caller of cleanup_receiver_thread() must already locked
+  terminate_sender_thread(peer_assoc);
+
+  // delete the AssocData structure from the connection map
+  // also frees allocated AssocData structure
+  connmap.erase(peer_assoc);
+
+  // end critical section
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name,"cleanup_receiver_thread() - Cleanup receiver thread <" << thread_id << ">. Done.");
+}
+
+
+/* sends a stop message to the sender thread that belongs to the peer address given in assoc
+ * @note terminate_receiver_thread() should be only called when an outer lock ensures that assoc
+ *       is still valid, a lock is also required, because senderthread_queuemap is changed
+ */
+void 
+TPoverTCP::terminate_sender_thread(const AssocData* assoc)
+{
+  if (assoc == 0)
+  {
+    Log(ERROR_LOG,LOG_NORMAL,tpparam.name,"terminate_sender_thread() - assoc data == NULL");
+    return;
+  }
+
+  sender_thread_queuemap_t::iterator it= senderthread_queuemap.find(assoc->peer);
+
+  if (it != senderthread_queuemap.end())
+  { // we have a sender thread: send a stop message to it
+    FastQueue* destqueue= it->second; 
+    if (destqueue)
+    {
+      TPoverTCPMsg* internalmsg= new TPoverTCPMsg(assoc,tpparam.source,TPoverTCPMsg::stop);
+      if (internalmsg)
+      {
+	// send the internal message to the sender thread queue
+	internalmsg->send(tpparam.source,destqueue);
+      }
+    }
+    else
+    {
+      Log(WARNING_LOG,LOG_NORMAL,tpparam.name,"terminate_sender_thread() - found entry for address, but no sender thread. addr:" << assoc->peer);
+    }
+    // erase entry from map
+    senderthread_queuemap.erase(it);
+  }
+}
+
+/* terminate all active threads
+ * note: locking should not be necessary here because this message is called as last method from
+ * main_loop()
+ */
+void 
+TPoverTCP::terminate_all_threads()
+{
+  AssocData* assoc= 0;
+  receiver_thread_arg_t* terminate_argp;
+
+  for (recv_thread_argmap_t::iterator terminate_iterator=  recv_thread_argmap.begin();
+       terminate_iterator !=  recv_thread_argmap.end();
+       terminate_iterator++)
+  {
+    if ( (terminate_argp= terminate_iterator->second) != 0)
+    {
+      // we need a non const pointer to erase it later on
+      assoc= const_cast<AssocData*>(terminate_argp->peer_assoc);
+      // check whether thread is still alive
+      if (terminate_argp->terminated == false)
+      {
+	terminate_argp->sig_terminate= true;
+	// then wait for its termination
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, 
+	    "Signaled receiver thread <" << terminate_iterator->first << "> for termination");
+	
+	pthread_join(terminate_iterator->first, 0);
+	
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, "Thread <" << terminate_iterator->first  << "> is terminated");
+      }
+      else
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, 
+	    "Receiver thread <" << terminate_iterator->first << "> already terminated");
+	
+      // cleanup all remaining argument structures of terminated threads
+      delete terminate_argp;
+
+      // terminate any related sender thread that is still running
+      terminate_sender_thread(assoc);
+      
+      connmap.erase(assoc);
+      // delete assoc is not necessary, because connmap.erase() will do the job
+    }
+  } // end for
+}
+
+
+/**
+ * sender thread starter: 
+ * just a static starter method to allow starting the 
+ * actual sender_thread() method.
+ *
+ * @param argp - pointer to the current TPoverTCP object instance and receiver_thread_arg_t struct
+ */
+void*
+TPoverTCP::sender_thread_starter(void *argp)
+{
+  sender_thread_start_arg_t *sargp= static_cast<sender_thread_start_arg_t *>(argp);
+  
+  //cout << "invoked sender_thread_Starter" << endl;
+
+  // invoke sender thread method
+  if (sargp != 0 && sargp->instance != 0)
+  {
+    // call receiver_thread member function on object instance
+    sargp->instance->sender_thread(sargp->sender_thread_queue);
+
+    //cout << "Before deletion of sarg" << endl;
+
+    // no longer needed
+    delete sargp;
+  }
+  else
+  {
+    Log(ERROR_LOG,LOG_CRIT,"sender_thread_starter","while starting sender_thread: 0 pointer to arg or object");
+  }
+  return 0;
+}
+
+
+
+
+/**
+ * receiver thread starter: 
+ * just a static starter method to allow starting the 
+ * actual receiver_thread() method.
+ *
+ * @param argp - pointer to the current TPoverTCP object instance and receiver_thread_arg_t struct
+ */
+void*
+TPoverTCP::receiver_thread_starter(void *argp)
+{
+  receiver_thread_start_arg_t *rargp= static_cast<receiver_thread_start_arg_t *>(argp);
+  // invoke receiver thread method
+  if (rargp != 0 && rargp->instance != 0)
+  {
+    // call receiver_thread member function on object instance
+    rargp->instance->receiver_thread(rargp->rtargp);
+
+    // no longer needed
+    delete rargp;
+  }
+  else
+  {
+    Log(ERROR_LOG,LOG_CRIT,"receiver_thread_starter","while starting receiver_thread: 0 pointer to arg or object");
+  }
+  return 0;
+}
+
+
+void
+TPoverTCP::create_new_sender_thread(FastQueue* senderfqueue)
+{
+  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "Starting new sender thread...");
+
+  pthread_t senderthreadid;
+  // create new thread; (arg == 0) is handled by thread, too
+  int pthread_status= pthread_create(&senderthreadid, 
+				     NULL, // NULL: default attributes: thread is joinable and has a 
+				     //       default, non-realtime scheduling policy
+				     TPoverTCP::sender_thread_starter,
+				     new sender_thread_start_arg_t(this,senderfqueue));
+  if (pthread_status)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "A new thread could not be created: " <<  strerror(pthread_status));
+    
+    delete senderfqueue;
+  }
+}
+
+
+void
+TPoverTCP::create_new_receiver_thread(AssocData* peer_assoc)
+{
+  receiver_thread_arg_t* argp= 
+    new(nothrow) receiver_thread_arg(peer_assoc);
+  
+  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "Starting new receiver thread...");
+
+  // create new thread; (arg == 0) is handled by thread, too
+  int pthread_status= pthread_create(&peer_assoc->thread_ID, 
+				     NULL, // NULL: default attributes: thread is joinable and has a 
+				     //       default, non-realtime scheduling policy
+				     receiver_thread_starter,
+				     new(nothrow) receiver_thread_start_arg_t(this,argp));
+  if (pthread_status)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "A new thread could not be created: " <<  strerror(pthread_status));
+    
+    delete argp;
+  }
+  else
+  {
+    lock(); // install_cleanup_thread_lock(TPoverTCP, this);
+
+    // remember pointer to thread arg structure
+    // thread arg structure should be destroyed after thread termination only
+    pair<recv_thread_argmap_t::iterator, bool> tmpinsiterator=
+      recv_thread_argmap.insert( pair<pthread_t,receiver_thread_arg_t*> (peer_assoc->thread_ID,argp) );
+    if (tmpinsiterator.second == false)
+    {
+      Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Thread argument could not be inserted into hashmap");
+    }
+    unlock(); // uninstall_cleanup(1);
+  }  
+}
+
+
+/**
+ * master listener thread starter: 
+ * just a static starter method to allow starting the 
+ * actual master_listener_thread() method.
+ *
+ * @param argp - pointer to the current TPoverTCP object instance
+ */
+void*
+TPoverTCP::master_listener_thread_starter(void *argp)
+{
+  // invoke listener thread method
+  if (argp != 0)
+  {
+    (static_cast<TPoverTCP*>(argp))->master_listener_thread();
+  }
+  return 0;
+}
+
+
+
+/**
+ * master listener thread: waits for incoming connections at the well-known tcp port
+ * when a connection request is received this thread spawns a receiver_thread for
+ * receiving packets from the peer at the new socket. 
+ */
+void
+TPoverTCP::master_listener_thread()
+{
+  // create a new address-structure for the listening masterthread
+  struct sockaddr_in6 own_address;
+  own_address.sin6_family = AF_INET6;
+  own_address.sin6_flowinfo= 0;
+  own_address.sin6_port = htons(tpparam.port); // use port number in param structure
+  // accept incoming connections on all interfaces 
+  own_address.sin6_addr = in6addr_any;
+  own_address.sin6_scope_id= 0;
+  
+  // create a listening socket
+  int master_listener_socket= socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
+  if (master_listener_socket == -1)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Could not create a new socket, error: " << strerror(errno));
+    return;
+  }
+  
+  // Disable Nagle Algorithm, set (TCP_NODELAY)
+  int nodelayflag= 1;
+  int status= setsockopt(master_listener_socket,
+			 IPPROTO_TCP,
+			 TCP_NODELAY,
+			 &nodelayflag,
+			 sizeof(nodelayflag));
+  if (status)
+  {
+    Log(ERROR_LOG,LOG_NORMAL,tpparam.name, "Could not set socket option TCP_NODELAY:" << strerror(errno));
+  }
+  
+  // Reuse ports, even if they are busy
+  int socketreuseflag= 1;
+  status= setsockopt(master_listener_socket,
+			   SOL_SOCKET,
+			   SO_REUSEADDR,
+			   (const char *) &socketreuseflag,
+			   sizeof(socketreuseflag));
+  if (status)
+  {
+       Log(ERROR_LOG,LOG_NORMAL,tpparam.name, "Could not set socket option SO_REUSEADDR:" << strerror(errno));
+  }
+  
+  
+  // bind the newly created socket to a specific address
+  int bind_status = bind(master_listener_socket,
+			 reinterpret_cast<struct sockaddr *>(&own_address),
+			 sizeof(own_address));
+  if (bind_status)
+    { 
+      Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Binding to " 
+	  << inet_ntop(AF_INET6, &own_address.sin6_addr, in6_addrstr, INET6_ADDRSTRLEN)
+	  << " port " << tpparam.port << " failed, error: " << strerror(errno));
+      return;
+    }
+
+    // listen at the socket, 
+    // queuesize for pending connections= max_listen_queue_size
+    int listen_status = listen(master_listener_socket, max_listen_queue_size);
+    if (listen_status)
+    {
+      Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Listen at socket " << master_listener_socket 
+	  << " failed, error: " << strerror(errno));
+      return;
+    }
+    else
+    {
+      Log(INFO_LOG,LOG_NORMAL, tpparam.name, color[green] << "Listening at port #" << tpparam.port << color[off]);
+    }
+
+    // activate O_NON_BLOCK for accept (accept does not block)
+    fcntl(master_listener_socket,F_SETFL, O_NONBLOCK);
+
+    // create a pollfd struct for use in the mainloop
+    struct pollfd poll_fd;
+    poll_fd.fd = master_listener_socket;
+    poll_fd.events = POLLIN | POLLPRI; 
+    poll_fd.revents = 0;
+    /*
+      #define POLLIN	0x001	// There is data to read. 
+      #define POLLPRI	0x002	// There is urgent data to read.  
+      #define POLLOUT	0x004	// Writing now will not block.  
+    */
+    
+    bool terminate = false;
+    // check for thread terminate condition using get_state()
+    state_t currstate= get_state();
+    int poll_status= 0;
+    const unsigned int number_poll_sockets= 1; 
+    struct sockaddr_in6 peer_address;
+    socklen_t peer_address_len;
+    int conn_socket;
+
+    // check whether this thread is signaled for termination
+    while(! (terminate= (currstate==STATE_ABORT || currstate==STATE_STOP) ) )
+    {
+      // wait on number_poll_sockets (main drm socket) 
+      // for the events specified above for sleep_time (in ms)
+      poll_status= poll(&poll_fd, number_poll_sockets, tpparam.sleep_time);
+      if (poll_fd.revents & POLLERR) // Error condition
+      {
+	if (errno != EINTR) 
+	{
+	  Log(ERROR_LOG,LOG_CRIT, tpparam.name, 
+	      "Poll caused error " << strerror(errno) << " - indicated by revents");
+	}
+	else
+	{
+	  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "poll(): " << strerror(errno));
+	}
+
+      }
+      if (poll_fd.revents & POLLHUP) // Hung up 
+      {
+	Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Poll hung up");
+	return;
+      }
+      if (poll_fd.revents & POLLNVAL) // Invalid request: fd not open
+      {
+	Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Poll Invalid request: fd not open");
+	return;
+      }
+      
+      switch (poll_status)
+      {
+	case -1:
+	  if (errno != EINTR)
+	  {
+	    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Poll status indicates error: " << strerror(errno));
+	  }
+	  else
+	  {
+	    Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "Poll status: " << strerror(errno));
+	  }
+	    
+	  break;
+
+	case 0:
+#ifdef DEBUG_HARD
+	  Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, 
+	      "Listen Thread - Poll timed out after " << tpparam.sleep_time << " ms.");
+#endif
+	  currstate= get_state();
+	  continue;
+	  break;
+
+	default:
+#ifdef DEBUG_HARD
+	  Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, "Poll: " << poll_status << " event(s) ocurred, of type " << poll_fd.revents);
+#endif
+	  break;
+      } // end switch
+
+      // after a successful accept call, 
+      // accept stores the address information of the connecting party
+      // in peer_address and the size of its address in addrlen
+      peer_address_len= sizeof(peer_address);
+      conn_socket = accept (master_listener_socket,
+			    reinterpret_cast<struct sockaddr *>(&peer_address),
+			    &peer_address_len);
+      if (conn_socket == -1)
+      {
+	if (errno != EWOULDBLOCK && errno != EAGAIN)
+	{
+	  Log(ERROR_LOG,LOG_EMERG, tpparam.name, "Accept at socket " << master_listener_socket
+	      << " failed, error: " << strerror(errno));
+	  return;
+	}
+      }
+      else
+      {
+	// create a new assocdata-object for the new thread
+	AssocData* peer_assoc = NULL;
+	appladdress addr(peer_address, IPPROTO_TCP);
+
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, "<<--Received connect--<< request from " << addr.get_ip_str() 
+	    << " port #" << addr.get_port());
+
+	struct sockaddr_in6 own_address;
+	socklen_t own_address_len= sizeof(own_address);
+	getsockname(conn_socket, reinterpret_cast<struct sockaddr*>(&own_address), &own_address_len);
+
+	// AssocData will copy addr content into its own structure
+	// allocated peer_assoc will be stored in connmap
+	peer_assoc = new(nothrow) AssocData(conn_socket, addr, appladdress(own_address,IPPROTO_TCP));
+
+	bool insert_success= false;
+	if (peer_assoc)
+	{
+	  // start critical section
+	  lock(); // install_cleanup_thread_lock(TPoverTCP, this);
+	  insert_success= connmap.insert(peer_assoc);
+	  // end critical section
+	  unlock(); // uninstall_cleanup(1);
+	}
+	
+	
+	if (insert_success == false) // not inserted into connmap
+	{
+	  Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Cannot insert AssocData for socket " << conn_socket
+	      << ", " << addr.get_ip_str() << ", port #" 
+	      << addr.get_port() << " into connection map, aborting connection...");
+
+	  // abort connection, delete its AssocData
+	  close (conn_socket);
+	  if (peer_assoc) 
+	  { 
+	    delete peer_assoc;
+	    peer_assoc= 0;
+	  }
+	  return;
+		
+	} //end __else(connmap.insert());__
+	
+	// create a new thread for each new connection
+	create_new_receiver_thread(peer_assoc);
+      } // end __else (connsocket)__
+      
+      // get new thread state
+      currstate= get_state();
+
+    } // end while(!terminate)
+    return;
+} // end listen_for_connections()    
+
+
+TPoverTCP::~TPoverTCP()
+{
+  init= false;
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name,  "Destructor called");
+
+  QueueManager::instance()->unregister_queue(tpparam.source);
+}
+
+/** TPoverTCP Thread main loop.
+ * This loop checks for internal messages of either
+ * a send() call to start a new receiver thread, or,
+ * of a receiver_thread() that signals its own termination
+ * for proper cleanup of control structures.
+ * It also handles the following internal TPoverTCPMsg types:
+ * - TPoverTCPMsg::stop - a particular receiver thread is terminated
+ * - TPoverTCPMsg::start - a particular receiver thread is started
+ * @param nr number of current thread instance
+ */
+void 
+TPoverTCP::main_loop(uint32 nr)
+{
+
+  // get internal queue for messages from receiver_thread
+  FastQueue* fq = get_fqueue();
+  if (!fq) 
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Cannot find message queue");
+    return;
+  } // end if not fq
+  // register queue for receiving internal messages from other modules
+  QueueManager::instance()->register_queue(fq,tpparam.source);
+
+  // start master listener thread
+  pthread_t master_listener_thread_ID;
+  int pthread_status= pthread_create(&master_listener_thread_ID, 
+				     NULL, // NULL: default attributes: thread is joinable and has a 
+				     //       default, non-realtime scheduling policy
+				     master_listener_thread_starter,
+				     this);
+  if (pthread_status)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, 
+	"New master listener thread could not be created: " <<  strerror(pthread_status));
+  }
+  else
+    Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, "Master listener thread started");
+
+
+  // define max latency for thread reaction on termination/stop signal
+  timespec wait_interval= { 0, 250000000L }; // 250ms
+  message* internal_thread_msg = NULL;
+  state_t currstate= get_state();
+
+  // check whether this thread is signaled for termination
+  while( currstate!=STATE_ABORT && currstate!=STATE_STOP )  
+  {
+    // poll internal message queue (blocking)
+    if ( (internal_thread_msg= fq->dequeue_timedwait(wait_interval)) != 0 )
+    {
+      TPoverTCPMsg* internalmsg= dynamic_cast<TPoverTCPMsg*>(internal_thread_msg);
+      if (internalmsg)
+      {
+	if (internalmsg->get_msgtype() == TPoverTCPMsg::stop)
+	{
+	  // a receiver thread terminated and signaled for cleanup by master thread
+	  AssocData* assocd= const_cast<AssocData*>(internalmsg->get_peer_assoc());
+	  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, "Got cleanup request for thread <" << assocd->thread_ID <<'>');
+	  lock();
+	  cleanup_receiver_thread( assocd );
+	  unlock();
+	}
+	else
+	if (internalmsg->get_msgtype() == TPoverTCPMsg::start)
+	{
+	  // start a new receiver thread
+	  create_new_receiver_thread( const_cast<AssocData*>(internalmsg->get_peer_assoc()) );
+	}
+	else
+	  Log(ERROR_LOG,LOG_CRIT, tpparam.name, "unexpected internal message:" << internalmsg->get_msgtype());
+	  
+	delete internalmsg;
+      }
+      else
+      {
+	Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Dynamic_cast failed - received unexpected and unknown internal message source "
+	    << internal_thread_msg->get_source());
+      }
+    } // endif
+
+    // get thread state
+    currstate= get_state();
+  } // end while
+
+  if (currstate==STATE_STOP)
+  {
+    // start abort actions
+    Log(INFO_LOG,LOG_NORMAL, tpparam.name, "Asked to abort, stopping all receiver threads");
+  } // end if stopped
+
+  // do not accept any more messages
+  fq->shutdown();
+  // terminate all receiver and sender threads that are still active 
+  terminate_all_threads();
+}
+
+} // end namespace protlib
+///@}
Index: /source/ariba/communication/modules/transport/protlib/tp_over_tcp.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/tp_over_tcp.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/tp_over_tcp.h	(revision 2378)
@@ -0,0 +1,256 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file tp_over_tcp.h
+/// Transport over TCP
+/// ----------------------------------------------------------
+/// $Id: tp_over_tcp.h 2718 2007-07-24 03:23:14Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/tp_over_tcp.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup tptcp
+ * @ file
+ * TP over TCP
+ */
+
+#ifndef TP_OVER_TCP_H
+#define TP_OVER_TCP_H
+
+#include <ext/hash_map>
+
+#include "tp.h"
+#include "threads.h"
+#include "threadsafe_db.h"
+#include "connectionmap.h"
+#include "assocdata.h"
+
+namespace protlib 
+{
+/** this struct conatains parameters that determine 
+  * the behavior of listener and receiver threads in TPoverTCP
+  * @param port - port number for master listener thread (server port)
+  * @param sleep - time (in ms) that listener and receiver wait at a poll() call
+  * @param d - destination module, where internal message are sent
+  */
+struct TPoverTCPParam : public ThreadParam 
+{
+  /// constructor
+    TPoverTCPParam(unsigned short common_header_length,
+		 bool (*const getmsglength) (NetMsg& m, uint32& clen_bytes),
+		 port_t p,
+		 const char* threadname= "TPoverTCP",
+		 uint32 sleep = ThreadParam::default_sleep_time,
+		 bool debug_pdu = false,
+		 message::qaddr_t source = message::qaddr_transport,
+		 message::qaddr_t dest = message::qaddr_signaling,
+		 bool sendaborts = false,
+		 uint8 tos = 0x10) :
+    ThreadParam(sleep,threadname,1,1),
+       port(p),
+       debug_pdu(debug_pdu),
+       source(source),
+       dest(dest),
+       common_header_length(common_header_length),
+       getmsglength(getmsglength),
+       terminate(false),
+       ip_tos(tos)
+        {};
+
+
+  /// port to bind master listener thread to
+  const port_t port;
+  bool debug_pdu;
+  /// message source
+  const message::qaddr_t source;
+  const message::qaddr_t dest;
+  /// what is the length of the common header
+  const unsigned short common_header_length;
+
+  /// function pointer to a function that figures out the msg length in number of 4 byte words
+  /// it returns false if error occured (e.g., malformed header), result is returned in variable clen_words
+  bool (*const getmsglength) (NetMsg& m, uint32& clen_words);
+
+  /// should master thread terminate?
+  const bool terminate;
+  const uint8 ip_tos;
+}; // end TPoverUDPParam
+
+
+/// TP over TCP
+/** This class implements the TP interface using TCP. */
+class TPoverTCP : public TP, public Thread 
+{
+/***** inherited from TP *****/
+public:
+  /// sends a network message, spawns receiver thread if necessary
+  virtual void send(NetMsg* msg,const address& addr, bool use_existing_connection);
+  virtual void terminate(const address& addr);
+  
+  /***** inherited from Thread *****/
+public:
+  /// main loop
+  virtual void main_loop(uint32 nr);
+  
+/***** other members *****/
+public:
+  /// constructor
+  TPoverTCP(const TPoverTCPParam& p) :
+    TP(tsdb::get_tcp_id(),"tcp",p.name,p.common_header_length,p.getmsglength),
+    Thread(p), tpparam(p), already_aborted(false), msgqueue(NULL), debug_pdu(p.debug_pdu)
+  { 
+    // perform some initializing actions
+    // currently not required (SCTP had to init its library)
+    init= true; ///< init done;
+  }
+  /// virtual destructor
+  virtual ~TPoverTCP();
+  
+  typedef
+  struct receiver_thread_arg
+  {
+    const AssocData* peer_assoc;
+    bool sig_terminate;
+    bool terminated;
+  public:
+    receiver_thread_arg(const AssocData* peer_assoc) : 
+      peer_assoc(peer_assoc), sig_terminate(false), terminated(true) {};
+  } receiver_thread_arg_t;
+  
+  class receiver_thread_start_arg_t
+  {
+  public:
+    TPoverTCP* instance;
+    receiver_thread_arg_t* rtargp;
+    
+    receiver_thread_start_arg_t(TPoverTCP* instance, receiver_thread_arg_t* rtargp) :
+      instance(instance), rtargp(rtargp) {};
+  };
+
+  class sender_thread_start_arg_t
+  {
+  public:
+    TPoverTCP* instance;
+    FastQueue* sender_thread_queue;
+    
+    sender_thread_start_arg_t(TPoverTCP* instance, FastQueue* sq) :
+      instance(instance), sender_thread_queue(sq) {};
+  };
+  
+private:
+  /// returns already existing connection or establishes a new one
+  AssocData* get_connection_to(const appladdress& addr);
+
+  /// receiver thread for a specific socket
+  void sender_thread(void *argp);
+  
+  /// receiver thread for a specific socket
+  void receiver_thread(void *argp);
+
+  /// send a message to the network via TCP
+  void tcpsend(NetMsg* msg, appladdress* addr);
+  
+  /// sender thread starter for a specific socket
+  static void* sender_thread_starter(void *argp);
+
+  /// receiver thread starter for a specific socket
+  static void* receiver_thread_starter(void *argp);
+  
+  /// a static starter method to invoke the actual main listener
+  static void* master_listener_thread_starter(void *argp);
+  
+  /// main listener thread procedure
+  void master_listener_thread();
+  
+  // create and start new sender thread
+  void create_new_sender_thread(FastQueue* senderqueue);
+
+  // create and start new receiver thread
+  void create_new_receiver_thread(AssocData* peer_assoc);
+  
+  /// terminates particular thread
+  void stop_receiver_thread(AssocData* peer_assoc);
+
+  /// cleans up thread management structures
+  void cleanup_receiver_thread(AssocData* peer_assoc);
+
+  /// terminates a sender thread
+  void terminate_sender_thread(const AssocData* assoc);
+  
+  /// terminates all active receiver or sender threads
+  void terminate_all_threads();
+  
+  /// ConnectionMap instance for keeping track of all existing connections
+  ConnectionMap connmap;
+  
+  /// store per receiver thread arguments, e.g. for signaling termination
+  typedef hash_map<pthread_t, receiver_thread_arg_t*> recv_thread_argmap_t;
+  recv_thread_argmap_t  recv_thread_argmap;
+
+  /// store sender thread related information
+  typedef hash_map<appladdress, FastQueue*> sender_thread_queuemap_t;
+  sender_thread_queuemap_t  senderthread_queuemap;
+  
+  /// parameters for main TPoverTCP thread
+  const TPoverTCPParam tpparam;
+  
+  /// did we already abort at thread shutdown
+  bool already_aborted;
+  /// message queue
+  FastQueue* msgqueue;
+  
+  bool debug_pdu;
+}; // end class TPoverTCP
+
+/** A simple internal message for selfmessages
+ * please note that carried items may get deleted after use of this message 
+ * the message destructor does not delete any item automatically
+ */
+class TPoverTCPMsg : public message 
+{
+ public:
+  // message type start/stop thread, send data
+  enum msg_t { start, 
+	       stop,
+	       send_data
+  };
+
+ private:
+  const AssocData* peer_assoc;
+  const TPoverTCPMsg::msg_t type;
+  NetMsg* netmsg;
+  appladdress* addr;
+
+public:
+  TPoverTCPMsg(const AssocData* peer_assoc, message::qaddr_t source= qaddr_unknown, TPoverTCPMsg::msg_t type= stop) : 
+    message(type_transport, source), peer_assoc(peer_assoc), type(type), netmsg(0), addr(0)  {}
+
+  TPoverTCPMsg(NetMsg* netmsg, appladdress* addr, message::qaddr_t source= qaddr_unknown) : 
+    message(type_transport, source), peer_assoc(0), type(send_data), netmsg(netmsg), addr(addr) {}
+
+  const AssocData* get_peer_assoc() const { return peer_assoc; }
+  TPoverTCPMsg::msg_t get_msgtype() const { return type; }
+  NetMsg* get_netmsg() const { return netmsg; }
+  appladdress* get_appladdr() const { return addr; } 
+};
+
+} // end namespace protlib
+
+#endif
Index: /source/ariba/communication/modules/transport/protlib/tp_over_tls_tcp.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/tp_over_tls_tcp.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/tp_over_tls_tcp.cpp	(revision 2378)
@@ -0,0 +1,1873 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file tp_over_tls_tcp.cpp
+/// TCP/TLS-based transport module
+/// ----------------------------------------------------------
+/// $Id: tp_over_tls_tcp.cpp 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/tp_over_tls_tcp.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+ 
+extern "C"
+{
+  //#define _SOCKADDR_LEN    /* use BSD 4.4 sockets */
+#include <unistd.h>      /* gethostname */
+#include <sys/types.h>   /* network socket interface */
+#include <netinet/in.h>  /* network socket interface */
+#include <netinet/tcp.h> /* for TCP Socket Option */
+#include <sys/socket.h>
+#include <arpa/inet.h>   /* inet_addr */
+
+#include <fcntl.h>
+#include <sys/poll.h>
+}
+
+#include <iostream>
+#include <errno.h>
+#include <string>
+#include <sstream>
+
+#include "tp_over_tls_tcp.h"
+#include "threadsafe_db.h"
+#include "cleanuphandler.h"
+#include "setuid.h"
+#include "queuemanager.h"
+#include "logfile.h"
+
+#include <set>
+
+#define TCP_SUCCESS 0
+#define TCP_SEND_FAILURE 1
+
+const unsigned int max_listen_queue_size= 10;
+
+namespace protlib {
+
+using namespace log;
+
+/** @defgroup tptcp TP over TCP
+ * @ingroup network
+ * @{
+ */
+
+char in6_addrstr_tls[INET6_ADDRSTRLEN+1];
+
+
+/******* class TPoverTLS_TCP *******/
+
+/*
+ * Obtain reason string for last SSL error
+ *
+ * Some caution is needed here since ERR_reason_error_string will
+ * return NULL if it doesn't recognize the error code.  We don't
+ * want to return NULL ever.
+ */
+const char *
+TPoverTLS_TCP::SSLerrmessage(void)
+{
+	unsigned long	errcode;
+	const char	   *errreason;
+	static char		errbuf[32];
+
+	errcode = ERR_get_error();
+	if (errcode == 0)
+		return "No SSL error reported";
+	errreason = ERR_reason_error_string(errcode);
+	if (errreason != NULL)
+		return errreason;
+	snprintf(errbuf, sizeof(errbuf), "SSL error code %lu", errcode);
+	return errbuf;
+}
+
+
+
+/** get_connection_to() checks for already existing connections. 
+ *  If a connection exists, it returns "AssocData" 
+ *  and saves it in "connmap" for further use
+ *  If no connection exists, a new connection to "addr"
+ *  is created.
+ */
+AssocData* 
+TPoverTLS_TCP::get_connection_to(const appladdress& addr)
+{
+  // get timeout
+  struct timespec ts;
+  get_time_of_day(ts);
+  ts.tv_nsec+= tpparam.sleep_time * 1000000L;
+  if (ts.tv_nsec>=1000000000L)
+  {
+    ts.tv_sec += ts.tv_nsec / 1000000000L;
+    ts.tv_nsec= ts.tv_nsec % 1000000000L;
+  }
+
+  // create a new AssocData pointer, initialize it to NULL
+  AssocData* assoc= NULL;
+  int new_socket;
+  // loop until timeout is exceeded: TODO: check applicability of loop
+  do 
+  {
+    // check for existing connections to addr
+    // start critical section
+    lock(); // install_cleanup_thread_lock(TPoverTLS_TCP, this);
+    assoc= connmap.lookup(addr);
+    // end critical section
+    unlock(); // uninstall_cleanup(1);
+    if (assoc) 
+    {
+      // If not shut down then use it, else abort, wait and check again.
+      if (!assoc->shutdown) 
+      {
+	return assoc;
+      }
+      else
+      {
+	// TODO: connection is already in shutdown mode. What now?
+	Log(ERROR_LOG,LOG_CRIT,tpparam.name,"socket exists, but is already in mode shutdown");
+
+	return 0;
+      }  
+    } //end __if (assoc)__
+    else 
+    {
+      Log(DEBUG_LOG,LOG_UNIMP,tpparam.name,"No existing connection to " 
+	  << addr.get_ip_str() << " port #" << addr.get_port() << " found, creating a new one.");
+    }
+
+    // no connection found, create a new one
+    new_socket = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
+    
+    if (new_socket == -1)
+    {
+      Log(ERROR_LOG,LOG_CRIT,tpparam.name,"Couldn't create a new socket: " << strerror(errno));
+
+      return 0;
+    }
+
+    // Disable Nagle Algorithm, set (TCP_NODELAY)
+    int nodelayflag= 1;
+    int status= setsockopt(new_socket,
+			   IPPROTO_TCP,
+			   TCP_NODELAY,
+			   &nodelayflag,
+			   sizeof(nodelayflag));
+    if (status)
+    {
+        Log(ERROR_LOG,LOG_NORMAL,tpparam.name, "Could not set socket option TCP_NODELAY:" << strerror(errno));
+    }
+    
+    // Reuse ports, even if they are busy
+    int socketreuseflag= 1;
+    status= setsockopt(new_socket,
+			   SOL_SOCKET,
+			   SO_REUSEADDR,
+			   (const char *) &socketreuseflag,
+			   sizeof(socketreuseflag));
+    if (status)
+    {
+        Log(ERROR_LOG,LOG_NORMAL,tpparam.name, "Could not set socket option SO_REUSEADDR:" << strerror(errno));
+    }
+
+    struct sockaddr_in6 dest_address;
+    dest_address.sin6_flowinfo= 0;
+    dest_address.sin6_scope_id= 0;
+    addr.get_sockaddr(dest_address);
+
+   // connect the socket to the destination address
+    int connect_status = connect(new_socket,
+				 reinterpret_cast<const struct sockaddr*>(&dest_address),
+				 sizeof(dest_address));
+
+
+    // connects to the listening_port of the peer's masterthread    
+    if (connect_status != 0)
+    {
+      Log(ERROR_LOG,LOG_NORMAL, tpparam.name,"Connect to " << addr.get_ip_str() << " port #" << addr.get_port() 
+	  << " failed: [" << color[red] << strerror(errno) << color[off] << "]");
+      // FIXME: that doesn't work gracefully
+      //throw TPError(TPError::ERROR_UNREACHABLE);
+      return 0;
+    }
+    
+    struct sockaddr_in6 own_address;
+    socklen_t own_address_len= sizeof(own_address);
+    getsockname(new_socket, reinterpret_cast<struct sockaddr*>(&own_address), &own_address_len);
+
+
+    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name,">>--Connect-->> to " << addr.get_ip_str() << " port #" << addr.get_port() 
+	<< " from " << inet_ntop(AF_INET6,&own_address.sin6_addr,in6_addrstr_tls,INET6_ADDRSTRLEN) 
+	<< " port #" << ntohs(own_address.sin6_port));
+    
+    // create new AssocData record (will copy addr)
+    assoc = new(nothrow) AssocData(new_socket, addr, appladdress(own_address,IPPROTO_TCP));
+
+    DLog(tpparam.name, "Before creation of a new SSL object");
+
+    SSL *ssl = NULL;
+
+    if (!ssl_ctx) ERRCLog(tpparam.name, "Could not create SSL context");
+
+    ssl = SSL_new(ssl_ctx);
+    
+    if (!ssl)
+    {
+      ERRCLog(tpparam.name,"could not create SSL context: " << SSLerrmessage());
+    }
+
+    if (!ssl) 
+      ERRCLog(tpparam.name, "Could not create SSL object");
+ 
+    DLog(tpparam.name, "Before binding it to the socket");
+
+    SSL_set_fd(ssl, new_socket);
+    
+    DLog(tpparam.name, "Bound SSL object to the socket");
+
+
+    // Connect to the server
+    if ((SSL_connect(ssl)) < 1) {
+	ERRCLog(tpparam.name, "SSL connect failed in get_connection_to(): " << SSLerrmessage());
+    }
+
+    sslmap[new_socket]=ssl;
+
+    DLog(tpparam.name, "Inserted SSL object into sslmap");
+
+    // if assoc could be successfully created, insert it into ConnectionMap
+    if (assoc) 
+    {
+      bool insert_success= false;
+      // start critical section
+      lock(); // install_cleanup_thread_lock(TPoverTLS_TCP, this);
+      // insert AssocData into connection map
+      insert_success= connmap.insert(assoc);
+      // end critical section
+      unlock(); // uninstall_cleanup(1);
+
+      if (insert_success == true) 
+      {
+#ifdef _DEBUG
+	Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, "Connected to " << addr.get_ip_str() << ", port #" << addr.get_port()
+	    << " via socket " << new_socket);
+
+		
+#endif
+
+	// notify master thread to start a receiver thread (i.e. send selfmessage)
+	TPoverTLS_TCPMsg* newmsg= new(nothrow)TPoverTLS_TCPMsg(assoc, tpparam.source, TPoverTLS_TCPMsg::start);
+	if (newmsg)
+	{
+	  newmsg->send_to(tpparam.source);
+	  return assoc;
+	}
+	else
+	  Log(ERROR_LOG,LOG_CRIT,tpparam.name,"get_connection_to: could not get memory for internal msg");
+      } 
+      else 
+      {
+	// delete data and abort
+	Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Cannot insert AssocData for socket " << new_socket << ", "<< addr.get_ip_str()
+	    <<", port #" << addr.get_port() << " into connection map, aborting connection");
+		
+	// abort connection, delete its AssocData
+	close (new_socket);
+	if (assoc) 
+	{ 
+	  delete assoc; 
+	  assoc= 0;
+	}
+	return assoc;
+      } // end else connmap.insert			
+      
+    } // end "if (assoc)"
+  } 
+  while (wait_cond(ts)!=ETIMEDOUT);
+
+  return assoc;
+} //end get_connection_to
+
+
+/** terminates a signaling association/connection
+ *  - if no connection exists, generate a warning
+ *  - otherwise: generate internal msg to related receiver thread
+ */
+void
+TPoverTLS_TCP::terminate(const address& in_addr)
+{
+
+    appladdress* addr = NULL;
+    addr= dynamic_cast<appladdress*>(in_addr.copy());
+    
+    if (!addr) return;
+
+#ifndef _NO_LOGGING
+  const char *const thisproc="terminate()   - ";
+#endif
+
+  // Create a new AssocData-pointer 
+  AssocData* assoc = NULL;
+
+  // check for existing connections to addr
+
+  // start critical section:
+  // please note if receiver_thread terminated already, the assoc data is not
+  // available anymore therefore we need a lock around cleanup_receiver_thread()
+
+  lock(); // install_cleanup_thread_lock(TPoverTLS_TCP, this);
+  assoc= connmap.lookup(*addr);
+  if (assoc) 
+  {
+    Log(EVENT_LOG,LOG_NORMAL,tpparam.name,thisproc<<"got request to shutdown connection for peer " << *addr);
+    // If not shut down then use it, else abort, wait and check again.
+    if (!assoc->shutdown) 
+    {
+      if (assoc->socketfd)
+      {
+	// disallow sending
+	if (shutdown(assoc->socketfd,SHUT_WR))
+	{
+	  Log(ERROR_LOG,LOG_UNIMP,tpparam.name,thisproc<<"shutdown (write) on socket for peer " << *addr << " returned error:" << strerror(errno));
+	}
+	else
+        {
+	  Log(EVENT_LOG,LOG_NORMAL,tpparam.name,thisproc<<"initiated closing of connection for peer " << *addr << ". Shutdown (write) on socket "<< assoc->socketfd );	  
+	}
+      }
+      assoc->shutdown= true;
+    }
+    else
+      Log(EVENT_LOG,LOG_NORMAL,tpparam.name,thisproc<<"connection for peer " << *addr << " is already in mode shutdown");
+      
+  }
+  else
+    Log(WARNING_LOG,LOG_NORMAL,tpparam.name,thisproc<<"could not find a connection for peer " << *addr);
+
+  stop_receiver_thread(assoc);
+
+  // end critical section
+  unlock(); // uninstall_cleanup(1);
+
+
+  if (addr) delete addr;
+
+}
+
+
+/** generates and internal TPoverTLS_TCP message to send a NetMsg to the network
+ *
+ *  - it is necessary to let a thread do this, because the caller
+ *     may get blocked if the connect() or send() call hangs for a while
+ *  - the sending thread will call TPoverTLS_TCP::tcpsend()
+ *  - if no connection exists, creates a new one
+ *  @note the netmsg is deleted by the send() method when it is not used anymore
+ */
+void
+TPoverTLS_TCP::send(NetMsg* netmsg, const address& in_addr, bool use_existing_connection)
+{
+  if (netmsg == NULL) {
+    ERRCLog(tpparam.name,"send() - called without valid NetMsg buffer (NULL)");
+    return;
+  }
+
+  appladdress* addr = NULL;
+  addr = dynamic_cast<appladdress*>(in_addr.copy());
+
+  if (!addr)
+  {
+    ERRCLog(tpparam.name,"send() - given destination address is not of expected type (appladdress), has type: " << (int) in_addr.get_type());
+    return;
+  }
+
+  // lock due to sendermap access
+  lock();
+
+  // check for existing sender thread
+  sender_thread_queuemap_t::const_iterator it= senderthread_queuemap.find(*addr);
+
+  FastQueue* destqueue= 0;
+
+  if (it == senderthread_queuemap.end())
+  { // no sender thread so far
+
+    // if we already have an existing connection it is save to create a sender thread
+    // since get_connection_to() will not be invoked, so an existing connection will
+    // be used
+    const AssocData* assoc = connmap.lookup(*addr);
+
+    //DLog(tpparam.name,"send() - use_existing_connection:" << (use_existing_connection ? "true" : "false") << " assoc:" << assoc);
+
+    if (use_existing_connection==false || (assoc && assoc->shutdown==false && assoc->socketfd>0))
+    { // it is allowed to create a new connection for this thread
+      // create a new queue for sender thread
+      FastQueue* sender_thread_queue= new FastQueue;
+      create_new_sender_thread(sender_thread_queue);
+      // remember queue for later use
+      
+      //pair<sender_thread_queuemap_t::iterator, bool> tmpinsiterator=
+      senderthread_queuemap.insert( pair<appladdress,FastQueue*> (*addr,sender_thread_queue) );
+
+      destqueue= sender_thread_queue;
+    }
+  }
+  else
+  { // we have a sender thread, use stored queue from map
+    destqueue= it->second; 
+  }
+
+  unlock();
+   
+  // send a send_data message to it (if we have a destination queue)
+  if (destqueue)
+  {
+    // both parameters will be freed after message was sent!
+    
+    TPoverTLS_TCPMsg* internalmsg= new TPoverTLS_TCPMsg(netmsg,new appladdress(*addr));
+    if (internalmsg)
+    {
+      // send the internal message to the sender thread queue
+      internalmsg->send(tpparam.source,destqueue);
+    }
+  }
+  else
+  {
+    if (!use_existing_connection)
+      WLog(tpparam.name,"send() - found entry for address, but no active sender thread available for peer addr:" << *addr << " - dropping data");
+    else
+      DLog(tpparam.name,"no active sender thread found for peer " << *addr << " - but policy forbids to set up a new connection, will drop data");
+     
+    // cannot send data, so we must drop it
+    delete netmsg;
+
+  }
+
+  if (addr) delete addr;
+}
+
+/** sends a NetMsg to the network.
+ *
+ * @param netmsg message to send
+ * @param addr   transport endpoint address 
+ *
+ * @note    if no connection exists, creates a new one 
+ * @note    both parameters are deleted after the message was sent
+ */
+void
+TPoverTLS_TCP::tcptlssend(NetMsg* netmsg, appladdress* addr)
+{                        
+#ifndef _NO_LOGGING
+  const char *const thisproc="sender   - ";
+#endif
+
+  // set result initially to success, set it to failure
+  // in places where these failures occur
+  int result = TCP_SUCCESS;
+  int ret= 0;
+
+  // Create a new AssocData-pointer 
+  AssocData* assoc = NULL;
+  
+  // tp.cpp checks for initialisation of tp and correctness of
+  // msgsize, protocol and ip,
+  // throws an error if something is not right
+  if (addr) {
+      addr->convert_to_ipv6();
+      check_send_args(*netmsg,*addr);
+  
+  } else {
+      Log(ERROR_LOG,LOG_CRIT, tpparam.name, thisproc << "address pointer is NULL");
+      result= TCP_SEND_FAILURE;    
+      throw TPErrorInternal();
+  }
+    
+
+
+  // check for existing connections, 
+  // if a connection exists, return its AssocData 
+  // and save it in assoc for further use
+  // if no connection exists, create a new one (in get_connection_to()).
+  // Connection is inserted into connection map that must be done
+  // with exclusive access
+  assoc= get_connection_to(*addr);
+
+  if (assoc==NULL || assoc->socketfd<=0)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, thisproc << "no valid assoc/socket data");
+
+    delete netmsg;
+    delete addr;
+    return;
+  }
+  if (assoc->shutdown)
+  {
+    Log(WARNING_LOG, LOG_ALERT, tpparam.name, thisproc << "should send message although connection already half closed");
+    delete netmsg;
+    delete addr;
+
+    throw TPErrorSendFailed();
+  }
+
+  uint32 msgsize= netmsg->get_size();
+#ifdef DEBUG_HARD
+  cerr << thisproc << "message size=" << netmsg->get_size() << endl;
+#endif
+
+
+  // get SSL connection data
+  SSL* ssl= sslmap[assoc->socketfd];
+
+
+  // send all the data contained in netmsg to the socket
+  // which belongs to the address "addr"
+  for (uint32 bytes_sent= 0;
+       bytes_sent < msgsize;
+       bytes_sent+= ret)
+  {
+
+#ifdef _DEBUG_HARD
+    for (uint32 i=0;i<msgsize;i++)
+    {
+      cout << "send_buf: " << i << " : "; 
+      if ( isalnum(*(netmsg->get_buffer()+i)) )
+	cout << "'" << *(netmsg->get_buffer()+i) << "' (0x" << hex << (unsigned short) *(netmsg->get_buffer()+i) << dec << ")" ;
+      else
+	cout << "0x" << hex << (unsigned short) *(netmsg->get_buffer()+i) << dec;
+      cout << endl;
+    }
+
+    cout << endl;
+    cout << "bytes_sent: " << bytes_sent << endl;
+    cout << "Message size: " <<  msgsize << endl;
+    cout << "Send-Socket: " << assoc->socketfd << endl;
+    cout << "pointer-Offset. " << netmsg->get_pos() << endl;
+    cout << "vor send " << endl;
+#endif
+
+
+    // socket send
+    //ret= ::send(assoc->socketfd, 
+//		netmsg->get_buffer() + bytes_sent,  
+//		msgsize - bytes_sent, 
+//		MSG_NOSIGNAL);
+
+
+    ret = SSL_write(ssl, netmsg->get_buffer() + bytes_sent, msgsize - bytes_sent);
+
+    //int SSL_write(SSL *ssl, const void *buf, int num);
+
+    //send_buf + bytes_sent
+
+    if (debug_pdu)
+    {
+      ostringstream hexdump;
+      netmsg->hexdump(hexdump,netmsg->get_buffer(),bytes_sent);
+      Log(DEBUG_LOG,LOG_NORMAL,tpparam.name,"PDU debugging enabled - Sent:" << hexdump.str());
+    }
+
+    if (ret < 0) 
+    {
+      result= TCP_SEND_FAILURE;
+      break;
+    } // end if (ret < 0)
+  } // end for
+
+  // *** note: netmsg is deleted here ***
+  delete netmsg;
+  
+  // Throwing an exception within a critical section does not 
+  // unlock the mutex.
+
+  if (result != TCP_SUCCESS)
+  {
+    Log(ERROR_LOG,LOG_NORMAL, tpparam.name, thisproc << "TLS/TCP error, returns " << ret << ", error : " << strerror(errno));
+    delete addr;
+
+    throw TPErrorSendFailed();
+    
+  }
+  else
+    Log(EVENT_LOG,LOG_NORMAL,tpparam.name, thisproc << ">>----Sent---->> message (" << msgsize << " bytes) using socket " << assoc->socketfd  << " to " << *addr);
+
+  if (!assoc) {
+    // no connection
+    
+    Log(ERROR_LOG,LOG_NORMAL, tpparam.name, thisproc << "cannot get connection to " << addr->get_ip_str() 
+	<< ", port #" << addr->get_port());
+
+    delete addr;
+
+    throw TPErrorUnreachable(); // should be no assoc found
+  } // end "if (!assoc)"
+  
+  // *** delete address ***
+  delete addr;
+}
+  
+/* this thread waits for an internal message that either:
+ * - requests transmission of a packet
+ * - requests to stop this thread
+ * @param argp points to the thread queue for internal messages
+ */
+void 
+TPoverTLS_TCP::sender_thread(void *argp)
+{
+#ifndef _NO_LOGGING
+  const char *const methodname="senderthread - ";
+#endif
+
+  message* internal_thread_msg = NULL;
+
+  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, methodname << "starting as thread <" << pthread_self() << ">");
+
+  FastQueue* fq= reinterpret_cast<FastQueue*>(argp);
+  if (!fq)
+  {
+    Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "thread <" << pthread_self() << "> no valid pointer to msg queue. Stop.");
+    return;
+  }
+
+  bool terminate= false;
+  TPoverTLS_TCPMsg* internalmsg= 0;
+  while (terminate==false && (internal_thread_msg= fq->dequeue()) != 0 )
+  {
+    internalmsg= dynamic_cast<TPoverTLS_TCPMsg*>(internal_thread_msg);
+    
+    if (internalmsg == 0)
+    {
+      Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "received not an TPoverTLS_TCPMsg but a" << internal_thread_msg->get_type_name());      
+    }
+    else
+    if (internalmsg->get_msgtype() == TPoverTLS_TCPMsg::send_data)
+    {
+      // create a connection if none exists and send the netmsg
+      if (internalmsg->get_netmsg() && internalmsg->get_appladdr())
+      {
+	tcptlssend(internalmsg->get_netmsg(),internalmsg->get_appladdr());
+      }
+      else
+      {
+	Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "problem with passed arguments references, they point to 0");
+      } 
+    }
+    else
+    if (internalmsg->get_msgtype() == TPoverTLS_TCPMsg::stop)
+    {
+      terminate= true;
+    }  
+  } // end while
+  
+  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, methodname << "<" << pthread_self() << "> terminated connection." );
+}
+
+
+/** receiver thread listens at a TCP socket for incoming PDUs 
+ *  and passes complete PDUs to the coordinator. Incomplete
+ *  PDUs due to aborted connections or buffer overflows are discarded.
+ *
+ *  @param argp - assoc data and flags sig_terminate and terminated
+ *  
+ *  @note this is a static member function, so you cannot use class variables
+ */
+void 
+TPoverTLS_TCP::receiver_thread(void *argp)
+{
+#ifndef _NO_LOGGING
+  const char *const methodname="receiver - ";
+#endif
+  receiver_thread_arg_t *receiver_thread_argp= static_cast<receiver_thread_arg_t *>(argp);
+  const appladdress* peer_addr = NULL;
+  const appladdress* own_addr = NULL;
+  uint32 bytes_received = 0;
+  TPMsg* tpmsg= NULL;
+
+  //uchar* sslbuffer = NULL;
+ 
+  
+  // argument parsing - start
+  if (receiver_thread_argp == 0)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "No arguments given at start of receiver thread <" << pthread_self() << ">, exiting.");
+
+    return;
+  }
+  else
+  {
+    // change status to running, i.e., not terminated
+    receiver_thread_argp->terminated= false;
+
+#ifdef _DEBUG
+    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname << "New receiver thread <" << pthread_self() << "> started. ");
+#endif
+  }
+
+  int conn_socket= 0;
+  if (receiver_thread_argp->peer_assoc)
+  {
+    // get socket descriptor from arg
+    conn_socket = receiver_thread_argp->peer_assoc->socketfd;
+    // get pointer to peer address of socket (source/sender address of peer) from arg
+    peer_addr= &receiver_thread_argp->peer_assoc->peer;
+    own_addr=  &receiver_thread_argp->peer_assoc->ownaddr;
+  }
+  else
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "No peer assoc available - pointer is NULL");
+    
+    return;
+  }
+
+  if (peer_addr == 0)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "No peer address available for socket " << conn_socket << ", exiting.");
+    
+    return;
+  }
+  // argument parsing - end
+#ifdef _DEBUG
+  Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname <<
+      "Preparing to wait for data at socket " 
+      << conn_socket << " from " << receiver_thread_argp->peer_assoc->peer);
+#endif
+
+  int ret= 0;
+  uint32 msgcontentlength= 0;
+  bool msgcontentlength_known= false;
+  bool pdu_complete= false; // when to terminate inner loop
+
+  /* maybe use this to create a new pdu, 
+    /// constructor
+    contextlistpdu(type_t t, subtype_t st, uint32 fc, uint32 numobj = 0);
+  */ 
+
+  // activate O_NON_BLOCK  for recv on socket conn_socket
+  fcntl(conn_socket,F_SETFL, O_NONBLOCK);
+    
+  // set options for polling
+  const unsigned int number_poll_sockets= 1; 
+  struct pollfd poll_fd;
+  // have to set structure before poll call
+  poll_fd.fd = conn_socket;
+  poll_fd.events = POLLIN | POLLPRI; 
+
+  int poll_status;
+  bool recv_error= false;
+
+  //get SSL handle
+  SSL *ssl=sslmap[conn_socket];
+
+  NetMsg* netmsg= 0;
+  NetMsg* remainbuf= 0;
+  uint32 buffer_bytes_left= 0;
+  size_t trailingbytes= 0;
+  bool skiprecv= false;
+  // loop until we receive a terminate signal (read-only var for this thread) 
+  // or get an error from socket read
+  while( receiver_thread_argp->sig_terminate == false )
+  {
+    // Read next PDU from socket or process trailing bytes in remainbuf
+    ret= 0;
+    msgcontentlength= 0;
+    msgcontentlength_known= false;
+    pdu_complete= false;
+    netmsg= 0;
+
+    // there are trailing bytes left from the last receive call
+    if (remainbuf != 0)
+    {
+      netmsg= remainbuf;
+      remainbuf= 0;
+      buffer_bytes_left= netmsg->get_size()-trailingbytes;
+      bytes_received= trailingbytes;
+      trailingbytes= 0;
+      skiprecv= true;
+    }
+    else // no trailing bytes, create a new buffer
+    if ( (netmsg= new NetMsg(NetMsg::max_size)) != 0 )
+    {
+      buffer_bytes_left= netmsg->get_size();
+      bytes_received= 0;
+      skiprecv= false;
+    }
+    else
+    { // buffer allocation failed
+      bytes_received= 0;
+      buffer_bytes_left= 0;
+      recv_error= true;
+    }
+    
+    // loops until PDU is complete
+    // >>>>>>>>>>>>>>>>>>>>>>>>>>> while >>>>>>>>>>>>>>>>>>>>>>>>
+    while (!pdu_complete && 
+	   !recv_error && 
+	   !receiver_thread_argp->sig_terminate)
+    {
+      if (!skiprecv)
+      {
+	// read from TCP socket or return after sleep_time
+	poll_status= poll(&poll_fd, number_poll_sockets, tpparam.sleep_time);
+	
+	if (receiver_thread_argp->sig_terminate)
+	{
+	  Log(EVENT_LOG,LOG_UNIMP,tpparam.name,methodname << "Thread <" << pthread_self() << "> found terminate signal after poll");
+	  // disallow sending
+	  AssocData* myassoc=const_cast<AssocData *>(receiver_thread_argp->peer_assoc);
+	  if (myassoc->shutdown == false)
+	  {
+	    myassoc->shutdown= true;
+	    if (shutdown(myassoc->socketfd,SHUT_WR))
+	    {
+	      if ( errno != ENOTCONN )
+		Log(ERROR_LOG,LOG_UNIMP,tpparam.name,methodname <<"shutdown (write) on socket " << conn_socket << " returned error:" << strerror(errno));
+	    }
+	  }
+	  // try to read do a last read from the TCP socket or return after sleep_time
+	  if (poll_status == 0)
+	  {
+	    poll_status= poll(&poll_fd, number_poll_sockets, tpparam.sleep_time);
+	  }
+	}
+
+	if (poll_fd.revents & POLLERR) // Error condition
+	{
+	  if (errno == 0 || errno == EINTR)
+	  {
+	    Log(EVENT_LOG,LOG_NORMAL, tpparam.name, methodname << "poll(): " << strerror(errno));
+	  }
+	  else
+	  {
+	    Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "Poll indicates error: " << strerror(errno));
+	    recv_error= true;
+	  }
+	}
+	
+	if (poll_fd.revents & POLLHUP) // Hung up 
+	{
+	  Log(EVENT_LOG,LOG_CRIT, tpparam.name, methodname << "Poll hung up");
+	  recv_error= true;
+	}
+	
+	if (poll_fd.revents & POLLNVAL) // Invalid request: fd not open
+	{
+	  Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "Poll Invalid request: fd not open");
+	  recv_error= true;
+	}
+	
+	// check status (return value) of poll call
+	switch (poll_status)
+	{
+	  case -1:
+	    if (errno == 0 || errno == EINTR)
+	    {
+	      Log(EVENT_LOG,LOG_NORMAL, tpparam.name, methodname << "Poll status: " << strerror(errno));
+	    }
+	    else
+	    {
+	      Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "Poll status indicates error: " << strerror(errno) << "- aborting");
+	      recv_error= true;
+	    }
+	    
+	    continue; // next while iteration
+	    break;
+	    
+	  case 0:
+#ifdef DEBUG_HARD
+	    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname << "Poll timed out after " << tpparam.sleep_time << " ms.");
+#endif
+	    continue; // next while iteration
+	    break;
+	    
+	  default:
+#ifdef DEBUG_HARD
+	    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname << "Poll: " << poll_status << " event(s) ocurred, of type " << poll_fd.revents);
+#endif
+	    break;
+	} // end switch
+
+	/// spawn a new buffer for SSL decoding
+	//sslbuffer = new(nothrow) uchar[NetMsg::max_size];
+
+	/// receive data from socket buffer (recv will not block)
+	//ret = recv(conn_socket, 
+	//	   netmsg->get_buffer() + bytes_received, 
+	//	   buffer_bytes_left, 
+	//	   0);
+	
+	/// try to read from SSL
+	ret = SSL_read(ssl, netmsg->get_buffer() + bytes_received, buffer_bytes_left);
+
+
+	/// memcpy decoded contents back into netmsg
+	//memcpy(netmsg->get_buffer() + bytes_received, sslbuffer, buffer_bytes_left);
+
+	/// delete sslbuffer
+	//delete sslbuffer;
+
+	if ( ret < 0 )
+	{
+	  if (errno!=EAGAIN && errno!=EWOULDBLOCK)
+	  {
+	    Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "Receive at socket " << conn_socket << " failed, error: " << strerror(errno));
+	    recv_error= true;
+	    continue;
+	  }
+	  else
+	  { // errno==EAGAIN || errno==EWOULDBLOCK
+	    // just nothing to read from socket, continue w/ next poll
+	    continue;
+	  }
+	}
+	else
+	{
+	  if (ret == 0)
+	  {
+	    // this means that EOF is reached, 
+	    // other side has closed connection
+	    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname << "Other side (" << *peer_addr << ") closed connection for socket " << conn_socket);
+	    // disallow sending
+	    AssocData* myassoc=const_cast<AssocData *>(receiver_thread_argp->peer_assoc);
+	    if (myassoc->shutdown == false)
+	    {
+	      myassoc->shutdown= true;
+	      if (shutdown(myassoc->socketfd,SHUT_WR))
+	      {
+		if ( errno != ENOTCONN )
+		  Log(ERROR_LOG,LOG_UNIMP,tpparam.name, methodname << "shutdown (write) on socket " << conn_socket << " returned error:" << strerror(errno));
+	      }
+	    }
+	    // not a real error, but we must quit the receive loop
+	    recv_error= true;
+	  }
+	  else
+	  {
+	    Log(EVENT_LOG,LOG_UNIMP, tpparam.name, methodname << "<<--Received--<< packet (" << ret << " bytes) at socket " << conn_socket << " from " << *peer_addr);
+	    // track number of received bytes
+	    bytes_received+= ret;
+	    buffer_bytes_left-= ret;
+	  }
+	}
+      } // end if do not skip recv() statement      
+
+      if (buffer_bytes_left < 0) ///< buffer space exhausted now
+      {
+	recv_error= true;
+        Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "during receive buffer space exhausted");
+      }
+
+      if (!msgcontentlength_known) ///< common header not parsed
+      {
+	
+        // enough bytes read to parse common header?
+	if (bytes_received >= common_header_length)
+	{
+	  // get message content length in number of bytes
+	  if (getmsglength(*netmsg, msgcontentlength))
+	    msgcontentlength_known= true;
+	  else
+	  {
+	      Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "Not a valid protocol header - discarding received packet. received size " << msgcontentlength);
+
+	    ostringstream hexdumpstr;
+	    netmsg->hexdump(hexdumpstr,netmsg->get_buffer(),bytes_received);
+	    Log(DEBUG_LOG,LOG_NORMAL,tpparam.name,"dumping received bytes:" << hexdumpstr.str());
+
+	    // reset all counters
+	    msgcontentlength= 0;
+	    msgcontentlength_known= false;
+	    bytes_received= 0;
+	    pdu_complete= false;
+	    continue;
+	  }
+	}
+      } // endif common header not parsed
+
+      // check whether we have read the whole Protocol PDU
+      DLog(tpparam.name, "bytes_received - common_header_length: " << bytes_received-common_header_length << "msgcontentlength: " << msgcontentlength << ">=");
+      if (msgcontentlength_known && bytes_received-common_header_length >= msgcontentlength )
+      {
+       	pdu_complete= true;
+
+	// truncate buffer exactly at common_header_length+msgcontentlength==PDU size, trailing stuff is handled separately
+	netmsg->truncate(common_header_length+msgcontentlength);
+
+	// trailing bytes are copied into new buffer
+	if (bytes_received-common_header_length > msgcontentlength)
+	{
+	  Log(WARNING_LOG,LOG_NORMAL,tpparam.name,"trailing bytes - received more bytes ("<<bytes_received<<") than expected for PDU (" << common_header_length+msgcontentlength << ")");
+	  remainbuf= new NetMsg(NetMsg::max_size);
+	  trailingbytes= (bytes_received-common_header_length) - msgcontentlength;
+	  bytes_received= common_header_length+msgcontentlength;
+	  memcpy(remainbuf->get_buffer(),netmsg->get_buffer()+common_header_length+msgcontentlength, trailingbytes);
+	}
+      }
+    } // end while (!pdu_complete && !recv_error && !signalled for termination)
+    // >>>>>>>>>>>>>>>>>>>>>>>>>>> while >>>>>>>>>>>>>>>>>>>>>>>>
+
+    // if other side closed the connection, we should still be able to deliver the remaining data
+    if (ret == 0)
+    {
+      recv_error= false;
+    }
+
+    // deliver only complete PDUs to signaling module
+    if (!recv_error && pdu_complete)
+    {
+      // create TPMsg and send it to the signaling thread
+      tpmsg = new(nothrow) TPMsg(netmsg, peer_addr->copy(), own_addr->copy());
+
+      Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, methodname << "receipt of PDU now complete, sending to module " <<  message::get_qaddr_name(tpparam.dest));
+
+      debug_pdu=false;
+
+      if (debug_pdu)
+      {
+	ostringstream hexdump;
+	netmsg->hexdump(hexdump,netmsg->get_buffer(),bytes_received);
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name,"PDU debugging enabled - Received:" << hexdump.str());
+      }
+
+      // send the message if it was successfully created
+      // bool message::send_to(qaddr_t dest, bool exp = false);
+      if (!tpmsg
+	  || (!tpmsg->get_peeraddress())
+	  || (!tpmsg->send_to(tpparam.dest))) 
+      {
+	Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "Cannot allocate/send TPMsg");
+	if (tpmsg) delete tpmsg;
+      } // end if tpmsg not allocated or not addr or not sent
+      
+    } // end if !recv_error
+    else
+    { // error during receive or PDU incomplete
+      if (bytes_received>0)
+      {
+	Log(WARNING_LOG,LOG_NORMAL, tpparam.name, methodname << "Attention! " << (recv_error? "Receive error, " : "") << (pdu_complete ?  "PDU complete" : "PDU incomplete") << "received bytes: " << bytes_received);
+      }
+
+      if (!pdu_complete && bytes_received>0 && bytes_received<common_header_length)
+      {
+	ostringstream hexdumpstr;
+	netmsg->hexdump(hexdumpstr,netmsg->get_buffer(),bytes_received);
+	Log(DEBUG_LOG,LOG_NORMAL,tpparam.name,"Message too short to be a valid protocol header - dumping received bytes:" << hexdumpstr.str());	
+      }
+      // leave the outer loop
+      /**********************/
+      break;
+      /**********************/
+    } // end else
+
+  } // end while (thread not signalled for termination)
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, methodname << "Thread <" << pthread_self() 
+      << "> shutting down and closing socket " << receiver_thread_argp->peer_assoc->peer);
+
+  // shutdown socket
+  if (shutdown(conn_socket, SHUT_RD))
+  {
+    if ( errno != ENOTCONN )
+      Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "Thread <" << pthread_self() << "> shutdown (read) on socket failed, reason: " << strerror(errno));
+  }
+
+  // close socket
+  close(conn_socket);
+
+  receiver_thread_argp->terminated= true;
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, methodname << "Thread <" << pthread_self() << "> terminated");
+
+#ifdef _DEBUG
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, methodname << "Signaling main loop for cleanup");
+#endif
+  // notify master thread for invocation of cleanup procedure
+  TPoverTLS_TCPMsg* newmsg= new(nothrow)TPoverTLS_TCPMsg(receiver_thread_argp->peer_assoc);
+  // send message to main loop thread
+  newmsg->send_to(tpparam.source);
+
+
+}  
+
+
+/** this signals a terminate to a thread and wait for the thread to stop
+ *  @note it is not safe to access any thread related data after this method returned,
+ *        because the receiver thread will initiate a cleanup_receiver_thread() method 
+ *        which may erase all relevant thread data.
+ */
+void 
+TPoverTLS_TCP::stop_receiver_thread(AssocData* peer_assoc)
+{
+  // All operations on  recv_thread_argmap and connmap require an already acquired lock
+  // after this procedure peer_assoc may be invalid because it was erased
+
+  // start critical section
+
+  if (peer_assoc == 0)
+    return;
+
+  pthread_t thread_id=  peer_assoc->thread_ID;
+  
+  // try to clean up receiver_thread_arg
+  recv_thread_argmap_t::iterator recv_thread_arg_iter= recv_thread_argmap.find(thread_id);
+  receiver_thread_arg_t* recv_thread_argp=  
+    (recv_thread_arg_iter != recv_thread_argmap.end()) ? recv_thread_arg_iter->second : 0;
+  if (recv_thread_argp)
+  {
+    if (!recv_thread_argp->terminated)
+    {
+      // thread signaled termination, but is not?
+      Log(EVENT_LOG,LOG_NORMAL, tpparam.name,"stop_receiver_thread() - Receiver thread <" << thread_id << "> signaled for termination");
+
+      // signal thread for its termination
+      recv_thread_argp->sig_terminate= true;
+      // wait for thread to join after termination
+      pthread_join(thread_id, 0);
+      // the dying thread will signal main loop to call this method, but this time we should enter the else branch
+      return;
+    }
+  }
+  else
+    Log(ERROR_LOG,LOG_NORMAL, tpparam.name,"stop_receiver_thread() - Receiver thread <" << thread_id << "> not found");
+
+}
+
+
+/** cleans up left over structures (assoc,receiver_thread_arg) from already terminated receiver_thread
+ *  usually called by the master_thread after the receiver_thread terminated
+ * @note clean_up_receiver_thread() should be only called when an outer lock ensures that peer_assoc
+ *       is still valid
+ */
+void 
+TPoverTLS_TCP::cleanup_receiver_thread(AssocData* peer_assoc)
+{
+  // All operations on  recv_thread_argmap and connmap require an already acquired lock
+  // after this procedure peer_assoc may be invalid because it was erased
+
+  // start critical section
+
+  if (peer_assoc == 0)
+    return;
+
+  pthread_t thread_id=  peer_assoc->thread_ID;
+  
+  // try to clean up receiver_thread_arg
+  recv_thread_argmap_t::iterator recv_thread_arg_iter= recv_thread_argmap.find(thread_id);
+  receiver_thread_arg_t* recv_thread_argp=  
+    (recv_thread_arg_iter != recv_thread_argmap.end()) ? recv_thread_arg_iter->second : 0;
+  if (recv_thread_argp)
+  {
+    if (!recv_thread_argp->terminated)
+    {
+      // thread signaled termination, but is not?
+      Log(ERROR_LOG,LOG_NORMAL, tpparam.name,"cleanup_receiver_thread() - Receiver thread <" << thread_id << "> not terminated yet?!");
+      return;
+    }
+    else
+    { // if thread is already terminated
+      Log(EVENT_LOG,LOG_NORMAL, tpparam.name,"cleanup_receiver_thread() - Receiver thread <" << thread_id << "> is terminated");
+
+      // delete it from receiver map
+      recv_thread_argmap.erase(recv_thread_arg_iter);
+
+      // then delete receiver arg structure
+      delete recv_thread_argp;
+    }
+  }
+
+  // delete entry from connection map
+
+  // cleanup sender thread
+  // no need to lock explicitly, because caller of cleanup_receiver_thread() must already locked
+  terminate_sender_thread(peer_assoc);
+
+  // delete the AssocData structure from the connection map
+  // also frees allocated AssocData structure
+  connmap.erase(peer_assoc);
+
+  // end critical section
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name,"cleanup_receiver_thread() - Cleanup receiver thread <" << thread_id << ">. Done.");
+}
+
+
+/* sends a stop message to the sender thread that belongs to the peer address given in assoc
+ * @note terminate_receiver_thread() should be only called when an outer lock ensures that assoc
+ *       is still valid, a lock is also required, because senderthread_queuemap is changed
+ */
+void 
+TPoverTLS_TCP::terminate_sender_thread(const AssocData* assoc)
+{
+  if (assoc == 0)
+  {
+    Log(ERROR_LOG,LOG_NORMAL,tpparam.name,"terminate_sender_thread() - assoc data == NULL");
+    return;
+  }
+
+  sender_thread_queuemap_t::iterator it= senderthread_queuemap.find(assoc->peer);
+
+  if (it != senderthread_queuemap.end())
+  { // we have a sender thread: send a stop message to it
+    FastQueue* destqueue= it->second; 
+    if (destqueue)
+    {
+      TPoverTLS_TCPMsg* internalmsg= new TPoverTLS_TCPMsg(assoc,tpparam.source,TPoverTLS_TCPMsg::stop);
+      if (internalmsg)
+      {
+	// send the internal message to the sender thread queue
+	internalmsg->send(tpparam.source,destqueue);
+      }
+    }
+    else
+    {
+      Log(WARNING_LOG,LOG_NORMAL,tpparam.name,"terminate_sender_thread() - found entry for address, but no sender thread. addr:" << assoc->peer);
+    }
+    // erase entry from map
+    senderthread_queuemap.erase(it);
+  }
+}
+
+/* terminate all active threads
+ * note: locking should not be necessary here because this message is called as last method from
+ * main_loop()
+ */
+void 
+TPoverTLS_TCP::terminate_all_threads()
+{
+  AssocData* assoc= 0;
+  receiver_thread_arg_t* terminate_argp;
+
+  for (recv_thread_argmap_t::iterator terminate_iterator=  recv_thread_argmap.begin();
+       terminate_iterator !=  recv_thread_argmap.end();
+       terminate_iterator++)
+  {
+    if ( (terminate_argp= terminate_iterator->second) != 0)
+    {
+      // we need a non const pointer to erase it later on
+      assoc= const_cast<AssocData*>(terminate_argp->peer_assoc);
+      // check whether thread is still alive
+      if (terminate_argp->terminated == false)
+      {
+	terminate_argp->sig_terminate= true;
+	// then wait for its termination
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, 
+	    "Signaled receiver thread <" << terminate_iterator->first << "> for termination");
+	
+	pthread_join(terminate_iterator->first, 0);
+	
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, "Thread <" << terminate_iterator->first  << "> is terminated");
+      }
+      else
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, 
+	    "Receiver thread <" << terminate_iterator->first << "> already terminated");
+	
+      // cleanup all remaining argument structures of terminated threads
+      delete terminate_argp;
+
+      // terminate any related sender thread that is still running
+      terminate_sender_thread(assoc);
+      
+      connmap.erase(assoc);
+      // delete assoc is not necessary, because connmap.erase() will do the job
+    }
+  } // end for
+}
+
+
+/**
+ * sender thread starter: 
+ * just a static starter method to allow starting the 
+ * actual sender_thread() method.
+ *
+ * @param argp - pointer to the current TPoverTLS_TCP object instance and receiver_thread_arg_t struct
+ */
+void*
+TPoverTLS_TCP::sender_thread_starter(void *argp)
+{
+  sender_thread_start_arg_t *sargp= static_cast<sender_thread_start_arg_t *>(argp);
+  
+  // invoke sender thread method
+  if (sargp != 0 && sargp->instance != 0)
+  {
+    // call receiver_thread member function on object instance
+    sargp->instance->sender_thread(sargp->sender_thread_queue);
+
+    // no longer needed
+    delete sargp;
+  }
+  else
+  {
+    Log(ERROR_LOG,LOG_CRIT,"sender_thread_starter","while starting sender_thread: 0 pointer to arg or object");
+  }
+  return 0;
+}
+
+
+
+
+/**
+ * receiver thread starter: 
+ * just a static starter method to allow starting the 
+ * actual receiver_thread() method.
+ *
+ * @param argp - pointer to the current TPoverTLS_TCP object instance and receiver_thread_arg_t struct
+ */
+void*
+TPoverTLS_TCP::receiver_thread_starter(void *argp)
+{
+  receiver_thread_start_arg_t *rargp= static_cast<receiver_thread_start_arg_t *>(argp);
+  // invoke receiver thread method
+  if (rargp != 0 && rargp->instance != 0)
+  {
+    // call receiver_thread member function on object instance
+    rargp->instance->receiver_thread(rargp->rtargp);
+
+    // no longer needed
+    delete rargp;
+  }
+  else
+  {
+    Log(ERROR_LOG,LOG_CRIT,"receiver_thread_starter","while starting receiver_thread: 0 pointer to arg or object");
+  }
+  return 0;
+}
+
+
+void
+TPoverTLS_TCP::create_new_sender_thread(FastQueue* senderfqueue)
+{
+  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "Starting new sender thread...");
+
+  pthread_t senderthreadid;
+  // create new thread; (arg == 0) is handled by thread, too
+  int pthread_status= pthread_create(&senderthreadid, 
+				     NULL, // NULL: default attributes: thread is joinable and has a 
+				     //       default, non-realtime scheduling policy
+				     TPoverTLS_TCP::sender_thread_starter,
+				     new sender_thread_start_arg_t(this,senderfqueue));
+  if (pthread_status)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "A new thread could not be created: " <<  strerror(pthread_status));
+    
+    delete senderfqueue;
+  }
+}
+
+
+void
+TPoverTLS_TCP::create_new_receiver_thread(AssocData* peer_assoc)
+{
+  receiver_thread_arg_t* argp= 
+    new(nothrow) receiver_thread_arg(peer_assoc);
+  
+  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "Starting new receiver thread...");
+
+  // create new thread; (arg == 0) is handled by thread, too
+  int pthread_status= pthread_create(&peer_assoc->thread_ID, 
+				     NULL, // NULL: default attributes: thread is joinable and has a 
+				     //       default, non-realtime scheduling policy
+				     receiver_thread_starter,
+				     new(nothrow) receiver_thread_start_arg_t(this,argp));
+  if (pthread_status)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "A new thread could not be created: " <<  strerror(pthread_status));
+    
+    delete argp;
+  }
+  else
+  {
+    lock(); // install_cleanup_thread_lock(TPoverTLS_TCP, this);
+
+    // remember pointer to thread arg structure
+    // thread arg structure should be destroyed after thread termination only
+    pair<recv_thread_argmap_t::iterator, bool> tmpinsiterator=
+      recv_thread_argmap.insert( pair<pthread_t,receiver_thread_arg_t*> (peer_assoc->thread_ID,argp) );
+    if (tmpinsiterator.second == false)
+    {
+      Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Thread argument could not be inserted into hashmap");
+    }
+    unlock(); // uninstall_cleanup(1);
+  }  
+}
+
+
+/**
+ * master listener thread starter: 
+ * just a static starter method to allow starting the 
+ * actual master_listener_thread() method.
+ *
+ * @param argp - pointer to the current TPoverTLS_TCP object instance
+ */
+void*
+TPoverTLS_TCP::master_listener_thread_starter(void *argp)
+{
+  // invoke listener thread method
+  if (argp != 0)
+  {
+    (static_cast<TPoverTLS_TCP*>(argp))->master_listener_thread();
+  }
+  return 0;
+}
+
+
+int 
+verify_callback(int ok, X509_STORE_CTX * store)
+{
+  if (!ok) {
+    ERRLog("TPoverTLS", color[red] << "Client cert check failed" << color[off]);
+  } else {
+    DLog("TPoverTLS", color[green] << "Client cert check OK" << color[off]);
+  };
+  return ok;
+}
+
+
+/**
+ * master listener thread: waits for incoming connections at the well-known tcp port
+ * when a connection request is received this thread spawns a receiver_thread for
+ * receiving packets from the peer at the new socket. 
+ */
+void
+TPoverTLS_TCP::master_listener_thread()
+{
+  // create a new address-structure for the listening masterthread
+  struct sockaddr_in6 own_address;
+  own_address.sin6_family = AF_INET6;
+  own_address.sin6_flowinfo= 0;
+  own_address.sin6_port = htons(tpparam.port); // use port number in param structure
+  // accept incoming connections on all interfaces 
+  own_address.sin6_addr = in6addr_any;
+  own_address.sin6_scope_id= 0;
+  
+  // create a listening socket
+  int master_listener_socket= socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
+  if (master_listener_socket == -1)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Could not create a new socket, error: " << strerror(errno));
+    return;
+  }
+  
+  // Disable Nagle Algorithm, set (TCP_NODELAY)
+  int nodelayflag= 1;
+  int status= setsockopt(master_listener_socket,
+			 IPPROTO_TCP,
+			 TCP_NODELAY,
+			 &nodelayflag,
+			 sizeof(nodelayflag));
+  if (status)
+  {
+    Log(ERROR_LOG,LOG_NORMAL,tpparam.name, "Could not set socket option TCP_NODELAY:" << strerror(errno));
+  }
+  
+  // Reuse ports, even if they are busy
+  int socketreuseflag= 1;
+  status= setsockopt(master_listener_socket,
+			   SOL_SOCKET,
+			   SO_REUSEADDR,
+			   (const char *) &socketreuseflag,
+			   sizeof(socketreuseflag));
+  if (status)
+  {
+       Log(ERROR_LOG,LOG_NORMAL,tpparam.name, "Could not set socket option SO_REUSEADDR:" << strerror(errno));
+  }
+  
+  
+  // bind the newly created socket to a specific address
+  int bind_status = bind(master_listener_socket,
+			 reinterpret_cast<struct sockaddr *>(&own_address),
+			 sizeof(own_address));
+  if (bind_status)
+    { 
+      Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Binding to " 
+	  << inet_ntop(AF_INET6, &own_address.sin6_addr, in6_addrstr_tls, INET6_ADDRSTRLEN)
+	  << " port " << tpparam.port << " failed, error: " << strerror(errno));
+      return;
+    }
+
+    // listen at the socket, 
+    // queuesize for pending connections= max_listen_queue_size
+    int listen_status = listen(master_listener_socket, max_listen_queue_size);
+    if (listen_status)
+    {
+      Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Listen at socket " << master_listener_socket 
+	  << " failed, error: " << strerror(errno));
+      return;
+    }
+    else
+    {
+      Log(INFO_LOG,LOG_NORMAL, tpparam.name, color[green] << "Listening at port #" << tpparam.port << color[off]);
+    }
+
+    // activate O_NON_BLOCK for accept (accept does not block)
+    fcntl(master_listener_socket,F_SETFL, O_NONBLOCK);
+
+    // create a pollfd struct for use in the mainloop
+    struct pollfd poll_fd;
+    poll_fd.fd = master_listener_socket;
+    poll_fd.events = POLLIN | POLLPRI; 
+    /*
+      #define POLLIN	0x001	// There is data to read. 
+      #define POLLPRI	0x002	// There is urgent data to read.  
+      #define POLLOUT	0x004	// Writing now will not block.  
+    */
+    
+    bool terminate = false;
+    // check for thread terminate condition using get_state()
+    state_t currstate= get_state();
+    int poll_status= 0;
+    const unsigned int number_poll_sockets= 1; 
+    struct sockaddr_in6 peer_address;
+    socklen_t peer_address_len;
+    int conn_socket;
+
+    // check whether this thread is signaled for termination
+    while(! (terminate= (currstate==STATE_ABORT || currstate==STATE_STOP) ) )
+    {
+      // wait on number_poll_sockets (main drm socket) 
+      // for the events specified above for sleep_time (in ms)
+      poll_status= poll(&poll_fd, number_poll_sockets, tpparam.sleep_time);
+      if (poll_fd.revents & POLLERR) // Error condition
+      {
+	if (errno != EINTR) 
+	{
+	  Log(ERROR_LOG,LOG_CRIT, tpparam.name, 
+	      "Poll caused error " << strerror(errno) << " - indicated by revents");
+	}
+	else
+	{
+	  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "poll(): " << strerror(errno));
+	}
+
+      }
+      if (poll_fd.revents & POLLHUP) // Hung up 
+      {
+	Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Poll hung up");
+	return;
+      }
+      if (poll_fd.revents & POLLNVAL) // Invalid request: fd not open
+      {
+	Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Poll Invalid request: fd not open");
+	return;
+      }
+      
+      switch (poll_status)
+      {
+	case -1:
+	  if (errno != EINTR)
+	  {
+	    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Poll status indicates error: " << strerror(errno));
+	  }
+	  else
+	  {
+	    Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "Poll status: " << strerror(errno));
+	  }
+	    
+	  break;
+
+	case 0:
+#ifdef DEBUG_HARD
+	  Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, 
+	      "Listen Thread - Poll timed out after " << tpparam.sleep_time << " ms.");
+#endif
+	  currstate= get_state();
+	  continue;
+	  break;
+
+	default:
+#ifdef DEBUG_HARD
+	  Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, "Poll: " << poll_status << " event(s) ocurred, of type " << poll_fd.revents);
+#endif
+	  break;
+      } // end switch
+
+      // after a successful accept call, 
+      // accept stores the address information of the connecting party
+      // in peer_address and the size of its address in addrlen
+      peer_address_len= sizeof(peer_address);
+
+      conn_socket = accept (master_listener_socket,
+			    reinterpret_cast<struct sockaddr *>(&peer_address),
+			    &peer_address_len);
+
+
+      if (conn_socket > -1) {
+
+	  // initialise SSL handshake, save ssl pointer in sslmap
+	  
+	  SSL_CTX *ssl_ctx_server = SSL_CTX_new(TLSv1_server_method());
+	  
+	  // Load client certificate
+	  if (SSL_CTX_use_certificate_chain_file(ssl_ctx_server, "client_cert.pem") != 1) {
+	      ERRCLog(tpparam.name, "Unable to load client certificate");
+	      this->abort_processing();
+	      
+	  }
+	  
+	  // Load private key
+	  if (SSL_CTX_use_PrivateKey_file(ssl_ctx_server, "client_privkey.pem", SSL_FILETYPE_PEM) != 1) {
+	    ERRCLog(tpparam.name, "Unable to load private Key, reason:" << SSLerrmessage());
+	      this->abort_processing();
+	  }
+	  
+	  // Verify private key
+	  if (SSL_CTX_load_verify_locations(ssl_ctx_server, "root_cert.pem", ".") != 1) {
+	      ERRCLog(tpparam.name, "Private Key failed verification against CA");
+	      this->abort_processing();
+	  }
+	  
+	  
+	  
+	  
+	  // We trust clients from this CA
+	  SSL_CTX_set_client_CA_list(ssl_ctx_server, SSL_load_client_CA_file("root_cert.pem"));
+	  
+	  // Enable (optional) client authentication
+	  SSL_CTX_set_verify(ssl_ctx_server, SSL_VERIFY_PEER, verify_callback);
+	  SSL_CTX_set_verify_depth(ssl_ctx_server, 4);
+	  
+	  SSL *ssl = SSL_new(ssl_ctx_server);
+	  
+	  SSL_set_fd(ssl, conn_socket);
+	  
+	  int result = SSL_accept(ssl);
+	  
+	  if (result==-1) ERRCLog(tpparam.name, "SSL connect failed");
+	  
+	  sslmap[conn_socket]=ssl;
+	  
+	  DLog(tpparam.name, "SSL handle saved for future use with that socket");
+	  
+      }
+
+      if (conn_socket == -1)
+      {
+	if (errno != EWOULDBLOCK && errno != EAGAIN)
+	{
+	  Log(ERROR_LOG,LOG_EMERG, tpparam.name, "Accept at socket " << master_listener_socket
+	      << " failed, error: " << strerror(errno));
+	  return;
+	}
+      }
+      else
+      {
+	// create a new assocdata-object for the new thread
+	AssocData* peer_assoc = NULL;
+	appladdress addr(peer_address, IPPROTO_TCP);
+
+	addr.set_protocol(prot_tls_tcp);
+
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, "<<--Received connect--<< request from " << addr.get_ip_str() 
+	    << " port #" << addr.get_port());
+
+	struct sockaddr_in6 own_address;
+	socklen_t own_address_len= sizeof(own_address);
+	getsockname(conn_socket, reinterpret_cast<struct sockaddr*>(&own_address), &own_address_len);
+
+	// AssocData will copy addr content into its own structure
+	// allocated peer_assoc will be stored in connmap
+	peer_assoc = new(nothrow) AssocData(conn_socket, addr, appladdress(own_address,IPPROTO_TCP));
+
+	bool insert_success= false;
+	if (peer_assoc)
+	{
+	  // start critical section
+	  lock(); // install_cleanup_thread_lock(TPoverTLS_TCP, this);
+	  insert_success= connmap.insert(peer_assoc);
+
+	  // end critical section
+	  unlock(); // uninstall_cleanup(1);
+	}
+	
+
+
+	
+	if (insert_success == false) // not inserted into connmap
+	{
+	  Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Cannot insert AssocData for socket " << conn_socket
+	      << ", " << addr.get_ip_str() << ", port #" 
+	      << addr.get_port() << " into connection map, aborting connection...");
+
+	  // abort connection, delete its AssocData
+	  close (conn_socket);
+	  if (peer_assoc) 
+	  { 
+	    delete peer_assoc;
+	    peer_assoc= 0;
+	  }
+	  return;
+		
+	} //end __else(connmap.insert());__
+	
+	// create a new thread for each new connection
+	create_new_receiver_thread(peer_assoc);
+      } // end __else (connsocket)__
+      
+      // get new thread state
+      currstate= get_state();
+
+    } // end while(!terminate)
+    return;
+} // end listen_for_connections()    
+
+
+TPoverTLS_TCP::~TPoverTLS_TCP()
+{
+  init= false;
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name,  "Destructor called");
+
+  QueueManager::instance()->unregister_queue(tpparam.source);
+}
+
+/** TPoverTLS_TCP Thread main loop.
+ * This loop checks for internal messages of either
+ * a send() call to start a new receiver thread, or,
+ * of a receiver_thread() that signals its own termination
+ * for proper cleanup of control structures.
+ * It also handles the following internal TPoverTLS_TCPMsg types:
+ * - TPoverTLS_TCPMsg::stop - a particular receiver thread is terminated
+ * - TPoverTLS_TCPMsg::start - a particular receiver thread is started
+ * @param nr number of current thread instance
+ */
+void 
+TPoverTLS_TCP::main_loop(uint32 nr)
+{
+    SSL_library_init();
+    OpenSSL_add_ssl_algorithms();
+    SSL_load_error_strings();
+
+    ssl_ctx=SSL_CTX_new(TLSv1_client_method());
+
+    if (!ssl_ctx)
+    {
+      ERRCLog(tpparam.name, "could not create SSL context: "<< SSLerrmessage());
+    }
+
+    // Load client certificate
+    if (SSL_CTX_use_certificate_chain_file(ssl_ctx, tpparam.client_cert_filename) != 1) {
+	ERRCLog(tpparam.name, "Unable to load client certificate: " << SSLerrmessage());
+    }
+    else
+    {
+      DLog(tpparam.name, color[green] << "Client certificate successfully loaded from " <<  tpparam.client_cert_filename << color[off]); 
+    }
+    
+    // Load private key
+    if (SSL_CTX_use_PrivateKey_file(ssl_ctx, tpparam.client_privkey_filename, SSL_FILETYPE_PEM) != 1) {
+	ERRCLog(tpparam.name, "Unable to load private Key: " << SSLerrmessage());
+    }
+    else
+    {
+      DLog(tpparam.name, color[green] << "Private key successfully loaded from " <<  tpparam.client_privkey_filename << color[off]); 
+    }
+    
+    // Verify private key
+    if (SSL_CTX_load_verify_locations(ssl_ctx, tpparam.root_cert_filename, ".") != 1) {
+	ERRCLog(tpparam.name, "Private Key failed verification against CA");
+    }
+    else
+    {
+      DLog(tpparam.name, color[green] << "Private key successfully verified as being certified by our CA " <<  tpparam.root_cert_filename << color[off]); 
+    }
+
+
+  // get internal queue for messages from receiver_thread
+  FastQueue* fq = get_fqueue();
+  if (!fq) 
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Cannot find message queue");
+    return;
+  } // end if not fq
+  // register queue for receiving internal messages from other modules
+  QueueManager::instance()->register_queue(fq,tpparam.source);
+
+
+
+  // start master listener thread
+  pthread_t master_listener_thread_ID;
+  int pthread_status= pthread_create(&master_listener_thread_ID, 
+				     NULL, // NULL: default attributes: thread is joinable and has a 
+				     //       default, non-realtime scheduling policy
+				     master_listener_thread_starter,
+				     this);
+  if (pthread_status)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, 
+	"New master listener thread could not be created: " <<  strerror(pthread_status));
+  }
+  else
+    DLog(tpparam.name, "Master listener thread started");
+
+
+  // define max latency for thread reaction on termination/stop signal
+  timespec wait_interval= { 0, 250000000L }; // 250ms
+  message* internal_thread_msg = NULL;
+  state_t currstate= get_state();
+
+  // check whether this thread is signaled for termination
+  while( currstate!=STATE_ABORT && currstate!=STATE_STOP )  
+  {
+    // poll internal message queue (blocking)
+    if ( (internal_thread_msg= fq->dequeue_timedwait(wait_interval)) != 0 )
+    {
+      TPoverTLS_TCPMsg* internalmsg= dynamic_cast<TPoverTLS_TCPMsg*>(internal_thread_msg);
+      if (internalmsg)
+      {
+	if (internalmsg->get_msgtype() == TPoverTLS_TCPMsg::stop)
+	{
+	  // a receiver thread terminated and signaled for cleanup by master thread
+	  AssocData* assocd= const_cast<AssocData*>(internalmsg->get_peer_assoc());
+	  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, "Got cleanup request for thread <" << assocd->thread_ID <<'>');
+	  lock();
+	  cleanup_receiver_thread( assocd );
+	  unlock();
+	}
+	else
+	if (internalmsg->get_msgtype() == TPoverTLS_TCPMsg::start)
+	{
+	  // start a new receiver thread
+	  create_new_receiver_thread( const_cast<AssocData*>(internalmsg->get_peer_assoc()) );
+	}
+	else
+	  Log(ERROR_LOG,LOG_CRIT, tpparam.name, "unexpected internal message:" << internalmsg->get_msgtype());
+	  
+	delete internalmsg;
+      }
+      else
+      {
+	Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Dynamic_cast failed - received unexpected and unknown internal message source "
+	    << internal_thread_msg->get_source());
+      }
+    } // endif
+
+    // get thread state
+    currstate= get_state();
+  } // end while
+
+  if (currstate==STATE_STOP)
+  {
+    // start abort actions
+    Log(INFO_LOG,LOG_NORMAL, tpparam.name, "Asked to abort, stopping all receiver threads");
+  } // end if stopped
+
+  // do not accept any more messages
+  fq->shutdown();
+  // terminate all receiver and sender threads that are still active 
+  terminate_all_threads();
+}
+
+} // end namespace protlib
+///@}
Index: /source/ariba/communication/modules/transport/protlib/tp_over_tls_tcp.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/tp_over_tls_tcp.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/tp_over_tls_tcp.h	(revision 2378)
@@ -0,0 +1,300 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file tp_over_tls_tcp.h
+/// Transport over TLS/TCP
+/// ----------------------------------------------------------
+/// $Id: tp_over_tls_tcp.h 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/tp_over_tls_tcp.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup transport
+ * @file tp_over_tls_tcp.h
+ * TP over TLS/TCP
+ */
+
+#ifndef TP_OVER_TLS_H
+#define TP_OVER_TLS_H
+
+#include <ext/hash_map>
+
+#include "tp.h"
+#include "threads.h"
+#include "threadsafe_db.h"
+#include "connectionmap.h"
+#include "assocdata.h"
+
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+#include <openssl/evp.h>
+
+
+namespace protlib 
+{
+
+/** this struct contains parameters that determine 
+  * the behavior of listener and receiver threads in TPoverTLS_TCP
+  * @param port - port number for master listener thread (server port)
+  * @param sleep - time (in ms) that listener and receiver wait at a poll() call
+  * @param d - destination module, where internal message are sent
+  */
+struct TPoverTLS_TCPParam : public ThreadParam 
+{
+  /// constructor
+  TPoverTLS_TCPParam(
+	const char* client_cert_filename,
+	const char* client_privkey_filename,
+	const char* root_cert_filename,
+        unsigned short common_header_length,
+	bool (*const getmsglength) (NetMsg& m, uint32& clen_bytes),
+	port_t p,
+	const char* threadname= "TPoverTLS_TCP",
+	uint32 sleep = ThreadParam::default_sleep_time,
+	bool debug_pdu = false,
+	message::qaddr_t source = message::qaddr_tp_over_tls_tcp,
+	message::qaddr_t dest = message::qaddr_signaling,
+	bool sendaborts = false,
+	uint8 tos = 0x10) :
+	ThreadParam(sleep,threadname,1,1),
+	port(p),
+	debug_pdu(debug_pdu),
+	source(source),
+	dest(dest),
+	common_header_length(common_header_length),
+	client_cert_filename(client_cert_filename),
+	client_privkey_filename(client_privkey_filename),
+	root_cert_filename(root_cert_filename),
+	getmsglength(getmsglength),
+	terminate(false),
+	ip_tos(tos)
+  {
+    
+    //set up SSL
+    ssl_ctx_client = SSL_CTX_new(TLSv1_client_method());
+    ssl_ctx_server = SSL_CTX_new(TLSv1_server_method());
+    
+  };
+
+  /// to bind master listener thread to
+  const port_t port;
+  bool debug_pdu;
+
+  /// message source
+  const message::qaddr_t source;
+  const message::qaddr_t dest;
+
+  /// what is the length of the common header
+  const unsigned short common_header_length;
+    
+  /// holds SSL context
+  SSL_CTX *ssl_ctx_client;
+  SSL_CTX *ssl_ctx_server;
+
+  const char* client_cert_filename;
+  const char* client_privkey_filename;
+  const char* root_cert_filename;
+  
+  /// function pointer to a function that figures out the msg length in number of 4 byte words
+  /// it returns false if error occured (e.g., malformed header), result is returned in variable clen_words
+  bool (*const getmsglength) (NetMsg& m, uint32& clen_words);
+  
+  /// should master thread terminate?
+  const bool terminate;
+  const uint8 ip_tos;
+}; // end TPoverTLS_TCPParam
+
+
+typedef hash_map<uint32, SSL*> sslmap_t;
+
+/// TP over TCP
+/** This class implements the TP interface using TCP. */
+class TPoverTLS_TCP : public TP, public Thread 
+{
+/***** inherited from TP *****/
+public:
+  /// sends a network message, spawns receiver thread if necessary
+  virtual void send(NetMsg* msg,const address& addr, bool use_existing_connection);
+  virtual void terminate(const address& addr);
+  
+  /***** inherited from Thread *****/
+public:
+  /// main loop
+  virtual void main_loop(uint32 nr);
+  
+/***** other members *****/
+public:
+  /// constructor
+  TPoverTLS_TCP(const TPoverTLS_TCPParam& p) :
+    TP(prot_tls_tcp,"TLS",p.name,p.common_header_length,p.getmsglength),
+    Thread(p), tpparam(p), already_aborted(false), msgqueue(NULL), debug_pdu(p.debug_pdu)
+  { 
+    // perform some initializing actions
+    // currently not required (SCTP had to init its library)
+    init= true; ///< init done;
+    
+    
+    sslmap.resize(128);
+
+  }
+  /// virtual destructor
+  virtual ~TPoverTLS_TCP();
+  
+  typedef
+  struct receiver_thread_arg
+  {
+    const AssocData* peer_assoc;
+    bool sig_terminate;
+    bool terminated;
+  public:
+    receiver_thread_arg(const AssocData* peer_assoc) : 
+      peer_assoc(peer_assoc), sig_terminate(false), terminated(true) {};
+  } receiver_thread_arg_t;
+  
+  class receiver_thread_start_arg_t
+  {
+  public:
+    TPoverTLS_TCP* instance;
+    receiver_thread_arg_t* rtargp;
+    
+    receiver_thread_start_arg_t(TPoverTLS_TCP* instance, receiver_thread_arg_t* rtargp) :
+      instance(instance), rtargp(rtargp) {};
+  };
+
+  class sender_thread_start_arg_t
+  {
+  public:
+    TPoverTLS_TCP* instance;
+    FastQueue* sender_thread_queue;
+    
+    sender_thread_start_arg_t(TPoverTLS_TCP* instance, FastQueue* sq) :
+      instance(instance), sender_thread_queue(sq) {};
+  };
+  
+private:
+  /// returns already existing connection or establishes a new one
+  AssocData* get_connection_to(const appladdress& addr);
+    
+  static const char *SSLerrmessage(void);
+
+  /// receiver thread for a specific socket
+  void sender_thread(void *argp);
+    
+  /// receiver thread for a specific socket
+  void receiver_thread(void *argp);
+    
+  /// send a message to the network via TCP+TLS
+  void tcptlssend(NetMsg* msg, appladdress* addr);
+    
+  /// sender thread starter for a specific socket
+  static void* sender_thread_starter(void *argp);
+    
+  /// receiver thread starter for a specific socket
+  static void* receiver_thread_starter(void *argp);
+    
+  /// a static starter method to invoke the actual main listener
+  static void* master_listener_thread_starter(void *argp);
+    
+  /// main listener thread procedure
+  void master_listener_thread();
+    
+  // create and start new sender thread
+  void create_new_sender_thread(FastQueue* senderqueue);
+    
+  // create and start new receiver thread
+  void create_new_receiver_thread(AssocData* peer_assoc);
+    
+  /// terminates particular thread
+  void stop_receiver_thread(AssocData* peer_assoc);
+    
+  /// cleans up thread management structures
+  void cleanup_receiver_thread(AssocData* peer_assoc);
+    
+  /// terminates a sender thread
+  void terminate_sender_thread(const AssocData* assoc);
+    
+  /// terminates all active receiver or sender threads
+  void terminate_all_threads();
+    
+  /// ConnectionMap instance for keeping track of all existing connections
+  ConnectionMap connmap;
+    
+    
+  /// SSL Context
+  SSL_CTX *ssl_ctx;
+   
+  /// store per receiver thread arguments, e.g. for signaling termination
+  typedef hash_map<pthread_t, receiver_thread_arg_t*> recv_thread_argmap_t;
+  recv_thread_argmap_t  recv_thread_argmap;
+
+  /// store sender thread related information
+  typedef hash_map<appladdress, FastQueue*> sender_thread_queuemap_t;
+  sender_thread_queuemap_t  senderthread_queuemap;
+    
+  /// parameters for main TPoverTLS_TCP thread
+  const TPoverTLS_TCPParam tpparam;
+    
+  /// did we already abort at thread shutdown
+  bool already_aborted;
+  /// message queue
+  FastQueue* msgqueue;
+    
+  bool debug_pdu;
+
+  /// holds socket<->SSL pointer assignment
+  sslmap_t sslmap;
+    
+}; // end class TPoverTLS_TCP
+
+/** A simple internal message for selfmessages
+ * please note that carried items may get deleted after use of this message 
+ * the message destructor does not delete any item automatically
+ */
+class TPoverTLS_TCPMsg : public message 
+{
+ public:
+  // message type start/stop thread, send data
+  enum msg_t { start, 
+	       stop,
+	       send_data
+  };
+
+ private:
+  const AssocData* peer_assoc;
+  const TPoverTLS_TCPMsg::msg_t type;
+  NetMsg* netmsg;
+  appladdress* addr;
+
+public:
+  TPoverTLS_TCPMsg(const AssocData* peer_assoc, message::qaddr_t source= qaddr_unknown, TPoverTLS_TCPMsg::msg_t type= stop) : 
+    message(type_transport, source), peer_assoc(peer_assoc), type(type), netmsg(0), addr(0)  {}
+
+  TPoverTLS_TCPMsg(NetMsg* netmsg, appladdress* addr, message::qaddr_t source= qaddr_unknown) : 
+    message(type_transport, source), peer_assoc(0), type(send_data), netmsg(netmsg), addr(addr) {}
+
+  const AssocData* get_peer_assoc() const { return peer_assoc; }
+  TPoverTLS_TCPMsg::msg_t get_msgtype() const { return type; }
+  NetMsg* get_netmsg() const { return netmsg; }
+  appladdress* get_appladdr() const { return addr; } 
+};
+
+} // end namespace protlib
+
+#endif
Index: /source/ariba/communication/modules/transport/protlib/tp_over_udp.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/tp_over_udp.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/tp_over_udp.cpp	(revision 2378)
@@ -0,0 +1,627 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file tp_over_udp.cpp
+/// UDP-based transport module
+/// ----------------------------------------------------------
+/// $Id: tp_over_udp.cpp 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/tp_over_udp.cpp $
+// ===========================================================
+//
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+
+extern "C"
+{
+  //#define _SOCKADDR_LEN    /* use BSD 4.4 sockets */
+#include <unistd.h>		/* gethostname */
+#include <sys/types.h>		/* network socket interface */
+#include <netinet/ip.h>         /* iphdr */
+#include <netinet/ip6.h>        /* ip6_hdr */
+#include <netinet/in.h>		/* network socket interface */
+#include <netinet/tcp.h>	/* for TCP Socket Option */
+#include <netinet/udp.h>	/* for UDP header */
+#include <sys/socket.h>
+#include <arpa/inet.h>		/* inet_addr */
+
+#include <fcntl.h>
+#include <sys/poll.h>
+}
+
+#include <iostream>
+#include <errno.h>
+#include <string>
+#include <sstream>
+
+#include "tp_over_udp.h"
+#include "threadsafe_db.h"
+#include "cleanuphandler.h"
+#include "setuid.h"
+#include "logfile.h"
+#include "linux/netfilter.h"
+
+#include <set>
+
+#define UDP_SUCCESS 0
+#define UDP_SEND_FAILURE 1
+
+#define BUFSIZE 2048000
+
+
+const unsigned int max_listen_queue_size = 10;
+
+namespace protlib
+{
+
+  using namespace log;
+
+/** @defgroup tpudp TP over UDP
+ * @ingroup network
+ * @{
+ */
+
+char in6_addrstr_loc[INET6_ADDRSTRLEN+1];
+
+/******* class TPoverUDP *******/
+
+
+/** generates an internal TPoverUDP message to send a NetMsg to the network
+ *
+ *  - the sending thread will call TPoverUDP::udpsend()
+ *  - since UDP is connectionless we can safely ignore the use_existing_connection attribute
+ *  @note the netmsg is deleted by the send() method when it is not used anymore
+ */
+void TPoverUDP::send (NetMsg * netmsg, const address & in_addr, bool use_existing_connection)
+{
+
+  appladdress* addr = NULL;
+  addr= dynamic_cast<appladdress*>(in_addr.copy());
+
+  if (!addr) return;
+
+  // Do it independently from master thread
+  udpsend(netmsg, addr);
+
+}
+
+/** sends a NetMsg to the network.
+ *
+ * @param netmsg   message to send
+ * @param addr     transport endpoint address
+ *
+ * @note           both parameters are deleted after the message was sent
+ */
+void
+TPoverUDP::udpsend (NetMsg * netmsg, appladdress * addr)
+{
+#ifndef _NO_LOGGING
+  const char *const thisproc = "sender   - ";
+#endif
+
+  // set result initially to success, set it to failure
+  // in places where these failures occur
+  int result = UDP_SUCCESS;
+  int ret = 0;
+
+
+  if (addr)
+    check_send_args (*netmsg, *addr);
+  else
+    {
+      ERRCLog (tpparam.name, thisproc << "address pointer is NULL");
+      result = UDP_SEND_FAILURE;
+      throw TPErrorInternal();
+    }
+
+
+  addr->convert_to_ipv6();
+  in6_addr ip6addr;
+
+  //convert to v4-mapped address if necessary! (we use dual-stack IPv4/IPv6 socket)
+  addr->get_ip(ip6addr);
+
+
+  // *********************************** revised socket code *********************************
+
+
+  // msghdr for sendmsg
+  struct msghdr header;
+
+  // pointer for ancillary data
+  struct cmsghdr *ancillary = NULL;
+
+  // iovec for sendmsg
+  struct iovec iov;
+  iov.iov_base = netmsg->get_buffer();
+  iov.iov_len = netmsg->get_size();
+
+  // destination address
+  struct sockaddr_in6 dest_address;
+  dest_address.sin6_family= AF_INET6;
+  dest_address.sin6_port  = htons(addr->get_port());
+  dest_address.sin6_addr  = ip6addr;
+  dest_address.sin6_flowinfo = 0;
+  dest_address.sin6_scope_id = 0;
+
+  // fill msghdr
+  header.msg_iov = &iov;
+  header.msg_iovlen = 1;
+  header.msg_name = &dest_address;
+  header.msg_namelen=sizeof(dest_address);
+  header.msg_control=NULL;
+  header.msg_controllen=0;
+
+
+  // pktinfo
+  in6_pktinfo pktinfo;
+
+  //addr->set_if_index(1);
+
+
+  // we have to add up to 2 ancillary data objects (for interface and hop limit)
+
+  uint32 buflength = 0;
+  if (addr->get_if_index()) {
+    buflength = CMSG_SPACE(sizeof(pktinfo));
+    //cout << "PKTINFO data object, total buffer size: " << buflength << "byte" << endl;
+  }
+
+  int hlim = addr->get_ip_ttl();
+
+  if (hlim) {
+    buflength = buflength + CMSG_SPACE(sizeof(int));
+    //cout << "HOPLIMIT data object, total buffer size: " << buflength << "byte" << endl;
+  }
+  // create the buffer
+  if ((addr->get_if_index()) || hlim) {
+    header.msg_control = malloc(buflength);
+    if (header.msg_control == 0)
+      ERRCLog(tpparam.name, thisproc << " malloc failed for ancillary data of size " << buflength);
+  }
+
+  // are we to set the outgoing interface?
+  if (addr->get_if_index()) {
+
+    DLog(tpparam.name, thisproc << " UDP send via Interface " << addr->get_if_index() << " requested.");
+
+    // first cmsghdr at beginning of buffer
+    ancillary = (cmsghdr*) header.msg_control;
+
+    ancillary->cmsg_level=IPPROTO_IPV6;
+    ancillary->cmsg_type=IPV6_PKTINFO;
+    ancillary->cmsg_len=CMSG_LEN(sizeof(pktinfo));
+
+    //cout << "Set up properties of ancillary data object 1" << endl;
+
+    pktinfo.ipi6_addr = in6addr_any;
+    pktinfo.ipi6_ifindex = addr->get_if_index();
+
+    memcpy (CMSG_DATA(ancillary), &pktinfo, sizeof(pktinfo));
+
+    //cout << "Set up data of ancillary data object 1" << endl;
+
+    // update msghdr controllen
+    header.msg_controllen = CMSG_SPACE(sizeof(pktinfo));
+
+  }
+
+  // should we set an explicit Hop Limit?
+  if (hlim) {
+    DLog(tpparam.name, thisproc << " UDP send with IP TTL of " << hlim << " requested.");
+
+    // second cmsghdr after first one
+    cmsghdr* ancillary2 = NULL;
+
+    if (ancillary) {
+      ancillary2 = (cmsghdr*) (ancillary + CMSG_SPACE(sizeof(pktinfo)));
+    } else {
+      ancillary2 = (cmsghdr*) header.msg_control;
+    }
+
+    ancillary2->cmsg_level=IPPROTO_IPV6;
+    ancillary2->cmsg_type=IPV6_HOPLIMIT;
+    ancillary2->cmsg_len = CMSG_LEN(sizeof(int));
+
+    memcpy(CMSG_DATA(ancillary2), &hlim, sizeof(int));
+
+    // update msghdr controllen
+    header.msg_controllen = header.msg_controllen + ancillary2->cmsg_len;
+
+  }
+
+#ifndef _NO_LOGGING
+  uint32 msgsize = netmsg->get_size();	// only used for logging below
+#endif
+
+  // check whether socket is already up and initialized by listener thread
+  // otherwise we may have a race condition, i.e., trying to send before socket is created
+  // FIXME: it may be the case that the socket is already created, but not bound
+  //        I'm not sure what happens, when we try to send...
+  while (master_listener_socket == -1)
+  {
+    const unsigned int sleeptime= 1;
+    DLog(tpparam.name, "socket not yet ready for sending - sending deferred (" << sleeptime << " s)");
+    sleep(sleeptime);
+    DLog(tpparam.name, "retrying to send");
+  }
+  // reset IP RAO option
+  ret = setsockopt(master_listener_socket, SOL_IP, IP_OPTIONS, 0, 0);
+  if ( ret != 0 )
+    ERRLog(tpparam.name, "unsetting IP options for IPv4 failed");
+
+  // send UDP packet
+  DLog(tpparam.name, "SEND to " << *addr);
+  ret= sendmsg(master_listener_socket,&header,MSG_DONTWAIT);
+
+  if (ret<0)
+    ERRCLog(tpparam.name, "Socket Send failed! - error (" << errno << "):" << strerror(errno));
+  if (debug_pdu)
+    {
+      ostringstream hexdump;
+      netmsg->hexdump (hexdump);
+      Log (DEBUG_LOG, LOG_NORMAL, tpparam.name,
+	   "PDU debugging enabled - Sent:" << hexdump.str ());
+    }
+
+  if (ret < 0)
+    {
+      result = UDP_SEND_FAILURE;
+      //    break;
+    } // end if (ret < 0)
+
+
+      // *** note: netmsg is deleted here ***
+  delete netmsg;
+
+
+  // Throwing an exception within a critical section does not
+  // unlock the mutex.
+
+  if (result != UDP_SUCCESS)
+    {
+      ERRLog(tpparam.name, thisproc << "UDP error, returns " << ret << ", error : " << strerror (errno));
+      delete addr;
+
+      throw TPErrorSendFailed();
+
+    }
+  else
+    Log (EVENT_LOG, LOG_NORMAL, tpparam.name,
+	 thisproc << ">>----Sent---->> message (" << msgsize <<
+	 " bytes) using socket " << master_listener_socket << " to " << *addr);
+
+  // *** delete address ***
+  delete addr;
+} // end TPoverUDP::udpsend
+
+
+
+/**
+ * IPv4 catcher thread starter:
+ * just a static starter method to allow starting the
+ * actual master_listener_thread() method.
+ *
+ * @param argp - pointer to the current TPoverUDP object instance
+ */
+void *
+TPoverUDP::listener_thread_starter (void *argp)
+{
+  // invoke listener thread method
+  if (argp != 0)
+    {
+	(static_cast < TPoverUDP * >(argp))->listener_thread ();
+    }
+  return 0;
+}
+
+
+
+
+
+/**
+ * UDP master receiver thread: waits for incoming connections at the well-known udp port
+ *
+ */
+void TPoverUDP::listener_thread ()
+{
+  // create a new address-structure for the listening masterthread
+  struct sockaddr_in6 own_address;
+  own_address.sin6_family = AF_INET6;
+  own_address.sin6_flowinfo= 0;
+  own_address.sin6_port = htons(tpparam.port); // use port number in param structure
+  // accept incoming connections on all interfaces
+  own_address.sin6_addr = in6addr_any;
+  own_address.sin6_scope_id= 0;
+
+  // create a listening socket
+  master_listener_socket= socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
+  if (master_listener_socket == -1)
+    {
+      ERRCLog(tpparam.name, "Could not create a new socket, error: " << strerror(errno));
+      return;
+    }
+
+  int socketreuseflag= 1;
+  int status= setsockopt(master_listener_socket,
+			 SOL_SOCKET,
+			 SO_REUSEADDR,
+			 (const char *) &socketreuseflag,
+			 sizeof(socketreuseflag));
+  if (status)
+  {
+    ERRCLog(tpparam.name, "Could not set socket option SO_REUSEADDR:" << strerror(errno));
+  }
+
+  // TODO: insert multicast socket options/calls here
+
+  // bind the newly created socket to a specific address
+  int bind_status = bind(master_listener_socket,
+			 reinterpret_cast<struct sockaddr *>(&own_address),
+			 sizeof(own_address));
+  if (bind_status)
+    {
+      ERRCLog(tpparam.name, "Binding to "
+	  << inet_ntop(AF_INET6, &own_address.sin6_addr, in6_addrstr_loc, INET6_ADDRSTRLEN)
+	  << " port " << tpparam.port << " failed, error: " << strerror(errno));
+      return;
+    }
+
+
+  // create a pollfd struct for use in the mainloop
+  struct pollfd poll_fd;
+  poll_fd.fd = master_listener_socket;
+  poll_fd.events = POLLIN | POLLPRI;
+  poll_fd.revents = 0;
+  /*
+    #define POLLIN	0x001	// There is data to read.
+    #define POLLPRI	0x002	// There is urgent data to read.
+    #define POLLOUT	0x004	// Writing now will not block.
+  */
+
+  bool terminate = false;
+  // check for thread terminate condition using get_state()
+  state_t currstate= get_state();
+  int poll_status= 0;
+  const unsigned int number_poll_sockets= 1;
+  struct sockaddr_in6 peer_address;
+  socklen_t peer_address_len;
+  // int conn_socket;
+
+  // check whether this thread is signaled for termination
+  while(! (terminate= (currstate==STATE_ABORT || currstate==STATE_STOP) ) )
+    {
+
+
+      // wait on number_poll_sockets (main drm socket)
+      // for the events specified above for sleep_time (in ms) tpparam.sleep_time
+      poll_status= poll(&poll_fd, number_poll_sockets, 250);
+      if (poll_fd.revents & POLLERR) // Error condition
+	{
+	  if (errno != EINTR)
+	    {
+	      ERRCLog(tpparam.name, "Poll caused error " << strerror(errno) << " - indicated by revents");
+	    }
+	  else
+	    {
+	      EVLog(tpparam.name, "poll(): " << strerror(errno));
+	    }
+
+	}
+      if (poll_fd.revents & POLLHUP) // Hung up
+	{
+	  ERRCLog(tpparam.name, "Poll hung up");
+	  return;
+	}
+      if (poll_fd.revents & POLLNVAL) // Invalid request: fd not open
+	{
+	  ERRCLog(tpparam.name, "Poll Invalid request: fd not open");
+	  return;
+	}
+
+      switch (poll_status)
+	{
+	case -1:
+	  if (errno != EINTR)
+	    {
+	      ERRCLog(tpparam.name, "Poll status indicates error: " << strerror(errno));
+	    }
+	  else
+	    {
+	      EVLog(tpparam.name, "Poll status: " << strerror(errno));
+	    }
+
+	  break;
+
+	case 0:
+#ifdef DEBUG_HARD
+	  Log(DEBUG_LOG,LOG_UNIMP, tpparam.name,
+	      "Listen Thread - Poll timed out after " << tpparam.sleep_time << " ms.");
+#endif
+	  currstate= get_state();
+	  continue;
+	  break;
+
+	default:
+#ifdef DEBUG_HARD
+	  Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, "Poll: " << poll_status << " event(s) ocurred, of type " << poll_fd.revents);
+#endif
+	  break;
+	} // end switch
+
+
+
+      //if there is data to read, do it
+
+      if ((poll_fd.revents & POLLIN) || (poll_fd.revents & POLLPRI)) {
+
+
+	// in peer_address and the size of its address in addrlen
+	peer_address_len= sizeof(peer_address);
+
+	//Build us a NetMsg
+	NetMsg *netmsg=0;
+	netmsg = new NetMsg (NetMsg::max_size);
+
+
+
+	/// receive data from socket buffer (recv will not block)
+	int ret = recvfrom (master_listener_socket,
+			    netmsg->get_buffer (), NetMsg::max_size, 0, reinterpret_cast<struct sockaddr *>(&peer_address),
+			    &peer_address_len);
+
+	if (ret)
+	{
+	  DLog(tpparam.name, "Yankeedoo, we received " << ret << " bytes of DATA!!");
+
+	  // truncate netmsg buffer
+	  netmsg->truncate(ret);
+	}
+
+	/**************************************************************
+	 *  The following restrictions should apply:                  *
+	 *                                                            *
+	 *  This is UDP, messages are contained in ONE datagram       *
+	 *  datagrams CANNOT fragment, as otherwise TCP is used       *
+	 *  so we now build a TPMsg, send it to signaling and         *
+	 *  all should be well. At least until now.                   *
+	 **************************************************************/
+
+	// Build peer_adr and own_addr
+	appladdress* peer_addr = new appladdress;
+	peer_addr->set_ip(peer_address.sin6_addr);
+	peer_addr->set_port(peer_address.sin6_port);
+	appladdress* own_addr = new appladdress();
+
+	// Log the sender peer and write to peer_addr
+	char source_addr[INET6_ADDRSTRLEN+1];
+	inet_ntop(AF_INET6, &peer_address.sin6_addr, source_addr, INET6_ADDRSTRLEN);
+
+
+	peer_addr->set_port(htons(peer_address.sin6_port));
+	peer_addr->set_ip(peer_address.sin6_addr);
+	peer_addr->set_protocol(get_underlying_protocol());
+
+	DLog(tpparam.name, "Peer: [" << *peer_addr << "]");
+
+	// create TPMsg and send it to the signaling thread
+	//fprintf (stderr, "Before TPMsg creation\n");
+	TPMsg *tpmsg=
+	  new (nothrow) TPMsg (netmsg, peer_addr, own_addr);
+
+	Log (DEBUG_LOG, LOG_NORMAL, tpparam.name,
+	     "recvthread - receipt of GIST PDU now complete, sending msg#" << tpmsg->get_id() << " to signaling module");
+
+
+	if (tpmsg == NULL || !tpmsg->send(tpparam.source, tpparam.dest))
+	  {
+	    ERRLog(tpparam.name, "rcvthread" << "Cannot allocate/send TPMsg");
+	    if (tpmsg)
+	      delete tpmsg;
+	    if (netmsg)
+	      delete netmsg;
+
+	  }
+
+      }
+
+      // get new thread state
+      currstate= get_state();
+
+    } // end while(!terminate)
+
+  return;
+
+}
+
+
+TPoverUDP::~TPoverUDP ()
+{
+  init = false;
+
+  Log (DEBUG_LOG, LOG_NORMAL, tpparam.name, "Destructor called");
+
+}
+
+/** TPoverUDP Thread main loop.
+ * This loop checks for internal messages of either
+ * a send() call to start a new receiver thread, or,
+ * of a receiver_thread() that signals its own termination
+ * for proper cleanup of control structures.
+ *
+ * @param nr number of current thread instance
+ */
+void
+TPoverUDP::main_loop (uint32 nr)
+{
+
+  int pthread_status = 0;
+
+
+  // start UDP listener thread
+  pthread_t listener_thread_ID;
+  pthread_status = pthread_create (&listener_thread_ID, NULL,	//NULL: default attributes
+				   listener_thread_starter, this);
+  if (pthread_status)
+    {
+      ERRCLog(tpparam.name,
+	   "UDP listening thread could not be created: " <<
+	   strerror (pthread_status));
+    }
+  else
+
+    Log(INFO_LOG,LOG_NORMAL, tpparam.name, color[green] << "Listening at port #" << tpparam.port << color[off]);
+
+
+
+  // define max latency for thread reaction on termination/stop signal
+  state_t currstate = get_state ();
+
+  // check whether this thread is signaled for termination
+  while (currstate != STATE_ABORT && currstate != STATE_STOP)
+    {
+
+      // get thread state
+      currstate = get_state ();
+
+      sleep(4);
+
+    }				// end while
+
+  if (currstate == STATE_STOP)
+    {
+      // start abort actions
+      Log (INFO_LOG, LOG_NORMAL, tpparam.name,
+	   "Asked to abort, stopping all receiver threads");
+    }				// end if stopped
+
+  // do not accept any more messages
+  // terminate all receiver and sender threads that are still active
+  //terminate_all_threads ();
+}
+
+
+void
+TPoverUDP::terminate(const address& addr)
+{
+	// no connection oriented protocol, nothing to terminate
+}
+
+}				// end namespace protlib
+
+///@}
Index: /source/ariba/communication/modules/transport/protlib/tp_over_udp.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/tp_over_udp.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/tp_over_udp.h	(revision 2378)
@@ -0,0 +1,205 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file tp_over_udp.h
+/// Transport over UDP
+/// ----------------------------------------------------------
+/// $Id: tp_over_udp.h 2718 2007-07-24 03:23:14Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/tp_over_udp.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup tpudp
+ * @ file
+ * TP over UDP
+ */
+
+#ifndef TP_OVER_UDP_H
+#define TP_OVER_UDP_H
+
+#include <ext/hash_map>
+
+#include "tp.h"
+#include "threads.h"
+#include "threadsafe_db.h"
+#include "connectionmap.h"
+#include "assocdata.h"
+
+namespace protlib 
+{
+/** this struct conatains parameters that determine 
+  * the behavior of listener and receiver threads in TPoverUDP
+  * @param port - port number for master listener thread (server port)
+  * @param sleep - time (in ms) that listener and receiver wait at a poll() call
+  * @param d - destination module, where internal message are sent
+  */
+struct TPoverUDPParam : public ThreadParam 
+{
+  /// constructor
+    TPoverUDPParam(
+		 unsigned short common_header_length,
+		 bool (*const getmsglength) (NetMsg& m, uint32& clen_words),
+		 port_t listen_port,
+		 uint32 sleep = ThreadParam::default_sleep_time,
+		 bool debug_pdu = false,
+		 message::qaddr_t source = message::qaddr_tp_over_udp,
+		 message::qaddr_t dest = message::qaddr_signaling,
+		 bool sendaborts = false,
+		 uint8 tos = 0x10) :
+    ThreadParam(sleep,"TPoverUDP",1,1),
+    port(listen_port),
+    debug_pdu(debug_pdu),
+    source(source),
+    dest(dest),
+    common_header_length(common_header_length),
+    getmsglength(getmsglength),
+    terminate(false),
+    ip_tos(tos)
+	{};
+
+    /// port to bind master listener thread to
+    const port_t port;
+    bool debug_pdu;
+    /// message source
+    const message::qaddr_t source;
+    const message::qaddr_t dest;
+    /// what is the length of the common header
+    const unsigned short common_header_length;
+    
+    /// function pointer to a function that figures out the msg length in number of 4 byte words
+    /// it returns false if error occured (e.g., malformed header), result is returned in variable clen_words
+    bool (*const getmsglength) (NetMsg& m, uint32& clen_words);
+    
+    /// should master thread terminate?
+    const bool terminate;
+    const uint8 ip_tos;
+    
+    bool (*rao_lookup) (uint32);
+    
+    
+}; // end TPoverUDPParam
+    
+
+/// TP over UDP
+/** This class implements the TP interface using UDP. */
+class TPoverUDP : public TP, public Thread 
+{
+/***** inherited from TP *****/
+public:
+  /// sends a network message, spawns receiver thread if necessary
+  virtual void send(NetMsg* msg, const address& addr, bool use_existing_connection);
+  virtual void terminate(const address& addr);
+  
+  /***** inherited from Thread *****/
+public:
+  /// main loop
+  virtual void main_loop(uint32 nr);
+  
+/***** other members *****/
+public:
+  /// constructor
+  TPoverUDP(const TPoverUDPParam& p) :
+    TP(tsdb::getprotobyname("udp"),"udp",p.name,p.common_header_length,p.getmsglength),
+    Thread(p), tpparam(p), already_aborted(false), msgqueue(NULL), debug_pdu(p.debug_pdu),
+    master_listener_socket(-1)
+  { 
+    // perform some initializing actions
+    // currently not required (SCTP had to init its library)
+    init= true; ///< init done;
+  }
+  /// virtual destructor
+  virtual ~TPoverUDP();
+
+  class sender_thread_start_arg_t
+  {
+  public:
+    TPoverUDP* instance;
+    FastQueue* sender_thread_queue;
+    
+    sender_thread_start_arg_t(TPoverUDP* instance, FastQueue* sq) :
+      instance(instance), sender_thread_queue(sq) {};
+  };
+
+  int get_listener_socket() const { return master_listener_socket; }
+  
+private:
+
+
+  /// send a message to the network via UDP
+  void udpsend(NetMsg* msg, appladdress* addr);
+  
+  /// a static starter method to invoke the listener thread
+  static void* listener_thread_starter(void *argp);
+
+  /// listener thread procedure
+  void listener_thread();
+
+  /// terminates all active receiver or sender threads
+  void terminate_all_threads();
+  
+  /// parameters for main TPoverUDP thread
+  const TPoverUDPParam tpparam;
+  
+  /// did we already abort at thread shutdown
+  bool already_aborted;
+  /// message queue
+  FastQueue* msgqueue;
+  
+  bool debug_pdu;
+
+  int master_listener_socket;
+
+}; // end class TPoverUDP
+
+/** A simple internal message for selfmessages
+ * please note that carried items may get deleted after use of this message 
+ * the message destructor does not delete any item automatically
+ */
+class TPoverUDPMsg : public message 
+{
+ public:
+  // message type start/stop thread, send data
+  enum msg_t { start, 
+	       stop,
+	       send_data
+  };
+
+ private:
+  const AssocData* peer_assoc;
+  const TPoverUDPMsg::msg_t type;
+  NetMsg* netmsg;
+  appladdress* addr;
+
+public:
+  TPoverUDPMsg(const AssocData* peer_assoc, message::qaddr_t source= qaddr_unknown, TPoverUDPMsg::msg_t type= stop) : 
+    message(type_transport, source), peer_assoc(peer_assoc), type(type), netmsg(0), addr(0)  {}
+
+  TPoverUDPMsg(NetMsg* netmsg, appladdress* addr, message::qaddr_t source= qaddr_unknown) : 
+    message(type_transport, source), peer_assoc(0), type(send_data), netmsg(netmsg), addr(addr) {}
+
+  const AssocData* get_peer_assoc() const { return peer_assoc; }
+  TPoverUDPMsg::msg_t get_msgtype() const { return type; }
+  NetMsg* get_netmsg() const { return netmsg; }
+  appladdress* get_appladdr() const { return addr; } 
+};
+
+} // end namespace protlib
+
+#endif
Index: /source/ariba/communication/modules/transport/protlib/tp_over_uds.cpp
===================================================================
--- /source/ariba/communication/modules/transport/protlib/tp_over_uds.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/tp_over_uds.cpp	(revision 2378)
@@ -0,0 +1,1651 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file tp_over_uds.cpp
+/// transport module for unix domain socket communication
+/// ----------------------------------------------------------
+/// $Id: tp_over_uds.cpp 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/src/tp_over_uds.cpp $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+ 
+extern "C"
+{
+  //#define _SOCKADDR_LEN    /* use BSD 4.4 sockets */
+#include <unistd.h>      /* gethostname */
+#include <sys/types.h>   /* network socket interface */
+#include <netinet/in.h>  /* network socket interface */
+#include <netinet/tcp.h> /* for TCP Socket Option */
+#include <sys/socket.h>
+#include <arpa/inet.h>   /* inet_addr */
+
+#include <fcntl.h>
+#include <sys/poll.h>
+#include <sys/un.h>
+}
+
+#include <iostream>
+#include <errno.h>
+#include <string>
+#include <sstream>
+
+#include "tp_over_uds.h"
+#include "threadsafe_db.h"
+#include "cleanuphandler.h"
+#include "setuid.h"
+#include "queuemanager.h"
+#include "logfile.h"
+
+#include <set>
+
+#define UDS_SUCCESS 0
+#define UDS_SEND_FAILURE 1
+
+const unsigned int max_listen_queue_size= 10;
+
+namespace protlib {
+
+using namespace log;
+
+/** @defgroup tpuds TP over UDS
+ * @ingroup network
+ * @{
+ */
+
+
+/******* class TPoverUDS *******/
+
+
+/** get_connection_to() checks for already existing connections. 
+ *  If a connection exists, it returns "AssocData" 
+ *  and saves it in "connmap" for further use
+ *  If no connection exists, a new connection to "addr"
+ *  is created.
+ */
+AssocDataUDS* 
+TPoverUDS::get_connection_to(udsaddress& addr)
+{
+  // get timeout
+  struct timespec ts;
+  get_time_of_day(ts);
+  ts.tv_nsec+= tpparam.sleep_time * 1000000L;
+  if (ts.tv_nsec>=1000000000L)
+  {
+    ts.tv_sec += ts.tv_nsec / 1000000000L;
+    ts.tv_nsec= ts.tv_nsec % 1000000000L;
+  }
+
+  // create a new AssocData pointer, initialize it to NULL
+  AssocDataUDS* assoc= NULL;
+  int new_socket;
+  // loop until timeout is exceeded: TODO: check applicability of loop
+  do 
+  {
+    // check for existing connections to addr
+    // start critical section
+    lock(); // install_cleanup_thread_lock(TPoverUDS, this);
+    assoc= connmap.lookup(addr);
+    // end critical section
+    unlock(); // uninstall_cleanup(1);
+    if (assoc) 
+    {
+      // If not shut down then use it, else abort, wait and check again.
+      if (!assoc->shutdown) 
+      {
+	return assoc;
+      }
+      else
+      {
+	// TODO: connection is already in shutdown mode. What now?
+	Log(ERROR_LOG,LOG_CRIT,tpparam.name,"socket exists, but is already in mode shutdown");
+
+	return 0;
+      }  
+    } //end __if (assoc)__
+    else 
+    {
+      Log(DEBUG_LOG,LOG_UNIMP,tpparam.name,"No existing connection to " 
+	  << addr << " found, creating a new one.");
+    }
+
+    // no connection found, create a new one
+    new_socket = socket(AF_UNIX, SOCK_STREAM, 0);
+    if (new_socket == -1)
+    {
+      Log(ERROR_LOG,LOG_CRIT,tpparam.name,"Couldn't create a new socket: " << strerror(errno));
+
+      return 0;
+    }
+    
+    // Reuse ports, even if they are busy
+    int socketreuseflag= 1;
+    int status= setsockopt(new_socket,
+			   SOL_SOCKET,
+			   SO_REUSEADDR,
+			   (const char *) &socketreuseflag,
+			   sizeof(socketreuseflag));
+    if (status)
+    {
+        Log(ERROR_LOG,LOG_NORMAL,tpparam.name, "Could not set socket option SO_REUSEADDR:" << strerror(errno));
+    }
+
+    struct sockaddr_un dest_address;
+    dest_address.sun_family= AF_UNIX;
+    strcpy(dest_address.sun_path, addr.get_udssocket().c_str());
+      
+    // connect the socket to the destination address
+    int connect_status = connect(new_socket,
+				 reinterpret_cast<const struct sockaddr*>(&dest_address),
+				 sizeof(dest_address));
+
+    // connects to the listening_port of the peer's masterthread    
+    if (connect_status != 0)
+    {
+	Log(ERROR_LOG,LOG_NORMAL, tpparam.name,"Connect to " << addr.get_udssocket() << "failed: [" << color[red] << strerror(errno) << color[off] << "]");
+      
+      throw TPErrorConnectSetupFail();
+    }
+
+    
+    //struct sockaddr_un own_address;
+    //socklen_t own_address_len= sizeof(own_address);
+    //getsockname(new_socket, reinterpret_cast<struct sockaddr*>(&own_address), &own_address_len);
+
+    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name,">>--Connect-->> to " << addr << " from " << udsaddress(new_socket));
+    
+    // create new AssocData record (will copy addr)
+    assoc = new(nothrow) AssocDataUDS(new_socket, addr, udsaddress(new_socket));
+
+    // if assoc could be successfully created, insert it into ConnectionMap
+    if (assoc) 
+    {
+      bool insert_success= false;
+      // start critical section
+      lock(); // install_cleanup_thread_lock(TPoverUDS, this);
+      // insert AssocData into connection map
+      insert_success= connmap.insert(assoc);
+      // end critical section
+      unlock(); // uninstall_cleanup(1);
+
+      if (insert_success == true) 
+      {
+#ifdef _DEBUG
+	Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, "Connected to " << addr << " via socket " << new_socket);
+
+		
+#endif
+
+	// notify master thread to start a receiver thread (i.e. send selfmessage)
+	TPoverUDSMsg* newmsg= new(nothrow)TPoverUDSMsg(assoc, tpparam.source, TPoverUDSMsg::start);
+	if (newmsg)
+	{
+	  newmsg->send_to(tpparam.source);
+	  return assoc;
+	}
+	else
+	  Log(ERROR_LOG,LOG_CRIT,tpparam.name,"get_connection_to: could not get memory for internal msg");
+      } 
+      else 
+      {
+	// delete data and abort
+	Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Cannot insert AssocData for socket " << new_socket << ", "<< addr << " into connection map, aborting connection");
+		
+	// abort connection, delete its AssocData
+	close (new_socket);
+	if (assoc) 
+	{ 
+	  delete assoc; 
+	  assoc= 0;
+	}
+	return assoc;
+      } // end else connmap.insert			
+      
+    } // end "if (assoc)"
+  } 
+  while (wait_cond(ts)!=ETIMEDOUT);
+
+  return assoc;
+} //end get_connection_to
+
+
+/** terminates a signaling association/connection
+ *  - if no connection exists, generate a warning
+ *  - otherwise: generate internal msg to related receiver thread
+ */
+void
+TPoverUDS::terminate(const address& in_addr)
+{
+
+    udsaddress* addr = NULL;
+    addr = dynamic_cast<udsaddress*>(in_addr.copy());
+
+#ifndef _NO_LOGGING
+  const char *const thisproc="terminate()   - ";
+#endif
+
+  // Create a new AssocData-pointer 
+  AssocDataUDS* assoc = NULL;
+
+  // check for existing connections to addr
+
+  // start critical section:
+  // please note if receiver_thread terminated already, the assoc data is not
+  // available anymore therefore we need a lock around cleanup_receiver_thread()
+
+  lock(); // install_cleanup_thread_lock(TPoverUDS, this);
+  assoc= connmap.lookup(*addr);
+  if (assoc) 
+  {
+    Log(EVENT_LOG,LOG_NORMAL,tpparam.name,thisproc<<"got request to shutdown connection for peer " << addr);
+    // If not shut down then use it, else abort, wait and check again.
+    if (!assoc->shutdown) 
+    {
+      if (assoc->socketfd)
+      {
+	// disallow sending
+	if (shutdown(assoc->socketfd,SHUT_WR))
+	{
+	  Log(ERROR_LOG,LOG_UNIMP,tpparam.name,thisproc<<"shutdown (write) on socket for peer " << addr << " returned error:" << strerror(errno));
+	}
+	else
+        {
+	  Log(EVENT_LOG,LOG_NORMAL,tpparam.name,thisproc<<"initiated closing of connection for peer " << addr << ". Shutdown (write) on socket "<< assoc->socketfd );	  
+	}
+      }
+      assoc->shutdown= true;
+    }
+    else
+      Log(EVENT_LOG,LOG_NORMAL,tpparam.name,thisproc<<"connection for peer " << addr << " is already in mode shutdown");
+      
+  }
+  else
+    Log(WARNING_LOG,LOG_NORMAL,tpparam.name,thisproc<<"could not find a connection for peer " << addr);
+
+  stop_receiver_thread(assoc);
+
+  // end critical section
+  unlock(); // uninstall_cleanup(1);
+
+  if (addr) delete addr;
+
+}
+
+
+/** generates and internal TPoverUDS message to send a NetMsg to the network
+ *
+ *  - it is necessary to let a thread do this, because the caller
+ *     may get blocked if the connect() or send() call hangs for a while
+ *  - the sending thread will call TPoverUDS::udssend()
+ *  - if no connection exists, creates a new one
+ *
+ *  @note the netmsg is deleted by the send() method when it is not used anymore
+ */
+void
+TPoverUDS::send(NetMsg* netmsg, const address& in_addr, bool use_existing_connection)
+{
+    if (netmsg == NULL) {
+      ERRCLog(tpparam.name,"send() - called without valid NetMsg buffer (NULL)");
+      return;
+    }
+
+    udsaddress* addr = NULL;
+    addr = dynamic_cast<udsaddress*>(in_addr.copy());
+
+    if (!addr)
+    {
+      ERRCLog(tpparam.name,"send() - given destination address is not of expected type (udsaddress), has type: " << (int) in_addr.get_type());
+      return;
+    }
+
+
+  // lock due to sendermap access
+  lock();
+
+
+  // check for existing sender thread
+  sender_thread_queuemap_t::const_iterator it= senderthread_queuemap.find(*addr);
+
+  FastQueue* destqueue= 0;
+
+  if (it == senderthread_queuemap.end())
+  { // no sender thread so far
+
+    if (!use_existing_connection)
+    { // it is allowed to create a new connection for this thread
+
+      // create a new queue for sender thread
+      FastQueue* sender_thread_queue= new FastQueue;
+      create_new_sender_thread(sender_thread_queue);
+      // remember queue for later use
+    
+      //pair<sender_thread_queuemap_t::iterator, bool> tmpinsiterator=
+      senderthread_queuemap.insert( pair<udsaddress,FastQueue*> (*addr,sender_thread_queue) );
+
+      destqueue= sender_thread_queue;
+    }
+  }
+  else
+  { // we have a sender thread, use stored queue from map
+    destqueue= it->second; 
+  }
+
+  unlock();
+   
+  // send a send_data message to it (if we have a destination queue)
+  if (destqueue)
+  {
+    // both parameters will be freed after message was sent!
+    
+      //DLog(tpparam.name, "Sending self-message for socket " << addr->get_udssocket().c_str());
+
+      TPoverUDSMsg* internalmsg= new TPoverUDSMsg(netmsg,addr->copy());
+      if (internalmsg)
+      {
+	  //DLog(tpparam.name, "Address in internal message: " << internalmsg->get_appladdr()->get_udssocket());
+          // send the internal message to the sender thread queue
+	  internalmsg->send(tpparam.source,destqueue);
+      }
+  }
+  else
+  {
+    if (!use_existing_connection)
+      WLog(tpparam.name,"send() - found entry for address, but no active sender thread available for peer addr:" << *addr << " - dropping data");
+    else
+      DLog(tpparam.name,"no active sender thread found " << *addr << " - but policy forbids to set up a new connection, will drop data");
+     
+    // cannot send data, so we must drop it
+    delete netmsg;
+  }
+
+  if (addr) delete addr;
+}
+
+/** sends a NetMsg to the network.
+ *
+ * @param netmsg - message to send
+ * @param addr   - transport endpoint address 
+ *
+ * @note if no connection exists, creates a new one 
+ * @note both parameters are deleted after the message was sent
+ */
+void
+TPoverUDS::udssend(NetMsg* netmsg, udsaddress* addr)
+{                        
+#ifndef _NO_LOGGING
+  const char *const thisproc="sender   - ";
+#endif
+
+  // set result initially to success, set it to failure
+  // in places where these failures occur
+  int result = UDS_SUCCESS;
+  int ret= 0;
+
+  // Create a new AssocData-pointer 
+  AssocDataUDS* assoc = NULL;
+  
+  // tp.cpp checks for initialisation of tp and correctness of
+  // msgsize, protocol and ip,
+  // throws an error if something is not right
+  if (addr) {
+      if (!(addr->get_udssocket().size() || addr->get_socknum())) {
+	  ERRCLog(tpparam.name, "No UNIX Domain Socket Path / Socket Number in address, will not process it: " << addr->get_udssocket());
+	  return;
+      }
+  } else {
+      Log(ERROR_LOG,LOG_CRIT, tpparam.name, thisproc << "address pointer is NULL");
+      result= UDS_SEND_FAILURE;    
+      throw TPErrorInternal();
+  }
+    
+
+
+  // check for existing connections, 
+  // if a connection exists, return its AssocData 
+  // and save it in assoc for further use
+  // if no connection exists, create a new one (in get_connection_to()).
+  // Connection is inserted into connection map that must be done
+  // with exclusive access
+  assoc= get_connection_to(*addr);
+
+  if (assoc==NULL || assoc->socketfd<=0)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, thisproc << "no valid assoc/socket data");
+
+    delete netmsg;
+    delete addr;
+    return;
+  }
+  if (assoc->shutdown)
+  {
+    Log(WARNING_LOG, LOG_ALERT, tpparam.name, thisproc << "should send message although connection already half closed");
+    delete netmsg;
+    delete addr;
+
+    throw TPErrorSendFailed();
+  }
+
+  uint32 msgsize= netmsg->get_size();
+#ifdef DEBUG_HARD
+  cerr << thisproc << "message size=" << netmsg->get_size() << endl;
+#endif
+
+  // send all the data contained in netmsg to the socket
+  // which belongs to the address "addr"
+  for (uint32 bytes_sent= 0;
+       bytes_sent < msgsize;
+       bytes_sent+= ret)
+  {
+
+#ifdef _DEBUG_HARD
+    for (uint32 i=0;i<msgsize;i++)
+    {
+      cout << "send_buf: " << i << " : "; 
+      if ( isalnum(*(netmsg->get_buffer()+i)) )
+	cout << "'" << *(netmsg->get_buffer()+i) << "' (0x" << hex << (unsigned short) *(netmsg->get_buffer()+i) << dec << ")" ;
+      else
+	cout << "0x" << hex << (unsigned short) *(netmsg->get_buffer()+i) << dec;
+      cout << endl;
+    }
+
+    cout << endl;
+    cout << "bytes_sent: " << bytes_sent << endl;
+    cout << "Message size: " <<  msgsize << endl;
+    cout << "Send-Socket: " << assoc->socketfd << endl;
+    cout << "pointer-Offset. " << netmsg->get_pos() << endl;
+    cout << "vor send " << endl;
+#endif
+
+    // socket send
+    ret= ::send(assoc->socketfd, 
+		netmsg->get_buffer() + bytes_sent,  
+		msgsize - bytes_sent, 
+		MSG_NOSIGNAL);
+
+    //send_buf + bytes_sent
+
+    if (debug_pdu)
+    {
+      ostringstream hexdump;
+      netmsg->hexdump(hexdump,netmsg->get_buffer(),bytes_sent);
+      Log(DEBUG_LOG,LOG_NORMAL,tpparam.name,"PDU debugging enabled - Sent:" << hexdump.str());
+    }
+
+    if (ret < 0) 
+    {
+      result= UDS_SEND_FAILURE;
+      break;
+    } // end if (ret < 0)
+  } // end for
+
+
+  // *** note: netmsg is deleted here ***
+  delete netmsg;
+  
+  // Throwing an exception within a critical section does not 
+  // unlock the mutex.
+
+  if (result != UDS_SUCCESS)
+  {
+    Log(ERROR_LOG,LOG_NORMAL, tpparam.name, thisproc << "Unix Domain Socket error, returns " << ret << ", error : " << strerror(errno));
+    delete addr;
+
+    throw TPErrorSendFailed();
+    
+    // There is no special errorcode for sending failed
+    // in tp.h, there are only these:
+    /*
+      ERROR_BAD_ADDRESS,
+      ERROR_BAD_NETMSG,
+      ERROR_NOT_INIT,
+      ERROR_UNREACHABLE,
+      ERROR_INTERNAL,
+      ERROR_PAYLOAD
+    */
+  }
+  else
+    Log(EVENT_LOG,LOG_NORMAL,tpparam.name, thisproc << ">>----Sent---->> message (" << msgsize << " bytes) using socket " << assoc->socketfd  << " to " << *addr);
+
+  if (!assoc) {
+    // no connection
+    
+    Log(ERROR_LOG,LOG_NORMAL, tpparam.name, thisproc << "cannot get connection to " << *addr);
+
+    delete addr;
+
+    throw TPErrorUnreachable(); // should be no assoc found
+  } // end "if (!assoc)"
+  
+  // *** delete address ***
+  delete addr;
+}
+  
+/* this thread waits for an internal message that either:
+ * - requests transmission of a packet
+ * - requests to stop this thread
+ * @param argp points to the thread queue for internal messages
+ */
+void 
+TPoverUDS::sender_thread(void *argp)
+{
+#ifndef _NO_LOGGING
+  const char *const methodname="senderthread - ";
+#endif
+
+  message* internal_thread_msg = NULL;
+
+  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, methodname << "starting as thread <" << pthread_self() << ">");
+
+  FastQueue* fq= reinterpret_cast<FastQueue*>(argp);
+  if (!fq)
+  {
+    Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "thread <" << pthread_self() << "> no valid pointer to msg queue. Stop.");
+    return;
+  }
+
+  bool terminate= false;
+  TPoverUDSMsg* internalmsg= 0;
+  while (terminate==false && (internal_thread_msg= fq->dequeue()) != 0 )
+  {
+    internalmsg= dynamic_cast<TPoverUDSMsg*>(internal_thread_msg);
+    
+    if (internalmsg == 0)
+    {
+      Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "received not an TPoverUDSMsg but a" << internal_thread_msg->get_type_name());      
+    }
+    else
+    if (internalmsg->get_msgtype() == TPoverUDSMsg::send_data)
+    {
+      
+	//DLog(tpparam.name, "Got a send request for socket " << *(internalmsg->get_appladdr()));
+
+      // create a connection if none exists and send the netmsg
+      if (internalmsg->get_netmsg() && internalmsg->get_udsaddr())
+      {
+	udssend(internalmsg->get_netmsg(),internalmsg->get_udsaddr());
+      }
+      else
+      {
+	Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "problem with passed arguments references, they point to 0");
+      } 
+    }
+    else
+    if (internalmsg->get_msgtype() == TPoverUDSMsg::stop)
+    {
+      terminate= true;
+    }  
+  } // end while
+  
+  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, methodname << "<" << pthread_self() << "> terminated connection.");
+}
+
+
+/** receiver thread listens at a TCP socket for incoming PDUs 
+ *  and passes complete PDUs to the coordinator. Incomplete
+ *  PDUs due to aborted connections or buffer overflows are discarded.
+ *  @param argp - assoc data and flags sig_terminate and terminated
+ *  
+ *  @note this is a static member function, so you cannot use class variables
+ */
+void 
+TPoverUDS::receiver_thread(void *argp)
+{
+#ifndef _NO_LOGGING
+  const char *const methodname="receiver - ";
+#endif
+  receiver_thread_arg_t *receiver_thread_argp= static_cast<receiver_thread_arg_t *>(argp);
+  const udsaddress* peer_addr = NULL;
+  const udsaddress* own_addr = NULL;
+  uint32 bytes_received = 0;
+  TPMsg* tpmsg= NULL;
+  
+  // argument parsing - start
+  if (receiver_thread_argp == 0)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "No arguments given at start of receiver thread <" << pthread_self() << ">, exiting.");
+
+    return;
+  }
+  else
+  {
+    // change status to running, i.e., not terminated
+    receiver_thread_argp->terminated= false;
+
+#ifdef _DEBUG
+    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname << "New receiver thread <" << pthread_self() << "> started. ");
+#endif
+  }
+
+  int conn_socket= 0;
+  if (receiver_thread_argp->peer_assoc)
+  {
+    // get socket descriptor from arg
+    conn_socket = receiver_thread_argp->peer_assoc->socketfd;
+    // get pointer to peer address of socket (source/sender address of peer) from arg
+    peer_addr= &receiver_thread_argp->peer_assoc->peer;
+    own_addr= &receiver_thread_argp->peer_assoc->ownaddr;
+  }
+  else
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "No peer assoc available - pointer is NULL");
+    
+    return;
+  }
+
+  if (peer_addr == 0)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "No peer address available for socket " << conn_socket << ", exiting.");
+    
+    return;
+  }
+  // argument parsing - end
+#ifdef _DEBUG
+  Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname <<
+      "Preparing to wait for data at socket " 
+      << conn_socket << " from " << receiver_thread_argp->peer_assoc->peer);
+#endif
+
+  int ret= 0;
+  uint32 msgcontentlength= 0;
+  bool msgcontentlength_known= false;
+  bool pdu_complete= false; // when to terminate inner loop
+
+  /* maybe use this to create a new pdu, 
+    /// constructor
+    contextlistpdu(type_t t, subtype_t st, uint32 fc, uint32 numobj = 0);
+  */ 
+
+  // activate O_NON_BLOCK  for recv on socket conn_socket
+  fcntl(conn_socket,F_SETFL, O_NONBLOCK);
+    
+  // set options for polling
+  const unsigned int number_poll_sockets= 1; 
+  struct pollfd poll_fd;
+  // have to set structure before poll call
+  poll_fd.fd = conn_socket;
+  poll_fd.events = POLLIN | POLLPRI; 
+
+  int poll_status;
+  bool recv_error= false;
+
+  NetMsg* netmsg= 0;
+  NetMsg* remainbuf= 0;
+  size_t buffer_bytes_left= 0;
+  size_t trailingbytes= 0;
+  bool skiprecv= false;
+  // loop until we receive a terminate signal (read-only var for this thread) 
+  // or get an error from socket read
+  while( receiver_thread_argp->sig_terminate == false )
+  {
+    // Read next PDU from socket or process trailing bytes in remainbuf
+    ret= 0;
+    msgcontentlength= 0;
+    msgcontentlength_known= false;
+    pdu_complete= false;
+    netmsg= 0;
+
+    // there are trailing bytes left from the last receive call
+    if (remainbuf != 0)
+    {
+      netmsg= remainbuf;
+      remainbuf= 0;
+      buffer_bytes_left= netmsg->get_size()-trailingbytes;
+      bytes_received= trailingbytes;
+      trailingbytes= 0;
+      skiprecv= true;
+    }
+    else // no trailing bytes, create a new buffer
+    if ( (netmsg= new NetMsg(NetMsg::max_size)) != 0 )
+    {
+      buffer_bytes_left= netmsg->get_size();
+      bytes_received= 0;
+      skiprecv= false;
+    }
+    else
+    { // buffer allocation failed
+      bytes_received= 0;
+      buffer_bytes_left= 0;
+      recv_error= true;
+    }
+    
+    // loops until PDU is complete
+    // >>>>>>>>>>>>>>>>>>>>>>>>>>> while >>>>>>>>>>>>>>>>>>>>>>>>
+    while (!pdu_complete && 
+	   !recv_error && 
+	   !receiver_thread_argp->sig_terminate)
+    {
+      if (!skiprecv)
+      {
+	// read from TCP socket or return after sleep_time
+	poll_status= poll(&poll_fd, number_poll_sockets, tpparam.sleep_time);
+	
+	if (receiver_thread_argp->sig_terminate)
+	{
+	  Log(EVENT_LOG,LOG_UNIMP,tpparam.name,methodname << "Thread <" << pthread_self() << "> found terminate signal after poll");
+	  // disallow sending
+	  AssocDataUDS* myassoc=const_cast<AssocDataUDS *>(receiver_thread_argp->peer_assoc);
+	  if (myassoc->shutdown == false)
+	  {
+	    myassoc->shutdown= true;
+	    if (shutdown(myassoc->socketfd,SHUT_WR))
+	    {
+	      if ( errno != ENOTCONN )
+		Log(ERROR_LOG,LOG_UNIMP,tpparam.name,methodname <<"shutdown (write) on socket " << conn_socket << " returned error:" << strerror(errno));
+	    }
+	  }
+	  // try to read do a last read from the TCP socket or return after sleep_time
+	  if (poll_status == 0)
+	  {
+	    poll_status= poll(&poll_fd, number_poll_sockets, tpparam.sleep_time);
+	  }
+	}
+
+	if (poll_fd.revents & POLLERR) // Error condition
+	{
+	  if (errno == 0 || errno == EINTR)
+	  {
+	    Log(EVENT_LOG,LOG_NORMAL, tpparam.name, methodname << "poll(): " << strerror(errno));
+	  }
+	  else
+	  {
+	    Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "Poll indicates error: " << strerror(errno));
+	    recv_error= true;
+	  }
+	}
+	
+	if (poll_fd.revents & POLLHUP) // Hung up 
+	{
+	  Log(EVENT_LOG,LOG_CRIT, tpparam.name, methodname << "Poll hung up");
+	  recv_error= true;
+	}
+	
+	if (poll_fd.revents & POLLNVAL) // Invalid request: fd not open
+	{
+	  Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "Poll Invalid request: fd not open");
+	  recv_error= true;
+	}
+	
+	// check status (return value) of poll call
+	switch (poll_status)
+	{
+	  case -1:
+	    if (errno == 0 || errno == EINTR)
+	    {
+	      Log(EVENT_LOG,LOG_NORMAL, tpparam.name, methodname << "Poll status: " << strerror(errno));
+	    }
+	    else
+	    {
+	      Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "Poll status indicates error: " << strerror(errno) << "- aborting");
+	      recv_error= true;
+	    }
+	    
+	    continue; // next while iteration
+	    break;
+	    
+	  case 0:
+#ifdef DEBUG_HARD
+	    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname << "Poll timed out after " << tpparam.sleep_time << " ms.");
+#endif
+	    continue; // next while iteration
+	    break;
+	    
+	  default:
+#ifdef DEBUG_HARD
+	    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname << "Poll: " << poll_status << " event(s) ocurred, of type " << poll_fd.revents);
+#endif
+	    break;
+	} // end switch
+
+
+	/// receive data from socket buffer (recv will not block)
+	ret = recv(conn_socket, 
+		   netmsg->get_buffer() + bytes_received, 
+		   buffer_bytes_left, 
+		   0);
+
+	if ( ret < 0 )
+	{
+	  if (errno!=EAGAIN && errno!=EWOULDBLOCK)
+	  {
+	    Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "Receive at socket " << conn_socket << " failed, error: " << strerror(errno));
+	    recv_error= true;
+	    continue;
+	  }
+	  else
+	  { // errno==EAGAIN || errno==EWOULDBLOCK
+	    // just nothing to read from socket, continue w/ next poll
+	    continue;
+	  }
+	}
+	else
+	{
+	  if (ret == 0)
+	  {
+	    // this means that EOF is reached, 
+	    // other side has closed connection
+	    Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, methodname << "Other side (" << *peer_addr << ") closed connection for socket " << conn_socket);
+	    // disallow sending
+	    AssocDataUDS* myassoc=const_cast<AssocDataUDS *>(receiver_thread_argp->peer_assoc);
+	    if (myassoc->shutdown == false)
+	    {
+	      myassoc->shutdown= true;
+	      if (shutdown(myassoc->socketfd,SHUT_WR))
+	      {
+		if ( errno != ENOTCONN )
+		  Log(ERROR_LOG,LOG_UNIMP,tpparam.name, methodname << "shutdown (write) on socket " << conn_socket << " returned error:" << strerror(errno));
+	      }
+	    }
+	    // not a real error, but we must quit the receive loop
+	    recv_error= true;
+	  }
+	  else
+	  {
+	    Log(EVENT_LOG,LOG_UNIMP, tpparam.name, methodname << "<<--Received--<< packet (" << ret << " bytes) at socket " << conn_socket << " from " << *peer_addr);
+	    // track number of received bytes
+
+	    bytes_received+= ret;
+	    buffer_bytes_left-= ret;
+	  }
+	}
+      } // end if do not skip recv() statement      
+
+      if (buffer_bytes_left < 0) ///< buffer space exhausted now
+      {
+	recv_error= true;
+        Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "during receive buffer space exhausted");
+      }
+
+      if (!msgcontentlength_known) ///< common header not parsed
+      {
+	// enough bytes read to parse common header?
+	if (bytes_received >= common_header_length)
+	{
+	  // get message content length in number of bytes
+	  if (getmsglength(*netmsg, msgcontentlength)) msgcontentlength_known= true;
+	  else
+	  {
+	      Log(ERROR_LOG,LOG_CRIT, tpparam.name, methodname << "Not a valid protocol header - discarding received packet. received size " << msgcontentlength);
+
+	    ostringstream hexdumpstr;
+	    netmsg->hexdump(hexdumpstr,netmsg->get_buffer(),bytes_received);
+	    Log(DEBUG_LOG,LOG_NORMAL,tpparam.name,"dumping received bytes:" << hexdumpstr.str());
+
+	    // reset all counters
+	    msgcontentlength= 0;
+	    msgcontentlength_known= false;
+	    bytes_received= 0;
+	    pdu_complete= false;
+	    continue;
+	  }
+	}
+      } // endif common header not parsed
+
+      // check whether we have read the whole Protocol PDU
+      //DLog(tpparam.name, "bytes_received - common_header_length: " << bytes_received-common_header_length << "msgcontentlength: " << msgcontentlength << ">=");
+      if (msgcontentlength_known && bytes_received-common_header_length >= msgcontentlength )
+      {
+	
+	pdu_complete= true;
+	if (bytes_received-common_header_length > msgcontentlength)
+	{
+	  Log(WARNING_LOG,LOG_NORMAL,tpparam.name,"trailing bytes - received more bytes ("<<bytes_received<<") than expected for PDU (" << common_header_length+msgcontentlength << ")");
+	  remainbuf= new NetMsg(NetMsg::max_size);
+	  trailingbytes= (bytes_received-common_header_length) - msgcontentlength;
+	  bytes_received= common_header_length+msgcontentlength;
+	  memcpy(remainbuf->get_buffer(),netmsg->get_buffer()+common_header_length+msgcontentlength, trailingbytes);
+	}
+      }
+    } // end while (!pdu_complete && !recv_error && !signalled for termination)
+    // >>>>>>>>>>>>>>>>>>>>>>>>>>> while >>>>>>>>>>>>>>>>>>>>>>>>
+
+    // if other side closed the connection, we should still be able to deliver the remaining data
+    if (ret == 0)
+    {
+      recv_error= false;
+    }
+
+    // deliver only complete PDUs to signaling module
+    if (!recv_error && pdu_complete)
+    {
+      // create TPMsg and send it to the signaling thread
+      tpmsg = new(nothrow) TPMsg(netmsg, peer_addr->copy(), own_addr->copy());
+
+      Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, methodname << "receipt of PDU now complete, sending to module " <<  message::get_qaddr_name(tpparam.dest));
+
+      debug_pdu=false;
+
+      if (debug_pdu)
+      {
+	ostringstream hexdump;
+	netmsg->hexdump(hexdump,netmsg->get_buffer(),bytes_received);
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name,"PDU debugging enabled - Received:" << hexdump.str());
+      }
+
+      // send the message if it was successfully created
+      // bool message::send_to(qaddr_t dest, bool exp = false);
+      if (!tpmsg
+	  || (!tpmsg->get_peeraddress())
+	  || (!tpmsg->send_to(tpparam.dest))) 
+      {
+	Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "Cannot allocate/send TPMsg");
+	if (tpmsg) delete tpmsg;
+      } // end if tpmsg not allocated or not addr or not sent
+
+    } // end if !recv_error
+    else
+    { // error during receive or PDU incomplete
+      if (bytes_received>0)
+      {
+	Log(WARNING_LOG,LOG_NORMAL, tpparam.name, methodname << "Attention! " << (recv_error? "Receive error, " : "") << (pdu_complete ?  "PDU complete" : "PDU incomplete") << "received bytes: " << bytes_received);
+      }
+
+      if (!pdu_complete && bytes_received>0 && bytes_received<common_header_length)
+      {
+	ostringstream hexdumpstr;
+	netmsg->hexdump(hexdumpstr,netmsg->get_buffer(),bytes_received);
+	Log(DEBUG_LOG,LOG_NORMAL,tpparam.name,"Message too short to be a valid protocol header - dumping received bytes:" << hexdumpstr.str());	
+      }
+      // leave the outer loop
+      /**********************/
+      break;
+      /**********************/
+    } // end else
+
+  } // end while (thread not signalled for termination)
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, methodname << "Thread <" << pthread_self() 
+      << "> shutting down and closing socket " << receiver_thread_argp->peer_assoc->peer);
+
+  // shutdown socket
+  if (shutdown(conn_socket, SHUT_RD))
+  {
+    if ( errno != ENOTCONN )
+      Log(ERROR_LOG,LOG_NORMAL, tpparam.name, methodname << "Thread <" << pthread_self() << "> shutdown (read) on socket failed, reason: " << strerror(errno));
+  }
+
+  // close socket
+  close(conn_socket);
+
+  receiver_thread_argp->terminated= true;
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, methodname << "Thread <" << pthread_self() << "> terminated");
+
+#ifdef _DEBUG
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, methodname << "Signaling main loop for cleanup");
+#endif
+  // notify master thread for invocation of cleanup procedure
+  TPoverUDSMsg* newmsg= new(nothrow)TPoverUDSMsg(receiver_thread_argp->peer_assoc);
+  // send message to main loop thread
+  newmsg->send_to(tpparam.source);
+}  
+
+
+/** this signals a terminate to a thread and wait for the thread to stop
+ *  @note it is not safe to access any thread related data after this method returned,
+ *        because the receiver thread will initiate a cleanup_receiver_thread() method 
+ *        which may erase all relevant thread data.
+ */
+void 
+TPoverUDS::stop_receiver_thread(AssocDataUDS* peer_assoc)
+{
+  // All operations on  recv_thread_argmap and connmap require an already acquired lock
+  // after this procedure peer_assoc may be invalid because it was erased
+
+  // start critical section
+
+  if (peer_assoc == 0)
+    return;
+
+  pthread_t thread_id=  peer_assoc->thread_ID;
+  
+  // try to clean up receiver_thread_arg
+  recv_thread_argmap_t::iterator recv_thread_arg_iter= recv_thread_argmap.find(thread_id);
+  receiver_thread_arg_t* recv_thread_argp=  
+    (recv_thread_arg_iter != recv_thread_argmap.end()) ? recv_thread_arg_iter->second : 0;
+  if (recv_thread_argp)
+  {
+    if (!recv_thread_argp->terminated)
+    {
+      // thread signaled termination, but is not?
+      Log(EVENT_LOG,LOG_NORMAL, tpparam.name,"stop_receiver_thread() - Receiver thread <" << thread_id << "> signaled for termination");
+
+      // signal thread for its termination
+      recv_thread_argp->sig_terminate= true;
+      // wait for thread to join after termination
+      pthread_join(thread_id, 0);
+      // the dying thread will signal main loop to call this method, but this time we should enter the else branch
+      return;
+    }
+  }
+  else
+    Log(ERROR_LOG,LOG_NORMAL, tpparam.name,"stop_receiver_thread() - Receiver thread <" << thread_id << "> not found");
+
+}
+
+
+/** cleans up left over structures (assoc,receiver_thread_arg) from already terminated receiver_thread
+ *  usually called by the master_thread after the receiver_thread terminated
+ * @note clean_up_receiver_thread() should be only called when an outer lock ensures that peer_assoc
+ *       is still valid
+ */
+void 
+TPoverUDS::cleanup_receiver_thread(AssocDataUDS* peer_assoc)
+{
+  // All operations on  recv_thread_argmap and connmap require an already acquired lock
+  // after this procedure peer_assoc may be invalid because it was erased
+
+  // start critical section
+
+  if (peer_assoc == 0)
+    return;
+
+  pthread_t thread_id=  peer_assoc->thread_ID;
+  
+  // try to clean up receiver_thread_arg
+  recv_thread_argmap_t::iterator recv_thread_arg_iter= recv_thread_argmap.find(thread_id);
+  receiver_thread_arg_t* recv_thread_argp=  
+    (recv_thread_arg_iter != recv_thread_argmap.end()) ? recv_thread_arg_iter->second : 0;
+  if (recv_thread_argp)
+  {
+    if (!recv_thread_argp->terminated)
+    {
+      // thread signaled termination, but is not?
+      Log(ERROR_LOG,LOG_NORMAL, tpparam.name,"cleanup_receiver_thread() - Receiver thread <" << thread_id << "> not terminated yet?!");
+      return;
+    }
+    else
+    { // if thread is already terminated
+      Log(EVENT_LOG,LOG_NORMAL, tpparam.name,"cleanup_receiver_thread() - Receiver thread <" << thread_id << "> is terminated");
+
+      // delete it from receiver map
+      recv_thread_argmap.erase(recv_thread_arg_iter);
+
+      // then delete receiver arg structure
+      delete recv_thread_argp;
+    }
+  }
+
+  // delete entry from connection map
+
+  // cleanup sender thread
+  // no need to lock explicitly, because caller of cleanup_receiver_thread() must already locked
+  terminate_sender_thread(peer_assoc);
+
+  // delete the AssocData structure from the connection map
+  // also frees allocated AssocData structure
+  connmap.erase(peer_assoc);
+
+  // end critical section
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name,"cleanup_receiver_thread() - Cleanup receiver thread <" << thread_id << ">. Done.");
+}
+
+
+/* sends a stop message to the sender thread that belongs to the peer address given in assoc
+ * @note terminate_receiver_thread() should be only called when an outer lock ensures that assoc
+ *       is still valid, a lock is also required, because senderthread_queuemap is changed
+ */
+void 
+TPoverUDS::terminate_sender_thread(const AssocDataUDS* assoc)
+{
+  if (assoc == 0)
+  {
+    Log(ERROR_LOG,LOG_NORMAL,tpparam.name,"terminate_sender_thread() - assoc data == NULL");
+    return;
+  }
+
+  sender_thread_queuemap_t::iterator it= senderthread_queuemap.find(assoc->peer);
+
+  if (it != senderthread_queuemap.end())
+  { // we have a sender thread: send a stop message to it
+    FastQueue* destqueue= it->second; 
+    if (destqueue)
+    {
+      TPoverUDSMsg* internalmsg= new TPoverUDSMsg(assoc,tpparam.source,TPoverUDSMsg::stop);
+      if (internalmsg)
+      {
+	// send the internal message to the sender thread queue
+	internalmsg->send(tpparam.source,destqueue);
+      }
+    }
+    else
+    {
+      Log(WARNING_LOG,LOG_NORMAL,tpparam.name,"terminate_sender_thread() - found entry for address, but no sender thread. addr:" << assoc->peer);
+    }
+    // erase entry from map
+    senderthread_queuemap.erase(it);
+  }
+}
+
+/* terminate all active threads
+ * note: locking should not be necessary here because this message is called as last method from
+ * main_loop()
+ */
+void 
+TPoverUDS::terminate_all_threads()
+{
+  AssocDataUDS* assoc= 0;
+  receiver_thread_arg_t* terminate_argp;
+
+  for (recv_thread_argmap_t::iterator terminate_iterator=  recv_thread_argmap.begin();
+       terminate_iterator !=  recv_thread_argmap.end();
+       terminate_iterator++)
+  {
+    if ( (terminate_argp= terminate_iterator->second) != 0)
+    {
+      // we need a non const pointer to erase it later on
+      assoc= const_cast<AssocDataUDS*>(terminate_argp->peer_assoc);
+      // check whether thread is still alive
+      if (terminate_argp->terminated == false)
+      {
+	terminate_argp->sig_terminate= true;
+	// then wait for its termination
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, 
+	    "Signaled receiver thread <" << terminate_iterator->first << "> for termination");
+	
+	pthread_join(terminate_iterator->first, 0);
+	
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, "Thread <" << terminate_iterator->first  << "> is terminated");
+      }
+      else
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, 
+	    "Receiver thread <" << terminate_iterator->first << "> already terminated");
+	
+      // cleanup all remaining argument structures of terminated threads
+      delete terminate_argp;
+
+      // terminate any related sender thread that is still running
+      terminate_sender_thread(assoc);
+      
+      connmap.erase(assoc);
+      // delete assoc is not necessary, because connmap.erase() will do the job
+    }
+  } // end for
+}
+
+
+/**
+ * sender thread starter: 
+ * just a static starter method to allow starting the 
+ * actual sender_thread() method.
+ *
+ * @param argp - pointer to the current TPoverUDS object instance and receiver_thread_arg_t struct
+ */
+void*
+TPoverUDS::sender_thread_starter(void *argp)
+{
+  sender_thread_start_arg_t *sargp= static_cast<sender_thread_start_arg_t *>(argp);
+  
+  //cout << "invoked sender_thread_Starter" << endl;
+
+  // invoke sender thread method
+  if (sargp != 0 && sargp->instance != 0)
+  {
+    // call receiver_thread member function on object instance
+    sargp->instance->sender_thread(sargp->sender_thread_queue);
+
+    //cout << "Before deletion of sarg" << endl;
+
+    // no longer needed
+    delete sargp;
+  }
+  else
+  {
+    Log(ERROR_LOG,LOG_CRIT,"sender_thread_starter","while starting sender_thread: 0 pointer to arg or object");
+  }
+  return 0;
+}
+
+
+
+
+/**
+ * receiver thread starter: 
+ * just a static starter method to allow starting the 
+ * actual receiver_thread() method.
+ *
+ * @param argp - pointer to the current TPoverUDS object instance and receiver_thread_arg_t struct
+ */
+void*
+TPoverUDS::receiver_thread_starter(void *argp)
+{
+  receiver_thread_start_arg_t *rargp= static_cast<receiver_thread_start_arg_t *>(argp);
+  // invoke receiver thread method
+  if (rargp != 0 && rargp->instance != 0)
+  {
+    // call receiver_thread member function on object instance
+    rargp->instance->receiver_thread(rargp->rtargp);
+
+    // no longer needed
+    delete rargp;
+  }
+  else
+  {
+    Log(ERROR_LOG,LOG_CRIT,"receiver_thread_starter","while starting receiver_thread: 0 pointer to arg or object");
+  }
+  return 0;
+}
+
+
+void
+TPoverUDS::create_new_sender_thread(FastQueue* senderfqueue)
+{
+  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "Starting new sender thread...");
+
+  pthread_t senderthreadid;
+  // create new thread; (arg == 0) is handled by thread, too
+  int pthread_status= pthread_create(&senderthreadid, 
+				     NULL, // NULL: default attributes: thread is joinable and has a 
+				     //       default, non-realtime scheduling policy
+				     TPoverUDS::sender_thread_starter,
+				     new sender_thread_start_arg_t(this,senderfqueue));
+  if (pthread_status)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "A new thread could not be created: " <<  strerror(pthread_status));
+    
+    delete senderfqueue;
+  }
+}
+
+
+void
+TPoverUDS::create_new_receiver_thread(AssocDataUDS* peer_assoc)
+{
+  receiver_thread_arg_t* argp= 
+    new(nothrow) receiver_thread_arg(peer_assoc);
+  
+  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "Starting new receiver thread...");
+
+  // create new thread; (arg == 0) is handled by thread, too
+  int pthread_status= pthread_create(&peer_assoc->thread_ID, 
+				     NULL, // NULL: default attributes: thread is joinable and has a 
+				     //       default, non-realtime scheduling policy
+				     receiver_thread_starter,
+				     new(nothrow) receiver_thread_start_arg_t(this,argp));
+  if (pthread_status)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "A new thread could not be created: " <<  strerror(pthread_status));
+    
+    delete argp;
+  }
+  else
+  {
+    lock(); // install_cleanup_thread_lock(TPoverUDS, this);
+
+    // remember pointer to thread arg structure
+    // thread arg structure should be destroyed after thread termination only
+    pair<recv_thread_argmap_t::iterator, bool> tmpinsiterator=
+      recv_thread_argmap.insert( pair<pthread_t,receiver_thread_arg_t*> (peer_assoc->thread_ID,argp) );
+    if (tmpinsiterator.second == false)
+    {
+      Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Thread argument could not be inserted into hashmap");
+    }
+    unlock(); // uninstall_cleanup(1);
+  }  
+}
+
+
+/**
+ * master listener thread starter: 
+ * just a static starter method to allow starting the 
+ * actual master_listener_thread() method.
+ *
+ * @param argp - pointer to the current TPoverUDS object instance
+ */
+void*
+TPoverUDS::master_listener_thread_starter(void *argp)
+{
+  // invoke listener thread method
+  if (argp != 0)
+  {
+    (static_cast<TPoverUDS*>(argp))->master_listener_thread();
+  }
+  return 0;
+}
+
+
+
+/**
+ * master listener thread: waits for incoming connections at the well-known tcp port
+ * when a connection request is received this thread spawns a receiver_thread for
+ * receiving packets from the peer at the new socket. 
+ */
+void
+TPoverUDS::master_listener_thread()
+{
+    //remove any existing socket files
+    unlink(tpparam.udssocket.c_str());
+
+
+  // create a new address-structure for the listening masterthread
+    struct sockaddr_un  own_address;
+    own_address.sun_family = AF_UNIX;
+    strcpy(own_address.sun_path, tpparam.udssocket.c_str());
+    unlink(tpparam.udssocket.c_str());
+    uint32 len = strlen(tpparam.udssocket.c_str()) + sizeof(own_address.sun_family);
+    
+    
+  // create a listening socket
+  int master_listener_socket= socket(AF_UNIX, SOCK_STREAM, 0);
+  if (master_listener_socket == -1)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Could not create a new socket, error: " << strerror(errno));
+    return;
+  }
+  
+
+  // Reuse ports, even if they are busy
+  int socketreuseflag= 1;
+  int status= setsockopt(master_listener_socket,
+			   SOL_SOCKET,
+			   SO_REUSEADDR,
+			   (const char *) &socketreuseflag,
+			   sizeof(socketreuseflag));
+  if (status)
+  {
+       Log(ERROR_LOG,LOG_NORMAL,tpparam.name, "Could not set socket option SO_REUSEADDR:" << strerror(errno));
+  }
+  
+  
+  // bind the newly created socket to a specific address
+  int bind_status = bind(master_listener_socket,
+			 reinterpret_cast<struct sockaddr *>(&own_address),
+			 len);
+  if (bind_status)
+    { 
+      Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Binding to " << tpparam.udssocket);
+      return;
+    }
+
+    // listen at the socket, 
+    // queuesize for pending connections= max_listen_queue_size
+    int listen_status = listen(master_listener_socket, max_listen_queue_size);
+    if (listen_status)
+    {
+      Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Listen at socket " << master_listener_socket 
+	  << " failed, error: " << strerror(errno));
+      return;
+    }
+    else
+    {
+      Log(INFO_LOG,LOG_NORMAL, tpparam.name, color[green] << "Listening at " << tpparam.udssocket << color[off]);
+    }
+
+    // activate O_NON_BLOCK for accept (accept does not block)
+    fcntl(master_listener_socket,F_SETFL, O_NONBLOCK);
+
+    // create a pollfd struct for use in the mainloop
+    struct pollfd poll_fd;
+    poll_fd.fd = master_listener_socket;
+    poll_fd.events = POLLIN | POLLPRI; 
+    poll_fd.revents = 0;
+    /*
+      #define POLLIN	0x001	// There is data to read. 
+      #define POLLPRI	0x002	// There is urgent data to read.  
+      #define POLLOUT	0x004	// Writing now will not block.  
+    */
+    
+    bool terminate = false;
+    // check for thread terminate condition using get_state()
+    state_t currstate= get_state();
+    int poll_status= 0;
+    const unsigned int number_poll_sockets= 1; 
+    struct sockaddr_un peer_address;
+    socklen_t peer_address_len;
+    int conn_socket;
+
+    // check whether this thread is signaled for termination
+    while(! (terminate= (currstate==STATE_ABORT || currstate==STATE_STOP) ) )
+    {
+      // wait on number_poll_sockets (main drm socket) 
+      // for the events specified above for sleep_time (in ms)
+      poll_status= poll(&poll_fd, number_poll_sockets, tpparam.sleep_time);
+      if (poll_fd.revents & POLLERR) // Error condition
+      {
+	if (errno != EINTR) 
+	{
+	  Log(ERROR_LOG,LOG_CRIT, tpparam.name, 
+	      "Poll caused error " << strerror(errno) << " - indicated by revents");
+	}
+	else
+	{
+	  Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "poll(): " << strerror(errno));
+	}
+
+      }
+      if (poll_fd.revents & POLLHUP) // Hung up 
+      {
+	Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Poll hung up");
+	return;
+      }
+      if (poll_fd.revents & POLLNVAL) // Invalid request: fd not open
+      {
+	Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Poll Invalid request: fd not open");
+	return;
+      }
+      
+      switch (poll_status)
+      {
+	case -1:
+	  if (errno != EINTR)
+	  {
+	    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Poll status indicates error: " << strerror(errno));
+	  }
+	  else
+	  {
+	    Log(EVENT_LOG,LOG_NORMAL, tpparam.name, "Poll status: " << strerror(errno));
+	  }
+	    
+	  break;
+
+	case 0:
+#ifdef DEBUG_HARD
+	  Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, 
+	      "Listen Thread - Poll timed out after " << tpparam.sleep_time << " ms.");
+#endif
+	  currstate= get_state();
+	  continue;
+	  break;
+
+	default:
+#ifdef DEBUG_HARD
+	  Log(DEBUG_LOG,LOG_UNIMP, tpparam.name, "Poll: " << poll_status << " event(s) ocurred, of type " << poll_fd.revents);
+#endif
+	  break;
+      } // end switch
+
+      // after a successful accept call, 
+      // accept stores the address information of the connecting party
+      // in peer_address and the size of its address in addrlen
+      peer_address_len= sizeof(peer_address);
+      conn_socket = accept (master_listener_socket,
+			    reinterpret_cast<struct sockaddr *>(&peer_address),
+			    &peer_address_len);
+      if (conn_socket == -1)
+      {
+	if (errno != EWOULDBLOCK && errno != EAGAIN)
+	{
+	  Log(ERROR_LOG,LOG_EMERG, tpparam.name, "Accept at socket " << master_listener_socket
+	      << " failed, error: " << strerror(errno));
+	  return;
+	}
+      }
+      else
+      {
+	// create a new assocdata-object for the new thread
+	AssocDataUDS* peer_assoc = NULL;
+	udsaddress addr(conn_socket);
+
+	Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, "<<--Received connect--<< request from " << addr);
+
+	//struct sockaddr_un own_address;
+	//socklen_t own_address_len= sizeof(own_address);
+	//getsockname(conn_socket, reinterpret_cast<struct sockaddr*>(&own_address), &own_address_len);
+
+	// AssocData will copy addr content into its own structure
+	// allocated peer_assoc will be stored in connmap
+	peer_assoc = new(nothrow) AssocDataUDS(conn_socket, addr, udsaddress(conn_socket));
+
+	bool insert_success= false;
+	if (peer_assoc)
+	{
+	  // start critical section
+	  lock(); // install_cleanup_thread_lock(TPoverUDS, this);
+	  insert_success= connmap.insert(peer_assoc);
+	  // end critical section
+	  unlock(); // uninstall_cleanup(1);
+	}
+	
+	
+	if (insert_success == false) // not inserted into connmap
+	{
+	  Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Cannot insert AssocData for socket " << conn_socket
+	      << ", " << addr << " into connection map, aborting connection...");
+
+	  // abort connection, delete its AssocData
+	  close (conn_socket);
+	  if (peer_assoc) 
+	  { 
+	    delete peer_assoc;
+	    peer_assoc= 0;
+	  }
+	  return;
+		
+	} //end __else(connmap.insert());__
+	
+	// create a new thread for each new connection
+	create_new_receiver_thread(peer_assoc);
+      } // end __else (connsocket)__
+      
+      // get new thread state
+      currstate= get_state();
+
+    } // end while(!terminate)
+    return;
+} // end listen_for_connections()    
+
+
+TPoverUDS::~TPoverUDS()
+{
+  init= false;
+
+  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name,  "Destructor called");
+
+  QueueManager::instance()->unregister_queue(tpparam.source);
+}
+
+/** TPoverUDS Thread main loop.
+ * This loop checks for internal messages of either
+ * a send() call to start a new receiver thread, or,
+ * of a receiver_thread() that signals its own termination
+ * for proper cleanup of control structures.
+ * It also handles the following internal TPoverUDSMsg types:
+ * - TPoverUDSMsg::stop - a particular receiver thread is terminated
+ * - TPoverUDSMsg::start - a particular receiver thread is started
+ * @param nr number of current thread instance
+ */
+void 
+TPoverUDS::main_loop(uint32 nr)
+{
+  // get internal queue for messages from receiver_thread
+  FastQueue* fq = get_fqueue();
+  if (!fq) 
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Cannot find message queue");
+    return;
+  } // end if not fq
+  // register queue for receiving internal messages from other modules
+  QueueManager::instance()->register_queue(fq,tpparam.source);
+
+  // start master listener thread
+  pthread_t master_listener_thread_ID;
+  int pthread_status= pthread_create(&master_listener_thread_ID, 
+				     NULL, // NULL: default attributes: thread is joinable and has a 
+				     //       default, non-realtime scheduling policy
+				     master_listener_thread_starter,
+				     this);
+  if (pthread_status)
+  {
+    Log(ERROR_LOG,LOG_CRIT, tpparam.name, 
+	"New master listener thread could not be created: " <<  strerror(pthread_status));
+  }
+  else
+    Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, "Master listener thread started");
+
+
+  // define max latency for thread reaction on termination/stop signal
+  timespec wait_interval= { 0, 250000000L }; // 250ms
+  message* internal_thread_msg = NULL;
+  state_t currstate= get_state();
+
+  // check whether this thread is signaled for termination
+  while( currstate!=STATE_ABORT && currstate!=STATE_STOP )  
+  {
+    // poll internal message queue (blocking)
+    if ( (internal_thread_msg= fq->dequeue_timedwait(wait_interval)) != 0 )
+    {
+      TPoverUDSMsg* internalmsg= dynamic_cast<TPoverUDSMsg*>(internal_thread_msg);
+      if (internalmsg)
+      {
+	if (internalmsg->get_msgtype() == TPoverUDSMsg::stop)
+	{
+	  // a receiver thread terminated and signaled for cleanup by master thread
+	  AssocDataUDS* assocd= const_cast<AssocDataUDS*>(internalmsg->get_peer_assoc());
+	  Log(DEBUG_LOG,LOG_NORMAL, tpparam.name, "Got cleanup request for thread <" << assocd->thread_ID <<'>');
+	  lock();
+	  cleanup_receiver_thread( assocd );
+	  unlock();
+	}
+	else
+	if (internalmsg->get_msgtype() == TPoverUDSMsg::start)
+	{
+	  // start a new receiver thread
+	  create_new_receiver_thread( const_cast<AssocDataUDS*>(internalmsg->get_peer_assoc()) );
+	}
+	else
+	  Log(ERROR_LOG,LOG_CRIT, tpparam.name, "unexpected internal message:" << internalmsg->get_msgtype());
+	  
+	delete internalmsg;
+      }
+      else
+      {
+	Log(ERROR_LOG,LOG_CRIT, tpparam.name, "Dynamic_cast failed - received unexpected and unknown internal message source "
+	    << internal_thread_msg->get_source());
+      }
+    } // endif
+
+    // get thread state
+    currstate= get_state();
+  } // end while
+
+  if (currstate==STATE_STOP)
+  {
+    // start abort actions
+    Log(INFO_LOG,LOG_NORMAL, tpparam.name, "Asked to abort, stopping all receiver threads");
+  } // end if stopped
+
+  // do not accept any more messages
+  fq->shutdown();
+  // terminate all receiver and sender threads that are still active 
+  terminate_all_threads();
+}
+
+} // end namespace protlib
+///@}
Index: /source/ariba/communication/modules/transport/protlib/tp_over_uds.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/tp_over_uds.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/tp_over_uds.h	(revision 2378)
@@ -0,0 +1,265 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file tp_over_uds.h
+/// Transport over Unix Domain Sockets
+/// ----------------------------------------------------------
+/// $Id: tp_over_uds.h 2872 2008-02-18 10:58:03Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/tp_over_uds.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+// ----------------------------------------*- mode: C++; -*--
+// tp_over_uds.h
+// Implementation of a transport module for Unix domain sockets
+// ----------------------------------------------------------
+// $Id: tp_over_uds.h 2872 2008-02-18 10:58:03Z bless $
+// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/tp_over_uds.h $
+// ==========================================================
+/** @ingroup transport
+ * @file tp_over_uds.h
+ * TP over UDS
+ */
+
+#ifndef TP_OVER_UDS_H
+#define TP_OVER_UDS_H
+
+#include <ext/hash_map>
+
+#include "tp.h"
+#include "threads.h"
+#include "threadsafe_db.h"
+#include "connectionmap_uds.h"
+#include "assocdata_uds.h"
+
+namespace protlib 
+{
+/** this struct conatains parameters that determine 
+  * the behavior of listener and receiver threads in TPoverUDS
+  * @param port - port number for master listener thread (server port)
+  * @param sleep - time (in ms) that listener and receiver wait at a poll() call
+  * @param d - destination module, where internal message are sent
+  */
+struct TPoverUDSParam : public ThreadParam 
+{
+  /// constructor
+  TPoverUDSParam(
+         unsigned short common_header_length,
+	 bool (*const getmsglength) (NetMsg& m, uint32& clen_bytes),
+	 string udssocket,
+	 bool server,
+	 uint32 sleep = ThreadParam::default_sleep_time,
+	 bool debug_pdu = false,
+	 message::qaddr_t source = message::qaddr_transport,
+	 message::qaddr_t dest = message::qaddr_signaling,
+         bool sendaborts = false,
+         uint8 tos = 0x10) :
+      ThreadParam(sleep,"TPoverUDS", 1,1),
+      udssocket(udssocket),
+      debug_pdu(debug_pdu),
+      source(source),
+      dest(dest),
+      common_header_length(common_header_length),
+      getmsglength(getmsglength),
+      terminate(false),
+      ip_tos(tos),
+      server(server)
+        {};
+
+    /// port to bind master listener thread to
+    const string udssocket;
+    bool debug_pdu;
+    /// message source
+    const message::qaddr_t source;
+    const message::qaddr_t dest;
+    /// what is the length of the common header
+    const unsigned short common_header_length;
+    
+    /// function pointer to a function that figures out the msg length in number of 4 byte words
+    /// it returns false if error occured (e.g., malformed header), result is returned in variable clen_words
+    bool (*const getmsglength) (NetMsg& m, uint32& clen_words);
+    
+    /// should master thread terminate?
+    const bool terminate;
+    const uint8 ip_tos;
+    bool server;
+}; // end TPoverUDPParam
+
+
+/// TP over TCP
+/** This class implements the TP interface using TCP. */
+class TPoverUDS : public TP, public Thread 
+{
+/***** inherited from TP *****/
+public:
+  /// sends a network message, spawns receiver thread if necessary
+  virtual void send(NetMsg* msg,const address& addr, bool use_existing_connection);
+  virtual void terminate(const address& addr);
+  
+  /***** inherited from Thread *****/
+public:
+  /// main loop
+  virtual void main_loop(uint32 nr);
+  
+/***** other members *****/
+public:
+  /// constructor
+  TPoverUDS(const TPoverUDSParam& p) :
+    TP(253,"uds",p.name,p.common_header_length,p.getmsglength),
+    Thread(p), tpparam(p), already_aborted(false), msgqueue(NULL), debug_pdu(p.debug_pdu)
+  { 
+    // perform some initializing actions
+    // currently not required (SCTP had to init its library)
+    init= true; ///< init done;
+  }
+  /// virtual destructor
+  virtual ~TPoverUDS();
+  
+  typedef
+  struct receiver_thread_arg
+  {
+    const AssocDataUDS* peer_assoc;
+    bool sig_terminate;
+    bool terminated;
+  public:
+    receiver_thread_arg(const AssocDataUDS* peer_assoc) : 
+      peer_assoc(peer_assoc), sig_terminate(false), terminated(true) {};
+  } receiver_thread_arg_t;
+  
+  class receiver_thread_start_arg_t
+  {
+  public:
+    TPoverUDS* instance;
+    receiver_thread_arg_t* rtargp;
+    
+    receiver_thread_start_arg_t(TPoverUDS* instance, receiver_thread_arg_t* rtargp) :
+      instance(instance), rtargp(rtargp) {};
+  };
+
+  class sender_thread_start_arg_t
+  {
+  public:
+    TPoverUDS* instance;
+    FastQueue* sender_thread_queue;
+    
+    sender_thread_start_arg_t(TPoverUDS* instance, FastQueue* sq) :
+      instance(instance), sender_thread_queue(sq) {};
+  };
+  
+private:
+  /// returns already existing connection or establishes a new one
+  AssocDataUDS* get_connection_to(udsaddress& addr);
+
+  /// receiver thread for a specific socket
+  void sender_thread(void *argp);
+  
+  /// receiver thread for a specific socket
+  void receiver_thread(void *argp);
+
+  /// send a message to the local process via UNIX domain sockets
+  void udssend(NetMsg* msg, udsaddress* addr);
+  
+  /// sender thread starter for a specific socket
+  static void* sender_thread_starter(void *argp);
+
+  /// receiver thread starter for a specific socket
+  static void* receiver_thread_starter(void *argp);
+  
+  /// a static starter method to invoke the actual main listener
+  static void* master_listener_thread_starter(void *argp);
+  
+  /// main listener thread procedure
+  void master_listener_thread();
+  
+  // create and start new sender thread
+  void create_new_sender_thread(FastQueue* senderqueue);
+
+  // create and start new receiver thread
+  void create_new_receiver_thread(AssocDataUDS* peer_assoc);
+  
+  /// terminates particular thread
+  void stop_receiver_thread(AssocDataUDS* peer_assoc);
+
+  /// cleans up thread management structures
+  void cleanup_receiver_thread(AssocDataUDS* peer_assoc);
+
+  /// terminates a sender thread
+  void terminate_sender_thread(const AssocDataUDS* assoc);
+  
+  /// terminates all active receiver or sender threads
+  void terminate_all_threads();
+  
+  /// ConnectionMap instance for keeping track of all existing connections
+  ConnectionMapUDS connmap;
+  
+  /// store per receiver thread arguments, e.g. for signaling termination
+  typedef hash_map<pthread_t, receiver_thread_arg_t*> recv_thread_argmap_t;
+  recv_thread_argmap_t  recv_thread_argmap;
+
+  /// store sender thread related information
+  typedef hash_map<udsaddress, FastQueue*> sender_thread_queuemap_t;
+  sender_thread_queuemap_t  senderthread_queuemap;
+  
+  /// parameters for main TPoverUDS thread
+  const TPoverUDSParam tpparam;
+  
+  /// did we already abort at thread shutdown
+  bool already_aborted;
+  /// message queue
+  FastQueue* msgqueue;
+  
+  bool debug_pdu;
+}; // end class TPoverUDS
+
+/** A simple internal message for selfmessages
+ * please note that carried items may get deleted after use of this message 
+ * the message destructor does not delete any item automatically
+ */
+class TPoverUDSMsg : public message 
+{
+ public:
+  // message type start/stop thread, send data
+  enum msg_t { start, 
+	       stop,
+	       send_data
+  };
+
+ private:
+  const AssocDataUDS* peer_assoc;
+  const TPoverUDSMsg::msg_t type;
+  NetMsg* netmsg;
+  udsaddress* addr;
+
+public:
+  TPoverUDSMsg(const AssocDataUDS* peer_assoc, message::qaddr_t source= qaddr_unknown, TPoverUDSMsg::msg_t type= stop) : 
+    message(type_transport, source), peer_assoc(peer_assoc), type(type), netmsg(0), addr(0)  {}
+
+  TPoverUDSMsg(NetMsg* netmsg, udsaddress* addr, message::qaddr_t source= qaddr_unknown) : 
+    message(type_transport, source), peer_assoc(0), type(send_data), netmsg(netmsg), addr(addr) {}
+
+  const AssocDataUDS* get_peer_assoc() const { return peer_assoc; }
+  TPoverUDSMsg::msg_t get_msgtype() const { return type; }
+  NetMsg* get_netmsg() const { return netmsg; }
+  udsaddress* get_udsaddr() const { return addr; } 
+};
+
+} // end namespace protlib
+
+#endif
Index: /source/ariba/communication/modules/transport/protlib/tperror.h
===================================================================
--- /source/ariba/communication/modules/transport/protlib/tperror.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/protlib/tperror.h	(revision 2378)
@@ -0,0 +1,157 @@
+/// ----------------------------------------*- mode: C++; -*--
+/// @file tperror.h
+/// Errors from TP module
+/// ----------------------------------------------------------
+/// $Id: tperror.h 2794 2007-09-05 12:01:22Z bless $
+/// $HeadURL: https://svn.ipv6.tm.uka.de/nsis/protlib/trunk/include/tperror.h $
+// ===========================================================
+//                      
+// Copyright (C) 2005-2007, all rights reserved by
+// - Institute of Telematics, Universitaet Karlsruhe (TH)
+//
+// More information and contact:
+// https://projekte.tm.uka.de/trac/NSIS
+//                      
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// ===========================================================
+/** @ingroup transport
+ * This is the interface for sending network messages over a transport 
+ * protocol. You can receive messages through queues.
+ */
+
+#ifndef _PROTLIB__TP_ERROR_H_
+#define _PROTLIB__TP_ERROR_H_
+
+#include <string.h>
+
+#include "protlib_types.h"
+
+namespace protlib {
+
+/** @addtogroup transport Transport Protocol
+ * @ingroup network
+ * @{
+ */
+
+/// Transport Protocol Error
+/** Reports a TP error while connection setup, sending a network message or initialization. */
+class TPError : public ProtLibException {
+public:
+	/// TP error codes
+	enum tp_error_t {
+	  TPERR_OK,           // everything ok
+	  TPERR_BAD_ADDRESS,  // Bad destination address
+	  TPERR_BAD_NETMSG,   // not used
+	  TPERR_ARGS_NOT_INIT,// arguments not initialized
+	  TPERR_UNREACHABLE,  // destination unreachable
+	  TPERR_INTERNAL,     // any other internal error
+	  TPERR_PAYLOAD,      // maximum payload
+	  TPERR_INITFAILED,   // Initialization failed, e.g. during socket setup 
+	  TPERR_SENDFAILED,   // send failure
+	  TPERR_CONNSETUPFAIL, // connection setup failed
+	  TPERR_CLOSEIND,       // close indication (other side closed connection)
+	  TPERR_ABORTIND      // abort indication (transport protocol)
+	}; // end tp_error_t
+
+	/// constructor
+        TPError(tp_error_t e) : errtype(e) {};
+
+	/// get error string
+	virtual const char* getstr() const= 0;
+	virtual const char *what() const throw() { return getstr(); }
+	/// error code
+	const tp_error_t errtype;
+}; // end class TPError
+
+
+/***** class TPError *****/
+
+class TPErrorBadDestAddress : public TPError
+{
+public:
+  TPErrorBadDestAddress() : TPError(TPError::TPERR_BAD_ADDRESS) {}
+  virtual const char* getstr() const {  return "Bad Destination Address"; }
+};
+
+
+class TPErrorArgsNotInit : public TPError 
+{
+public:
+  TPErrorArgsNotInit() : TPError(TPError::TPERR_ARGS_NOT_INIT) {}
+  virtual const char* getstr() const {  return "arguments of TPMsg not initialized"; }
+};
+
+class TPErrorUnreachable : public TPError 
+{
+public:
+  TPErrorUnreachable() : TPError(TPError::TPERR_UNREACHABLE) {}
+  virtual const char* getstr() const {  return "Destination unreachable"; }
+};
+
+class TPErrorInternal : public TPError 
+{
+public:
+  TPErrorInternal() : TPError(TPError::TPERR_INTERNAL) {}
+  virtual const char* getstr() const {  return "Internal Transport Protocol Error"; }
+};
+
+
+class TPErrorPayload : public TPError 
+{
+public:
+  TPErrorPayload() : TPError(TPError::TPERR_PAYLOAD) {}
+  virtual const char* getstr() const {  return "Payload exceeds maximum transmission unit or empty payload given"; }
+};
+
+class TPErrorInitFailed : public TPError 
+{
+public:
+  TPErrorInitFailed() : TPError(TPError::TPERR_INITFAILED) {}
+  virtual const char* getstr() const {  return "Initialization of protocol failed"; }
+};
+
+class TPErrorSendFailed : public TPError 
+{
+  int saved_errno; ///< value of errno from send call
+public:
+  TPErrorSendFailed(int current_errno= 0) : TPError(TPError::TPERR_SENDFAILED), saved_errno(current_errno) {}
+  virtual const char* getstr() const {  return "Failure while trying to send a protocol data unit"; }
+  int get_reason() const { return saved_errno; } ///< returns saved value of errno from send call
+};
+
+class TPErrorConnectSetupFail : public TPError 
+{
+public:
+  TPErrorConnectSetupFail() : TPError(TPError::TPERR_CONNSETUPFAIL) {}
+  virtual const char* getstr() const {  return "Connection Setup Failure"; }
+};
+
+class TPErrorCloseInd : public TPError 
+{
+public:
+  TPErrorCloseInd() : TPError(TPError::TPERR_CLOSEIND) {}
+  virtual const char* getstr() const {  return "Other side closed connection"; }
+};
+
+class TPErrorAbortInd : public TPError 
+{
+public:
+  TPErrorAbortInd() : TPError(TPError::TPERR_ABORTIND) {}
+  virtual const char* getstr() const {  return "Abort indication, transport protocol indicated failure/abort"; }
+};
+
+} // end namespace protlib
+
+#endif // _PROTLIB__TP_ERROR_H_
Index: /source/ariba/communication/modules/transport/tcp/TCPTransport.cpp
===================================================================
--- /source/ariba/communication/modules/transport/tcp/TCPTransport.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/tcp/TCPTransport.cpp	(revision 2378)
@@ -0,0 +1,323 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "TCPTransport.h"
+
+#define _NO_LOGGING
+
+// std includes
+#include <unistd.h>
+#include <iostream>
+#include <string>
+#include <sstream>
+
+// protlib includes
+#include "../protlib/network_message.h"
+#include "../protlib/tp_over_tcp.h"
+#include "../protlib/logfile.h"
+#include "../protlib/queuemanager.h"
+#include "../protlib/threadsafe_db.h"
+#include "../protlib/setuid.h"
+
+// spovnet includes
+#include "ariba/utility/serialization.h"
+#include "ariba/utility/system/SystemQueue.h"
+#include "ariba/utility/system/SystemEvent.h"
+#include "ariba/utility/system/SystemEventType.h"
+#include "ariba/communication/modules/network/ip/IPv4Locator.h"
+
+// protlib namespaces
+using namespace protlib;
+using namespace protlib::log;
+
+// spovnet namespaces
+using ariba::utility::SystemQueue;
+using ariba::utility::SystemEvent;
+using ariba::utility::SystemEventType;
+using ariba::utility::MessageProvider;
+using ariba::utility::TextMessage;
+using ariba::utility::MessageReceiver;
+using ariba::communication::IPv4Locator;
+
+using_serialization;
+
+logfile commonlog;
+protlib::log::logfile& protlib::log::DefaultLog(commonlog);
+
+#include "ariba/communication/modules/_namespace.h"
+NAMESPACE_BEGIN;
+
+SystemEventType TCPTransportEvent("TCPTransport");
+SystemEventType TCPMessageDispatchEvent("MessageDispatchEvent", TCPTransportEvent );
+SystemEventType TCPTransportTestEvent("Test", TCPTransportEvent );
+
+use_logging_cpp(TCPTransport);
+
+TCPTransport::TCPTransport( port_t port ) {
+	this->running = false;
+	this->done = false;
+	this->port = port;
+
+	logging_debug( "creating tcp transport module" );
+}
+
+TCPTransport::~TCPTransport() {
+	logging_debug( "deleting tcp transport module" );
+}
+
+void TCPTransport::start() {
+
+	logging_info( "starting tcp transport module ..." );
+
+	// initalize netdb and setuid
+	protlib::tsdb::init();
+	protlib::setuid::init();
+
+	/* set tcp parameters */
+	port_t port = this->port; // port
+	TPoverTCPParam tppar(4, TCPTransport::getMessageLength, port);
+
+	/* create receiver thread */
+	FastQueue* tpchecker_fq = new FastQueue("TCPTransport", true);
+	QueueManager::instance()->register_queue(tpchecker_fq,
+			message::qaddr_signaling);
+
+	/* start thread */
+	pthread_create( &tpreceivethread, NULL, TCPTransport::receiverThread, this );
+	tpthread = new ThreadStarter<TPoverTCP, TPoverTCPParam> ( 1, tppar );
+	tpthread->start_processing();
+
+	logging_info( "tcp transport module started" );
+}
+
+void TCPTransport::stop() {
+
+	logging_info( "stopping tcp transport module ..." );
+
+	// stop receiver thread
+	done = true;
+
+	// stop TPoverTCP
+	tpthread->stop_processing();
+	tpthread->abort_processing(true);
+	tpthread->wait_until_stopped();
+
+	// unregister TPoverTCP
+	QueueManager::instance()->unregister_queue( message::qaddr_signaling );
+
+	// destroy QueueManager
+	QueueManager::clear();
+
+	// de-initalize netdb and setuid
+	protlib::setuid::end();
+	protlib::tsdb::end();
+
+	logging_info( "tcp transport module stopped" );
+}
+
+bool TCPTransport::getMessageLength( NetMsg& m, uint32& clen_bytes ) {
+	clen_bytes = m.decode32();
+	m.set_pos_r(-4);
+	return true;
+}
+
+void* TCPTransport::receiverThread( void* ptp ) {
+
+	logging_info( "running tcp transport receiver thread" );
+
+	// get reference to transport object
+	TCPTransport& tp = *((TCPTransport*)ptp);
+
+	// get queue
+	FastQueue* fq =
+		QueueManager::instance()->get_queue(message::qaddr_signaling);
+
+	// main processing loop
+	tp.running = true;
+	while (!tp.done) {
+
+		// wait for new message to approach
+		message* msg = fq->dequeue_timedwait(300);
+
+		// handle message
+		if (msg) {
+
+			logging_debug( "Received incoming message" );
+
+			// handle transport message
+			TPMsg* tpmsg = dynamic_cast<TPMsg*> (msg);
+			if (tpmsg) {
+				// evaluate TP message
+				const appladdress* peer = static_cast<const appladdress*>( tpmsg->get_peeraddress() );
+				NetMsg* datamsg = tpmsg->get_message();
+				TPError* err = tpmsg->get_error();
+
+				// get data
+				if (datamsg) {
+
+					datamsg->set_pos(0);
+					uint32_t msgLength = datamsg->decode32(true);
+					uint16_t remotePort = datamsg->decode16(true);
+
+					// convert data
+					Data data(
+						(uint8_t*)(datamsg->get_buffer()+6),
+						(datamsg->get_size()-6)*8
+					);
+
+					// converting message
+					logging_debug( "Converting message" );
+					Message* msg = new Message(data);
+					std::ostringstream o;
+					o << (peer->get_ip_str() + 7) << ":" << remotePort;
+					msg->setSourceAddress( new IPv4Locator(IPv4Locator::fromString(o.str())) );
+					logging_debug( "> source address = " << o.str() );
+					logging_debug( "> message = " << msg->toString() );
+
+					// dispatching message
+					logging_debug( "Dispatching message" );
+					SystemQueue::instance().scheduleEvent(
+						SystemEvent( &tp, TCPMessageDispatchEvent, msg )
+					);
+				}
+
+				// check error
+				if (err)
+					logging_error( "TCP transport error " + string(err->getstr()) );
+
+				logging_debug( "Message processed." );
+
+				tpmsg = NULL;
+			}
+			delete msg;
+		}
+	}
+
+	// clean queue & stop
+	fq->cleanup();
+	tp.running = false;
+	return NULL;
+}
+
+seqnum_t TCPTransport::sendMessage(const Message* message ) {
+
+	Data data = data_serialize( message );
+	const_cast<Message*>(message)->dropPayload();
+
+	// prepare netmsg and send it
+	NetMsg* datamsg = new NetMsg(data.getLength()/8+6);
+	datamsg->encode32(data.getLength()/8+2, true);
+	datamsg->encode16(this->port,true);
+	for (int i=0; i<data.getLength()/8; i++)
+		datamsg->encode8(data.getBuffer()[i],true);
+
+	// send message
+	const IPv4Locator* address = dynamic_cast<const IPv4Locator*>(message->getDestinationAddress());
+	if( address == NULL) return 0;
+
+	logging_debug( "sending message of size " << data.getLength() <<
+			" to address " + address->toString() <<
+			": " + message->toString() );
+
+	string s = address->toString();
+	string::size_type i = s.find(':');
+	string ip = address->toString().substr(0,i).c_str();
+	logging_debug( "ip= " << ip << " port=" << address->getPort() );
+
+	appladdress peer(ip.c_str(), "tcp", address->getPort() );
+	tpthread->get_thread_object()->send(datamsg, peer, false);
+
+	// release data
+	data.release();
+	logging_debug( "message sent!" );
+
+	return 0;
+}
+
+void TCPTransport::terminate(const NetworkLocator* local, const NetworkLocator* remote){
+
+	const IPv4Locator* address = dynamic_cast<const IPv4Locator*>(remote);
+	if( address == NULL) return;
+
+	string s = address->toString();
+	string::size_type i = s.find(':');
+	string ip = address->toString().substr(0,i).c_str();
+
+	appladdress peer( ip.c_str(), "tcp", address->getPort() );
+	peer.convert_to_ipv6();
+
+	tpthread->get_thread_object()->terminate( peer );
+}
+
+TransportLocator::prot_t TCPTransport::getId() {
+	return 6; // TCP
+}
+
+
+
+const vector<TransportLocator*> TCPTransport::getLocators() {
+	return vector<TransportLocator*>();
+}
+
+/* system event handler */
+void TCPTransport::handleSystemEvent( const SystemEvent& event ) {
+
+	// dispatch received messages
+	if ( event.getType() == TCPMessageDispatchEvent ){
+		logging_debug( "forwarding message to local receivers" );
+		Message* msg = event.getData<Message>();
+		MessageProvider::sendMessageToReceivers( msg );
+		msg->dropPayload();
+//		delete msg->getSourceAddress();
+		delete msg;
+	}
+
+	if ( event.getType() == TCPTransportTestEvent ) {
+
+		// add listener
+		addMessageReceiver( new MessageReceiver() );
+
+		// send message
+		cout << "Sending message ..." << endl;
+		sendMessage( new TextMessage( "Hello World!" ) );
+		cout << "Message sent ..." << endl;
+
+	}
+}
+
+NAMESPACE_END;
Index: /source/ariba/communication/modules/transport/tcp/TCPTransport.h
===================================================================
--- /source/ariba/communication/modules/transport/tcp/TCPTransport.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/tcp/TCPTransport.h	(revision 2378)
@@ -0,0 +1,114 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef TCPTRANSPORT_H_
+#define TCPTRANSPORT_H_
+
+// kill protlib logging
+//#define _NO_LOGGING
+
+#include "ariba/utility/logging/Logging.h"
+#include "ariba/utility/messages.h"
+#include "ariba/utility/types/Address.h"
+#include "ariba/utility/misc/Helper.h"
+#include "ariba/utility/system/SystemEventListener.h"
+#include "ariba/utility/system/SystemEvent.h"
+#include "ariba/utility/system/SystemEventType.h"
+#include "ariba/communication/modules/network/ip/IPv4Locator.h"
+#include "ariba/communication/modules/transport/TransportProtocol.h"
+#include "ariba/communication/modules/transport/protlib/network_message.h"
+#include "ariba/communication/modules/transport/protlib/protlib_types.h"
+#include "ariba/communication/modules/transport/protlib/threads.h"
+#include "ariba/communication/modules/transport/protlib/tp_over_tcp.h"
+
+#include "ariba/communication/modules/_namespace.h"
+NAMESPACE_BEGIN;
+
+using namespace protlib;
+using ariba::utility::Address;
+using ariba::utility::seqnum_t;
+using ariba::utility::Message;
+using ariba::utility::SystemEventListener;
+using ariba::utility::SystemEvent;
+using ariba::utility::SystemEventType;
+using ariba::communication::IPv4Locator;
+
+class TCPTransport : public TransportProtocol, public SystemEventListener {
+
+	use_logging_h(TCPTransport);
+
+private:
+	port_t port;
+	volatile bool done;
+	volatile bool running;
+	pthread_t tpreceivethread;
+	ThreadStarter<TPoverTCP, TPoverTCPParam>* tpthread;
+
+	static void* receiverThread( void* ptp );
+	static bool  getMessageLength( NetMsg& m, uint32& clen_bytes );
+
+public:
+	TCPTransport( port_t port );
+	virtual ~TCPTransport();
+
+	/** @see TransportProtocol.h */
+	virtual void start();
+
+	/** @see TransportProtocol.h */
+	virtual void stop();
+
+	/** @see TransportProtocol.h */
+	virtual TransportLocator::prot_t getId();
+
+	/** @see TransportProtocol.h */
+	virtual const vector<TransportLocator*> getLocators();
+
+	/* @see MessageSender */
+	virtual seqnum_t sendMessage( const Message* message );
+
+	/** @see TransportProtocol.h */
+	virtual void terminate(const NetworkLocator* local, const NetworkLocator* remote);
+
+protected:
+	virtual void handleSystemEvent( const SystemEvent& event );
+
+};
+
+NAMESPACE_END;
+
+#endif /* TCPTRANSPORT_H_ */
Index: /source/ariba/communication/modules/transport/tcp/TCPTransportLocator.cpp
===================================================================
--- /source/ariba/communication/modules/transport/tcp/TCPTransportLocator.cpp	(revision 2378)
+++ /source/ariba/communication/modules/transport/tcp/TCPTransportLocator.cpp	(revision 2378)
@@ -0,0 +1,56 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "TCPTransportLocator.h"
+
+#include "ariba/communication/modules/_namespace.h"
+NAMESPACE_BEGIN;
+
+vsznDefault( TCPTransportLocator );
+
+TCPTransportLocator::TCPTransportLocator( port_t port ) {
+	this->port = port;
+}
+
+TCPTransportLocator::TCPTransportLocator() {
+}
+
+TCPTransportLocator::~TCPTransportLocator() {
+}
+
+NAMESPACE_END;
Index: /source/ariba/communication/modules/transport/tcp/TCPTransportLocator.h
===================================================================
--- /source/ariba/communication/modules/transport/tcp/TCPTransportLocator.h	(revision 2378)
+++ /source/ariba/communication/modules/transport/tcp/TCPTransportLocator.h	(revision 2378)
@@ -0,0 +1,87 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef TCPTRANSPORTLOCATOR_H_
+#define TCPTRANSPORTLOCATOR_H_
+
+// forward decl
+class TCPTransportLocator;
+
+// spovnet includes
+#include "../../modules.h"
+#include "ariba/utility/serialization.h"
+
+// boost includes
+#include <boost/cstdint.hpp>
+
+// lib includes
+#include <vector>
+
+// namespace begin
+#include "ariba/communication/modules/_namespace.h"
+NAMESPACE_BEGIN;
+
+using std::vector;
+
+class TCPTransportLocator : public TransportLocator {
+	VSERIALIZEABLE;
+	friend class TCPTransport;
+public:
+	typedef uint16_t port_t;
+
+protected:
+	port_t port;
+
+public:
+	TCPTransportLocator();
+	TCPTransportLocator( port_t port );
+	virtual ~TCPTransportLocator();
+
+	inline uint16_t getPort() const {
+		return port;
+	}
+};
+
+// namespace end
+NAMESPACE_END
+
+sznBeginDefault( ariba::communication::TCPTransportLocator, X ) {
+	X && port;
+} sznEnd();
+
+#endif /* TCPTRANSPORTLOCATOR_H_ */
Index: urce/ariba/communication/networkinfo/AddressDiscovery.cpp
===================================================================
--- /source/ariba/communication/networkinfo/AddressDiscovery.cpp	(revision 12775)
+++ 	(revision )
@@ -1,244 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "AddressDiscovery.h"
-#include "ariba/config.h"
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <ifaddrs.h>
-
-#include <string>
-#include <boost/asio/ip/address.hpp>
-#include <boost/foreach.hpp>
-
-#include "ariba/utility/addressing2/tcpip_endpoint.hpp"
-#include "ariba/utility/addressing/mac_address.hpp"
-
-#ifdef HAVE_LIBBLUETOOTH
-  #include <bluetooth/bluetooth.h>
-  #include <bluetooth/hci.h>
-  #include <bluetooth/hci_lib.h>
-#endif
-
-namespace ariba {
-namespace communication {
-
-
-using namespace std;
-using namespace addressing2;
-using namespace boost::asio::ip;
-
-using ariba::addressing::mac_address;
-
-mac_address getMacFromIF( const char* name )
-{
-	mac_address addr;
-#ifdef HAVE_LIBBLUETOOTH
-	int s;
-	struct ifreq buffer;
-	s = socket(PF_INET, SOCK_DGRAM, 0);
-	memset(&buffer, 0x00, sizeof(buffer));
-	strcpy(buffer.ifr_name, name);
-	ioctl(s, SIOCGIFHWADDR, &buffer);
-	close(s);
-	addr.assign( (uint8_t*)buffer.ifr_hwaddr.sa_data, 6 );
-#endif
-	return addr;
-}
-
-int dev_info(int s, int dev_id, long arg)
-{
-#ifdef HAVE_LIBBLUETOOTH
-//	endpoint_set* set = (endpoint_set*)arg;
-//	struct hci_dev_info di;
-//	memset(&di, 0, sizeof(struct hci_dev_info));
-//	di.dev_id = dev_id;
-//	if (ioctl(s, HCIGETDEVINFO, (void *) &di)) return 0;
-//	mac_address mac;
-//	mac.bluetooth( di.bdaddr );
-//	address_vf vf = mac;
-//	set->add(vf);
-#endif
-	return 0;
-}
-
-void discover_bluetooth(
-        EndpointSetPtr listenOn_endpoints,
-        EndpointSetPtr discovered_endpoints )
-{
-#ifdef HAVE_LIBBLUETOOTH
-    // FIXME aktuell bluetooth
-//	hci_for_each_dev(HCI_UP, &AddressDiscovery::dev_info, (long)&endpoints );
-#endif
-}
-
-void discover_ip_addresses(
-        EndpointSetPtr listenOn_endpoints,
-        EndpointSetPtr discovered_endpoints )
-{
-    bool discover_ipv4 = false;
-    bool discover_ipv6 = false;
-    vector<uint16_t> ipv4_ports;
-    vector<uint16_t> ipv6_ports;
-    
-    /* analyze listenOn_endpoints */
-    BOOST_FOREACH( TcpIP_EndpointPtr endp, listenOn_endpoints->get_tcpip_endpoints() )
-    {
-        // BRANCH: IPv4 any [0.0.0.0]
-        if ( endp->to_asio().address() == address_v4::any() )
-        {
-            // add port
-            ipv4_ports.push_back(endp->to_asio().port());
-            
-            discover_ipv4 = true;
-        }
-
-        // BRANCH: IPv6 any [::]
-        else if ( endp->to_asio().address() == address_v6::any() )
-        {
-            // add port
-            ipv6_ports.push_back(endp->to_asio().port());
-            
-            discover_ipv6 = true;
-
-            
-            // NOTE: on linux the ipv6-any address [::] catches ipv4 as well
-            ipv4_ports.push_back(endp->to_asio().port());
-            discover_ipv4 = true;
-        }
-        
-        // BRANCH: explicit ip address
-        else
-        {
-            // ---> don't discover anything, just add it directly
-            discovered_endpoints->add_endpoint(endp);
-        }
-    }
-    
-    
-    /* discover addresses */
-    if ( discover_ipv4 || discover_ipv6 )
-    {
-        struct ifaddrs* ifaceBuffer = NULL;
-        void*           tmpAddrPtr  = NULL;
-    
-        int ret = getifaddrs( &ifaceBuffer );
-        if( ret != 0 ) return;
-    
-        for( struct ifaddrs* i=ifaceBuffer; i != NULL; i=i->ifa_next )
-        {
-            // ignore devices that are disabled or have no ip
-            if(i == NULL) continue;
-            struct sockaddr* addr = i->ifa_addr;
-            if (addr==NULL) continue;
-    
-    //		// ignore tun devices  // XXX why?
-    //		string device = string(i->ifa_name);
-    //		if(device.find_first_of("tun") == 0) continue;
-
-            // IPv4
-            if ( discover_ipv4 && addr->sa_family == AF_INET )
-            {
-                char straddr[INET_ADDRSTRLEN];
-                tmpAddrPtr= &((struct sockaddr_in*)addr)->sin_addr;
-                inet_ntop( i->ifa_addr->sa_family, tmpAddrPtr, straddr, sizeof(straddr) );
-                
-                address ip_addr = address::from_string(straddr);
-    
-                // skip loopback address
-                if ( ip_addr.to_v4() == address_v4::loopback() )
-                    continue;
-
-                // add endpoint for this address and every given ipv4 port
-                BOOST_FOREACH( uint16_t port, ipv4_ports )
-                {
-                    tcp::endpoint tcpip_endp(ip_addr, port);
-                    TcpIP_EndpointPtr endp(new tcpip_endpoint(tcpip_endp));
-                    
-                    discovered_endpoints->add_endpoint(endp);
-                }
-            }
-            
-            // IPv6
-            else if ( discover_ipv6 && addr->sa_family == AF_INET6 )
-            {
-                // look for ipv6
-                char straddr[INET6_ADDRSTRLEN];
-                tmpAddrPtr= &((struct sockaddr_in6*)addr)->sin6_addr;
-                inet_ntop( i->ifa_addr->sa_family, tmpAddrPtr, straddr, sizeof(straddr) );
-                
-                address ip_addr = address::from_string(straddr);
-                
-                // skip loopback address
-                if ( ip_addr.to_v6() == address_v6::loopback() )
-                    continue;
-
-                // add endpoint for this address and every given ipv4 port
-                BOOST_FOREACH( uint16_t port, ipv6_ports )
-                {
-                    tcp::endpoint tcpip_endp(ip_addr, port);
-                    TcpIP_EndpointPtr endp(new tcpip_endpoint(tcpip_endp));
-                    
-                    discovered_endpoints->add_endpoint(endp);
-                }
-            }
-        }
-    
-        freeifaddrs(ifaceBuffer);
-    }
-}
-
-
-
-EndpointSetPtr AddressDiscovery::discover_endpoints(EndpointSetPtr listenOn_endpoints)
-{
-    EndpointSetPtr discovered_endpoints(new addressing2::endpoint_set());
-    
-	discover_ip_addresses( listenOn_endpoints, discovered_endpoints );
-	discover_bluetooth( listenOn_endpoints, discovered_endpoints );
-	
-	return discovered_endpoints;
-}
-
-}} // namespace ariba, communication
Index: urce/ariba/communication/networkinfo/AddressDiscovery.h
===================================================================
--- /source/ariba/communication/networkinfo/AddressDiscovery.h	(revision 12775)
+++ 	(revision )
@@ -1,63 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef __ADDRESS_DISCOVERY_H
-#define __ADDRESS_DISCOVERY_H
-
-#include "ariba/utility/addressing2/endpoint_set.hpp"
-
-namespace ariba {
-namespace communication {
-
-using addressing2::EndpointSetPtr;
-
-class AddressDiscovery {
-public:
-	static EndpointSetPtr discover_endpoints(EndpointSetPtr listenOn_endpoints);
-
-private:
-	// TODO aktuell weg damit..
-//	static mac_address getMacFromIF( const char* name );
-//	static int dev_info(int s, int dev_id, long arg);
-//	static void discover_bluetooth( EndpointSetPtr listenOn_endpoints, EndpointSetPtr discovered_endpoints );
-//	static void discover_ip_addresses( EndpointSetPtr listenOn_endpoints, EndpointSetPtr discovered_endpoints );
-};
-
-}} // namespace ariba, communication
-
-#endif // __ADDRESS_DISCOVERY_H
Index: /source/ariba/communication/networkinfo/AddressInformation.cpp
===================================================================
--- /source/ariba/communication/networkinfo/AddressInformation.cpp	(revision 2378)
+++ /source/ariba/communication/networkinfo/AddressInformation.cpp	(revision 2378)
@@ -0,0 +1,86 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "AddressInformation.h"
+
+namespace ariba {
+namespace communication {
+
+AddressInformation::AddressInformation(){
+}
+
+AddressInformation::~AddressInformation(){
+}
+
+AddressList AddressInformation::getAddresses(const NetworkInterface& interface){
+
+	AddressList retlist;
+
+	//
+	// gather transport addresses
+	//
+
+	struct ifaddrs* ifap;
+	getifaddrs( &ifap );
+
+	for( struct ifaddrs* p = ifap; p != NULL; p=p->ifa_next ){
+		if( interface.name.compare(string(p->ifa_name)) != 0 ) continue;
+
+		// TODO: currently only handle IPv4
+		struct sockaddr* addr = p->ifa_addr;
+		if( addr->sa_family != AF_INET ) continue;
+
+		const struct sockaddr_in& ipv4 = (const struct sockaddr_in&)*addr;
+		boost::asio::ip::address_v4::bytes_type bytes;
+		for( int i=0; i<4; i++ )
+			bytes[i] = (ipv4.sin_addr.s_addr >> (24-i*8)) & 0xff;
+
+		boost::asio::ip::address boost_addr = boost::asio::ip::address_v4( bytes );
+		retlist.push_back( IPv4Locator::fromString(boost_addr.to_string()) );
+	}
+
+	freeifaddrs( ifap );
+
+	//
+	// TODO: gather further addresses like MAC etc.
+	//
+
+	return retlist;
+}
+
+}} // namespace ariba, communication
Index: /source/ariba/communication/networkinfo/AddressInformation.h
===================================================================
--- /source/ariba/communication/networkinfo/AddressInformation.h	(revision 2378)
+++ /source/ariba/communication/networkinfo/AddressInformation.h	(revision 2378)
@@ -0,0 +1,69 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef __ADDRESS_INFORMATION_H
+#define __ADDRESS_INFORMATION_H
+
+#include <ifaddrs.h>
+#include <vector>
+#include <boost/asio/ip/address.hpp>
+#include <boost/asio/ip/address_v4.hpp>
+#include "ariba/communication/networkinfo/NetworkInterface.h"
+#include "ariba/communication/modules/network/ip/IPv4Locator.h"
+
+using std::vector;
+using ariba::communication::NetworkInterface;
+using ariba::communication::IPv4Locator;
+
+namespace ariba {
+namespace communication {
+
+typedef vector<IPv4Locator> AddressList; // TODO: make more general, not only ipv4
+
+class AddressInformation {
+public:
+	AddressInformation();
+	~AddressInformation();
+
+	AddressList getAddresses(const NetworkInterface& interface);
+
+};
+
+}} // namespace ariba, communication
+
+#endif // __ADDRESS_INFORMATION_H
Index: urce/ariba/communication/networkinfo/CMakeLists.txt
===================================================================
--- /source/ariba/communication/networkinfo/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,52 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    AddressDiscovery.h
-    NetworkChangeDetection.h
-    NetworkChangeInterface.h
-    NetworkInformation.h
-    NetworkInterface.h
-    )
-
-add_sources(
-    AddressDiscovery.cpp
-    NetworkChangeDetection.cpp
-    NetworkInformation.cpp
-    NetworkInterface.cpp
-    )
Index: /source/ariba/communication/networkinfo/NetworkChangeDetection.cpp
===================================================================
--- /source/ariba/communication/networkinfo/NetworkChangeDetection.cpp	(revision 12775)
+++ /source/ariba/communication/networkinfo/NetworkChangeDetection.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,27 +35,7 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "NetworkChangeDetection.h"
-
-#include <string>
-#include <algorithm>
-#include <cerrno>
-#include <string.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <boost/bind.hpp>
-#include <sys/socket.h>
-
-extern "C" {
-	#include <linux/netlink.h>
-	#include <linux/rtnetlink.h>
-}
-
-#include "ariba/utility/system/SystemQueue.h"
-
-using std::find;
-using ariba::utility::SystemQueue;
-using ariba::utility::SystemEventType;
 
 namespace ariba {
@@ -143,5 +123,5 @@
 	if( obj->routingSocket < 0 ){
 		logging_error("could not connect to routing socket: " +
-					std::string(strerror(errno)));
+					string(strerror(errno)));
 		return;
 	}
@@ -175,5 +155,5 @@
 	if( ret < 0 ){
 		close( obj->routingSocket );
-		logging_error( "could not bind routing socket: " + std::string(strerror(errno)) );
+		logging_error( "could not bind routing socket: " + string(strerror(errno)) );
 		return;
 	}
@@ -205,23 +185,23 @@
 			// all others are some kind of error
 			logging_error( "could not read from routing socket: " +
-							std::string(strerror(errno)) );
+							string(strerror(errno)) );
 			break;
 		}
 
 		for( ; bytesRead > 0; header = NLMSG_NEXT(header, bytesRead)) {
-			if (!NLMSG_OK(header, (size_t)bytesRead) ||
+			if (	!NLMSG_OK(header, bytesRead) ||
 				(size_t) bytesRead < sizeof(struct nlmsghdr) ||
-				(size_t) bytesRead < (size_t)header->nlmsg_len) {
+				(size_t) bytesRead < header->nlmsg_len) {
 				continue;
 			}
-
-			// somehow all notifications with pid=0 are
-			// invalid and occur much too often
-			if(header->nlmsg_pid == 0) continue;
 
 			//
 			// here we evaluate the routing netlink message. for, the following
 			// messages are of interest:
+			// 	RTM_NEWLINK, RTM_DELLINK -> interface up/down
 			//	RTM_NEWADDR, RTM_DELADDR -> new address on iface, address deleted from iface
+			// not interesting are:
+			//	RTM_GETLINK, RTM_GETADDR
+			//	RTM_NEWROUTE, RTM_DELROUTE, RTM_GETROUTE
 			//
 
@@ -229,4 +209,15 @@
 
 			switch( header->nlmsg_type ){
+
+				//
+				// handle network interface up/down notifications
+				// --> link layer notifications
+				//
+
+				case RTM_NEWLINK:
+				case RTM_DELLINK:
+
+					changeInfo = obj->extractInterfaceEvent( header );
+					break;
 
 				//
@@ -266,4 +257,45 @@
 }
 
+NetworkChangeInterface::NetworkChangeInfo NetworkChangeDetection::extractInterfaceEvent(struct nlmsghdr* header){
+	NetworkChangeInterface::NetworkChangeInfo changeInfo;
+
+	//
+	// handle network interface up/down notifications
+	// the differentiation between up/down is _not_
+	// made using new/del-link in the message!
+	//
+
+	if( header->nlmsg_type == RTM_NEWLINK ){
+		logging_debug("network change message RTM_NEWLINK");
+	}else if( header->nlmsg_type == RTM_DELLINK ){
+		logging_debug("network change message RTM_DELLINK");
+	}
+
+	if( header->nlmsg_len < NLMSG_LENGTH(sizeof(struct ifinfomsg)) ){
+		logging_error( "netlink packet soo small for ifinfomsg" );
+		return changeInfo;
+	}
+
+	//
+	// get the interface index and through this
+	// further information about the interface
+	//
+
+	struct ifinfomsg* detailIface = (struct ifinfomsg*)NLMSG_DATA(header);
+	changeInfo.interface = networkInformation.getInterface( detailIface->ifi_index );
+
+	//
+	// check whether device is now up or down
+	//
+
+	if( changeInfo.interface.isUp && changeInfo.interface.isRunning )
+		changeInfo.type = NetworkChangeInterface::EventTypeInterfaceUp;
+	else
+		changeInfo.type = NetworkChangeInterface::EventTypeInterfaceDown;
+
+
+	return changeInfo;
+}
+
 NetworkChangeInterface::NetworkChangeInfo NetworkChangeDetection::extractAddressEvent(struct nlmsghdr* header){
 	NetworkChangeInterface::NetworkChangeInfo changeInfo;
@@ -276,8 +308,8 @@
 	if( header->nlmsg_type == RTM_NEWADDR ){
 		logging_debug("network change message RTM_NEWADDR");
-		changeInfo.type = NetworkChangeInterface::EventTypeInterfaceUp;
+		changeInfo.type = NetworkChangeInterface::EventTypeAddressNew;
 	}else if( header->nlmsg_type == RTM_DELADDR ){
 		logging_debug("network change message RTM_DELADDR");
-		changeInfo.type = NetworkChangeInterface::EventTypeInterfaceDown;
+		changeInfo.type = NetworkChangeInterface::EventTypeAddressDelete;
 	}
 
Index: /source/ariba/communication/networkinfo/NetworkChangeDetection.h
===================================================================
--- /source/ariba/communication/networkinfo/NetworkChangeDetection.h	(revision 12775)
+++ /source/ariba/communication/networkinfo/NetworkChangeDetection.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,25 +35,42 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __NETWORK_CHANGE_DETECTION_H
 #define __NETWORK_CHANGE_DETECTION_H
 
-// Forward declarations
-struct nlmsghdr;
+#include <cerrno>
+#include <csignal>
+#include <vector>
+#include <algorithm>
+#include <string>
+#include <net/if.h>
+#include <arpa/inet.h>
+#include <linux/types.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/utility.hpp>
+#include <boost/bind.hpp>
+#include "ariba/communication/networkinfo/NetworkChangeInterface.h"
+#include "ariba/communication/networkinfo/NetworkInformation.h"
+#include "ariba/utility/system/SystemQueue.h"
+#include "ariba/utility/logging/Logging.h"
 
-#include <vector>
-#include <boost/thread/thread.hpp>
-
-#include "NetworkInformation.h"
-#include "NetworkChangeInterface.h"
-#include "ariba/utility/logging/Logging.h"
-#include "ariba/utility/system/SystemEventListener.h"
+using std::string;
+using std::vector;
+using std::find;
+using ariba::utility::SystemQueue;
+using ariba::utility::SystemEvent;
+using ariba::utility::SystemEventType;
+using ariba::utility::SystemEventListener;
+using ariba::communication::NetworkInformation;
 
 namespace ariba {
 namespace communication {
-
-using ariba::utility::SystemEvent;
-using ariba::utility::SystemEventListener;
 
 class NetworkChangeDetection : public SystemEventListener {
@@ -70,5 +87,5 @@
 
 private:
-	typedef std::vector<NetworkChangeInterface*> RegistrationList;
+	typedef vector<NetworkChangeInterface*> RegistrationList;
 	RegistrationList registrations;
 
@@ -76,6 +93,6 @@
 	void stopMonitoring();
 
+	boost::thread* monitoringThread;
 	volatile bool running;
-	boost::thread* monitoringThread;
 	static void monitoringThreadFunc( NetworkChangeDetection* obj );
 
@@ -83,4 +100,5 @@
 	NetworkInformation networkInformation;
 
+	NetworkChangeInterface::NetworkChangeInfo extractInterfaceEvent( struct nlmsghdr* header );
 	NetworkChangeInterface::NetworkChangeInfo extractAddressEvent( struct nlmsghdr* header );
 };
Index: /source/ariba/communication/networkinfo/NetworkChangeInterface.h
===================================================================
--- /source/ariba/communication/networkinfo/NetworkChangeInterface.h	(revision 12775)
+++ /source/ariba/communication/networkinfo/NetworkChangeInterface.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __NETWORK_CHANGE_INTERFACE_H
@@ -55,15 +55,19 @@
 
 	typedef enum _EventType {
-		EventTypeInvalid,			// INVALID
+		EventTypeInvalid,		// INVALID
 		EventTypeInterfaceUp,		// network interface came up
 		EventTypeInterfaceDown,		// network interface went down
+		EventTypeAddressNew,		// new network address configured
+		EventTypeAddressDelete,		// network address deleted
 	} EventType;
 
 	static string eventString(EventType ev){
 		switch( ev ){
-			case EventTypeInvalid: 			return "invalid type";
-			case EventTypeInterfaceUp: 		return "interface up";
+			case EventTypeInvalid: 		return "invalid type";
+			case EventTypeInterfaceUp: 	return "interface up";
 			case EventTypeInterfaceDown: 	return "interface down";
-			default:						return "unknown event";
+			case EventTypeAddressNew: 	return "new address";
+			case EventTypeAddressDelete: 	return "deleted address";
+			default:			return "unknown event";
 		}
 	}
Index: /source/ariba/communication/networkinfo/NetworkInformation.cpp
===================================================================
--- /source/ariba/communication/networkinfo/NetworkInformation.cpp	(revision 12775)
+++ /source/ariba/communication/networkinfo/NetworkInformation.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,14 +35,7 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "NetworkInformation.h"
-#include "ariba/config.h"
-
-#ifdef HAVE_LIBBLUETOOTH
-  #include <bluetooth/bluetooth.h>
-  #include <bluetooth/hci.h>
-  #include <bluetooth/hci_lib.h>
-#endif
 
 namespace ariba {
@@ -91,12 +84,4 @@
 			logging_error( "getting interface list failed with: " <<
 						strerror(errno));
-
-			// if the socket is bogus, try to get
-			// a new one for the next call
-			if(errno == EBADF){
-				close( infoSocket );
-				infoSocket = socket( AF_INET, SOCK_DGRAM, 0 );
-			}
-
 			return retlist;
 		}
@@ -147,5 +132,4 @@
 	// hold several values, depending on the request
 	// see /usr/include/net/if.h
-	//
 
 	NetworkInterfaceList::iterator i = retlist.begin();
@@ -207,57 +191,4 @@
 	} // for( ; i != iend; i++ )*/
 
-	//
-	// not we try to get bluetooth interfaces
-	//
-
-#ifdef HAVE_LIBBLUETOOTH
-
-	int btsock = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
-	if(btsock <  0){
-		logging_error("failed getting bluetooth raw socket");
-		return retlist;
-	}
-
-	struct hci_dev_list_req* btlist = NULL;
-	struct hci_dev_req* btdev = NULL;
-
-	btlist = (hci_dev_list_req*)malloc(HCI_MAX_DEV *
-			sizeof(struct hci_dev_list_req) + sizeof(struct hci_dev_req));
-
-	btlist->dev_num = HCI_MAX_DEV;
-	btdev = btlist->dev_req;
-
-	if(ioctl(btsock, HCIGETDEVLIST, btlist) < 0){
-		logging_error("failed getting requesting bluetooth devices");
-		free(btlist);
-		close(btsock);
-		return retlist;
-	}
-
-	btdev = btlist->dev_req;
-
-	for(int i=0; i<btlist->dev_num; i++, btdev++){
-		struct hci_dev_info di;
-		NetworkInterface interface;
-
-		if(hci_devinfo(btdev->dev_id, &di) < 0) continue;
-		if(hci_test_bit(HCI_RAW, &di.flags)) continue;
-
-		interface.name = string(di.name);
-		interface.index = di.dev_id;
-		interface.mtu = di.sco_mtu;
-		interface.isBroadcast = false;
-		interface.isLoopback = false;
-		interface.isMulticast = false;
-		interface.isUp = hci_test_bit(HCI_UP, &di.flags);
-		interface.isRunning = hci_test_bit(HCI_RUNNING, &di.flags);
-
-		retlist.push_back( interface );
-	}
-
-	free(btlist);
-	close(btsock);
-#endif
-
 	return retlist;
 }
Index: /source/ariba/communication/networkinfo/NetworkInformation.h
===================================================================
--- /source/ariba/communication/networkinfo/NetworkInformation.h	(revision 12775)
+++ /source/ariba/communication/networkinfo/NetworkInformation.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,15 +35,13 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __NETWORK_INFORMATION_H
 #define __NETWORK_INFORMATION_H
 
-#include <unistd.h>
 #include <vector>
 #include <string>
 #include <algorithm>
 #include <cerrno>
-#include <cstring>
 #include <net/if.h>
 #include <sys/socket.h>
Index: /source/ariba/communication/networkinfo/NetworkInterface.cpp
===================================================================
--- /source/ariba/communication/networkinfo/NetworkInterface.cpp	(revision 12775)
+++ /source/ariba/communication/networkinfo/NetworkInterface.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "NetworkInterface.h"
@@ -47,5 +47,5 @@
 	name( "" ), index( -1 ), isRunning( false ),
 	isUp( false ), isLoopback(false ), isBroadcast( false ),
-	isMulticast( false ), mtu( -1 ), txQueueLen( -1 )
+	mtu( -1 ), isMulticast( false ), txQueueLen( -1 )
 {
 }
Index: /source/ariba/communication/networkinfo/NetworkInterface.h
===================================================================
--- /source/ariba/communication/networkinfo/NetworkInterface.h	(revision 12775)
+++ /source/ariba/communication/networkinfo/NetworkInterface.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __NETWORK_INTERFACE_H
@@ -63,23 +63,10 @@
 	bool 	isBroadcast;
 	bool	isMulticast;
-	int		mtu;
-	int		txQueueLen;
+	int	mtu;
+	int	txQueueLen;
 
 	static NetworkInterface UNDEFINED;
 
-	NetworkInterface& operator=(const NetworkInterface& rh){
-		name 		= rh.name;
-		index 		= rh.index;
-		isRunning 	= rh.isRunning;
-		isUp 		= rh.isUp;
-		isLoopback 	= rh.isLoopback;
-		isBroadcast	= rh.isBroadcast;
-		isMulticast	= rh.isMulticast;
-		mtu 		= rh.mtu;
-		txQueueLen	= rh.txQueueLen;
-		return *this;
-	}
-
-	bool operator==(const NetworkInterface& rh ){
+	inline bool operator==(const NetworkInterface& rh ){
 		// equality means same name
 		return ( name.compare(rh.name) == 0 );
Index: urce/ariba/config.h.in
===================================================================
--- /source/ariba/config.h.in	(revision 12775)
+++ 	(revision )
@@ -1,55 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-// Version number
-#define VERSION @ariba_VERSION@
-
-// Debugging
-#cmakedefine DEBUG
-
-// Defined if you have avahi support (i.e. avahi-client and avahi-common)
-#cmakedefine HAVE_AVAHI
-
-// Defined if you have the `bluetooth' library (-lbluetooth)
-#cmakedefine HAVE_LIBBLUETOOTH
-
-// Defined if you have the log4cxx library
-#cmakedefine HAVE_LOG4CXX
-
-// Defined if you are on the Maemo platform
-#cmakedefine HAVE_MAEMO
Index: /source/ariba/interface/AribaContext.cpp
===================================================================
--- /source/ariba/interface/AribaContext.cpp	(revision 2378)
+++ /source/ariba/interface/AribaContext.cpp	(revision 2378)
@@ -0,0 +1,68 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "AribaContext.h"
+
+namespace ariba {
+namespace interface {
+
+AribaContext::AribaContext(BaseCommunication& _basecomm, BaseOverlay& _overlay,
+		const SpoVNetID& _spovnetid, const NodeID& _nodeid)
+	: basecomm( _basecomm ), overlay( _overlay ), spovnetid( _spovnetid ), nodeid( _nodeid ) {
+}
+
+AribaContext::~AribaContext() {
+}
+
+const SpoVNetID& AribaContext::getSpoVNetID() const {
+	return spovnetid;
+}
+
+const NodeID& AribaContext::getNodeID(void) const {
+	return nodeid;
+}
+
+BaseOverlay& AribaContext::getOverlay(){
+	return overlay;
+}
+
+BaseCommunication& AribaContext::getBaseCommunication() {
+	return basecomm;
+}
+
+}} // ariba, interface
Index: /source/ariba/interface/AribaContext.h
===================================================================
--- /source/ariba/interface/AribaContext.h	(revision 2378)
+++ /source/ariba/interface/AribaContext.h	(revision 2378)
@@ -0,0 +1,77 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef __ARIBA_CONTEXT_H
+#define __ARIBA_CONTEXT_H
+
+#include "ariba/utility/types/SpoVNetID.h"
+#include "ariba/utility/types/NodeID.h"
+#include "ariba/communication/BaseCommunication.h"
+#include "ariba/overlay/BaseOverlay.h"
+
+using ariba::utility::SpoVNetID;
+using ariba::utility::NodeID;
+using ariba::communication::BaseCommunication;
+using ariba::overlay::BaseOverlay;
+
+namespace ariba {
+namespace interface {
+
+class AribaContext {
+public:
+	AribaContext(BaseCommunication& _basecomm, BaseOverlay& _overlay,
+			const SpoVNetID& _spovnetid, const NodeID& _nodeid);
+	~AribaContext();
+
+	const SpoVNetID& getSpoVNetID() const;
+	const NodeID& getNodeID() const;
+
+	BaseOverlay& getOverlay();
+	BaseCommunication& getBaseCommunication();
+
+private:
+	SpoVNetID spovnetid;
+	NodeID nodeid;
+
+	BaseCommunication& basecomm;
+	BaseOverlay& overlay;
+};
+
+}} // ariba, interface
+
+#endif //__ARIBA_CONTEXT_H
Index: /source/ariba/interface/ServiceInterface.cpp
===================================================================
--- /source/ariba/interface/ServiceInterface.cpp	(revision 2378)
+++ /source/ariba/interface/ServiceInterface.cpp	(revision 2378)
@@ -0,0 +1,108 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "ServiceInterface.h"
+#include "ariba/interface/AribaContext.h"
+
+namespace ariba {
+namespace interface {
+
+ServiceInterface::ServiceInterface() : overlay( NULL ){
+}
+
+ServiceInterface::~ServiceInterface(){
+	if( overlay != NULL )
+		overlay->unbind( this, serviceid );
+}
+
+bool ServiceInterface::initialize( AribaContext* _ctx, const ServiceID& _serviceid ){
+	return initialize( &_ctx->getOverlay(), _serviceid );
+}
+
+bool ServiceInterface::initialize( BaseOverlay* _overlay, const ServiceID& _serviceid ){
+	if( _overlay == NULL ) return false;
+
+	overlay = _overlay;
+	serviceid = _serviceid;
+
+	return overlay->bind( this, serviceid);
+}
+
+void ServiceInterface::onOverlayCreate( const SpoVNetID& id ){
+}
+
+void ServiceInterface::onOverlayDestroy( const SpoVNetID& id ){
+}
+
+bool ServiceInterface::isJoinAllowed( const NodeID& nodeid, const SpoVNetID& spovnetid ){
+	// default: allow all nodes to join
+	return true;
+}
+
+void ServiceInterface::onNodeJoin( const NodeID& nodeid, const SpoVNetID& spovnetid ){
+}
+
+void ServiceInterface::onNodeLeave( const NodeID& id, const SpoVNetID& spovnetid ){
+}
+
+void ServiceInterface::onJoinSuccess( const SpoVNetID& spovnetid ){
+}
+
+void ServiceInterface::onJoinFail( const SpoVNetID& spovnetid ){
+}
+
+void ServiceInterface::onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote ){
+}
+
+void ServiceInterface::onLinkDown( const LinkID& link, const NodeID& local, const NodeID& remote ){
+}
+
+void ServiceInterface::onLinkChanged( const LinkID& link, const NodeID& local, const NodeID& remote ){
+}
+
+void ServiceInterface::onLinkFail(const LinkID& id, const NodeID& local, const NodeID& remote){
+}
+
+void ServiceInterface::onLinkQoSChanged(const LinkID& id, const NodeID& local, const NodeID& remote , const QoSParameterSet& qos){
+}
+
+bool ServiceInterface::receiveMessage( const Message* message, const LinkID& link, const NodeID& node ){
+	return true;
+}
+
+}} // namespace ariba, interface
Index: /source/ariba/interface/ServiceInterface.h
===================================================================
--- /source/ariba/interface/ServiceInterface.h	(revision 2378)
+++ /source/ariba/interface/ServiceInterface.h	(revision 2378)
@@ -0,0 +1,106 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef __SERVICE_INTERFACE_H
+#define __SERVICE_INTERFACE_H
+
+#include "ariba/overlay/OverlayEvents.h"
+#include "ariba/utility/messages/MessageReceiver.h"
+#include "ariba/utility/messages/Message.h"
+#include "ariba/utility/types/LinkID.h"
+#include "ariba/utility/types/SpoVNetID.h"
+#include "ariba/utility/types/ServiceID.h"
+#include "ariba/utility/types/NodeID.h"
+#include "ariba/utility/types/QoSParameterSet.h"
+
+namespace ariba {
+namespace overlay {
+	class BaseOverlay;
+}}
+
+using ariba::overlay::OverlayEvents;
+using ariba::overlay::BaseOverlay;
+using ariba::utility::MessageReceiver;
+using ariba::utility::Message;
+using ariba::utility::LinkID;
+using ariba::utility::SpoVNetID;
+using ariba::utility::ServiceID;
+using ariba::utility::NodeID;
+using ariba::utility::QoSParameterSet;
+
+namespace ariba {
+namespace interface {
+
+class AribaContext;
+
+class ServiceInterface : public OverlayEvents, MessageReceiver {
+	friend class ariba::overlay::BaseOverlay;
+public:
+	ServiceInterface();
+	virtual ~ServiceInterface();
+
+	bool initialize( AribaContext* _ctx, const ServiceID& _serviceid );
+	bool initialize( BaseOverlay* _overlay, const ServiceID& _serviceid );
+
+protected:
+	virtual void onOverlayCreate( const SpoVNetID& id );
+	virtual void onOverlayDestroy( const SpoVNetID& id );
+
+	virtual bool isJoinAllowed( const NodeID& nodeid, const SpoVNetID& spovnetid );
+	virtual void onNodeJoin( const NodeID& nodeid, const SpoVNetID& spovnetid );
+	virtual void onNodeLeave( const NodeID& id, const SpoVNetID& spovnetid );
+
+	virtual void onJoinSuccess( const SpoVNetID& spovnetid );
+	virtual void onJoinFail( const SpoVNetID& spovnetid );
+
+	virtual void onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkDown( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkChanged( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkFail(const LinkID& id, const NodeID& local, const NodeID& remote );
+	virtual void onLinkQoSChanged(const LinkID& id, const NodeID& local, const NodeID& remote , const QoSParameterSet& qos);
+
+	virtual bool receiveMessage( const Message* message, const LinkID& link, const NodeID& node );
+
+private:
+	BaseOverlay* overlay;
+	ServiceID serviceid;
+};
+
+}} // namespace ariba, interface
+
+#endif // __SERVICE_INTERFACE_H
Index: /source/ariba/interface/UnderlayAbstraction.cpp
===================================================================
--- /source/ariba/interface/UnderlayAbstraction.cpp	(revision 2378)
+++ /source/ariba/interface/UnderlayAbstraction.cpp	(revision 2378)
@@ -0,0 +1,112 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "UnderlayAbstraction.h"
+
+namespace ariba {
+namespace interface {
+
+use_logging_cpp(UnderlayAbstraction);
+
+UnderlayAbstraction::UnderlayAbstraction() : basecomm( NULL ) {
+}
+
+UnderlayAbstraction::~UnderlayAbstraction() {
+}
+
+AribaContext* UnderlayAbstraction::createNode(const SpoVNetID& spovnetid, const NodeID& nodeid, const NetworkLocator* locallocator, const uint16_t localport) {
+
+	logging_info( "creating node ...");
+
+	NodeID newid = nodeid;
+
+	if( nodeid == NodeID::UNSPECIFIED ){
+		logging_debug( "nodeid is unspecified, creating random ..." );
+		newid = NodeID( Identifier::random() );
+		logging_info( "local nodeid is " << newid.toString() );
+	}
+
+	basecomm = new BaseCommunication( locallocator, localport );
+
+	BaseOverlay* baseoverlay = new BaseOverlay( *basecomm, newid );
+	AribaContext* ctx = new AribaContext( *basecomm, *baseoverlay, spovnetid, newid );
+
+	logging_info( "spovnetid = " << ctx->getSpoVNetID().toString() <<
+			", nodeid = " << ctx->getNodeID().toString() );
+
+	return ctx;
+}
+
+AribaContext* UnderlayAbstraction::createSpoVNet(const SpoVNetID& spovnetid, const NodeID& nodeid, const NetworkLocator* locallocator, const uint16_t localport, const OverlayParameterSet& param, const SecurityParameterSet& sec, const QoSParameterSet& qos) {
+
+	// create new node
+	AribaContext* ctx = createNode( spovnetid, nodeid, locallocator, localport );
+
+	// create new base overlay (initiator)
+	logging_info("creating new spovnet...");
+	ctx->getOverlay().createSpoVNet( spovnetid, param, sec, qos );
+	logging_info("node created");
+
+	return ctx;
+}
+
+void UnderlayAbstraction::destroySpoVNet(AribaContext* ctx) {
+	ctx->getOverlay().leaveSpoVNet();
+	delete &ctx->getOverlay();
+	delete &ctx->getBaseCommunication();
+	delete ctx;
+}
+
+AribaContext* UnderlayAbstraction::joinSpoVNet(const SpoVNetID& spovnetid, const EndpointDescriptor& bootstrapnode, const NodeID& nodeid, const NetworkLocator* locallocator, const uint16_t localport) {
+
+	// create new node
+	AribaContext* ctx = createNode( spovnetid, nodeid, locallocator, localport );
+
+	// join spovnet
+	logging_info("joining existing spovnet...");
+	ctx->getOverlay().joinSpoVNet( spovnetid, bootstrapnode );
+	logging_info("node created");
+
+	return ctx;
+}
+
+void UnderlayAbstraction::leaveSpoVNet(AribaContext* ctx) {
+	destroySpoVNet( ctx );
+}
+
+}} // namespace ariba, interface
Index: /source/ariba/interface/UnderlayAbstraction.h
===================================================================
--- /source/ariba/interface/UnderlayAbstraction.h	(revision 2378)
+++ /source/ariba/interface/UnderlayAbstraction.h	(revision 2378)
@@ -0,0 +1,108 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef UNDERLAYABSTRACTION_H_
+#define UNDERLAYABSTRACTION_H_
+
+#include <string>
+#include "ariba/utility/types/OverlayParameterSet.h"
+#include "ariba/utility/types/SecurityParameterSet.h"
+#include "ariba/utility/types/QoSParameterSet.h"
+#include "ariba/utility/types/SpoVNetID.h"
+#include "ariba/interface/AribaContext.h"
+#include "ariba/communication/BaseCommunication.h"
+#include "ariba/overlay/BaseOverlay.h"
+
+using std::string;
+using ariba::utility::OverlayParameterSet;
+using ariba::utility::SecurityParameterSet;
+using ariba::utility::QoSParameterSet;
+using ariba::utility::SpoVNetID;
+using ariba::interface::AribaContext;
+using ariba::communication::BaseCommunication;
+using ariba::overlay::BaseOverlay;
+
+namespace ariba {
+namespace interface {
+
+#define ARIBA_DEFAULT_PORT 0xa1ba
+
+class UnderlayAbstraction {
+	use_logging_h( UnderlayAbstraction );
+public:
+	UnderlayAbstraction();
+	virtual ~UnderlayAbstraction();
+
+	AribaContext* createSpoVNet(
+		const SpoVNetID& spovnetid,
+		const NodeID& nodeid = NodeID::UNSPECIFIED,
+		const NetworkLocator* locallocator = NULL,
+		const uint16_t localport = ARIBA_DEFAULT_PORT,
+		const OverlayParameterSet& param = OverlayParameterSet::DEFAULT,
+		const SecurityParameterSet& sec  = SecurityParameterSet::DEFAULT,
+		const QoSParameterSet& qos = QoSParameterSet::DEFAULT
+	);
+
+	void destroySpoVNet( AribaContext* ctx );
+
+	AribaContext* joinSpoVNet(
+		const SpoVNetID& spovnetid,
+		const EndpointDescriptor& bootstrapnode,
+		const NodeID& nodeid = NodeID::UNSPECIFIED,
+		const NetworkLocator* locallocator = NULL,
+		const uint16_t localport = ARIBA_DEFAULT_PORT
+	);
+
+	void leaveSpoVNet( AribaContext* ctx );
+
+protected:
+	AribaContext* createNode(
+		const SpoVNetID& spovnetid,
+		const NodeID& nodeid,
+		const NetworkLocator* locallocator,
+		const uint16_t localport
+	);
+
+private:
+	BaseCommunication* basecomm;
+
+};
+
+}} //namespace ariba, interface
+
+#endif //UNDERLAYABSTRACTION_H_
Index: /source/ariba/overlay/BaseOverlay.cpp
===================================================================
--- /source/ariba/overlay/BaseOverlay.cpp	(revision 12775)
+++ /source/ariba/overlay/BaseOverlay.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,2721 +35,794 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "BaseOverlay.h"
 
-#include <sstream>
-#include <iostream>
-#include <string>
-#include <boost/foreach.hpp>
-
-#include "ariba/NodeListener.h"
-#include "ariba/CommunicationListener.h"
-#include "ariba/SideportListener.h"
-
-#include "ariba/overlay/LinkDescriptor.h"
-
-#include "ariba/overlay/messages/OverlayMsg.h"
-#include "ariba/overlay/messages/JoinRequest.h"
-#include "ariba/overlay/messages/JoinReply.h"
-
-#include "ariba/utility/visual/OvlVis.h"
-#include "ariba/utility/visual/DddVis.h"
-#include "ariba/utility/visual/ServerVis.h"
-#include <ariba/utility/misc/sha1.h>
+#include "ariba/utility/misc/OvlVis.h"
+using ariba::utility::OvlVis;
 
 namespace ariba {
 namespace overlay {
 
-using namespace std;
-using ariba::transport::system_priority;
-
-#define visualInstance 		ariba::utility::DddVis::instance()
-#define visualIdOverlay 	ariba::utility::ServerVis::NETWORK_ID_BASE_OVERLAY
-#define visualIdBase		ariba::utility::ServerVis::NETWORK_ID_BASE_COMMUNICATION
-
-
-// time constants (in seconds)
-#define KEEP_ALIVE_TIME         60                      // send keep-alive message after link is not used for #s  
-
-#define LINK_ESTABLISH_TIME_OUT 10                      // timeout: link requested but not up
-#define KEEP_ALIVE_TIME_OUT     KEEP_ALIVE_TIME + LINK_ESTABLISH_TIME_OUT     // timeout: no data received on this link (incl. keep-alive messages)
-#define AUTO_LINK_TIME_OUT      KEEP_ALIVE_TIME_OUT                    // timeout: auto link not used for #s
-
-
-// ----------------------------------------------------------------------------
-
-/* *****************************************************************************
- * PREREQUESITES
- * ****************************************************************************/
-
-CommunicationListener* BaseOverlay::getListener( const ServiceID& service ) {
-	if( !communicationListeners.contains( service ) ) {
-		logging_info( "No listener found for service " << service.toString() );
-		return NULL;
-	}
-	CommunicationListener* listener = communicationListeners.get( service );
-	assert( listener != NULL );
-	return listener;
-}
-
-// link descriptor handling ----------------------------------------------------
-
-LinkDescriptor* BaseOverlay::getDescriptor( const LinkID& link, bool communication ) {
-	foreach( LinkDescriptor* lp, links )
-				if ((communication ? lp->communicationId : lp->overlayId) == link)
-					return lp;
-	return NULL;
-}
-
-const LinkDescriptor* BaseOverlay::getDescriptor( const LinkID& link, bool communication ) const {
-	foreach( const LinkDescriptor* lp, links )
-				if ((communication ? lp->communicationId : lp->overlayId) == link)
-					return lp;
-	return NULL;
-}
-
-/// erases a link descriptor
-void BaseOverlay::eraseDescriptor( const LinkID& link, bool communication ) {
-	for ( vector<LinkDescriptor*>::iterator i = links.begin(); i!= links.end(); i++) {
-		LinkDescriptor* ld = *i;
-		if ((communication ? ld->communicationId : ld->overlayId) == link) {
-			delete ld;
-			links.erase(i);
-			break;
-		}
-	}
-}
-
-/// adds a link descriptor
-LinkDescriptor* BaseOverlay::addDescriptor( const LinkID& link ) {
-	LinkDescriptor* desc = getDescriptor( link );
-	if ( desc == NULL ) {
-		desc = new LinkDescriptor();
-		if (!link.isUnspecified()) desc->overlayId = link;
-		links.push_back(desc);
-	}
-	return desc;
-}
-
-/// returns a auto-link descriptor
-LinkDescriptor* BaseOverlay::getAutoDescriptor( const NodeID& node, const ServiceID& service )
-{
-	// search for a descriptor that is already up
-	foreach( LinkDescriptor* lp, links )
-    {
-        if (lp->autolink && lp->remoteNode == node && lp->service == service && isLinkVital(lp) )
-            return lp;
-    }
-	
-	// if not found, search for one that is about to come up...
-	foreach( LinkDescriptor* lp, links )
-	{
-	    time_t now = time(NULL);
-	    
-        if (lp->autolink && lp->remoteNode == node && lp->service == service
-                && difftime( now, lp->keepAliveReceived ) <= LINK_ESTABLISH_TIME_OUT )
-            return lp;
-	}
-	
-	return NULL;
-}
-
-/// stabilizes link information
-void BaseOverlay::stabilizeLinks() {
-    time_t now = time(NULL);
-    
-    // send keep-alive messages over established links
-	foreach( LinkDescriptor* ld, links )
-    {
-		if (!ld->up) continue;
-		
-		if ( difftime( now, ld->keepAliveSent ) >= KEEP_ALIVE_TIME )
-		{
-		    logging_debug("[BaseOverlay] Sending KeepAlive over "
-		            << ld->to_string()
-		            << " after "
-		            << difftime( now, ld->keepAliveSent )
-		            << "s");
-		    
-            OverlayMsg msg( OverlayMsg::typeKeepAlive,
-                    OverlayInterface::OVERLAY_SERVICE_ID, nodeId, ld->remoteNode );
-            msg.setRouteRecord(true);
-            ld->keepAliveSent = now;
-            send_link( &msg, ld->overlayId, system_priority::OVERLAY );
-		}
-	}
-
-	// iterate over all links and check for time boundaries
-	vector<LinkDescriptor*> oldlinks;
-	foreach( LinkDescriptor* ld, links ) {
-
-		// link connection request stale?
-		if ( !ld->up && difftime( now, ld->keepAliveReceived ) >= LINK_ESTABLISH_TIME_OUT )  // NOTE: keepAliveReceived == now, on connection request
-		{
-            logging_info( "Link connection request is stale, closing: " << ld );
-            ld->failed = true;
-            oldlinks.push_back( ld );
-            continue;
-		}
-
-		if (!ld->up) continue;
-
-		
-		
-		
-		// check if link is relayed and retry connecting directly
-		// TODO Mario: What happens here?  --> There are 3 attempts to replace a relayed link with a direct one. see: handleLinkReply
-		if ( ld->relayed && !ld->communicationUp && ld->retryCounter > 0) {
-			ld->retryCounter--;
-			ld->communicationId = bc->establishLink( ld->endpoint );
-		}
-
-		// remote used as relay flag
-		if ( ld->relaying && difftime( now, ld->timeRelaying ) > KEEP_ALIVE_TIME_OUT)  // TODO is this a reasonable timeout ??
-			ld->relaying = false;
-
-		// drop links that are dropped and not used as relay
-		if (ld->dropAfterRelaying && !ld->relaying && !ld->autolink) {
-			oldlinks.push_back( ld );
-			continue;
-		}
-
-		// auto-link time exceeded?
-		if ( ld->autolink && difftime( now, ld->lastuse ) > AUTO_LINK_TIME_OUT ) {
-			oldlinks.push_back( ld );
-			continue;
-		}
-
-		// keep alives missed? yes->
-		if ( difftime( now, ld->keepAliveReceived ) >= KEEP_ALIVE_TIME_OUT )
-		{
-            logging_info( "Link is stale, closing: " << ld );
-            ld->failed = true;
-            oldlinks.push_back( ld );
-            continue;
-		}
-	}
-
-	// drop links
-	foreach( LinkDescriptor* ld, oldlinks ) {
-		logging_info( "Link timed out. Dropping " << ld );
-		ld->relaying = false;
-		dropLink( ld->overlayId );
-	}
-
-	
-	
-	
-	// show link state  (debug output)
-	if (counter>=10 || counter<0)
-    {
-	    showLinks();
-	    counter = 0;
-    }
-	else
-	{
-	    counter++;
-	}
-}
-
-
-std::string BaseOverlay::getLinkHTMLInfo() {
-	std::ostringstream s;
-	vector<NodeID> nodes;
-	if (links.size()==0) {
-		s << "<h2 style=\"color=#606060\">No links established!</h2>";
-	} else {
-		s << "<h2 style=\"color=#606060\">Links</h2>";
-		s << "<table width=\"100%\" cellpadding=\"0\" border=\"0\" cellspacing=\"0\">";
-		s << "<tr style=\"background-color=#ffe0e0\">";
-		s << "<td><b>Link ID</b></td><td><b>Remote ID</b></td><td><b>Relay path</b></td>";
-		s << "</tr>";
-
-		int i=0;
-		foreach( LinkDescriptor* ld, links ) {
-			if (!isLinkVital(ld) || ld->service != OverlayInterface::OVERLAY_SERVICE_ID) continue;
-			bool found = false;
-			foreach(NodeID& id, nodes)
-			if (id  == ld->remoteNode) found = true;
-			if (found) continue;
-			i++;
-			nodes.push_back(ld->remoteNode);
-			if ((i%1) == 1) s << "<tr style=\"background-color=#f0f0f0;\">";
-			else s << "<tr>";
-			s << "<td>" << ld->overlayId.toString().substr(0,4) << "..</td>";
-			s << "<td>" << ld->remoteNode.toString().substr(0,4) << "..</td>";
-			s << "<td>";
-			if (ld->routeRecord.size()>1 && ld->relayed) {
-				for (size_t i=1; i<ld->routeRecord.size(); i++)
-					s << ld->routeRecord[ld->routeRecord.size()-i-1].toString().substr(0,4) << ".. ";
-			} else {
-				s << "Direct";
-			}
-			s << "</td>";
-			s << "</tr>";
-		}
-		s << "</table>";
-	}
-	return s.str();
-}
-
-/// shows the current link state
-void BaseOverlay::showLinks() {
-	int i=0;
-	logging_info("--- link state -------------------------------");
-	foreach( LinkDescriptor* ld, links ) {
-		string epd = "";
-		if (isLinkDirectVital(ld))
-		{
-//			epd = getEndpointDescriptor(ld->remoteNode).toString();
-		    
-		    epd = "Connection: ";
-		    epd += bc->get_local_endpoint_of_link(ld->communicationId)->to_string();
-		    epd += " <---> ";
-		    epd += bc->get_remote_endpoint_of_link(ld->communicationId)->to_string();
-		}
-
-		logging_info("LINK_STATE: " << i << ": " << ld << " " << epd);
-		i++;
-	}
-	logging_info("----------------------------------------------");
-}
-
-/// compares two arbitrary links to the same node
-int BaseOverlay::compare( const LinkID& lhs, const LinkID& rhs ) {
-	LinkDescriptor* lhsld = getDescriptor(lhs);
-	LinkDescriptor* rhsld = getDescriptor(rhs);
-	if (lhsld==NULL || rhsld==NULL
-			|| !lhsld->up || !rhsld->up
-			|| lhsld->remoteNode != rhsld->remoteNode) return -1;
-
-	if ((lhsld->remoteLink^lhsld->overlayId)<(rhsld->remoteLink^lhsld->overlayId)  )
-		return -1;
-
-	return 1;
-}
-
-
-// internal message delivery ---------------------------------------------------
-
-
-seqnum_t BaseOverlay::send_overlaymessage_down( OverlayMsg* message, const LinkID& bc_link, uint8_t priority )
-{
-    // set priority
-    message->setPriority(priority);
-    
-    // wrap old OverlayMsg into reboost message
-    reboost::message_t wrapped_message = message->wrap_up_for_sending();
-    
-    // send down to BaseCommunication
-    try
-    {
-        // * send *
-        return bc->sendMessage(bc_link, wrapped_message, priority, false);
-    }
-    catch ( communication::communication_message_not_sent& e )
-    {
-        ostringstream out;
-        out << "Communication message not sent: " << e.what();
-        throw message_not_sent(out.str());
-    }
-    
-    throw logic_error("This should never happen!");
-}
-
-
-/// routes a message to its destination node
-void BaseOverlay::route( OverlayMsg* message, const NodeID& last_hop )
-{
-	// exceeded time-to-live? yes-> drop message
-	if (message->getNumHops() > message->getTimeToLive())
-	{
-		logging_warn("Message exceeded TTL. Dropping message and relay routes "
-            << "for recovery. Hop count: " << (int) message->getNumHops());
-		removeRelayNode(message->getDestinationNode());
-		return;
-	}
-
-	// no-> forward message
-	else
-	{
-		// destinastion myself? yes-> handle message
-		if (message->getDestinationNode() == nodeId)
-		{
-			logging_warn("Usually I should not route messages to myself. And I won't!");
-		}
-
-		// no->send message to next hop
-		else
-		{
-		    try
-		    {
-                /* (deep) packet inspection to determine priority */
-                // BRANCH: typeData  -->  send with low priority
-                if ( message->getType() == OverlayMsg::typeData )
-                {
-                    // TODO think about implementing explicit routing queue (with active queue management??)
-                    send( message,
-                          message->getDestinationNode(),
-                          message->getPriority(),
-                          last_hop );
-                }
-                // BRANCH: internal message  -->  send with higher priority
-                else
-                {
-                    send( message,
-                          message->getDestinationNode(),
-                          system_priority::HIGH,
-                          last_hop );
-                }
-		    }
-		    catch ( message_not_sent& e )
-		    {
-		        logging_warn("Unable to route message of type "
-		                << message->getType()
-		                << " to "
-		                << message->getDestinationNode()
-		                << ". Reason: "
-		                << e.what());
-		        
-		        // inform sender
-                if ( message->getType() != OverlayMsg::typeMessageLost )
-                {
-                    report_lost_message(message);
-                }
-		    }
-		}
-	}
-}
-
-void BaseOverlay::report_lost_message( const OverlayMsg* message )
-{
-    OverlayMsg reply(OverlayMsg::typeMessageLost);
-    reply.setSeqNum(message->getSeqNum());
-    
-    /**
-     * MessageLost-Message
-     * 
-     * - Type of lost message
-     * - Hop count of lost message
-     * - Source-LinkID  of lost message
-     */
-    reboost::shared_buffer_t b(sizeof(uint8_t)*2);
-    b.mutable_data()[0] = message->getType();
-    b.mutable_data()[1] = message->getNumHops();
-    reply.append_buffer(b);
-    reply.append_buffer(message->getSourceLink().serialize());
-    
-    try
-    {
-        send_node(&reply, message->getSourceNode(),
-                system_priority::OVERLAY,
-                OverlayInterface::OVERLAY_SERVICE_ID);
-    }
-    catch ( message_not_sent& e )
-    {
-        logging_warn("Tried to inform another node that we could'n route their message. But we were not able to send this error-message, too.");
-    }
-}
-
-/// sends a message to another node, delivers it to the base overlay class
-seqnum_t BaseOverlay::send( OverlayMsg* message,
-        const NodeID& destination,
-        uint8_t priority,
-        const NodeID& last_hop ) throw(message_not_sent)
-{
-	LinkDescriptor* next_link = NULL;
-
-	// drop messages to unspecified destinations
-	if (destination.isUnspecified())
-	    throw message_not_sent("No destination specified. Drop!");
-
-	// send messages to myself -> drop!
-    // TODO maybe this is not what we want. why not just deliver this message?
-    //   There is a similar check in the route function, there it should be okay.
-	if (destination == nodeId)
-	{
-	    logging_warn("Sent message to myself. Drop!");
-	    
-	    throw message_not_sent("Sent message to myself. Drop!");
-	}
-
-	// use relay path?
-	if (message->isRelayed())
-	{
-		next_link = getRelayLinkTo( destination );
-		
-		if (next_link != NULL)
-		{
-			next_link->setRelaying();
-
-			// * send message over relayed link *
-			return send_overlaymessage_down(message, next_link->communicationId, priority);
-		}
-		else
-		{
-			logging_warn("No relay hop found to " << destination
-			        << " -- trying to route over overlay paths ...")
-		}
-	}
-
-	
-	// last resort -> route over overlay path
-	LinkID next_id = overlayInterface->getNextLinkId( destination );
-	if ( next_id.isUnspecified() )
-	{		
-        // apperently we're the closest node --> try second best node
-        //   NOTE: This is helpful if our routing table is not up-to-date, but 
-        //   may lead to circles. So we have to be careful.
-        std::vector<const LinkID*> next_ids = 
-            overlayInterface->getSortedLinkIdsTowardsNode( destination );
-            
-        for ( size_t i = 0; i < next_ids.size(); i++ )
-        {
-            const LinkID& link = *next_ids[i];
-            
-            if ( ! link.isUnspecified() )
-            {
-                next_id = link;
-                
-                break;
-            }
-        }
-     
-        // still no next hop found. drop.
-        if ( next_id.isUnspecified() )
-        {
-            logging_warn("Could not send message. No next hop found to " <<
-                destination );
-            logging_error("ERROR: " << debugInformation() );
-            
-            throw message_not_sent("No next hop found.");
-        }
-	}
-
-	
-	/* get link descriptor, do some checks and send message */
-	next_link = getDescriptor(next_id);
-    
-    // check pointer
-    if ( next_link == NULL )
-    {
-        // NOTE: this shuldn't happen
-        throw message_not_sent("Could not send message. Link not known.");
-    }
-    
-    // avoid circles
-    if ( next_link->remoteNode == last_hop )
-    {
-        // XXX logging_debug
-        logging_info("Possible next hop would create a circle: "
-            << next_link->remoteNode);
-        
-        throw message_not_sent("Could not send message. Possible next hop would create a circle.");
-    }
-    
-    // check if link is up
-	if ( ! next_link->up)
-	{
-        logging_warn("Could not send message. Link not up");
-        logging_error("ERROR: " << debugInformation() );
-        
-        throw message_not_sent("Could not send message. Link not up");
-	}
-
-	// * send message over overlay link *
-	return send(message, next_link, priority);
-}
-
-
-/// send a message using a link descriptor, delivers it to the base overlay class
-seqnum_t BaseOverlay::send( OverlayMsg* message,
-        LinkDescriptor* ldr,
-        uint8_t priority ) throw(message_not_sent)
-{
-	// check if null
-	if (ldr == NULL)
-	{
-        ostringstream out;
-        out << "Can not send message to " << message->getDestinationAddress();
-        throw message_not_sent(out.str());
-	}
-
-	// check if up
-	if ( !ldr->up )
-	{
-		logging_error("DEBUG_INFO: " << debugInformation() );
-
-        ostringstream out;
-        out << "Can not send message. Link not up:" << ldr->to_string();
-        throw message_not_sent(out.str());
-	}
-	
-	LinkDescriptor* next_hop_ld = NULL;
-
-	// BRANCH: relayed link
-	if (ldr->relayed)
-	{
-		logging_debug("Resolving direct link for relayed link to "
-				<< ldr->remoteNode);
-		
-		next_hop_ld = getRelayLinkTo( ldr->remoteNode );
-		
-		if (next_hop_ld==NULL)
-		{
-			logging_error("DEBUG_INFO: " << debugInformation() );
-			
-	        ostringstream out;
-	        out << "No relay path found to link: " << ldr;
-	        throw message_not_sent(out.str());
-		}
-		
-		next_hop_ld->setRelaying();
-		message->setRelayed(true);
-	}
-	// BRANCH: direct link
-	else
-	{
-		next_hop_ld = ldr;
-	}
-
-	
-	// check next hop-link
-	if ( ! next_hop_ld->communicationUp)
-	{
-	    throw message_not_sent( "send(): Could not send message."
-	            " Not a relayed link and direct link is not up." );
-	}
-
-	// send over next link
-    logging_debug("send(): Sending message over direct link.");
-    return send_overlaymessage_down(message, next_hop_ld->communicationId, priority);
-
-}
-
-seqnum_t BaseOverlay::send_node( OverlayMsg* message, const NodeID& remote,
-        uint8_t priority, const ServiceID& service) throw(message_not_sent)
-{
-	message->setSourceNode(nodeId);
-	message->setDestinationNode(remote);
-	message->setService(service);
-	return send( message, remote, priority );
-}
-
-void BaseOverlay::send_link( OverlayMsg* message,
-        const LinkID& link,
-        uint8_t priority ) throw(message_not_sent)
-{
-	LinkDescriptor* ld = getDescriptor(link);
-	if (ld==NULL)
-	{
-	    throw message_not_sent("Cannot find descriptor to link id=" + link.toString());
-	}
-	
-	message->setSourceNode(nodeId);
-	message->setDestinationNode(ld->remoteNode);
-
-	message->setSourceLink(ld->overlayId);
-	message->setDestinationLink(ld->remoteLink);
-
-	message->setService(ld->service);
-	message->setRelayed(ld->relayed);
-    
-    
-    try
-    {
-        // * send message *
-        send( message, ld, priority );
-    }
-    catch ( message_not_sent& e )
-    {
-        // drop failed link
-        ld->failed = true;
-        dropLink(ld->overlayId);
-    }
-}
-
-// relay route management ------------------------------------------------------
-
-/// stabilize relay information
-void BaseOverlay::stabilizeRelays() {
-	vector<relay_route>::iterator i = relay_routes.begin();
-	while (i!=relay_routes.end() ) {
-		relay_route& route = *i;
-		LinkDescriptor* ld = getDescriptor(route.link);
-
-		// relay link still used and alive?
-		if (ld==NULL
-				|| !isLinkDirectVital(ld)
-				|| difftime(route.used, time(NULL)) > KEEP_ALIVE_TIME_OUT)  // TODO this was set to 8 before.. Is the new timeout better?
-		{
-			logging_info("Forgetting relay information to node "
-					<< route.node.toString() );
-			i = relay_routes.erase(i);
-		} else
-			i++;
-	}
-}
-
-void BaseOverlay::removeRelayLink( const LinkID& link ) {
-	vector<relay_route>::iterator i = relay_routes.begin();
-	while (i!=relay_routes.end() ) {
-		relay_route& route = *i;
-		if (route.link == link ) i = relay_routes.erase(i); else i++;
-	}
-}
-
-void BaseOverlay::removeRelayNode( const NodeID& remote ) {
-	vector<relay_route>::iterator i = relay_routes.begin();
-	while (i!=relay_routes.end() ) {
-		relay_route& route = *i;
-		if (route.node == remote ) i = relay_routes.erase(i); else i++;
-	}
-}
-
-/// refreshes relay information
-void BaseOverlay::refreshRelayInformation( const OverlayMsg* message, LinkDescriptor* ld ) {
-
-	// handle relayed messages from real links only
-	if (ld == NULL
-			|| ld->relayed
-			|| message->getSourceNode()==nodeId ) return;
-
-	// update usage information
-	if (message->isRelayed()) {
-		// try to find source node
-		foreach( relay_route& route, relay_routes ) {
-			// relay route found? yes->
-			if ( route.node == message->getDestinationNode() ) {
-				ld->setRelaying();
-				route.used = time(NULL);
-			}
-		}
-
-	}
-
-	// register relay path
-	if (message->isRegisterRelay()) {
-		// set relaying
-		ld->setRelaying();
-
-		// try to find source node
-		foreach( relay_route& route, relay_routes ) {
-
-			// relay route found? yes->
-			if ( route.node == message->getSourceNode() ) {
-
-				// refresh timer
-				route.used = time(NULL);
-				LinkDescriptor* rld = getDescriptor(route.link);
-
-				// route has a shorter hop count or old link is dead? yes-> replace
-				if (route.hops > message->getNumHops()
-						|| rld == NULL
-						|| !isLinkDirectVital(ld)) {
-					logging_info("Updating relay information to node "
-							<< route.node.toString()
-							<< " reducing to " << (int) message->getNumHops() << " hops.");
-					route.hops = message->getNumHops();
-					route.link = ld->overlayId;
-				}
-				return;
-			}
-		}
-
-		// not found-> add new entry
-		relay_route route;
-		route.hops = message->getNumHops();
-		route.link = ld->overlayId;
-		route.node = message->getSourceNode();
-		route.used = time(NULL);
-		logging_info("Remembering relay information to node "
-				<< route.node.toString());
-		relay_routes.push_back(route);
-	}
-}
-
-/// returns a known "vital" relay link which is up and running
-LinkDescriptor* BaseOverlay::getRelayLinkTo( const NodeID& remote ) {
-	// try to find source node
-	foreach( relay_route& route, relay_routes ) {
-		if (route.node == remote ) {
-			LinkDescriptor* ld = getDescriptor( route.link );
-			if (ld==NULL || !isLinkDirectVital(ld)) return NULL; else {
-				route.used = time(NULL);
-				return ld;
-			}
-		}
-	}
-	return NULL;
-}
-
-/* *****************************************************************************
- * PUBLIC MEMBERS
- * ****************************************************************************/
-
 use_logging_cpp(BaseOverlay);
 
-// ----------------------------------------------------------------------------
-
-BaseOverlay::BaseOverlay() :
-			started(false),
-			connected(false),
-			state(BaseOverlayStateInvalid),
-			bc(NULL),
-			nodeId(NodeID::UNSPECIFIED), spovnetId(SpoVNetID::UNSPECIFIED),
-			sideport(&SideportListener::DEFAULT), overlayInterface(NULL),
-			counter(0) {
+BaseOverlay::BaseOverlay( BaseCommunication& _basecomm, const NodeID& _nodeid )
+	: 	bc( _basecomm ), nodeId( _nodeid ), spovnetId( SpoVNetID::UNSPECIFIED), overlayInterface( NULL ),
+		initiatorLink( LinkID::UNSPECIFIED ), state( BaseOverlayStateInvalid ) {
+
+	logging_info("creating base overlay");
+
+	bc.registerMessageReceiver( this );
+	bc.registerEventListener( this );
+
+	ovl.visCreate( ovlId, nodeId, string(""), string("") );
+	ovl.visChangeNodeColor(ovlId, nodeId, OvlVis::NODE_COLORS_GREY);
+
+// 	if (Identifier(Configuration::instance().read<unsigned long>("BASE_nodeid")) ==
+// 	    Identifier(Configuration::instance().read<unsigned long>("SOURCE"))) {
+// 		ovl.visChangeNodeIcon(ovlId, nodeId, OvlVis::ICON_ID_CAMERA);
+// 	} else if (Identifier(Configuration::instance().read<unsigned long>("BASE_nodeid")) ==
+// 	    Identifier(Configuration::instance().read<unsigned long>("MR_A"))) {
+// 		ovl.visChangeNodeIcon(ovlId, nodeId, OvlVis::ICON_ID_CHARACTER_A);
+// 	} else if (Identifier(Configuration::instance().read<unsigned long>("BASE_nodeid")) ==
+// 	    Identifier(Configuration::instance().read<unsigned long>("MR_W"))) {
+// 		ovl.visChangeNodeIcon(ovlId, nodeId, OvlVis::ICON_ID_CHARACTER_W);
+// 	}
 }
 
 BaseOverlay::~BaseOverlay() {
-}
-
-// ----------------------------------------------------------------------------
-
-void BaseOverlay::start( BaseCommunication* _basecomm, const NodeID& _nodeid ) {
-	logging_info("Starting...");
-
-	// set parameters
-	bc = _basecomm;
-	nodeId = _nodeid;
-
-	// register at base communication
-	bc->registerMessageReceiver( this );
-	bc->registerEventListener( this );
-
-	// timer for auto link management
-	Timer::setInterval( 1000 ); // XXX
-//	Timer::setInterval( 10000 );
-	Timer::start();
-
-	started = true;
+
+	logging_info("deleting base overlay");
+
+	bc.unregisterMessageReceiver( this );
+	bc.unregisterEventListener( this );
+}
+
+void BaseOverlay::joinSpoVNet(const SpoVNetID& id, const EndpointDescriptor& bootstrapEp){
+
+	ovl.visShowNodeBubble ( ovlId, nodeId, "joining..." );
+	logging_info( "starting to join spovnet " << id.toString() << "...");
+
+	//
+	// contact the spovnet initiator and request
+	// to join. if the join is granted we will
+	// receive further information on the structure
+	// of the overlay that is used in the spovnet
+	//
+	// but first, we have to establish a link to the initiator...
+	//
+
+	spovnetId = id;
+	state = BaseOverlayStateJoinInitiated;
+
+	initiatorLink = bc.establishLink( bootstrapEp );
+}
+
+void BaseOverlay::leaveSpoVNet(){
+
+	logging_info( "leaving spovnet " << spovnetId );
+
+	// first, leave the overlay interface
+	overlayInterface->leaveOverlay();
+
+	if( state != BaseOverlayStateInitiator ){
+
+		// then, leave the spovnet baseoverlay
+		OverlayMsg overMsg( OverlayMsg::OverlayMessageTypeBye, nodeId );
+		bc.sendMessage( initiatorLink, &overMsg );
+
+		// drop the link and set to correct state
+		bc.dropLink( initiatorLink );
+		initiatorLink = LinkID::UNSPECIFIED;
+	}
+
 	state = BaseOverlayStateInvalid;
-}
-
-void BaseOverlay::stop() {
-	logging_info("Stopping...");
-
-	// stop timer
-	Timer::stop();
-
-	// delete oberlay interface
-	if(overlayInterface != NULL) {
-		delete overlayInterface;
-		overlayInterface = NULL;
-	}
-
-	// unregister at base communication
-	bc->unregisterMessageReceiver( this );
-	bc->unregisterEventListener( this );
-
-	started = false;
-	state = BaseOverlayStateInvalid;
-}
-
-bool BaseOverlay::isStarted(){
-	return started;
-}
-
-// ----------------------------------------------------------------------------
-
-void BaseOverlay::joinSpoVNet(const SpoVNetID& id,
-		const EndpointDescriptor& bootstrapEp) {
-
-	if(id != spovnetId){
-		logging_error("attempt to join against invalid spovnet, call initiate first");
-		return;
-	}
-
-	//ovl.visShowNodeBubble ( ovlId, nodeId, "joining..." );
-	logging_info( "Starting to join spovnet " << id.toString() <<
-			" with nodeid " << nodeId.toString());
-
-	if(bootstrapEp.isUnspecified() && state == BaseOverlayStateInvalid){
-
-		//** FIRST STEP - MANDATORY */
-
-		// bootstrap against ourselfs
-		logging_info("joining spovnet locally");
-
-		overlayInterface->joinOverlay();
-		state = BaseOverlayStateCompleted;
-		foreach( NodeListener* i, nodeListeners )
-			i->onJoinCompleted( spovnetId );
-
-		//ovl.visChangeNodeIcon ( ovlId, nodeId, OvlVis::ICON_ID_CAMERA );
-		//ovl.visChangeNodeColor( ovlId, nodeId, OvlVis::NODE_COLORS_GREEN );
-
-	} else {
-
-		//** SECOND STEP - OPTIONAL */
-
-		// bootstrap against another node
-		logging_info("joining spovnet remotely against " << bootstrapEp.toString());
-
-		const LinkID& lnk = bc->establishLink( bootstrapEp );
-		bootstrapLinks.push_back(lnk);
-		logging_info("join process initiated for " << id.toString() << "...");
-	}
-}
-
-
-void BaseOverlay::startBootstrapModules(vector<pair<BootstrapManager::BootstrapType,string> > modules){
-	logging_debug("starting overlay bootstrap module");
-	overlayBootstrap.start(this, spovnetId, nodeId, modules);
-	overlayBootstrap.publish(bc->getEndpointDescriptor());
-}
-
-void BaseOverlay::stopBootstrapModules(){
-	logging_debug("stopping overlay bootstrap module");
-	overlayBootstrap.stop();
-	overlayBootstrap.revoke();
-}
-
-void BaseOverlay::leaveSpoVNet() {
-
-	logging_info( "Leaving spovnet " << spovnetId );
-	bool ret = ( state != this->BaseOverlayStateInvalid );
-
-	logging_debug( "Dropping all auto-links" );
-
-	// gather all service links
-	vector<LinkID> servicelinks;
-	foreach( LinkDescriptor* ld, links )
-	{
-		if( ld->service != OverlayInterface::OVERLAY_SERVICE_ID )
-			servicelinks.push_back( ld->overlayId );
-	}
-
-	// drop all service links
-	foreach( LinkID lnk, servicelinks )
-	{
-	    logging_debug("Dropping service link " << lnk.toString());
-	    dropLink( lnk );
-	}
-
-	// let the node leave the spovnet overlay interface
-	logging_debug( "Leaving overlay" );
-	if( overlayInterface != NULL )
-	{
-		overlayInterface->leaveOverlay();
-	}
-
-	// drop still open bootstrap links
-	foreach( LinkID lnk, bootstrapLinks )
-	{
-	    logging_debug("Dropping bootstrap link " << lnk.toString());
-	    bc->dropLink( lnk );
-	}
-
-	// change to inalid state
-	state = BaseOverlayStateInvalid;
-	//ovl.visShutdown( ovlId, nodeId, string("") );
-
-	visualInstance.visShutdown(visualIdOverlay, nodeId, "");
-	visualInstance.visShutdown(visualIdBase, nodeId, "");
+	ovl.visShutdown( ovlId, nodeId, string("") );
 
 	// inform all registered services of the event
-	foreach( NodeListener* i, nodeListeners )
-	{
-		if( ret ) i->onLeaveCompleted( spovnetId );
-		else i->onLeaveFailed( spovnetId );
-	}
-}
-
-void BaseOverlay::createSpoVNet(const SpoVNetID& id,
-		const OverlayParameterSet& param,
-		const SecurityParameterSet& sec,
-		const QoSParameterSet& qos) {
-
-	// set the state that we are an initiator, this way incoming messages are
-	// handled correctly
-	logging_info( "creating spovnet " + id.toString() <<
-			" with nodeid " << nodeId.toString() );
+	BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
+		i->onOverlayDestroy( spovnetId );
+	}
+}
+
+void BaseOverlay::createSpoVNet(const SpoVNetID& id, const OverlayParameterSet& param, const SecurityParameterSet& sec, const QoSParameterSet& qos){
+
+	//
+	// set the state that we are an initiator,
+	// this way incoming messages are handled correctly
+	//
+
+	logging_info("creating spovnet " + id.toString());
 
 	spovnetId = id;
+	state = BaseOverlayStateInitiator;
 
 	overlayInterface = OverlayFactory::create( *this, param, nodeId, this );
-	if( overlayInterface == NULL ) {
+	if( overlayInterface == NULL ){
 		logging_fatal( "overlay structure not supported" );
 		state = BaseOverlayStateInvalid;
-
-		foreach( NodeListener* i, nodeListeners )
-		i->onJoinFailed( spovnetId );
-
 		return;
 	}
 
-	visualInstance.visCreate(visualIdBase, nodeId, "", "");
-	visualInstance.visCreate(visualIdOverlay, nodeId, "", "");
-}
-
-// ----------------------------------------------------------------------------
-
-const LinkID BaseOverlay::establishLink( const EndpointDescriptor& remoteEp,
-		const NodeID& remoteId, const ServiceID& service ) {
-
-	// establish link via overlay
-	if (!remoteId.isUnspecified())
-		return establishLink( remoteId, service );
-	else
-		return establishDirectLink(remoteEp, service );
-}
-
-/// call base communication's establish link and add link mapping
-const LinkID BaseOverlay::establishDirectLink( const EndpointDescriptor& ep,
-		const ServiceID& service ) {
-
-	/// find a service listener
-	if( !communicationListeners.contains( service ) ) {
-		logging_error( "No listener registered for service id=" << service.toString() );
+	//
+	// create the overlay
+	// and bootstrap against ourselfs
+	//
+
+	overlayInterface->createOverlay();
+	overlayInterface->joinOverlay();
+
+	ovl.visChangeNodeIcon ( ovlId, nodeId, OvlVis::ICON_ID_CAMERA );
+	ovl.visChangeNodeColor( ovlId, nodeId, OvlVis::NODE_COLORS_GREEN);
+
+	// inform all registered services of the event
+	BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
+		i->onOverlayCreate( spovnetId );
+	}
+}
+
+const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(const LinkID& link) const {
+
+	return bc.getEndpointDescriptor( link );
+}
+
+const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(const NodeID& node) const {
+
+	if( node == nodeId || node == NodeID::UNSPECIFIED )
+		return bc.getEndpointDescriptor();
+
+	if( overlayInterface == NULL ){
+		logging_error( "overlay interface not set, cannot resolve endpoint" );
+		return EndpointDescriptor::UNSPECIFIED;
+	}
+
+	// TODO: if this is not a onehop overlay the operation will go asynchronously
+	return overlayInterface->resolveNode( node );
+}
+
+const LinkID BaseOverlay::establishLink(const NodeID& node, const ServiceID& service){
+
+	// TODO: if this is not a onehop overlay the operation will go asynchronously
+	const EndpointDescriptor& endpoint = overlayInterface->resolveNode( node );
+	if( endpoint == EndpointDescriptor::UNSPECIFIED ){
+		logging_error( "could not resolve node to endpoint. unable to establish link" );
 		return LinkID::UNSPECIFIED;
 	}
-	CommunicationListener* listener = communicationListeners.get( service );
-	assert( listener != NULL );
-
-	// create descriptor
-	LinkDescriptor* ld = addDescriptor();
-	ld->relayed = false;
-	ld->listener = listener;
-	ld->service = service;
-	ld->communicationId = bc->establishLink( ep );
-
-	/// establish link and add mapping
-	logging_info("Establishing direct link " << ld->communicationId.toString()
-			<< " using " << ep.toString());
-
-	return ld->communicationId;
-}
-
-/// establishes a link between two arbitrary nodes
-const LinkID BaseOverlay::establishLink( const NodeID& remote,
-		const ServiceID& service ) {
-
-    // TODO What if we already have a Link to this node and this service id?
-    
-	// do not establish a link to myself!
-	if (remote == nodeId) return 
-	        LinkID::UNSPECIFIED;
-
-	
-	// create a link descriptor
-	LinkDescriptor* ld = addDescriptor();
-	ld->relayed = true;
-	ld->remoteNode = remote;
-	ld->service = service;
-	ld->listener = getListener(ld->service);
-    
-    // initialize sequence numbers
-    ld->last_sent_seqnum = SequenceNumber::createRandomSeqNum_Short();
-    logging_debug("Creating new link with initial SeqNum: " << ld->last_sent_seqnum);
-
-	// create link request message
-	OverlayMsg msg(OverlayMsg::typeLinkRequest, service, nodeId, remote );
-	msg.setSourceLink(ld->overlayId);
-
-	// send over relayed link
-	msg.setRelayed(true);
-	msg.setRegisterRelay(true);
-//	msg.setRouteRecord(true);
-    
-    msg.setSeqNum(ld->last_sent_seqnum);
-
-	// debug message
-	logging_info(
-			"Sending link request with"
-			<< " link=" << ld->overlayId.toString()
-			<< " node=" << ld->remoteNode.toString()
-			<< " serv=" << ld->service.toString()
-	);
-
-	
-	// sending message to node
-	try
-	{
-	    // * send *
-	    seqnum_t seq = send_node( &msg, ld->remoteNode, system_priority::OVERLAY, ld->service );
-	}
-	catch ( message_not_sent& e )
-	{
-	    logging_warn("Link request not sent: " << e.what());
-	    
-	    // Message not sent. Cancel link request.
-	    SystemQueue::instance().scheduleCall(
-	            boost::bind(
-	                    &BaseOverlay::__onLinkEstablishmentFailed,
-	                    this,
-	                    ld->overlayId)
-	        );
-	}
-	
-	return ld->overlayId;
-}
-
-/// NOTE: "id" is an Overlay-LinkID
-void BaseOverlay::__onLinkEstablishmentFailed(const LinkID& id)
-{
-    // TODO This code redundant. But also it's not easy to aggregate in one function.
-    
-    // get descriptor for link
-    LinkDescriptor* ld = getDescriptor(id, false);
-    if ( ld == NULL ) return; // not found? ->ignore!
-
-    logging_debug( "__onLinkEstablishmentFaild: " << ld );
-
-    // removing relay link information
-    removeRelayLink(ld->overlayId);
-
-    // inform listeners about link down
-    ld->communicationUp = false;
-    if (!ld->service.isUnspecified())
-    {
-        CommunicationListener* lst = getListener(ld->service);
-        if(lst != NULL) lst->onLinkFail( ld->overlayId, ld->remoteNode );
-        sideport->onLinkFail( id, this->nodeId, ld->remoteNode, this->spovnetId );
-    }
-
-    // delete all queued messages (auto links)
-    if( ld->messageQueue.size() > 0 ) {
-        logging_warn( "Dropping link " << id.toString() << " that has "
-                << ld->messageQueue.size() << " waiting messages" );
-        ld->flushQueue();
-    }
-
-    // erase mapping
-    eraseDescriptor(ld->overlayId);
-}
-
-
-/// drops an established link
-void BaseOverlay::dropLink(const LinkID& link)
-{
-	logging_info( "Dropping link: " << link.toString() );
-
-	// find the link item to drop
-	LinkDescriptor* ld = getDescriptor(link);
-	if( ld == NULL )
-	{
-		logging_warn( "Can't drop link, link is unknown!");
+
+	logging_debug( "baseoverlay called to establish link between node " <<
+			node.toString() << " on endpoint " << endpoint.toString() <<
+			" for service " << service.toString() );
+
+	return establishLink( endpoint, service );
+}
+
+const LinkID BaseOverlay::establishLink(const EndpointDescriptor& ep, const ServiceID& service){
+
+	if( !listenerMux.contains( service ) ){
+		logging_error( "no registered listener on serviceid " << service.toString() );
+		return LinkID::UNSPECIFIED;
+	}
+
+	ServiceInterface* receiver = listenerMux.get( service );
+	const LinkID link = bc.establishLink( ep );
+
+	LinkItem item (link, NodeID::UNSPECIFIED, service, receiver);
+	linkMapping.insert( make_pair(link, item) );
+
+	return link;
+}
+
+void BaseOverlay::dropLink(const LinkID& link){
+
+	logging_debug( "baseoverlay dropping link " << link.toString() );
+	LinkMapping::iterator i = linkMapping.find( link );
+
+	if( i == linkMapping.end() ){
+		logging_warn( "can't drop link, mapping unknown " << link.toString() );
 		return;
 	}
 
-	// delete all queued messages
-	if( ld->messageQueue.size() > 0 )
-	{
-		logging_warn( "Dropping link " << ld->overlayId.toString() << " that has "
-				<< ld->messageQueue.size() << " waiting messages" );
-		ld->flushQueue();
-	}
-	
-	    
-	// inform application and remote note (but only once)
-	//   NOTE: If we initiated the drop, this function is called twice, but on 
-	//   the second call, there is noting to do.
-	if ( ld->up && ! ld->failed )
-	{
-        // inform sideport and listener
-        if(ld->listener != NULL)
-        {
-            ld->listener->onLinkDown( ld->overlayId, ld->remoteNode );
-        }
-        sideport->onLinkDown(ld->overlayId, this->nodeId, ld->remoteNode, this->spovnetId );
-	
-        // send link-close to remote node
-        logging_info("Sending LinkClose message to remote node.");
-        OverlayMsg close_msg(OverlayMsg::typeLinkClose);
-        send_link(&close_msg, link, system_priority::OVERLAY);
-    
-        // deactivate link
-        ld->up = false;
-//         ld->closing = true;
-	}
-	
-	else if ( ld->failed )
-    {
-        // inform listener
-        if( ld->listener != NULL )
-        {
-            ld->listener->onLinkFail( ld->overlayId, ld->remoteNode );
-        }
-        
-        ld->up = false;
-        __removeDroppedLink(ld->overlayId);
-    }
-}
-
-/// called from typeLinkClose-handler
-void BaseOverlay::__removeDroppedLink(const LinkID& link)
-{
-    // find the link item to drop
-    LinkDescriptor* ld = getDescriptor(link);
-    if( ld == NULL )
-    {
-        return;
-    }
-
-    // do not drop relay links
-    if (!ld->relaying)
-    {
-        // drop the link in base communication
-        if (ld->communicationUp)
-        {
-            bc->dropLink( ld->communicationId );
-        }
-
-        // erase descriptor
-        eraseDescriptor( ld->overlayId );
-    }
-    else
-    {
-        ld->dropAfterRelaying = true;
-    }
-}
-
-// ----------------------------------------------------------------------------
-
-/// internal send message, always use this functions to send messages over links
-const SequenceNumber& BaseOverlay::sendMessage( reboost::message_t message,
-        const LinkID& link,
-        uint8_t priority ) throw(message_not_sent)
-{
-	logging_debug( "Sending data message on link " << link.toString() );
-
-	// get the mapping for this link
-	LinkDescriptor* ld = getDescriptor(link);
-	if( ld == NULL )
-	{
-	    throw message_not_sent("Could not send message. Link not found id=" + link.toString());
-	}
-
-	// check if the link is up yet, if its an auto link queue message
-	if( !ld->up )
-	{
-		ld->setAutoUsed();
-		if( ld->autolink )
-		{
-			logging_info("Auto-link " << link.toString() << " not up, queue message");
-			
-			// queue message
-	        LinkDescriptor::message_queue_entry msg;
-	        msg.message = message;
-	        msg.priority = priority;
-
-			ld->messageQueue.push_back( msg );
-			
-			return SequenceNumber::DISABLED;  // TODO what to return if message is queued?
-		}
-		else
-		{
-		    throw message_not_sent("Link " + link.toString() + " not up, drop message");
-		}
-	}
-	
-	// TODO XXX ----> coordinate with QUIC-efforts !!
-	// TODO aktuell: sequence numbers
-	// TODO seqnum on fast path ?
-	ld->last_sent_seqnum.increment();
-	
-	/* choose fast-path for direct links; normal overlay-path otherwise */
-	// BRANCH: direct link
-	if ( ld->communicationUp && !ld->relayed )
-	{
-	    // * send down to BaseCommunication *
-	    try
-	    {
-	        bc->sendMessage(ld->communicationId, message, priority, true);
-        }
-        catch ( communication::communication_message_not_sent& e )
-        {
-            ostringstream out;
-            out << "Communication message on fast-path not sent: " << e.what();
-            throw message_not_sent(out.str());
-        }
-	}
-
-	// BRANCH: use (slow) overlay-path
-	else
-	{
-        // compile overlay message (has service and node id)
-        OverlayMsg overmsg( OverlayMsg::typeData );
-        overmsg.set_payload_message(message);
-        
-        // set SeqNum
-        if ( ld->transmit_seqnums )
-        {
-            overmsg.setSeqNum(ld->last_sent_seqnum);
-        }
-        logging_debug("Sending Message with SeqNum: " << overmsg.getSeqNum());
-    
-        // send message over relay/direct/overlay
-        send_link( &overmsg, ld->overlayId, priority );
-	}
-	
-	// return seqnum
- 	return ld->last_sent_seqnum;
-}
-
-
-const SequenceNumber& BaseOverlay::sendMessage(reboost::message_t message,
-		const NodeID& node, uint8_t priority, const ServiceID& service) {
-
-	// find link for node and service
-	LinkDescriptor* ld = getAutoDescriptor( node, service );
-
-	// if we found no link, create an auto link
-	if( ld == NULL ) {
-
-		// debug output
-		logging_info( "No link to send message to node "
-				<< node.toString() << " found for service "
-				<< service.toString() << ". Creating auto link ..."
-		);
-
-		// call base overlay to create a link
-		LinkID link = establishLink( node, service );
-		ld = getDescriptor( link );
-		if( ld == NULL ) {
-			logging_error( "Failed to establish auto-link.");
-            throw message_not_sent("Failed to establish auto-link.");
-		}
-		ld->autolink = true;
-
-		logging_debug( "Auto-link establishment in progress to node "
-				<< node.toString() << " with link id=" << link.toString() );
-	}
-	assert(ld != NULL);
-
-	// mark the link as used, as we now send a message through it
-	ld->setAutoUsed();
-
-	// send / queue message
-	return sendMessage( message, ld->overlayId, priority );
-}
-
-
-NodeID BaseOverlay::sendMessageCloserToNodeID(reboost::message_t message,
-        const NodeID& address, uint8_t priority, const ServiceID& service) {
-    
-    if ( overlayInterface->isClosestNodeTo(address) )
-    {
-        return NodeID::UNSPECIFIED;
-    }
-        
-    const NodeID& closest_node = overlayInterface->getNextNodeId(address); 
-    
-    if ( closest_node != NodeID::UNSPECIFIED )
-    {
-        sendMessage(message, closest_node, priority, service);
-    }
-    
-    return closest_node;  // return seqnum ?? tuple? closest_node via (non const) reference?
-}
-// ----------------------------------------------------------------------------
-
-const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(
-		const LinkID& link) const {
-
-	// return own end-point descriptor
-	if( link.isUnspecified() )
-		return bc->getEndpointDescriptor();
-
-	// find link descriptor. not found -> return unspecified
-	const LinkDescriptor* ld = getDescriptor(link);
-	if (ld==NULL) return EndpointDescriptor::UNSPECIFIED();
-
-	// return endpoint-descriptor from base communication
-	return bc->getEndpointDescriptor( ld->communicationId );
-}
-
-const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(
-		const NodeID& node) const {
-
-	// return own end-point descriptor
-	if( node == nodeId || node.isUnspecified() ) {
-		//logging_info("getEndpointDescriptor: returning self.");
-		return bc->getEndpointDescriptor();
-	}
-
-	// no joined and request remote descriptor? -> fail!
-	if( overlayInterface == NULL ) {
-		logging_error( "Overlay interface not set, cannot resolve end-point." );
-		return EndpointDescriptor::UNSPECIFIED();
-	}
-
-//	// resolve end-point descriptor from the base-overlay routing table
-//	const EndpointDescriptor& ep = overlayInterface->resolveNode( node );
-//	if(ep.toString() != "") return ep;
-
-	// see if we can find the node in our own table
-	foreach(const LinkDescriptor* ld, links){
-		if(ld->remoteNode != node) continue;
-		if(!ld->communicationUp) continue;
-		const EndpointDescriptor& ep =
-				bc->getEndpointDescriptor(ld->communicationId);
-		if(ep != EndpointDescriptor::UNSPECIFIED()) {
-			//logging_info("getEndpointDescriptor: using " << ld->to_string());
-			return ep;
-		}
-	}
-
-	logging_warn( "No EndpointDescriptor found for node " << node );
-	logging_warn( const_cast<BaseOverlay*>(this)->debugInformation() );
-
-	return EndpointDescriptor::UNSPECIFIED();
-}
-
-// ----------------------------------------------------------------------------
-
-bool BaseOverlay::registerSidePort(SideportListener* _sideport) {
-	sideport = _sideport;
-	_sideport->configure( this );
+	linkMapping.erase( i );
+
+	LinkItem item = i->second;
+	bc.dropLink( link );
+
+	if( item.interface != NULL )
+		item.interface->onLinkDown( spovnetId, nodeId, item.node );
+}
+
+seqnum_t BaseOverlay::sendMessage(const Message* message, const LinkID& link ){
+
+	logging_debug( "baseoverlay is sending message on link " << link.toString() );
+
+	LinkMapping::iterator i = linkMapping.find( link );
+	if( i == linkMapping.end() ){
+		logging_error( "could not send message. link not found " << link.toString() );
+		return -1;
+	}
+
+	OverlayMsg overmsg( OverlayMsg::OverlayMessageTypeData, i->second.service, nodeId );
+	overmsg.encapsulate( const_cast<Message*>(message) );
+
+	return bc.sendMessage( link, &overmsg );
+}
+
+seqnum_t BaseOverlay::sendMessage(const Message* message, const NodeID& node, const ServiceID& service){
+
+	LinkID link = LinkID::UNSPECIFIED;
+
+	LinkMapping::iterator i = linkMapping.begin();
+	LinkMapping::iterator iend = linkMapping.end();
+
+	for( ; i != iend; i++ ){
+		if( i->second.node == node && i->second.service == service ){
+			link = i->second.link;
+			break;
+		}
+	}
+
+	if( link == LinkID::UNSPECIFIED ){
+		logging_error( "no link could be found to send message to node " <<
+				node.toString() << " for service " << service.toString() );
+		return -1;
+	}
+
+	return sendMessage( message, link );
+}
+
+bool BaseOverlay::bind(ServiceInterface* service, const ServiceID& sid) {
+
+	logging_debug( "binding service on serviceid " << sid.toString() );
+
+	if( listenerMux.contains( sid ) ){
+		logging_error( "some service already registered for service id " << sid.toString() );
+		return false;
+	}
+
+	listenerMux.registerItem( service, sid );
 	return true;
 }
 
-bool BaseOverlay::unregisterSidePort(SideportListener* _sideport) {
-	sideport = &SideportListener::DEFAULT;
+bool BaseOverlay::unbind(ServiceInterface* service, const ServiceID& sid){
+
+	logging_debug( "unbinding service on serviceid " << sid.toString() );
+
+	if( !listenerMux.contains( sid ) ){
+		logging_warn( "cannot unbind service. no service registered on service id " << sid.toString() );
+		return false;
+	}
+
+	listenerMux.unregisterItem( service );
 	return true;
 }
 
-// ----------------------------------------------------------------------------
-
-bool BaseOverlay::bind(CommunicationListener* listener, const ServiceID& sid) {
-	logging_debug( "binding communication listener " << listener
-			<< " on serviceid " << sid.toString() );
-
-	if( communicationListeners.contains( sid ) ) {
-		logging_error( "some listener already registered for service id "
-				<< sid.toString() );
+void BaseOverlay::onLinkUp(const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote){
+
+	logging_debug( "base overlay received linkup event " + id.toString() );
+	// TODO: updateOvlVis( getNodeID(id) );
+
+	//
+	// if we get up a link while we are in the
+	// join phase and this is the link that
+	// we have initiated towards the spovnet owner
+	// continue the join process by sending
+	// a join request message through the link
+	//
+
+	if( state == BaseOverlayStateJoinInitiated && id == initiatorLink){
+
+		logging_info( "join has been initiated by me and the link is now up. " <<
+				"sending out join request for spovnet " <<
+				spovnetId.toString() );
+
+		OverlayMsg overMsg( OverlayMsg::OverlayMessageTypeJoinRequest, nodeId );
+		JoinRequest joinmsg( spovnetId, nodeId );
+		overMsg.encapsulate( &joinmsg );
+
+		state = BaseOverlayStateJoinInitiated; // state remains in JoinInitiated
+		bc.sendMessage( id, &overMsg );
+
+		return;
+
+	} // if( state == BaseOverlayStateJoinInitiated && id == initiatorLink)
+
+	//
+	// otherwise this is a link initiated by a service
+	// then we exchange update messages to exchange the
+	// service id and node id for the link. in this case
+	// we should have a link mapping for this link. if
+	// we have no link mapping this link was initiated by
+	// the remote side.
+	//
+
+	LinkMapping::iterator i = linkMapping.find( id );
+
+	if( i == linkMapping.end() ){
+
+		LinkItem item (id, NodeID::UNSPECIFIED, ServiceID::UNSPECIFIED, NULL );
+		linkMapping.insert( make_pair(id, item) );
+
+	} else {
+
+		logging_debug( "sending out OverlayMessageTypeUpdate" <<
+				" for service " << i->second.service.toString() <<
+				" with local node id " << nodeId.toString() <<
+				" on link " << id.toString() );
+
+		OverlayMsg overMsg( OverlayMsg::OverlayMessageTypeUpdate, i->second.service, nodeId );
+		bc.sendMessage( id, &overMsg );
+
+	} // if( i == linkMapping.end() )
+
+	// the link is only valid for the service when we receive
+	// the OverlayMessageTypeUpdate from the remote node and
+	// have the nodeid and serviceid for the link!
+}
+
+void BaseOverlay::onLinkDown(const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote){
+
+	logging_debug( "link went down " << id.toString() );
+
+	//
+	// tell the service that the link went
+	// down and remove the mapping
+	//
+
+	LinkMapping::iterator i = linkMapping.find( id );
+	if( i == linkMapping.end() ) {
+		// this can also be one of the baseoverlay links that
+		// no mapping is stored for. therefore we issue no warning
+		return;
+	}
+
+	if( i->second.interface != NULL )
+		i->second.interface->onLinkDown( id, nodeId, i->second.node );
+
+	linkMapping.erase( i );
+}
+
+void BaseOverlay::onLinkChanged(const LinkID& id, const NetworkLocator* oldlocal, const NetworkLocator* newlocal, const NetworkLocator* oldremote, const NetworkLocator* newremote){
+
+	logging_debug( "link changed " << id.toString() );
+
+	//
+	// tell the service that the link changed
+	//
+
+	LinkMapping::iterator i = linkMapping.find( id );
+	if( i == linkMapping.end() ) return;
+
+	if( i->second.interface != NULL )
+		i->second.interface->onLinkChanged( id, nodeId, i->second.node );
+}
+
+void BaseOverlay::onLinkFail(const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote){
+
+	logging_debug( "link failed " << id.toString() );
+
+	//
+	// tell the service that the link failed
+	//
+
+	LinkMapping::iterator i = linkMapping.find( id );
+	if( i == linkMapping.end() ) return;
+
+	if( i->second.interface != NULL )
+		i->second.interface->onLinkFail( id, nodeId, i->second.node );
+}
+
+void BaseOverlay::onLinkQoSChanged(const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote, const QoSParameterSet& qos) {
+
+	logging_debug( "link qos changed " << id.toString() );
+
+	//
+	// tell the service that the link qos has changed
+	//
+
+	LinkMapping::iterator i = linkMapping.find( id );
+	if( i == linkMapping.end() ) return;
+
+	if( i->second.interface != NULL )
+		i->second.interface->onLinkQoSChanged( id, nodeId, i->second.node, qos );
+}
+
+bool BaseOverlay::receiveMessage(const Message* message,
+	const LinkID& link, const NodeID& /*the nodeid is invalid in this case! removed var to prevent errors*/ ){
+
+	OverlayMsg* overlayMsg = ((Message*)message)->decapsulate<OverlayMsg>();
+	if( overlayMsg == NULL ) return false;
+
+	//
+	// handle user date that we forward to the
+	// appropriate service using the service id
+	// in the message. as we don't know the class
+	// of message that the service handles, we
+	// forward it as a pure Message*
+	//
+
+	if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeData) ) {
+
+		logging_debug( "baseoverlay received message of type OverlayMessageTypeData" );
+
+		const ServiceID& service = overlayMsg->getService();
+		ServiceInterface* serviceListener = listenerMux.get( service );
+
+		logging_debug( "received data for service " << service.toString() );
+
+		if( serviceListener != NULL )
+			serviceListener->receiveMessage( overlayMsg, link, overlayMsg->getSourceNode() );
+
+		return true;
+
+	} // if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeData) )
+
+	//
+	// handle spovnet instance join requests
+	//
+
+	else if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeJoinRequest) &&
+						state == BaseOverlayStateInitiator){
+
+		logging_debug( "baseoverlay received message of type OverlayMessageTypeJoinRequest" );
+
+		JoinRequest* joinReq = overlayMsg->decapsulate<JoinRequest>();
+		logging_info( "received join request for spovnet " <<
+					 joinReq->getSpoVNetID().toString() );
+
+		//
+		// make sure that the node actually wants to join
+		// the correct spovnet id that we administrate
+		//
+
+		if( joinReq->getSpoVNetID() != spovnetId ){
+			logging_error( "received join request for spovnet we don't handle " <<
+					joinReq->getSpoVNetID().toString() );
+			return false;
+		}
+
+		//
+		// only if all services allow the node to join it is allowed
+		// using the isJoinAllowed interface security policies can be
+		// implemented by higher layer services
+		//
+
+		bool allow = true;
+
+		BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
+			allow &= i->isJoinAllowed( overlayMsg->getSourceNode(), spovnetId );
+		}
+
+		logging_info( "sending back join reply for spovnet " <<
+				spovnetId.toString() << " to node " <<
+				overlayMsg->getSourceNode().toString() <<
+				". result: " << (allow ? "allowed" : "denied") );
+
+		joiningNodes.push_back( overlayMsg->getSourceNode() );
+
+		//
+		// send back our spovnetid, default overlay parameters,
+		// join allow result, and ourself as the endpoint
+		// to bootstrap the overlay against
+		//
+
+		OverlayMsg retmsg( OverlayMsg::OverlayMessageTypeJoinReply, nodeId );
+		JoinReply replyMsg( spovnetId, OverlayParameterSet::DEFAULT,
+					allow, getEndpointDescriptor() );
+
+		retmsg.encapsulate(&replyMsg);
+		bc.sendMessage( link, &retmsg );
+
+		return true;
+
+	} // else if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeJoinRequest) && state == BaseOverlayStateInitiator)
+
+	//
+	// handle replies to spovnet instance join requests
+	//
+
+	else if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeJoinReply) &&
+						state == BaseOverlayStateJoinInitiated){
+
+		logging_debug( "baseoverlay received message of type OverlayMessageTypeJoinReply" );
+
+		JoinReply* replyMsg = overlayMsg->decapsulate<JoinReply>();
+		logging_info( "received spovnet join reply" );
+
+		//
+		// make sure that we actually wanted to get
+		// into the spovnet whose id is in the message
+		//
+
+		if( replyMsg->getSpoVNetID() != spovnetId ){
+			logging_error( "received spovnet join reply for spovnet " <<
+					replyMsg->getSpoVNetID().toString() <<
+					" but we wanted to join spovnet " <<
+					spovnetId.toString() );
+
+			// state does not change here, maybe
+			// the reply does come in later
+			return false;
+		}
+
+		//
+		// if we did not get access to the spovnet
+		// notify of the failure and
+		// close the link to the initiator
+		//
+
+		if( ! replyMsg->getJoinAllowed() ){
+
+			logging_warn( "our join request has been denied" );
+
+			bc.dropLink( initiatorLink );
+			initiatorLink = LinkID::UNSPECIFIED;
+			state = BaseOverlayStateInvalid;
+
+			// inform all registered services of the event
+			BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
+				i->onJoinFail( spovnetId );
+			}
+
+			return true;
+		}
+
+		logging_info( "join request has been accepted for spovnet " << spovnetId.toString() );
+
+		//
+		// if we did get access to the spovnet
+		// we try to create the overlay structure
+		// as given in the reply message
+		//
+
+		overlayInterface = OverlayFactory::create( *this, replyMsg->getParam(), nodeId, this );
+
+		if( overlayInterface == NULL ){
+			logging_error( "overlay structure not supported" );
+
+			bc.dropLink( initiatorLink );
+			initiatorLink = LinkID::UNSPECIFIED;
+			state = BaseOverlayStateInvalid;
+
+			// inform all registered services of the event
+			BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
+				i->onJoinFail( spovnetId );
+			}
+
+			return true;
+		}
+
+		//
+		// now start the join process for the overlay.
+		// the join process for the spovnet baseoverlay
+		// is now complete. we use the endpoint for
+		// overlay structure bootstrapping that the
+		// initiator provided in his reply message
+		//
+
+		state = BaseOverlayStateCompleted;
+		ovl.visChangeNodeColor( ovlId, nodeId, OvlVis::NODE_COLORS_GREEN);
+
+		overlayInterface->createOverlay();
+
+		// inform all registered services of the event
+		BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
+			i->onOverlayCreate( spovnetId );
+		}
+
+		overlayInterface->joinOverlay( replyMsg->getBootstrapEndpoint() );
+
+		// inform all registered services of the event
+		BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
+			i->onJoinSuccess( spovnetId );
+		}
+
+		return true;
+
+	} // else if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeJoinReply) && state == BaseOverlayStateJoinInitiated)
+
+
+	//
+	// handle update messages for link establishment
+	//
+
+	else if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeUpdate) ){
+
+		logging_debug( "baseoverlay received message of type OverlayMessageTypeUpdate" );
+
+		const NodeID& sourcenode = overlayMsg->getSourceNode();
+		const ServiceID& service = overlayMsg->getService();
+
+		//
+		// we should have a linkmapping for the link, otherwise
+		// we ignore update messages
+		//
+
+		LinkMapping::iterator i = linkMapping.find( link );
+		if( i == linkMapping.end() ){
+			logging_warn( "received overlay update message for link " <<
+					link.toString() << " for which we have no mapping" );
+			return false;
+		}
+
+		//
+		// update our link mapping information for this link
+		//
+
+		bool changed = ( i->second.node != sourcenode ) || ( i->second.service != service );
+
+		i->second.node = sourcenode;
+		i->second.service = service;
+
+		//
+		// if our link information changed, we send out an update, too
+		//
+
+		if( changed ){
+			OverlayMsg overMsg( OverlayMsg::OverlayMessageTypeUpdate, i->second.service, nodeId );
+			bc.sendMessage( link, &overMsg );
+		}
+
+		//
+		// set the correct listener service for the linkitem
+		// now we can tell the registered service of the linkup event
+		//
+
+		if( !listenerMux.contains( service ) ){
+			logging_warn( "linkup event for service that has not been registered" );
+			return false;
+		}
+
+		ServiceInterface* iface = listenerMux.get( service );
+		if( iface == NULL ){
+			logging_warn( "linkup event for service that has been registered with a NULL interface" );
+			return true;
+		}
+
+		i->second.interface = iface;
+		iface->onLinkUp( link, nodeId, sourcenode );
+
+		return true ;
+
+	} // else if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeUpdate) )
+
+	//
+	// bye messages to say goodbye
+	//
+
+	else if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeBye)){
+
+		logging_debug( "baseoverlay received message of type OverlayMessageTypeBye" );
+
+		logging_debug( "received bye message from " <<
+				overlayMsg->getSourceNode().toString() );
+
+		//
+		// if we are the initiator and receive a bye from a node
+		// the node just left. if we are a node and receive a bye
+		// from the initiator, we have to close, too.
+		//
+
+		if( overlayMsg->getSourceNode() == spovnetInitiator ){
+
+			bc.dropLink( initiatorLink );
+			initiatorLink = LinkID::UNSPECIFIED;
+			state = BaseOverlayStateInvalid;
+
+			logging_fatal( "initiator ended spovnet" );
+
+			// inform all registered services of the event
+			BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
+				i->onOverlayDestroy( spovnetId );
+			}
+
+		} else {
+
+			// a node that said goodbye and we are the initiator
+			// don't have to do much here, as the node also
+			// will go out of the overlay structure
+			logging_info( "node left " << overlayMsg->getSourceNode() );
+
+			// inform all registered services of the event
+			BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
+				i->onNodeLeave( overlayMsg->getSourceNode(), spovnetId );
+			}
+		}
+
+		return true;
+
+	} // else if( overlayMsg->isType(OverlayMsg::OverlayMessageTypeBye))
+
+	//
+	// something wrong ...
+	//
+
+	else {
+
+		logging_error( "received message in invalid state! don't know " <<
+				"what to do with this message of type " <<
+				overlayMsg->getType() );
 		return false;
-	}
-
-	communicationListeners.registerItem( listener, sid );
-	return true;
-}
-
-
-bool BaseOverlay::unbind(CommunicationListener* listener, const ServiceID& sid) {
-	logging_debug( "unbinding listener " << listener << " from serviceid " << sid.toString() );
-
-	if( !communicationListeners.contains( sid ) ) {
-		logging_warn( "cannot unbind listener. no listener registered on service id " << sid.toString() );
-		return false;
-	}
-
-	if( communicationListeners.get(sid) != listener ) {
-		logging_warn( "listener bound to service id " << sid.toString()
-				<< " is different than listener trying to unbind" );
-		return false;
-	}
-
-	communicationListeners.unregisterItem( sid );
-	return true;
-}
-
-// ----------------------------------------------------------------------------
-
-bool BaseOverlay::bind(NodeListener* listener) {
-	logging_debug( "Binding node listener " << listener );
-
-	// already bound? yes-> warning
-	NodeListenerVector::iterator i =
-			find( nodeListeners.begin(), nodeListeners.end(), listener );
-	if( i != nodeListeners.end() ) {
-		logging_warn("Node listener " << listener << " is already bound!" );
-		return false;
-	}
-
-	// no-> add
-	nodeListeners.push_back( listener );
-	return true;
-}
-
-bool BaseOverlay::unbind(NodeListener* listener) {
-	logging_debug( "Unbinding node listener " << listener );
-
-	// already unbound? yes-> warning
-	NodeListenerVector::iterator i = find( nodeListeners.begin(), nodeListeners.end(), listener );
-	if( i == nodeListeners.end() ) {
-		logging_warn( "Node listener " << listener << " is not bound!" );
-		return false;
-	}
-
-	// no-> remove
-	nodeListeners.erase( i );
-	return true;
-}
-
-// ----------------------------------------------------------------------------
-
-void BaseOverlay::onLinkUp(const LinkID& id,
-        const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote)
-{
-	logging_debug( "Link up with base communication link id=" << id );
-
-	// get descriptor for link
-	LinkDescriptor* ld = getDescriptor(id, true);
-
-	// BRANCH: handle bootstrap link we initiated
-	if( std::find(bootstrapLinks.begin(), bootstrapLinks.end(), id) != bootstrapLinks.end() ){
-		logging_info(
-				"Join has been initiated by me and the link is now up. " <<
-				"LinkID: " << id.toString() <<
-				"Sending out join request for SpoVNet " << spovnetId.toString()
-		);
-
-		// send join request message
-		OverlayMsg overlayMsg( OverlayMsg::typeJoinRequest,
-				OverlayInterface::OVERLAY_SERVICE_ID, nodeId );
-		JoinRequest joinRequest( spovnetId, nodeId );
-		overlayMsg.append_buffer(joinRequest.serialize_into_shared_buffer());
-
-		send_overlaymessage_down(&overlayMsg, id, system_priority::OVERLAY);
-		
-		return;
-	}
-
-	// BRANCH: link establishment from remote, add one!
-	if (ld == NULL) {
-		ld = addDescriptor( id );
-		logging_info( "onLinkUp (remote request) descriptor: " << ld );
-
-		// update descriptor
-		ld->fromRemote = true;
-		ld->communicationId = id;
-		ld->communicationUp = true;
-		ld->setAutoUsed();
-		ld->setAlive();
-
-		// in this case, do not inform listener, since service it unknown
-		// -> wait for update message!
-	}
-	
-	// BRANCH: We requested this link in the first place
-	else
-	{
-		logging_info( "onLinkUp descriptor (initiated locally):" << ld );
-
-		// update descriptor
-		ld->setAutoUsed();
-		ld->setAlive();
-		ld->communicationUp = true;
-		ld->fromRemote = false;
-
-		// BRANCH: this was a relayed link before --> convert to direct link
-		//   TODO do we really have to send a message here?
-		if (ld->relayed)
-		{
-			ld->up = true;
-			ld->relayed = false;
-			logging_info( "Converting to direct link: " << ld );
-			
-			// send message
-			OverlayMsg overMsg( OverlayMsg::typeLinkDirect );
-			overMsg.setSourceLink( ld->overlayId );
-			overMsg.setDestinationLink( ld->remoteLink );
-			send_link( &overMsg, ld->overlayId, system_priority::OVERLAY );
-			
-		    // inform listener
-		    if( ld->listener != NULL)
-		        ld->listener->onLinkChanged( ld->overlayId, ld->remoteNode );
-		}
-		
-
-        /* NOTE: Chord is opening direct-links in it's setup routine which are
-         *   neither set to "relayed" nor to "up". To activate these links a
-         *   typeLinkUpdate must be sent.
-         *   
-         * This branch is would also be taken when we had a working link before 
-         *   (ld->up == true). I'm not sure if this case does actually happen 
-         *   and whether it's tested.
-         */
-		else
-		{
-			// note: necessary to validate the link on the remote side!
-			logging_info( "Sending out update" <<
-					" for service " << ld->service.toString() <<
-					" with local node id " << nodeId.toString() <<
-					" on link " << ld->overlayId.toString() );
-
-			// compile and send update message
-			OverlayMsg overlayMsg( OverlayMsg::typeLinkUpdate );
-			overlayMsg.setAutoLink( ld->autolink );
-		    overlayMsg.setSourceNode(nodeId);
-		    overlayMsg.setDestinationNode(ld->remoteNode);
-		    overlayMsg.setSourceLink(ld->overlayId);
-		    overlayMsg.setDestinationLink(ld->remoteLink);
-		    overlayMsg.setService(ld->service);
-		    overlayMsg.setRelayed(false);
-
-		    // TODO ld->communicationId = id ??
-		    
-		    send_overlaymessage_down(&overlayMsg, id, system_priority::OVERLAY);
-		}
-	}
-}
-
-void BaseOverlay::onLinkDown(const LinkID& id,
-        const addressing2::EndpointPtr local,
-        const addressing2::EndpointPtr remote)
-{
-	// erase bootstrap links
-	vector<LinkID>::iterator it = std::find( bootstrapLinks.begin(), bootstrapLinks.end(), id );
-	if( it != bootstrapLinks.end() ) bootstrapLinks.erase( it );
-
-	// get descriptor for link
-	LinkDescriptor* ld = getDescriptor(id, true);
-	if ( ld == NULL ) return; // not found? ->ignore!
-	logging_info( "onLinkDown descriptor: " << ld );
-
-	// removing relay link information
-	removeRelayLink(ld->overlayId);
-
-	// inform listeners about link down
-	ld->communicationUp = false;
-	if (!ld->service.isUnspecified()) {
-		CommunicationListener* lst = getListener(ld->service);
-		if(lst != NULL) lst->onLinkDown( ld->overlayId, ld->remoteNode );
-		sideport->onLinkDown( id, this->nodeId, ld->remoteNode, this->spovnetId );
-	}
-
-	// delete all queued messages (auto links)
-	if( ld->messageQueue.size() > 0 ) {
-		logging_warn( "Dropping link " << id.toString() << " that has "
-				<< ld->messageQueue.size() << " waiting messages" );
-		ld->flushQueue();
-	}
-
-	// erase mapping
-	eraseDescriptor(ld->overlayId);
-    
-    
-    // notify the application if this is the last link to a different node
-    if ( connected )
-    {
-        bool active_links = false;
-        
-        // look for links that are still active
-        foreach( LinkDescriptor* ld, links )
-        {
-            if ( isLinkDirectVital(ld) )
-            {
-                active_links = true;
-                break;
-            }
-        }
-
-        if ( ! active_links )
-        {
-            connected = false;
-            
-            foreach( NodeListener* i, nodeListeners )
-                i->onOverlayDisconnected( spovnetId );
-        }
-    }
-
-}
-
-
-void BaseOverlay::onLinkFail(const LinkID& id,
-        const addressing2::EndpointPtr local,
-        const addressing2::EndpointPtr remote)
-{
-	logging_debug( "Link fail with base communication link id=" << id );
-
-//	// erase bootstrap links
-//	vector<LinkID>::iterator it = std::find( bootstrapLinks.begin(), bootstrapLinks.end(), id );
-//	if( it != bootstrapLinks.end() ) bootstrapLinks.erase( it );
-//
-//	// get descriptor for link
-//	LinkDescriptor* ld = getDescriptor(id, true);
-//	if ( ld == NULL ) return; // not found? ->ignore!
-//	logging_debug( "Link failed id=" << ld->overlayId.toString() );
-//
-//	// inform listeners
-//	ld->listener->onLinkFail( ld->overlayId, ld->remoteNode );
-//	sideport->onLinkFail( id, this->nodeId, ld->remoteNode, this->spovnetId );
-	
-	logging_debug( "  ... calling onLinkDown ..." );
-	onLinkDown(id, local, remote);
-}
-
-
-void BaseOverlay::onLinkChanged(const LinkID& id,
-        const addressing2::EndpointPtr oldlocal,  const addressing2::EndpointPtr newlocal,
-        const addressing2::EndpointPtr oldremote, const addressing2::EndpointPtr newremote)
-{
-    // get descriptor for link
-    LinkDescriptor* ld = getDescriptor(id, true);
-    if ( ld == NULL ) return; // not found? ->ignore!
-    logging_debug( "onLinkChanged descriptor: " << ld );
-
-    // inform listeners
-    ld->listener->onLinkChanged( ld->overlayId, ld->remoteNode );
-    sideport->onLinkChanged( id, this->nodeId, ld->remoteNode, this->spovnetId );
-
-    // autolinks: refresh timestamp
-    ld->setAutoUsed();
-}
-
-//void BaseOverlay::onLinkQoSChanged(const LinkID& id,
-//        const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote,
-//        const QoSParameterSet& qos)
-//{
-//	logging_debug( "Link quality changed with base communication link id=" << id );
-//
-//	// get descriptor for link
-//	LinkDescriptor* ld = getDescriptor(id, true);
-//	if ( ld == NULL ) return; // not found? ->ignore!
-//	logging_debug( "Link quality changed id=" << ld->overlayId.toString() );
-//}
-
-bool BaseOverlay::onLinkRequest(const LinkID& id,
-        const addressing2::EndpointPtr local,
-        const addressing2::EndpointPtr remote)
-{
-	logging_debug("Accepting link request from " << remote->to_string() );
-	
-	// TODO ask application..?
-	
-	return true;
-}
-
-
-
-
-/// handles a message from base communication
-bool BaseOverlay::receiveMessage( reboost::shared_buffer_t message,
-		const LinkID& link,
-		const NodeID&,
-		bool bypass_overlay )
-{
-	// get descriptor for link
-	LinkDescriptor* ld = getDescriptor( link, true );
-
-	
-	/* choose fastpath for direct links; normal overlay-path otherwise */	
-	if ( bypass_overlay && ld )
-	{
-        // message received --> link is alive
-        ld->keepAliveReceived = time(NULL);
-        // hop count on this link
-        ld->hops = 0;
-
-        
-        // hand over to CommunicationListener (aka Application) 
-	    CommunicationListener* lst = getListener(ld->service);
-	    if ( lst != NULL )
-	    {
-	        lst->onMessage(
-	                message,
-	                ld->remoteNode,
-	                ld->overlayId,
-                    SequenceNumber::DISABLED,
-	                NULL );
-	        
-	        return true;
-	    }
-
-	    return false;
-	}
-	else
-	{
-	    return handleMessage( message, ld, link );	    
-	}
-}
-
-// ----------------------------------------------------------------------------
-
-/// Handle spovnet instance join requests
-bool BaseOverlay::handleJoinRequest( reboost::shared_buffer_t message, const NodeID& source, const LinkID& bcLink )
-{
-	// decapsulate message
-	JoinRequest joinReq;
-	joinReq.deserialize_from_shared_buffer(message);
-	
-	logging_info( "Received join request for spovnet " <<
-			joinReq.getSpoVNetID().toString() );
-
-	// check spovnet id
-	if( joinReq.getSpoVNetID() != spovnetId ) {
-		logging_error(
-				"Received join request for spovnet we don't handle " <<
-				joinReq.getSpoVNetID().toString() );
-
-		return false;
-	}
-
-	// TODO: here you can implement mechanisms to deny joining of a node
-	bool allow = true;
-	logging_info( "Sending join reply for spovnet " <<
-			spovnetId.toString() << " to node " <<
-			source.toString() <<
-			". Result: " << (allow ? "allowed" : "denied") );
-	joiningNodes.push_back( source );
-
-	// return overlay parameters
-	assert( overlayInterface != NULL );
-	logging_debug( "Using bootstrap end-point "
-			<< getEndpointDescriptor().toString() )
-	OverlayParameterSet parameters = overlayInterface->getParameters();
-	
-	
-	// create JoinReplay Message
-	OverlayMsg retmsg( OverlayMsg::typeJoinReply,
-			OverlayInterface::OVERLAY_SERVICE_ID, nodeId );
-	JoinReply replyMsg( spovnetId, parameters, allow );
-	retmsg.append_buffer(replyMsg.serialize_into_shared_buffer());
-
-	// XXX This is unlovely clash between the old message system and the new one,
-	// but a.t.m. we can't migrate everything to the new system at once..
-	// ---> Consider the EndpointDescriptor as part of the JoinReply..
-	retmsg.append_buffer(getEndpointDescriptor().serialize());
-	
-	// * send *
-	send_overlaymessage_down(&retmsg, bcLink, system_priority::OVERLAY);
-
-	return true;
-}
-
-/// Handle replies to spovnet instance join requests
-bool BaseOverlay::handleJoinReply( reboost::shared_buffer_t message, const LinkID& bcLink )
-{
-	// decapsulate message
-	logging_debug("received join reply message");
-	JoinReply replyMsg;
-	EndpointDescriptor endpoints;
-	reboost::shared_buffer_t buff = replyMsg.deserialize_from_shared_buffer(message);
-	buff = endpoints.deserialize(buff);
-
-	// correct spovnet?
-	if( replyMsg.getSpoVNetID() != spovnetId ) { // no-> fail
-		logging_error( "Received SpoVNet join reply for " <<
-				replyMsg.getSpoVNetID().toString() <<
-				" != " << spovnetId.toString() );
-
-		return false;
-	}
-
-	// access granted? no -> fail
-	if( !replyMsg.getJoinAllowed() ) {
-		logging_error( "Our join request has been denied" );
-
-		// drop initiator link
-		if( !bcLink.isUnspecified() ){
-			bc->dropLink( bcLink );
-
-			vector<LinkID>::iterator it = std::find(
-					bootstrapLinks.begin(), bootstrapLinks.end(), bcLink);
-			if( it != bootstrapLinks.end() )
-				bootstrapLinks.erase(it);
-		}
-
-		// inform all registered services of the event
-		foreach( NodeListener* i, nodeListeners )
-		i->onJoinFailed( spovnetId );
-
-		return true;
-	}
-
-	// access has been granted -> continue!
-	logging_info("Join request has been accepted for spovnet " <<
-			spovnetId.toString() );
-
-	logging_debug( "Using bootstrap end-point "
-			<< endpoints.toString() );
-
-	// create overlay structure from spovnet parameter set
-	// if we have not boostrapped yet against some other node
-	if( overlayInterface == NULL ){
-
-		logging_debug("first-time bootstrapping");
-
-		overlayInterface = OverlayFactory::create(
-				*this, replyMsg.getParam(), nodeId, this );
-
-		// overlay structure supported? no-> fail!
-		if( overlayInterface == NULL ) {
-			logging_error( "overlay structure not supported" );
-
-			if( !bcLink.isUnspecified() ){
-				bc->dropLink( bcLink );
-
-				vector<LinkID>::iterator it = std::find(
-						bootstrapLinks.begin(), bootstrapLinks.end(), bcLink);
-				if( it != bootstrapLinks.end() )
-					bootstrapLinks.erase(it);
-			}
-
-			// inform all registered services of the event
-			foreach( NodeListener* i, nodeListeners )
-			i->onJoinFailed( spovnetId );
-
-			return true;
-		}
-
-		// everything ok-> join the overlay!
-		state = BaseOverlayStateCompleted;
-		overlayInterface->createOverlay();
-
-		overlayInterface->joinOverlay( endpoints );
-		overlayBootstrap.recordJoin( endpoints );
-
-		// update ovlvis
-		//ovl.visChangeNodeColor( ovlId, nodeId, OvlVis::NODE_COLORS_GREEN);
-
-		// inform all registered services of the event
-		foreach( NodeListener* i, nodeListeners )
-		    i->onJoinCompleted( spovnetId );
-	}
-	else
-	{
-		// this is not the first bootstrap, just join the additional node
-		logging_debug("not first-time bootstrapping");
-		overlayInterface->joinOverlay( endpoints );
-		overlayBootstrap.recordJoin( endpoints );
-	} // if( overlayInterface == NULL )
-
-	return true;
-}
-
-
-bool BaseOverlay::handleData( reboost::shared_buffer_t message, OverlayMsg* overlayMsg, LinkDescriptor* ld )
-{
-	// get service
-	const ServiceID& service = ld->service; //overlayMsg->getService();
-
-	logging_debug( "Received data for service " << service.toString()
-			<< " on link " << overlayMsg->getDestinationLink().toString() );
-
-	// delegate data message
-	CommunicationListener* lst = getListener(service);
-	if(lst != NULL){
-		lst->onMessage(
-				message,
-//				overlayMsg->getSourceNode(),
-//				overlayMsg->getDestinationLink(),
-				ld->remoteNode,
-				ld->overlayId,
-                overlayMsg->getSeqNum(),
-				overlayMsg
-		);
-	}
-
-	return true;
-}
-
-bool BaseOverlay::handleLostMessage( reboost::shared_buffer_t message, OverlayMsg* msg )
-{
-    /**
-     * Deserialize MessageLost-Message
-     * 
-     * - Type of lost message
-     * - Hop count of lost message
-     * - Source-LinkID  of lost message
-     */
-    const uint8_t* buff = message(0, sizeof(uint8_t)*2).data();
-    uint8_t type = buff[0];
-    uint8_t hops = buff[1];
-    LinkID linkid;
-    linkid.deserialize(message(sizeof(uint8_t)*2));
-    
-    logging_warn("Node " << msg->getSourceNode()
-            << " informed us, that our message of type " << (int) type
-            << " is lost after traveling " << (int) hops << " hops."
-            << " (LinkID: " << linkid.toString());
-
-    
-    // TODO switch-case ?
-    
-    // BRANCH: LinkRequest --> link request failed
-    if ( type == OverlayMsg::typeLinkRequest )
-    {
-        __onLinkEstablishmentFailed(linkid);
-    }
-    
-    // BRANCH: Data --> link disrupted. Drop link.
-    //   (We could use something more advanced here. e.g. At least send a 
-    //    keep-alive message and wait for a keep-alive reply.)
-    if ( type == OverlayMsg::typeData )
-    {
-        LinkDescriptor* link_desc = getDescriptor(linkid);
-        
-        if ( link_desc )
-        {
-            link_desc->failed = true;
-        }
-        
-        dropLink(linkid);
-    }
-    
-    // BRANCH: ping lost
-    if ( type == OverlayMsg::typePing )
-    {
-        CommunicationListener* lst = getListener(msg->getService());
-        if( lst != NULL )
-        {
-            lst->onPingLost(msg->getSourceNode());
-        }
-    }
-    
-    return true;
-}
-
-bool BaseOverlay::handlePing( OverlayMsg* overlayMsg, LinkDescriptor* ld )
-{
-    // TODO AKTUELL: implement interfaces: Node::ping(node); BaseOverlay::ping(node)
-    
-    bool send_pong = false;
-    
-    // inform application and ask permission to send a pong message
-    CommunicationListener* lst = getListener(overlayMsg->getService());
-    if( lst != NULL )
-    {
-        send_pong = lst->onPing(overlayMsg->getSourceNode());
-    }
-    
-    // send pong message if allowed
-    if ( send_pong )
-    {
-        OverlayMsg pong_msg(OverlayMsg::typePong);
-        pong_msg.setSeqNum(overlayMsg->getSeqNum());
-        
-        // send message
-        try
-        {
-            send_node( &pong_msg, 
-                overlayMsg->getSourceNode(), 
-                system_priority::OVERLAY,
-                overlayMsg->getService() );
-        }
-        catch ( message_not_sent& e )
-        {
-            logging_info("Could not send Pong-Message to node: " << 
-                overlayMsg->getSourceNode());
-        }
-    }
-    
-    return true;  // XXX when shall we return false..?
-}
-
-bool BaseOverlay::handlePong( OverlayMsg* overlayMsg, LinkDescriptor* ld )
-{
-    // inform application
-    CommunicationListener* lst = getListener(overlayMsg->getService());
-    if( lst != NULL )
-    {
-        lst->onPong(overlayMsg->getSourceNode());
-    }
-    
-    return true;  // XXX when shall we return false..?
-}
-
-bool BaseOverlay::handleLinkUpdate( OverlayMsg* overlayMsg, LinkDescriptor* ld ) {
-
-	if( ld == NULL ) {
-		logging_warn( "received overlay update message for link for "
-				<< "which we have no mapping" );
-		return false;
-	}
-	logging_info("Received type update message on link " << ld );
-
-	// update our link mapping information for this link
-	bool changed =
-			( ld->remoteNode != overlayMsg->getSourceNode() )
-			|| ( ld->service != overlayMsg->getService() );
-
-	// set parameters
-	ld->up         = true;
-	ld->remoteNode = overlayMsg->getSourceNode();
-	ld->remoteLink = overlayMsg->getSourceLink();
-	ld->service    = overlayMsg->getService();
-	ld->autolink   = overlayMsg->isAutoLink();
-
-	// if our link information changed, we send out an update, too
-	if( changed ) {
-		overlayMsg->swapRoles();
-		overlayMsg->setSourceNode(nodeId);
-		overlayMsg->setSourceLink(ld->overlayId);
-		overlayMsg->setService(ld->service);
-		send( overlayMsg, ld, system_priority::OVERLAY );
-	}
-
-	// service registered? no-> error!
-	if( !communicationListeners.contains( ld->service ) ) {
-		logging_warn( "Link up: event listener has not been registered" );
-		return false;
-	}
-
-	// default or no service registered?
-	CommunicationListener* listener = communicationListeners.get( ld->service );
-	if( listener == NULL || listener == &CommunicationListener::DEFAULT ) {
-		logging_warn("Link up: event listener is default or null!" );
-		return true;
-	}
-
-	// update descriptor
-	ld->listener = listener;
-	ld->setAutoUsed();
-	ld->setAlive();
-
-	// ask the service whether it wants to accept this link
-	if( !listener->onLinkRequest(ld->remoteNode) ) {
-
-		logging_debug("Link id=" << ld->overlayId.toString() <<
-				" has been denied by service " << ld->service.toString() << ", dropping link");
-
-		// prevent onLinkDown calls to the service
-		ld->listener = &CommunicationListener::DEFAULT;
-
-		// drop the link
-		dropLink( ld->overlayId );
-		return true;
-	}
-
-	// set link up
-	ld->up = true;
-	logging_info( "Link has been accepted by service and is up: " << ld );
-
-	// auto links: link has been accepted -> send queued messages
-	if( ld->messageQueue.size() > 0 ) {
-		logging_info( "Sending out queued messages on link " << ld );
-        foreach( LinkDescriptor::message_queue_entry msg, ld->messageQueue )
-        {
-            sendMessage( msg.message, ld->overlayId, msg.priority );
-        }
-		ld->messageQueue.clear();
-	}
-
-	// call the notification functions
-	listener->onLinkUp( ld->overlayId, ld->remoteNode );
-	sideport->onLinkUp( ld->overlayId, nodeId, ld->remoteNode, this->spovnetId );
-
-    
-    // notify the application if this is the first link to a different node
-    if ( not connected )
-    {
-        connected = true;
-        
-        foreach( NodeListener* i, nodeListeners )
-            i->onOverlayConnected( spovnetId );
-    }
-    
-	return true;
-}
-
-/// handle a link request and reply
-bool BaseOverlay::handleLinkRequest( OverlayMsg* overlayMsg, LinkDescriptor* ld ) {
-
-	//TODO: Check if a request has already been sent using getSourceLink() ...
-
-	// create link descriptor
-	LinkDescriptor* ldn = addDescriptor();
-
-	// flags
-	ldn->up = true;
-	ldn->fromRemote = true;
-	ldn->relayed = true;
-
-	// parameters
-	ldn->service = overlayMsg->getService();
-	ldn->listener = getListener(ldn->service);
-	ldn->remoteNode = overlayMsg->getSourceNode();
-	ldn->remoteLink = overlayMsg->getSourceLink();
-	ldn->hops = overlayMsg->getNumHops();
-	
-    // initialize sequence numbers
-    ldn->last_sent_seqnum = SequenceNumber::createRandomSeqNum_Short();
-    logging_debug("Creating new link with initial SeqNum: " << ldn->last_sent_seqnum);
-    
-    
-	// update time-stamps
-	ldn->setAlive();
-	ldn->setAutoUsed();
-
-	logging_info( "Link request received from node id="
-	        << overlayMsg->getSourceNode()
-	        << " LINK: "
-	        << ldn);
-	
-	// create reply message and send back!
-	overlayMsg->swapRoles(); // swap source/destination
-	overlayMsg->setType(OverlayMsg::typeLinkReply);
-	overlayMsg->setSourceLink(ldn->overlayId);
-	overlayMsg->setRelayed(true);
-//	overlayMsg->setRouteRecord(true);
-    overlayMsg->setSeqNum(ld->last_sent_seqnum);
-	
-	// TODO aktuell do the same thing in the typeLinkRequest-Message, too. But be careful with race conditions!!
-	// append our endpoints (for creation of a direct link)
-	overlayMsg->set_payload_message(bc->getEndpointDescriptor().serialize());
-	
-	send( overlayMsg, ld, system_priority::OVERLAY ); // send back to link
-
-	// inform listener
-	if(ldn != NULL && ldn->listener != NULL)
-		ldn->listener->onLinkUp( ldn->overlayId, ldn->remoteNode );
-
-	return true;
-}
-
-bool BaseOverlay::handleLinkReply(
-        OverlayMsg* overlayMsg,
-        reboost::shared_buffer_t sub_message,
-        LinkDescriptor* ld )
-{
-    // deserialize EndpointDescriptor
-    EndpointDescriptor endpoints;
-    endpoints.deserialize(sub_message);
-    
-	// find link request
-	LinkDescriptor* ldn = getDescriptor(overlayMsg->getDestinationLink());
-
-	// not found? yes-> drop with error!
-	if (ldn == NULL) {
-		logging_error( "No link request pending for "
-				<< overlayMsg->getDestinationLink().toString() );
-		return false;
-	}
-	logging_debug("Handling link reply for " << ldn )
-
-	// check if already up
-	if (ldn->up) {
-		logging_warn( "Link already up: " << ldn );
-		return true;
-	}
-
-	// debug message
-	logging_info( "Link request reply received. Establishing link"
-			<< " for service " << overlayMsg->getService().toString()
-			<< " with local id=" << overlayMsg->getDestinationLink()
-			<< " and remote link id=" << overlayMsg->getSourceLink()
-			<< " to " << endpoints.toString()
-			<< " hop count: " << overlayMsg->getRouteRecord().size()
-	);
-
-	// set local link descriptor data
-	ldn->up = true;
-	ldn->relayed = true;
-	ldn->service = overlayMsg->getService();
-	ldn->listener = getListener(ldn->service);
-	ldn->remoteLink = overlayMsg->getSourceLink();
-	ldn->remoteNode = overlayMsg->getSourceNode();
-
-	// update timestamps
-	ldn->setAlive();
-	ldn->setAutoUsed();
-
-	// auto links: link has been accepted -> send queued messages
-	if( ldn->messageQueue.size() > 0 ) {
-		logging_info( "Sending out queued messages on link " <<
-				ldn->overlayId.toString() );
-		foreach( LinkDescriptor::message_queue_entry msg, ldn->messageQueue )
-		{
-			sendMessage( msg.message, ldn->overlayId, msg.priority );
-		}
-		ldn->messageQueue.clear();
-	}
-
-	// inform listeners about new link
-	ldn->listener->onLinkUp( ldn->overlayId, ldn->remoteNode );
-
-	// try to replace relay link with direct link
-	ldn->retryCounter = 3;
-	ldn->endpoint = endpoints;
-	ldn->communicationId =	bc->establishLink( ldn->endpoint );
-
-	return true;
-}
-
-/// handle a keep-alive message for a link
-bool BaseOverlay::handleLinkAlive( OverlayMsg* overlayMsg, LinkDescriptor* ld )
-{
-	LinkDescriptor* rld = getDescriptor(overlayMsg->getDestinationLink());
-	
-	if ( rld != NULL )
-	{
-		logging_debug("Keep-Alive for " << overlayMsg->getDestinationLink() );
-		if (overlayMsg->isRouteRecord())
-		{
-			rld->routeRecord = overlayMsg->getRouteRecord();
-		}
-		
-		// set alive
-		rld->setAlive();
-		
-		
-		/* answer keep alive */
-		if ( overlayMsg->getType() == OverlayMsg::typeKeepAlive )
-		{
-            time_t now = time(NULL);
-            logging_debug("[BaseOverlay] Answering KeepAlive over "
-                    << ld->to_string()
-                    << " after "
-                    << difftime( now, ld->keepAliveSent )
-                    << "s");
-            
-            OverlayMsg msg( OverlayMsg::typeKeepAliveReply,
-                    OverlayInterface::OVERLAY_SERVICE_ID, nodeId, ld->remoteNode );
-            msg.setRouteRecord(true);
-            ld->keepAliveSent = now;
-            send_link( &msg, ld->overlayId, system_priority::OVERLAY );
-		}
-
-		return true;
-	}
-	else
-	{
-		logging_error("No Keep-Alive for "
-				<< overlayMsg->getDestinationLink() << ": link unknown." );
-		return false;
-	}
-}
-
-/// handle a direct link message
-bool BaseOverlay::handleLinkDirect( OverlayMsg* overlayMsg, LinkDescriptor* ld ) {
-	logging_debug( "Received direct link replacement request" );
-
-	/// get destination overlay link
-	LinkDescriptor* rld = getDescriptor( overlayMsg->getDestinationLink() );
-	if (rld == NULL || ld == NULL) {
-		logging_error("Direct link replacement: Link "
-				<< overlayMsg->getDestinationLink() << "not found error." );
-		return false;
-	}
-	logging_info( "Received direct link convert notification for " << rld );
-
-	// update information
-	rld->communicationId = ld->communicationId;
-	rld->communicationUp = true;
-	rld->relayed = false;
-
-	// mark used and alive!
-	rld->setAlive();
-	rld->setAutoUsed();
-
-	// erase the original descriptor
-	eraseDescriptor(ld->overlayId);
-	
-    // inform listener
-    if( rld->listener != NULL)
-        rld->listener->onLinkChanged( rld->overlayId, rld->remoteNode );
-	
-	return true;
-}
-
-/// handles an incoming message
-bool BaseOverlay::handleMessage( reboost::shared_buffer_t message, LinkDescriptor* ld,
-		const LinkID bcLink )
-{
-	// decapsulate overlay message
-	OverlayMsg* overlayMsg = new OverlayMsg();
-	reboost::shared_buffer_t sub_buff = overlayMsg->deserialize_from_shared_buffer(message);
-
-// 	// XXX debug
-// 	logging_info( "Received overlay message."
-// 	        << " Hops: " << (int) overlayMsg->getNumHops()
-// 	        << " Type: " << (int) overlayMsg->getType()
-// 	        << " Payload size: " << sub_buff.size()
-//             << " SeqNum: " << overlayMsg->getSeqNum() );
-	
-	
-	// increase number of hops
-	overlayMsg->increaseNumHops();
-
-	// refresh relay information
-	refreshRelayInformation( overlayMsg, ld );
-
-	// update route record
-	overlayMsg->addRouteRecord(nodeId);
-
-	// handle signaling messages (do not route!)
-	if (overlayMsg->getType()>=OverlayMsg::typeSignalingStart &&
-			overlayMsg->getType()<=OverlayMsg::typeSignalingEnd )
-	{
-		overlayInterface->onMessage(overlayMsg, sub_buff, NodeID::UNSPECIFIED, LinkID::UNSPECIFIED);
-		delete overlayMsg;
-		return true;
-	}
-
-	// message for reached destination? no-> route message
-	if (!overlayMsg->getDestinationNode().isUnspecified() &&
-			overlayMsg->getDestinationNode() != nodeId ) {
-		logging_debug("Routing message "
-				<< " from " << overlayMsg->getSourceNode()
-				<< " to " << overlayMsg->getDestinationNode()
-		);
-		
-//		// XXX testing AKTUELL
-//        logging_info("MARIO: Routing message "
-//                << " from " << overlayMsg->getSourceNode()
-//                << " to " << overlayMsg->getDestinationNode() );
-//        logging_info( "Type: " << overlayMsg->getType() << " Payload size: " << sub_buff.size());
-		overlayMsg->append_buffer(sub_buff);
-		
-		route( overlayMsg, ld->remoteNode );
-		delete overlayMsg;
-		return true;
-	}
-
-	
-	/* handle base overlay message */
-	bool ret = false; // return value
-	try
-	{
-        switch ( overlayMsg->getType() ) 
-        {
-            // data transport messages
-            case OverlayMsg::typeData:
-            {
-                // NOTE: On relayed links, Â»ldÂ« does not point to our link, but on the relay link. 
-                LinkDescriptor* end_to_end_ld = getDescriptor(overlayMsg->getDestinationLink());
-                
-                if ( ! end_to_end_ld )
-                {
-                    logging_warn("Error: Data-Message claims to belong to a link we don't know.");
-                    
-                    ret = false;
-                }
-                else
-                {
-                    // message received --> link is alive
-                    end_to_end_ld->keepAliveReceived = time(NULL);
-                    // hop count on this link
-                    end_to_end_ld->hops = overlayMsg->getNumHops();
-                    
-                    // * call handler *
-                    ret = handleData(sub_buff, overlayMsg, end_to_end_ld);
-                }
-                
-                break;
-            }
-            case OverlayMsg::typeMessageLost:
-                ret = handleLostMessage(sub_buff, overlayMsg);
-                
-                break;
-        
-                // overlay setup messages
-            case OverlayMsg::typeJoinRequest:
-                ret = handleJoinRequest(sub_buff, overlayMsg->getSourceNode(), bcLink ); 	break;
-            case OverlayMsg::typeJoinReply:
-                ret = handleJoinReply(sub_buff, bcLink ); 	break;
-        
-                // link specific messages
-            case OverlayMsg::typeLinkRequest:
-                ret = handleLinkRequest(overlayMsg, ld ); 	break;
-            case OverlayMsg::typeLinkReply:
-                ret = handleLinkReply(overlayMsg, sub_buff, ld ); 	break;
-            case OverlayMsg::typeLinkUpdate:
-                ret = handleLinkUpdate(overlayMsg, ld );  	break;
-            case OverlayMsg::typeKeepAlive:
-            case OverlayMsg::typeKeepAliveReply:
-                ret = handleLinkAlive(overlayMsg, ld );   	break;
-            case OverlayMsg::typeLinkDirect:
-                ret = handleLinkDirect(overlayMsg, ld );  	break;
-                
-            case OverlayMsg::typeLinkClose:
-            {
-                dropLink(overlayMsg->getDestinationLink());
-                __removeDroppedLink(overlayMsg->getDestinationLink());
-                
-                break;
-            }
-            
-            /// ping over overlay path (or similar)
-            case OverlayMsg::typePing:
-            {
-                ret = handlePing(overlayMsg, ld);
-                break;
-            }
-            case OverlayMsg::typePong:
-            {
-                ret = handlePong(overlayMsg, ld);
-                break;
-            }
-            
-                // handle unknown message type
-            default:
-            {
-                logging_error( "received message in invalid state! don't know " <<
-                        "what to do with this message of type " << overlayMsg->getType() );
-                ret = false;
-                break;
-            }
-        }
-	}
-	catch ( reboost::illegal_sub_buffer& e )
-	{
-	    logging_error( "Failed to create sub-buffer while reading message: Â»"
-	            << e.what()
-	            << "Â« Message too short? ");
-	    
-	    assert(false); // XXX
-	}
-
-	// free overlay message and return value
-	delete overlayMsg;
-	return ret;
-}
-
-// ----------------------------------------------------------------------------
-
-void BaseOverlay::broadcastMessage(reboost::message_t message, const ServiceID& service, uint8_t priority) {
+
+	} // else
+
+	return false;
+}
+
+void BaseOverlay::broadcastMessage(Message* message, const ServiceID& service){
 
 	logging_debug( "broadcasting message to all known nodes " <<
 			"in the overlay from service " + service.toString() );
 
-	OverlayInterface::NodeList nodes = overlayInterface->getKnownNodes(true);
-	for(size_t i=0; i<nodes.size(); i++){
-		NodeID& id = nodes.at(i);
-		if(id == this->nodeId) continue; // don't send to ourselfs
-
-		sendMessage( message, id, priority, service );
-	}
-}
-
-/// return the overlay neighbors
-vector<NodeID> BaseOverlay::getOverlayNeighbors(bool deep) const {
-	// the known nodes _can_ also include our node, so we remove ourself
-	vector<NodeID> nodes = overlayInterface->getKnownNodes(deep);
-	vector<NodeID>::iterator i = find( nodes.begin(), nodes.end(), this->nodeId );
-	if( i != nodes.end() ) nodes.erase( i );
-	return nodes;
+	OverlayInterface::NodeList nodes = overlayInterface->getKnownNodes();
+
+	OverlayInterface::NodeList::iterator i = nodes.begin();
+	OverlayInterface::NodeList::iterator iend = nodes.end();
+
+	for( ; i != iend; i++ ){
+		if( *i == nodeId) continue; // don't send to ourselfs
+		sendMessage( message, *i, service ); // TODO: sollte auto links aufbauen fÃŒr sowas
+	}
+}
+
+void BaseOverlay::updateOvlVis( const NodeID& n ) {
+	NodeID node = n;
+/*	void visShowNodeBubble (
+        NETWORK_ID network,
+        NodeID& node,
+        string label
+        );
+*/
+	using namespace std;
+
+	if (node == nodeId || node.isUnspecified()) return;
+
+	// min/max
+	if ( node < min || min.isUnspecified() ) min = node;
+	if ( node > max || max.isUnspecified() ) max = node;
+
+	// successor
+	if ( succ.isUnspecified() || (node > nodeId && (succ < nodeId || (node-nodeId) < (succ-nodeId))) ) {
+		if (!succ.isUnspecified() && node != succ)
+			ovl.visDisconnect(ovlId, nodeId, succ, string(""));
+		succ = node;
+		ovl.visConnect(ovlId, nodeId, succ, string(""));
+	}
+
+	// set successor (circle-wrap)
+	if (succ.isUnspecified() && !min.isUnspecified()) {
+		succ = min;
+		ovl.visConnect(ovlId, nodeId, succ, string(""));
+	}
 }
 
 const NodeID& BaseOverlay::getNodeID(const LinkID& lid) const {
+
 	if( lid == LinkID::UNSPECIFIED ) return nodeId;
-	const LinkDescriptor* ld = getDescriptor(lid);
-	if( ld == NULL ) return NodeID::UNSPECIFIED;
-	else return ld->remoteNode;
-}
-
-vector<LinkID> BaseOverlay::getLinkIDs( const NodeID& nid ) const {
-	vector<LinkID> linkvector;
-	foreach( LinkDescriptor* ld, links ) {
-		if( ld->remoteNode == nid || nid == NodeID::UNSPECIFIED ) {
-			linkvector.push_back( ld->overlayId );
-		}
-	}
-	return linkvector;
-}
-
-
-void BaseOverlay::onNodeJoin(const NodeID& node) {
+
+	LinkMapping::const_iterator i = linkMapping.find( lid );
+	if( i == linkMapping.end() ) return NodeID::UNSPECIFIED;
+	else return i->second.node;
+}
+
+void BaseOverlay::incomingRouteMessage(Message* msg){
+	// gets handled as normal data message
+	// TODO: passt das so?
+	receiveMessage( msg, LinkID::UNSPECIFIED, NodeID::UNSPECIFIED );
+}
+
+void BaseOverlay::onNodeJoin(const NodeID& node){
+
 	JoiningNodes::iterator i = std::find( joiningNodes.begin(), joiningNodes.end(), node );
 	if( i == joiningNodes.end() ) return;
 
 	logging_info( "node has successfully joined baseoverlay and overlay structure "
-			<< node.toString() );
+				<< node.toString() );
+
+	BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
+		i->onNodeJoin( node, spovnetId );
+	}
 
 	joiningNodes.erase( i );
 }
 
-void BaseOverlay::eventFunction() {
-	stabilizeRelays();
-	stabilizeLinks();
-	updateVisual();
-}
-
-
-
-/* link status */
-bool BaseOverlay::isLinkDirect(const ariba::LinkID& lnk) const
-{
-    const LinkDescriptor* ld = getDescriptor(lnk);
-    
-    if (!ld)
-        return false;
-    
-    return ld->communicationUp && !ld->relayed;
-}
-
-int BaseOverlay::getHopCount(const ariba::LinkID& lnk) const
-{
-    const LinkDescriptor* ld = getDescriptor(lnk);
-    
-    if (!ld)
-        return -1;
-    
-    return ld->hops;    
-}
-
-
-bool BaseOverlay::isLinkVital(const LinkDescriptor* link) const
-{
-    time_t now = time(NULL);
-
-    return link->up && difftime( now, link->keepAliveReceived ) <= KEEP_ALIVE_TIME_OUT; // TODO is this too long for a "vital" link..? 
-}
-
-bool BaseOverlay::isLinkDirectVital(const LinkDescriptor* link) const
-{
-    return isLinkVital(link) && link->communicationUp && !link->relayed;
-}
-
-/* [link status] */
-
-
-void BaseOverlay::updateVisual(){
-
-	//
-	// update base overlay structure
-	//
-
-	static NodeID pre = NodeID::UNSPECIFIED;
-	static NodeID suc = NodeID::UNSPECIFIED;
-
-	vector<NodeID> nodes = this->getOverlayNeighbors(false);
-
-	if(nodes.size() == 0){
-
-		if(pre != NodeID::UNSPECIFIED){
-			visualInstance.visDisconnect(visualIdOverlay, this->nodeId, pre, "");
-			pre = NodeID::UNSPECIFIED;
-		}
-		if(suc != NodeID::UNSPECIFIED){
-			visualInstance.visDisconnect(visualIdOverlay, this->nodeId, suc, "");
-			suc = NodeID::UNSPECIFIED;
-		}
-
-	} // if(nodes.size() == 0)
-
-	if(nodes.size() == 1){
-		// only one node, make this pre and succ
-		// and then go into the node.size()==2 case
-		//nodes.push_back(nodes.at(0));
-
-		if(pre != nodes.at(0)){
-			pre = nodes.at(0);
-			if(pre != NodeID::UNSPECIFIED)
-				visualInstance.visConnect(visualIdOverlay, this->nodeId, pre, "");
-		}
-	}
-
-	if(nodes.size() == 2){
-
-		// old finger
-		if(nodes.at(0) != pre){
-			if(pre != NodeID::UNSPECIFIED)
-				visualInstance.visDisconnect(visualIdOverlay, this->nodeId, pre, "");
-			pre = NodeID::UNSPECIFIED;
-		}
-		if(nodes.at(1) != suc){
-			if(suc != NodeID::UNSPECIFIED)
-				visualInstance.visDisconnect(visualIdOverlay, this->nodeId, suc, "");
-			suc = NodeID::UNSPECIFIED;
-		}
-
-		// connect with fingers
-		if(pre == NodeID::UNSPECIFIED){
-			pre = nodes.at(0);
-			if(pre != NodeID::UNSPECIFIED)
-				visualInstance.visConnect(visualIdOverlay, this->nodeId, pre, "");
-		}
-		if(suc == NodeID::UNSPECIFIED){
-			suc = nodes.at(1);
-			if(suc != NodeID::UNSPECIFIED)
-				visualInstance.visConnect(visualIdOverlay, this->nodeId, suc, "");
-		}
-
-	} //if(nodes.size() == 2)
-
-//	{
-//		logging_error("================================");
-//		logging_error("my nodeid " << nodeId.get(MAX_KEYLENGTH-16, 16));
-//		logging_error("================================");
-//		if(nodes.size()>= 1){
-//			logging_error("real pre " << nodes.at(0).toString());
-//			logging_error("real pre " << nodes.at(0).get(MAX_KEYLENGTH-16, 16));
-//		}
-//		if(nodes.size()>= 2){
-//			logging_error("real suc " << nodes.at(1).toString());
-//			logging_error("real suc " << nodes.at(1).get(MAX_KEYLENGTH-16, 16));
-//		}
-//		logging_error("================================");
-//		if(pre == NodeID::UNSPECIFIED){
-//			logging_error("pre: unspecified");
-//		}else{
-//			unsigned int prei = pre.get(MAX_KEYLENGTH-16, 16);
-//			logging_error("pre: " << prei);
-//		}
-//		if(suc == NodeID::UNSPECIFIED){
-//			logging_error("suc: unspecified");
-//		}else{
-//			unsigned int suci = suc.get(MAX_KEYLENGTH-16, 16);
-//			logging_error("suc: " << suci);
-//		}
-//		logging_error("================================");
-//	}
-
-	//
-	// update base communication links
-	//
-
-	static set<NodeID> linkset;
-	set<NodeID> remotenodes;
-	foreach( LinkDescriptor* ld, links ) {
-		if (!isLinkVital(ld) || ld->service != OverlayInterface::OVERLAY_SERVICE_ID)
-			continue;
-
-		if (ld->routeRecord.size()>1 && ld->relayed) {
-			for (size_t i=1; i<ld->routeRecord.size(); i++)
-				remotenodes.insert( ld->routeRecord[ld->routeRecord.size()-i-1] );
-		} else {
-			remotenodes.insert(ld->remoteNode);
-		}
-	}
-
-	// which links are old and need deletion?
-	bool changed = false;
-
-	do{
-		changed = false;
-		foreach(NodeID n, linkset){
-			if(remotenodes.find(n) == remotenodes.end()){
-				visualInstance.visDisconnect(visualIdBase, this->nodeId, n, "");
-				linkset.erase(n);
-				changed = true;
-				break;
-			}
-		}
-	}while(changed);
-
-	// which links are new and need creation?
-	do{
-		changed = false;
-		foreach(NodeID n, remotenodes){
-			if(linkset.find(n) == linkset.end()){
-				visualInstance.visConnect(visualIdBase, this->nodeId, n, "");
-				linkset.insert(n);
-				changed = true;
-				break;
-			}
-		}
-	}while(changed);
-
-}
-
-// ----------------------------------------------------------------------------
-
-std::string BaseOverlay::debugInformation() {
-	std::stringstream s;
-	int i=0;
-
-	// dump overlay information
-	s << "Long debug info ... [see below]" << endl << endl;
-	s << "--- overlay information ----------------------" << endl;
-	s << overlayInterface->debugInformation() << endl;
-
-	// dump link state
-	s << "--- link state -------------------------------" << endl;
-	foreach( LinkDescriptor* ld, links ) {
-		s << "link " << i << ": " << ld << endl;
-		i++;
-	}
-	s << endl << endl;
-
-	return s.str();
-}
-
 }} // namespace ariba, overlay
Index: /source/ariba/overlay/BaseOverlay.h
===================================================================
--- /source/ariba/overlay/BaseOverlay.h	(revision 12775)
+++ /source/ariba/overlay/BaseOverlay.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef BASEOVERLAY_H_
@@ -43,15 +43,5 @@
 #include <iostream>
 #include <algorithm>
-#include <ctime>
-#include <list>
-#include <vector>
-#include <deque>
 #include <boost/foreach.hpp>
-
-#ifdef ECLIPSE_PARSER
-    #define foreach(a, b) for(a : b)
-#else
-    #define foreach(a, b) BOOST_FOREACH(a, b)
-#endif
 
 #include "ariba/utility/messages.h"
@@ -60,5 +50,4 @@
 #include "ariba/utility/misc/Demultiplexer.hpp"
 #include "ariba/utility/logging/Logging.h"
-#include "ariba/utility/system/Timer.h"
 
 #include "ariba/communication/EndpointDescriptor.h"
@@ -66,43 +55,30 @@
 #include "ariba/communication/CommunicationEvents.h"
 
+#include "ariba/interface/ServiceInterface.h"
+
 #include "ariba/overlay/modules/OverlayInterface.h"
 #include "ariba/overlay/modules/OverlayFactory.h"
 #include "ariba/overlay/modules/OverlayStructureEvents.h"
-#include "ariba/overlay/OverlayBootstrap.h"
-#include "ariba/overlay/SequenceNumber.h"
-#include "ariba/overlay/PublicExceptions.h"
-
-// forward declarations
-namespace ariba {
-  class NodeListener;
-  class CommunicationListener;
-  class SideportListener;
-}
-
-using std::vector;
-using std::list;
+#include "ariba/overlay/messages/OverlayMsg.h"
+#include "ariba/overlay/messages/JoinRequest.h"
+#include "ariba/overlay/messages/JoinReply.h"
+
+using std::cout;
 using std::map;
 using std::make_pair;
-using std::pair;
-using std::find;
-using std::deque;
-
-// ariba interface
-using ariba::NodeListener;
-using ariba::SideportListener;
-using ariba::CommunicationListener;
-
-// overlay
-using ariba::overlay::OverlayBootstrap;
-
-// communication
+
 using ariba::communication::EndpointDescriptor;
 using ariba::communication::BaseCommunication;
 using ariba::communication::CommunicationEvents;
 
-// transport
-//using ariba::transport::system_priority;
-
-// utilities
+using ariba::interface::ServiceInterface;
+
+using ariba::overlay::OverlayMsg;
+using ariba::overlay::JoinRequest;
+using ariba::overlay::JoinReply;
+using ariba::overlay::OverlayInterface;
+using ariba::overlay::OverlayFactory;
+using ariba::overlay::OverlayStructureEvents;
+
 using ariba::utility::NodeID;
 using ariba::utility::SpoVNetID;
@@ -114,112 +90,76 @@
 using ariba::utility::Demultiplexer;
 using ariba::utility::MessageReceiver;
+using ariba::utility::MessageSender;
 using ariba::utility::seqnum_t;
-using ariba::utility::Timer;
+
+#define ovl OvlVis::instance()
+#define ovlId OvlVis::NETWORK_ID_BASE_OVERLAY
+
+// needed for friend decleration
+// in different namespace
+namespace ariba {
+namespace interface {
+	class UnderlayAbstraction;
+}}
 
 namespace ariba {
 namespace overlay {
 
-class LinkDescriptor;
-class OverlayMsg;
-class DHT;
-
-class BaseOverlay: public MessageReceiver,
-		public CommunicationEvents,
-		public OverlayStructureEvents,
-		protected Timer {
-
-//	friend class OneHop;  // DEPRECATED
-	friend class Chord;
-	friend class ariba::SideportListener;
+class BaseOverlay :
+	public MessageReceiver,
+	public CommunicationEvents,
+	public OverlayStructureEvents {
 
 	use_logging_h( BaseOverlay );
+	friend class ariba::interface::UnderlayAbstraction;
 
 public:
-	/**
-	 * Constructs an empty non-functional base overlay instance
-	 */
-	BaseOverlay();
-
-	/**
-	 * Destructs a base overlay instance
+
+	/**
+	 * Constructs a Base Overlay instance
+	 */
+	BaseOverlay( BaseCommunication& _basecomm, const NodeID& _nodeid );
+
+	/**
+	 * TODO
 	 */
 	virtual ~BaseOverlay();
 
 	/**
-	 * Starts the Base Overlay instance
-	 */
-	void start(BaseCommunication* _basecomm, const NodeID& _nodeid);
-
-	/**
-	 * Stops the Base Overlay instance
-	 */
-	void stop();
-
-	/**
-	 * Is the BaseOverlay instance started up yet
-	 */
-	bool isStarted();
-
-	/// Tries to establish a direct or overlay link
-	const LinkID establishLink(	const EndpointDescriptor& ep,
-		const NodeID& node, const ServiceID& service );
-
-	/**
 	 * Starts a link establishment procedure to the specfied node
-	 * for the service with id service
-	 * 
-	 * @param node Destination node id
-	 * @param service Service to connect to
-	 * @param linkid Link identifier to be used with this link
-	 */
-	const LinkID establishLink(	const NodeID& remote,
-		const ServiceID& service = OverlayInterface::OVERLAY_SERVICE_ID );
-
-	/**
-	 * Starts a link establishment procedure to the specified
-	 * endpoint and to the specified service
-	 */
-	const LinkID establishDirectLink( const EndpointDescriptor& endpoint,
-		const ServiceID& service = OverlayInterface::OVERLAY_SERVICE_ID );
-
-	/// drops a link
-	void dropLink( const LinkID& link );
-
-	
-	
-	/* +++++ Message sending +++++ */
-	
-	
-	/// sends a message over an existing link
-	const SequenceNumber& sendMessage(reboost::message_t message,
-	        const LinkID& link,
-	        uint8_t priority ) throw(message_not_sent);
-
-	/// sends a message to a node and a specific service
-    const SequenceNumber& sendMessage(reboost::message_t message,
-	        const NodeID& remote,
-	        uint8_t priority,
-	        const ServiceID& service = OverlayInterface::OVERLAY_SERVICE_ID);
-
-
-    /**
-     *  send a message to the closest directly known node to an address
-     *  
-     *  @return NodeID of the (closest) destination node; 
-     */
-	NodeID sendMessageCloserToNodeID(reboost::message_t message, const NodeID& address,
-	        uint8_t priority, const ServiceID& service = OverlayInterface::OVERLAY_SERVICE_ID);
-	
+	 *
+	 * @param node The node id
+	 */
+	const LinkID establishLink( const NodeID& node, const ServiceID& service );
+
+	/**
+	 * TODO
+	 */
+	const LinkID establishLink( const EndpointDescriptor& ep, const ServiceID& service );
+
+	/**
+	 * TODO
+	 */
+	void  dropLink( const LinkID& link );
+
+	/**
+	 * TODO
+	 */
+	seqnum_t sendMessage( const Message* message, const LinkID& link );
+
+	/**
+	 * TODO
+	 */
+	seqnum_t sendMessage( const Message* message, const NodeID& node, const ServiceID& service );
+
 	/**
 	 * Send out a message to all nodes that are known in the overlay structure.
 	 * Depending on the structure of the overlay, this can be very different.
 	 */
-	void broadcastMessage(reboost::message_t message, const ServiceID& service, uint8_t priority);
-
-	
-	/* +++++ [Message sending] +++++ */
-	
-	
-	
+	void broadcastMessage(
+		Message* message,
+		const ServiceID& service
+	);
+
 	/**
 	 * Returns the end-point descriptor of a link.
@@ -228,41 +168,24 @@
 	 * @return The end-point descriptor of the link's end-point
 	 */
-	const EndpointDescriptor& getEndpointDescriptor(
-		const LinkID& link = LinkID::UNSPECIFIED) const;
-
-	/**
-	 * Get a list of overlay neighbors.
-	 *
-	 * @return A list of overlay neighbors.
-	 */
-	vector<NodeID> getOverlayNeighbors(bool deep = true) const;
-
-	/**
-	 * Returns a end-endpoint descriptor of a overlay neighbor.
-	 * If the node is not known -- an unspecified endpoint descriptor is
-	 * returned.
-	 *
-	 * @param node The node identifer of a overlay neighbor.
-	 * @return The end-point descriptor of the node or unspecified.
-	 */
-	const EndpointDescriptor& getEndpointDescriptor(const NodeID& node) const;
-
-	// TODO: Doc
-	bool bind(CommunicationListener* listener, const ServiceID& sid);
-
-	// TODO: Doc
-	bool unbind(CommunicationListener* listener, const ServiceID& sid);
-
-	// TODO: Doc
-	bool bind(NodeListener* listener);
-
-	// TODO: Doc
-	bool unbind(NodeListener* listener);
-
-	// TODO: Doc
-	bool registerSidePort(SideportListener* _sideport);
-
-	// TODO: Doc
-	bool unregisterSidePort(SideportListener* _sideport);
+	const EndpointDescriptor& getEndpointDescriptor( const LinkID& link = LinkID::UNSPECIFIED ) const;
+
+	/**
+	 * TODO
+	 */
+	const EndpointDescriptor& getEndpointDescriptor( const NodeID& node ) const;
+
+	/**
+	 * Registers a receiver.
+	 *
+	 * @param receiver An implementation of the receiver interface
+	 */
+	bool bind( ServiceInterface* service, const ServiceID& sid );
+
+	/**
+	 * Unregister a receiver.
+	 *
+	 * @param receiver An implementation of the receiver interface
+	 */
+	bool unbind( ServiceInterface* service, const ServiceID& sid );
 
 	/**
@@ -272,313 +195,144 @@
 	 * @return The NodeID of the link
 	 */
-	const NodeID& getNodeID(const LinkID& lid = LinkID::UNSPECIFIED) const;
-
-	/**
-	 * Return all Links for the specified remote nodeid, or all links when
-	 * the node id given is set to unspecified
-	 *
-	 * @param nid The node id to request links for, or unspecified for all links
-	 * @return a vector that contains all the link ids requested
-	 */
-	vector<LinkID> getLinkIDs(const NodeID& nid = NodeID::UNSPECIFIED) const;
-
-	/**
-	 * Join a existing sponaneous virtual network (spovnet).
-	 *
-	 * @param id A spovnet identifier
-	 * @param boot A bootstrap node
-	 */
-	void joinSpoVNet(const SpoVNetID& id, const EndpointDescriptor& boot = EndpointDescriptor::UNSPECIFIED());
-
-	/**
-	 * Initiates a new spontaneous virtual network.
-	 * This makes this BaseOverlay to the SpoVNet-Initiator.
-	 *
-	 * @param id The spovnet identifier
-	 */
-	void createSpoVNet(const SpoVNetID& id, const OverlayParameterSet& param =
-			OverlayParameterSet::DEFAULT, const SecurityParameterSet& sec =
-			SecurityParameterSet::DEFAULT, const QoSParameterSet& qos =
-			QoSParameterSet::DEFAULT);
-
-	/**
-	 * Start the bootstrap modules
-	 */
-	void startBootstrapModules(vector<pair<BootstrapManager::BootstrapType,string> > modules);
-
-	/**
-	 * Stop the bootstrap modules
-	 */
-	void stopBootstrapModules();
-
-	/**
-	 * Let the node leave the SpoVNet.
-	 */
-	void leaveSpoVNet();
-	
-	
-	/* link status */
-	bool isLinkDirect(const ariba::LinkID& lnk) const;
-	int getHopCount(const ariba::LinkID& lnk) const;
-
-    bool isLinkVital(const LinkDescriptor* link) const;
-    bool isLinkDirectVital(const LinkDescriptor* link) const;
+	const NodeID& getNodeID( const LinkID& lid = LinkID::UNSPECIFIED ) const ;
 
 protected:
 
-    /**
-     * @see ariba::communication::CommunicationEvents.h
-     */
-    virtual bool onLinkRequest(const LinkID& id,
-            const addressing2::EndpointPtr local,
-            const addressing2::EndpointPtr remote);
-
-    /**
-     * @see ariba::communication::CommunicationEvents.h
-     */
-    virtual void onLinkUp(const LinkID& id,
-            const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote);
-
-    /**
-     * @see ariba::communication::CommunicationEvents.h
-     */
-    virtual void onLinkDown(const LinkID& id,
-            const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote);
-
-    /**
-     * @see ariba::communication::CommunicationEvents.h
-     */
-    virtual void onLinkChanged(const LinkID& id,
-        const addressing2::EndpointPtr oldlocal,  const addressing2::EndpointPtr newlocal,
-        const addressing2::EndpointPtr oldremote, const addressing2::EndpointPtr newremote);
-
-    /**
-     * @see ariba::communication::CommunicationEvents.h
-     * 
-     * NOTE: Just calls onLinkDown (at the moment..)
-     */
-    virtual void onLinkFail(const LinkID& id,
-            const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote);
-
-    /**
-     * @see ariba::communication::CommunicationEvents.h
-     */
-//    virtual void onLinkQoSChanged(const LinkID& id,
-//            const addressing2::EndpointPtr local, const addressing2::EndpointPtr remote,
-//            const QoSParameterSet& qos);
-
-	
-	
-	
-	/**
-	 * Processes a received message from BaseCommunication
-	 *
-	 * In case of a message routed by the overlay the source identifies
-	 * the node the message came from!
-	 */
-	virtual bool receiveMessage( reboost::shared_buffer_t message,
-	        const LinkID& link,
-	        const NodeID&,
-	        bool bypass_overlay );
-
-	/**
-	 * This method is called, when a new node joined the network
-	 *
-	 * @see OverlayStructureEvents.h
-	 */
-	virtual void onNodeJoin(const NodeID& node);
-
-	/**
-	 * Timer Event method
-	 */
-	virtual void eventFunction();
-
-	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-	std::string getLinkHTMLInfo();
-
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+	void joinSpoVNet(
+		const SpoVNetID& id,
+		const EndpointDescriptor& bootstrapEp
+	);
+
+	void createSpoVNet(
+		const SpoVNetID& id,
+		const OverlayParameterSet& param = OverlayParameterSet::DEFAULT,
+		const SecurityParameterSet& sec  = SecurityParameterSet::DEFAULT,
+		const QoSParameterSet& qos = QoSParameterSet::DEFAULT
+	);
+
+	void leaveSpoVNet(
+	);
+
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+	virtual void onLinkUp( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote );
+
+	virtual void onLinkDown( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote );
+
+	virtual void onLinkChanged( const LinkID& id, const NetworkLocator* oldlocal, const NetworkLocator* newlocal, const NetworkLocator* oldremote, const NetworkLocator* newremote );
+
+	virtual void onLinkFail( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote );
+
+	virtual void onLinkQoSChanged( const LinkID& id, const NetworkLocator* local, const NetworkLocator* remote, const QoSParameterSet& qos );
+
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+	virtual bool receiveMessage( const Message* message, const LinkID& link, const NodeID& ); // nodeid is not valid in this case!
+
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+	/**
+	 * see OverlayStructureEvents.h, called from specific OverlayInterface class
+	 */
+	virtual void incomingRouteMessage( Message* msg );
+	virtual void onNodeJoin( const NodeID& node );
 
 private:
-	/// NOTE: "id" is an Overlay-LinkID
-	void __onLinkEstablishmentFailed(const LinkID& id);
-	
-	/// called from typeLinkClose-handler
-    void __removeDroppedLink(const LinkID& link);
-	
-private:
-	/// is the base overlay started yet
-	bool started;
-    
-    /// Â»trueÂ« if we have neighbours, Â»falseÂ« otherwise
-    bool connected;
-
-	/// The state of the BaseOverlay
+
+	/**
+	 * The BaseCommunication the BaseOverlay
+	 * communicates over
+	 */
+	BaseCommunication& bc;
+
+	/**
+	 * The nodeid of this BaseOverlay instance.
+	 */
+	NodeID nodeId;
+
+	/**
+	 * The SpoVNetID that we are joined to
+	 * or that we have created.
+	 */
+	SpoVNetID spovnetId;
+
+	/**
+	 * A demultiplexer that maps listeners to service ids
+	 * to deliver upcoming messages to the correct service.
+	 */
+	Demultiplexer<ServiceInterface*, const ServiceID> listenerMux;
+
+	/**
+	 * The abstract overlay interface that implements
+	 * the overlay specific functionality.
+	 */
+	OverlayInterface* overlayInterface;
+
+	/**
+	 * The special link to the Initiator of the SpoVNet
+	 * or LinkID::UNDEFINED if we are the Initiator
+	 */
+	LinkID initiatorLink;
+
+	/**
+	 * The state of the BaseOverlay
+	 */
 	typedef enum _BaseOverlayState {
-		BaseOverlayStateInvalid = 0,
-		BaseOverlayStateCompleted = 1,
+		BaseOverlayStateInvalid        = 0,
+		BaseOverlayStateInitiator      = 1,
+		BaseOverlayStateJoinInitiated  = 2,
+		BaseOverlayStateCompleted      = 3,
 	} BaseOverlayState;
 
-	BaseOverlayState state;         ///< Current Base-Overlay state
-	BaseCommunication* bc;          ///< reference to the base communication
-	NodeID nodeId;                  ///< the node id of this node
-	SpoVNetID spovnetId;            ///< the spovnet id of the currently joined overlay
-	vector<LinkID> bootstrapLinks;  ///< the link id of the link to the initiator node
-	NodeID spovnetInitiator;        ///< The initiator node
-
-	/// the service id communication listeners
-	Demultiplexer<CommunicationListener*, ServiceID> communicationListeners;
-	CommunicationListener* getListener( const ServiceID& id );
-
-	/// the node listeners
-	typedef vector<NodeListener*> NodeListenerVector;
-	NodeListenerVector nodeListeners;
-
-	/// the sideport listener
-	SideportListener* sideport;
-
-	/// the used overlay structure
-	OverlayInterface* overlayInterface;
-
-	/// Bootstrapper for our spovnet
-	OverlayBootstrap overlayBootstrap;
-
-	// message handlers --------------------------------------------------------
-
-	/// demultiplexes a incoming message with link descriptor
-	bool handleMessage( reboost::shared_buffer_t message, LinkDescriptor* ld,
-		const LinkID bcLink = LinkID::UNSPECIFIED );
-
-	// handle data and signalling messages
-	bool handleData( reboost::shared_buffer_t message, OverlayMsg* msg, LinkDescriptor* ld );
-	bool handleLostMessage( reboost::shared_buffer_t message, OverlayMsg* msg );
-	bool handleSignaling( OverlayMsg* msg, LinkDescriptor* ld );
-
-	// handle join request / reply messages
-	bool handleJoinRequest( reboost::shared_buffer_t message, const NodeID& source, const LinkID& bcLink );
-	bool handleJoinReply( reboost::shared_buffer_t message, const LinkID& bcLink );
-
-	// handle link messages
-	bool handleLinkRequest( OverlayMsg* msg, LinkDescriptor* ld );
-	bool handleLinkReply( OverlayMsg* msg, reboost::shared_buffer_t sub_message, LinkDescriptor* ld );
-	bool handleLinkUpdate( OverlayMsg* msg, LinkDescriptor* ld );
-	bool handleLinkDirect( OverlayMsg* msg, LinkDescriptor* ld );
-	bool handleLinkAlive( OverlayMsg* msg, LinkDescriptor* ld );
-    
-    // ping-pong over overlaypath/routing
-    bool handlePing( OverlayMsg* overlayMsg, LinkDescriptor* ld );
-    bool handlePong( OverlayMsg* overlayMsg, LinkDescriptor* ld );
-
-
-	// link state handling -----------------------------------------------------
-
-	/// link state information counter
-	int counter;
-
-	/// The link mapping of the node
-	vector<LinkDescriptor*> links;
-
-	/// erases a link descriptor
-	void eraseDescriptor(const LinkID& link, bool communication = false);
-
-	/// returns a link descriptor for the given id
-	LinkDescriptor* getDescriptor(const LinkID& link,
-			bool communication = false);
-
-	/// returns a link descriptor for the given id
-	const LinkDescriptor* getDescriptor(const LinkID& link,
-			bool communication = false) const;
-
-	/// returns a auto-link descriptor for the given node and service id
-	LinkDescriptor* getAutoDescriptor(const NodeID& node, const ServiceID& service);
-
-	/// adds a new link descriptor or uses an existing one
-	LinkDescriptor* addDescriptor(const LinkID& link = LinkID::UNSPECIFIED);
-
-	/// stabilizes link information
-	void stabilizeLinks();
-
-	/// print the currently known links
-	void showLinks();
-
-	/// compares two arbitrary links to the same node
-	int compare( const LinkID& lhs, const LinkID& rhs );
-
-	// relay route management --------------------------------------------------
-
-	/// relay route definitions
-	class relay_route {
+	BaseOverlayState state;
+
+	/**
+	 * The initiator node
+	 */
+	NodeID spovnetInitiator;
+
+	/**
+	 * OvlVis
+	 */
+	NodeID min, max;
+	NodeID succ, pred;
+	void updateOvlVis( const NodeID& node );
+
+	/**
+	 * Link management
+	 */
+	class LinkItem {
 	public:
-		NodeID  node;
-		LinkID  link;
-		uint8_t hops;
-		time_t  used;
+		static const LinkItem UNSPECIFIED;
+
+		LinkItem( const LinkID& _link, const NodeID& _node,
+				const ServiceID& _service, ServiceInterface* _interface )
+			: link( _link ), node( _node ), service( _service ), interface( _interface ){
+		}
+
+		const LinkID link;
+		NodeID node;
+		ServiceID service;
+		ServiceInterface* interface;
 	};
-	vector<relay_route> relay_routes;
-
-	/// stabilize relay information
-	void stabilizeRelays();
-
-	/// refreshes relay information
-	void refreshRelayInformation( const OverlayMsg* message, LinkDescriptor* ld );
-
-	/// returns a known relay link
-	LinkDescriptor* getRelayLinkTo( const NodeID& remote );
-
-	/// removes relay link information
-	void removeRelayLink( const LinkID& link );
-
-	/// removes relay node information
-	void removeRelayNode( const NodeID& link );
-
-	// internal message delivery -----------------------------------------------
-
-    // Convert OverlayMessage into new format and give it down to BaseCommunication
-    seqnum_t send_overlaymessage_down( OverlayMsg* message, const LinkID& bc_link, uint8_t priority );
-
-    
-	/// routes a message to its destination node
-	void route( OverlayMsg* message, const NodeID& last_hop = NodeID::UNSPECIFIED );
-	
-	/// sends a raw message to another node, delivers it to the base overlay class
-	/// may throw "message_not_sent"-exception
-	seqnum_t send( OverlayMsg* message,
-                   const NodeID& destination,
-                   uint8_t priority,
-                const NodeID& last_hop = NodeID::UNSPECIFIED )
-    throw(message_not_sent);
-
-	/// send a raw message using a link descriptor, delivers it to the base overlay class
-	seqnum_t send( OverlayMsg* message,
-	        LinkDescriptor* ld,
-	        uint8_t priority ) throw(message_not_sent);
-
-	/// send a message using a node id using overlay routing
-	/// sets necessary fields in the overlay message!
-	/// may throw "message_not_sent"-exception
-	seqnum_t send_node( OverlayMsg* message, const NodeID& remote, uint8_t priority,
-		const ServiceID& service = OverlayInterface::OVERLAY_SERVICE_ID) throw(message_not_sent);
-
-	/// send a message using a node id using overlay routing using a link
-	/// sets necessary fields in the overlay message!
-	void send_link( OverlayMsg* message,
-	        const LinkID& link,
-	        uint8_t priority ) throw(message_not_sent);
-
-	
-	/// sends a notification to a sender from whom we just dropped a message
-	void report_lost_message( const OverlayMsg* message );
-	
-	// misc --------------------------------------------------------------------
-
-	std::string debugInformation();
-
-	/**
-	 * nodes with pending joines. TODO: should be cleaned every
-	 * some seconds, add timestamps to each, and check on occasion
-	 */
+
+	typedef map<const LinkID, LinkItem> LinkMapping;
+	LinkMapping linkMapping;
+
+	// nodes with pending joines. TODO: should be cleaned every some seconds
+	// add timestamps to each, and check on occasion
 	typedef vector<NodeID> JoiningNodes;
 	JoiningNodes joiningNodes;
 
-	void updateVisual();
 };
 
Index: urce/ariba/overlay/CMakeLists.txt
===================================================================
--- /source/ariba/overlay/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,54 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    BaseOverlay.h
-    LinkDescriptor.h
-    OverlayBootstrap.h
-    SequenceNumber.h
-    PublicExceptions.h
-    )
-
-add_sources(
-    BaseOverlay.cpp
-    LinkDescriptor.cpp
-    OverlayBootstrap.cpp
-    SequenceNumber.cpp
-    )
-
-add_subdir_sources(messages modules)
Index: urce/ariba/overlay/LinkDescriptor.cpp
===================================================================
--- /source/ariba/overlay/LinkDescriptor.cpp	(revision 12775)
+++ 	(revision )
@@ -1,14 +1,0 @@
-#include "LinkDescriptor.h"
-
-namespace ariba {
-namespace overlay {
-
-std::ostream& operator<<(std::ostream& s, const LinkDescriptor* ld ) {
-	return s << ld->to_string();
-}
-
-std::ostream& operator<<(std::ostream& s, const LinkDescriptor& ld ) {
-	return s << ld.to_string();
-}
-
-}} // ariba, overlay
Index: urce/ariba/overlay/LinkDescriptor.h
===================================================================
--- /source/ariba/overlay/LinkDescriptor.h	(revision 12775)
+++ 	(revision )
@@ -1,187 +1,0 @@
-#ifndef __LINK_DESCRIPTOR_H
-#define __LINK_DESCRIPTOR_H
-
-#include <iostream>
-#include <sstream>
-#include <ctime>
-#include <deque>
-#include <boost/foreach.hpp>
-
-#include "ariba/utility/messages.h"
-#include "ariba/utility/types.h"
-#include "ariba/communication/EndpointDescriptor.h"
-#include "ariba/CommunicationListener.h"
-
-// reboost messages
-#include "ariba/utility/transport/messages/message.hpp"
-#include <ariba/utility/misc/sha1.h>
-
-#include "ariba/overlay/SequenceNumber.h"
-
-
-namespace ariba {
-	class CommunicationListener;
-}
-
-using std::deque;
-using ariba::utility::Message;
-using ariba::utility::NodeID;
-using ariba::utility::SpoVNetID;
-using ariba::utility::ServiceID;
-using ariba::utility::LinkID;
-using ariba::CommunicationListener;
-using ariba::communication::EndpointDescriptor;
-
-namespace ariba {
-namespace overlay {
-
-class LinkDescriptor;
-
-std::ostream& operator<<(std::ostream& s, const LinkDescriptor* ld );
-std::ostream& operator<<(std::ostream& s, const LinkDescriptor& ld );
-
-/// LinkDescriptor
-class LinkDescriptor {
-public:
-    struct message_queue_entry
-    {
-        reboost::message_t message;
-        uint8_t priority;
-    };
-    
-	// ctor
-	LinkDescriptor() {
-	    time_t now = time(NULL);
-	    
-		// default values
-		this->up = false;
-//         this->closing = false;
-        this->failed = false;
-		this->fromRemote = false;
-		this->remoteNode = NodeID::UNSPECIFIED;
-		this->overlayId  = LinkID::create();
-		this->communicationUp = false;
-		this->communicationId = LinkID::UNSPECIFIED;
-		this->keepAliveReceived = now;
-		this->keepAliveSent = now;
-		this->relaying     = false;
-		this->timeRelaying = now;
-		this->dropAfterRelaying = false;
-		this->service  = ServiceID::UNSPECIFIED;
-		this->listener = &CommunicationListener::DEFAULT;
-		this->relayed = false;
-		this->remoteLink = LinkID::UNSPECIFIED;
-		this->autolink = false;
-		this->lastuse = now;
-		this->retryCounter = 0;
-		this->hops = -1;
-        
-        this->transmit_seqnums = false; // XXX
-	}
-
-	// dtor
-	~LinkDescriptor() {
-		flushQueue();
-	}
-
-	// general information about the link --------------------------------------
-	bool up;           ///< flag whether this link is up and running
-// 	bool closing;      ///< flag, whether this link is in the regular process of closing
-	bool failed;       ///< flag, whether communication is (assumed to be) not/no longer possible on this link
-	bool fromRemote;   ///< flag, whether this link was requested from remote
-	NodeID remoteNode; ///< remote end-point node
-
-
-	// link identifiers --------------------------------------------------------
-	LinkID overlayId;       ///< the base overlay link id
-	LinkID communicationId; ///< the communication id
-	bool   communicationUp;   ///< flag, whether the communication is up
-
-	// sequence numbers --------------------------------------------------------
-	SequenceNumber last_sent_seqnum;
-    bool transmit_seqnums;
-    
-	// direct link retries -----------------------------------------------------
-	EndpointDescriptor endpoint;
-	int retryCounter;
-
-	// link alive information --------------------------------------------------
-	time_t keepAliveReceived; ///< the last time a keep-alive message was received
-	time_t keepAliveSent;  ///< the number of missed keep-alive messages
-	void setAlive() {
-//		keepAliveSent = time(NULL);
-		keepAliveReceived = time(NULL);
-	}
-
-	// relay information -------------------------------------------------------
-	bool   relayed;    ///< flag whether this link is a relayed link
-	LinkID remoteLink; ///< the remote link id
-	vector<NodeID> routeRecord;
-	int hops;
-
-	// relay state -------------------------------------------------------------
-	bool   relaying;     ///< flag, wheter this link has been used as relay
-	bool   dropAfterRelaying;
-	time_t timeRelaying; ///< last time the link has been used as relay
-	void setRelaying() {
-		relaying = true;
-		timeRelaying = time(NULL);
-	}
-
-	// owner -------------------------------------------------------------------
-	ServiceID service; ///< service using this link
-	CommunicationListener* listener; ///< the listener using this node
-
-	// auto links --------------------------------------------------------------
-	bool autolink;  ///< flag, whether this link is a auto-link
-	time_t lastuse; ///< time, when the link was last used XXX AUTO_LINK-ONLY
-	deque<message_queue_entry> messageQueue; ///< waiting messages to be delivered
-	void setAutoUsed() {
-		if (autolink) lastuse = time(NULL);
-	}
-	/// drops waiting auto-link messages
-	void flushQueue() {
-//		BOOST_FOREACH( Message* msg, messageQueue )	delete msg;  // XXX MARIO: shouldn't be necessary anymore, since we're using shared pointers
-		messageQueue.clear();
-	}
-
-	// string representation ---------------------------------------------------
-	std::string to_string() const {
-	    time_t now = time(NULL);
-	    
-		std::ostringstream s;
-        if ( relayed )
-            s << "[RELAYED-";
-        else
-            s << "[DIRECT-";
-        s << "LINK] ";
-        s << "id=" << overlayId.toString().substr(0,4) << " ";
-        s << "serv=" << service.toString() << " ";
-		s << "up=" << up << " ";
-		s << "init=" << !fromRemote << " ";
-		s << "node=" << remoteNode.toString().substr(0,4) << " ";
-		s << "relaying=" << relaying << " ";
-		s << "last_received=" << now - keepAliveReceived << "s ";
-		s << "auto=" << autolink << " ";
-		s << "hops=" << hops << " ";
-		if ( relayed ) {
-			s << "| Relayed: ";
-			s << "remote link=" << remoteLink.toString().substr(0,4) << " ";
-			if (routeRecord.size()>0) {
-				s << "route record=";
-				for (size_t i=0; i<routeRecord.size(); i++)
-					s << routeRecord[i].toString().substr(0,4) << " ";
-			}
-		} else {
-			s << "| Direct: ";
-			s << "using [COMMUNICATION-LINK] id=" << communicationId.toString().substr(0,4) << " ";
-			s << "(up=" << communicationUp << ") ";
-		}
-		return s.str();
-	}
-};
-
-}} // namespace ariba, overlay
-
-#endif // __LINK_DESCRIPTOR_H
-
Index: urce/ariba/overlay/OverlayBootstrap.cpp
===================================================================
--- /source/ariba/overlay/OverlayBootstrap.cpp	(revision 12775)
+++ 	(revision )
@@ -1,246 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "OverlayBootstrap.h"
-
-#include "BaseOverlay.h"
-#include "ariba/utility/bootstrap/modules/bluetoothsdp/BluetoothSdp.h"
-
-using ariba::utility::BluetoothSdp;
-
-namespace ariba {
-namespace overlay {
-
-use_logging_cpp(OverlayBootstrap);
-SystemEventType OverlayBootstrapMethodType("OverlayBootstrapMethodType");
-
-OverlayBootstrap::OverlayBootstrap()
-	: 	manager( BootstrapManager::instance() ),
-		spovnetid( SpoVNetID::UNSPECIFIED ),
-		nodeid( NodeID::UNSPECIFIED ),
-		overlay( NULL ),
-		watchtimer(this),
-		haveOverlayConnection(false){
-
-	srand(time(NULL));
-
-	BluetoothSdp::CONNECTION_CHECKER = this;
-}
-
-OverlayBootstrap::~OverlayBootstrap(){
-}
-
-void OverlayBootstrap::start(BaseOverlay* _overlay,
-		const SpoVNetID& _spovnetid, const NodeID& _nodeid,
-		vector<pair<BootstrapManager::BootstrapType,string> > modules){
-	overlay = _overlay;
-	spovnetid = _spovnetid;
-	nodeid = _nodeid;
-
-	logging_info("starting overlay bootstrap");
-
-	manager.registerCallback( this );
-
-	typedef pair<BootstrapManager::BootstrapType,string> X;
-	BOOST_FOREACH( X i, modules){
-		manager.registerModule( i.first, i.second );
-	}
-
-	watchtimer.startWatchdog();
-}
-
-void OverlayBootstrap::stop(){
-	overlay = NULL;
-	spovnetid = SpoVNetID::UNSPECIFIED;
-	nodeid = NodeID::UNSPECIFIED;
-
-	logging_info("stopping overlay bootstrap");
-
-	manager.unregisterCallback( this );
-	manager.unregisterAllModules();
-
-	watchtimer.stopWatchdog();
-}
-
-void OverlayBootstrap::handleSystemEvent(const SystemEvent& event){
-	JoinData* data = event.getData<JoinData>();
-
-	// announcement for our spovnet
-	logging_info( "found bootstrap node for our SpoVNetID " << data->spovnetid.toString()
-			<< " on NodeID " << data->nodeid.toString() << " with endpoint " << data->endpoint.toString() );
-
-	// tell the base overlay to join using this endpoint
-	assert( overlay != NULL );
-	overlay->joinSpoVNet( spovnetid, data->endpoint );
-
-	delete data;
-}
-
-void OverlayBootstrap::onBootstrapServiceFound(string name, string info1, string info2, string info3){
-	if( overlay == NULL ) return;
-	if(name.length() <= 0 || info1.length() <= 0 || info2.length() <= 0 || info3.length() <= 0) return;
-
-	//
-	// generate the types
-	//
-
-	SpoVNetID sid( info1 );
-	NodeID nid( info2 );
-	EndpointDescriptor ep( info3 );
-
-	//
-	// is this announcement of interest for us?
-	//
-
-	// announcement for another spovnet
-	if( sid != this->spovnetid ) return;
-
-	// announcement with our nodeid (either our announcement
-	// or a node with the same id, any way -> ignore)
-	if( nid == this->nodeid ) return;
-
-	//
-	// send out the bootstrap information as
-	// event to synchronize into the system queue
-	//
-
-	JoinData* data = new JoinData();
-	data->spovnetid = sid;
-	data->nodeid = nid;
-	data->endpoint = ep;
-
-	SystemQueue::instance().scheduleEvent(
-			SystemEvent( this, OverlayBootstrapMethodType, data), 0 );
-}
-
-void OverlayBootstrap::publish(const EndpointDescriptor& _ep){
-
-	ostringstream r;
-	r << std::hex << rand();
-
-	randname = r.str();
-	manager.publish( randname, spovnetid.toString(), nodeid.toString(), _ep.toString() );
-}
-
-void OverlayBootstrap::revoke(){
-	manager.revoke( randname );
-}
-
-void OverlayBootstrap::recordJoin(const EndpointDescriptor& _ep){
-	boost::mutex::scoped_lock lock(lastJoinesMutex);
-
-	JoinData data;
-	data.spovnetid = spovnetid;
-	data.nodeid = nodeid;
-	data.endpoint = _ep;
-
-	logging_info("recording bootstrap information " << data.endpoint.toString());
-
-	lastJoines.push_front(data);
-}
-
-bool OverlayBootstrap::haveOverlayConnections(){
-	boost::mutex::scoped_lock lock(haveOverlayConnectionMutex);
-	return haveOverlayConnection;
-}
-
-void OverlayBootstrap::checkOverlayStatus(){
-
-	// if we have no overlay neighbors, try to bootstrap using
-	// bootstrap information that we already used
-
-	{	//limit history to 10 endpoints
-		boost::mutex::scoped_lock lock(lastJoinesMutex);
-		while(lastJoines.size() > 10)
-			lastJoines.pop_back();
-	}
-
-	{
-		boost::mutex::scoped_lock lock(haveOverlayConnectionMutex);
-		haveOverlayConnection = overlay->getOverlayNeighbors().size() > 0;
-
-		// we have overlay neighbors -> ok nothing to do
-		if(haveOverlayConnection > 0) return;
-	}
-
-	// no overlay neighbors, see if we can join using old information
-	logging_info("overlay not joined, checking for earlier used bootstrap information");
-	EndpointDescriptor joinep = EndpointDescriptor::UNSPECIFIED();
-
-	// no overlay neighbors -> try out already
-	// successfully used bootstrap nodes
-	JoinData data;
-	{
-		boost::mutex::scoped_lock lock(lastJoinesMutex);
-		JoinStack::iterator i = lastJoines.begin();
-		if(i == lastJoines.end()) return;
-
-		// use last used element and then put it into back
-		joinep = (*i).endpoint;
-
-		if(lastJoines.size() >= 2)
-			swap( *lastJoines.begin(), *(--(lastJoines.end())) );
-	}
-
-	logging_info("no overlay conenctivity detected, " <<
-					"trying to join using old bootstrap information: " <<
-					joinep.toString());
-
-	// try to join using this node, if the join is successfull
-	// the endpoint will again be inserted using recordJoin
-	overlay->joinSpoVNet( spovnetid, joinep );
-}
-
-OverlayBootstrap::WatchdogTimer::WatchdogTimer(OverlayBootstrap* _obj) : obj(_obj) {
-}
-
-void OverlayBootstrap::WatchdogTimer::startWatchdog(){
-	Timer::setInterval(5000);
-	Timer::start();
-}
-
-void OverlayBootstrap::WatchdogTimer::stopWatchdog(){
-	Timer::stop();
-}
-
-void OverlayBootstrap::WatchdogTimer::eventFunction(){
-	if(obj == NULL) return;
-	obj->checkOverlayStatus();
-}
-
-}} // namespace ariba, overlay
Index: urce/ariba/overlay/OverlayBootstrap.h
===================================================================
--- /source/ariba/overlay/OverlayBootstrap.h	(revision 12775)
+++ 	(revision )
@@ -1,155 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef __OVERLAY_BOOTSTRAP_H
-#define __OVERLAY_BOOTSTRAP_H
-
-#include <string>
-#include <sstream>
-#include <ctime>
-#include <deque>
-#include <vector>
-#include <algorithm>
-#include <boost/thread/mutex.hpp>
-#include <boost/foreach.hpp>
-#include "ariba/utility/logging/Logging.h"
-#include "ariba/utility/types.h"
-#include "ariba/utility/system/Timer.h"
-#include "ariba/utility/bootstrap/BootstrapManager.h"
-#include "ariba/utility/bootstrap/BootstrapInformationCallback.h"
-#include "ariba/communication/EndpointDescriptor.h"
-#include "ariba/utility/system/SystemEventListener.h"
-#include "ariba/utility/system/SystemQueue.h"
-#include "ariba/utility/system/SystemEvent.h"
-#include "ariba/utility/system/SystemEventType.h"
-
-using std::swap;
-using std::deque;
-using std::string;
-using std::vector;
-using std::pair;
-using std::ostringstream;
-using ariba::utility::SpoVNetID;
-using ariba::utility::NodeID;
-using ariba::utility::BootstrapManager;
-using ariba::utility::BootstrapInformationCallback;
-using ariba::communication::EndpointDescriptor;
-using ariba::utility::SystemEventType;
-using ariba::utility::SystemEvent;
-using ariba::utility::SystemQueue;
-using ariba::utility::Timer;
-using ariba::utility::SystemEventListener;
-
-namespace ariba {
-namespace overlay {
-
-class BaseOverlay;
-
-class OverlayBootstrap : public BootstrapInformationCallback, public SystemEventListener {
-	use_logging_h(OverlayBootstrap);
-public:
-	OverlayBootstrap();
-	virtual ~OverlayBootstrap();
-
-	void start(
-			BaseOverlay* _overlay,
-			const SpoVNetID& _spovnetid,
-			const NodeID& _nodeid,
-			vector<pair<BootstrapManager::BootstrapType,string> > modules
-			);
-	void stop();
-
-	void publish( const EndpointDescriptor& _ep );
-	void revoke();
-
-	void recordJoin(const EndpointDescriptor& _ep);
-	bool haveOverlayConnections();
-
-protected:
-	virtual void handleSystemEvent(const SystemEvent& event);
-	virtual void onBootstrapServiceFound(string name, string info1, string info2, string info);
-
-private:
-	class JoinData {
-	public:
-		JoinData() : spovnetid(), nodeid(), endpoint() {
-		}
-
-		JoinData& operator=( const JoinData& rhs) {
-			spovnetid = rhs.spovnetid;
-			nodeid = rhs.nodeid;
-			endpoint = rhs.endpoint;
-			return *this;
-		}
-
-		SpoVNetID spovnetid;
-		NodeID nodeid;
-		EndpointDescriptor endpoint;
-	};
-
-	BootstrapManager& manager;
-	SpoVNetID spovnetid;
-	NodeID nodeid;
-	BaseOverlay* overlay;
-	string randname;
-
-	class WatchdogTimer : public Timer {
-	public:
-		WatchdogTimer(OverlayBootstrap* _obj);
-		void startWatchdog();
-		void stopWatchdog();
-	protected:
-		virtual void eventFunction();
-	private:
-		OverlayBootstrap* obj;
-	};
-
-	typedef deque<JoinData> JoinStack;
-	JoinStack lastJoines;
-	boost::mutex lastJoinesMutex;
-	WatchdogTimer watchtimer;
-	void checkOverlayStatus();
-
-
-	bool haveOverlayConnection;
-	boost::mutex haveOverlayConnectionMutex;
-};
-
-}} // namespace ariba, overlay
-
-#endif // __OVERLAY_BOOTSTRAP_H
Index: /source/ariba/overlay/OverlayEvents.cpp
===================================================================
--- /source/ariba/overlay/OverlayEvents.cpp	(revision 2378)
+++ /source/ariba/overlay/OverlayEvents.cpp	(revision 2378)
@@ -0,0 +1,82 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "OverlayEvents.h"
+
+namespace ariba {
+namespace overlay {
+
+OverlayEvents::OverlayEvents(){
+}
+
+OverlayEvents::~OverlayEvents(){
+}
+
+void OverlayEvents::onOverlayCreate( const SpoVNetID& id ){
+}
+
+void OverlayEvents::onOverlayDestroy( const SpoVNetID& id ){
+}
+
+bool OverlayEvents::isJoinAllowed( const NodeID& nodeid, const SpoVNetID& spovnetid ){
+	// default: allow all nodes to join
+	return true;
+}
+
+void OverlayEvents::onNodeJoin( const NodeID& nodeid, const SpoVNetID& spovnetid ){
+}
+
+void OverlayEvents::onNodeLeave( const NodeID& id, const SpoVNetID& spovnetid ){
+}
+
+void OverlayEvents::onJoinSuccess( const SpoVNetID& spovnetid ){
+}
+
+void OverlayEvents::onJoinFail( const SpoVNetID& spovnetid ){
+}
+
+void OverlayEvents::onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote ){
+}
+
+void OverlayEvents::onLinkDown( const LinkID& link, const NodeID& local, const NodeID& remote ){
+}
+
+void OverlayEvents::onLinkChanged( const LinkID& link, const NodeID& local, const NodeID& remote ){
+}
+
+}} // namespace ariba, overlay
Index: /source/ariba/overlay/OverlayEvents.h
===================================================================
--- /source/ariba/overlay/OverlayEvents.h	(revision 2378)
+++ /source/ariba/overlay/OverlayEvents.h	(revision 2378)
@@ -0,0 +1,80 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef __OVERLAY_EVENTS_H
+#define __OVERLAY_EVENTS_H
+
+#include "ariba/utility/types/LinkID.h"
+#include "ariba/utility/types/NodeID.h"
+#include "ariba/utility/types/SpoVNetID.h"
+
+using ariba::utility::LinkID;
+using ariba::utility::NodeID;
+using ariba::utility::SpoVNetID;
+
+namespace ariba {
+namespace overlay {
+
+class OverlayEvents {
+	friend class BaseOverlay;
+public:
+	OverlayEvents();
+	virtual ~OverlayEvents();
+
+protected:
+
+	virtual void onOverlayCreate( const SpoVNetID& id );
+	virtual void onOverlayDestroy( const SpoVNetID& id );
+
+	/// for initiator about remote nodes
+	virtual bool isJoinAllowed( const NodeID& nodeid, const SpoVNetID& spovnetid );
+	virtual void onNodeJoin( const NodeID& nodeid, const SpoVNetID& spovnetid );
+	virtual void onNodeLeave( const NodeID& id, const SpoVNetID& spovnetid );
+
+	/// our local status
+	virtual void onJoinSuccess( const SpoVNetID& spovnetid );
+	virtual void onJoinFail( const SpoVNetID& spovnetid );
+
+	virtual void onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkDown( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkChanged( const LinkID& link, const NodeID& local, const NodeID& remote );
+};
+
+}} // namespace ariba, overlay
+
+#endif // __OVERLAY_EVENTS_H
Index: urce/ariba/overlay/PublicExceptions.h
===================================================================
--- /source/ariba/overlay/PublicExceptions.h	(revision 12775)
+++ 	(revision )
@@ -1,23 +1,0 @@
-#ifndef PUBLICEXCEPTIONS_H
-#define PUBLICEXCEPTIONS_H
-
-#include <stdexcept>
-
-namespace ariba {
-namespace overlay {
-
-class message_not_sent: public std::runtime_error
-{
-public:
-    /** Takes a character string describing the error.  */
-    explicit message_not_sent(const string& __arg)  :
-        std::runtime_error(__arg)
-    {
-    }
-    
-    virtual ~message_not_sent() throw() {}
-};
-
-}} // namespace ariba::overlay
-
-#endif // PUBLICEXCEPTIONS_H
Index: urce/ariba/overlay/SequenceNumber.cpp
===================================================================
--- /source/ariba/overlay/SequenceNumber.cpp	(revision 12775)
+++ 	(revision )
@@ -1,167 +1,0 @@
-
-#include "SequenceNumber.h"
-#include <ctime>
-#include <limits>
-
-namespace ariba {
-namespace overlay {
-
-/** static initializers **/
-// DISABLED_SEQNUM const
-const SequenceNumber SequenceNumber::DISABLED;
-    
-// seed the RNG
-boost::mt19937 SequenceNumber::rng_32bit(std::time(NULL));
-
-boost::uniform_int<uint32_t> SequenceNumber::seqnum_distribution_32bit(
-    MIN_SEQ_NUM, std::numeric_limits<uint32_t>::max());
-
-boost::uniform_int<uint32_t> SequenceNumber::distribution_full32bit(
-    0, std::numeric_limits<uint32_t>::max());
-
-
-
-/** class implementation **/
-SequenceNumber::SequenceNumber():
-    seqnum_32(SEQ_NUM_DISABLED),
-    seqnum_64(SEQ_NUM_DISABLED)
-{
-}
-SequenceNumber::SequenceNumber(uint32_t seqnum):
-    seqnum_32(seqnum),
-    seqnum_64(SEQ_NUM_DISABLED)
-{
-}
-SequenceNumber::SequenceNumber(uint64_t seqnum):
-    seqnum_32(SEQ_NUM_DISABLED),
-    seqnum_64(seqnum)
-{
-}
-
-
-SequenceNumber SequenceNumber::createRandomSeqNum_Short() 
-{
-    uint32_t num = seqnum_distribution_32bit(rng_32bit);
-    return SequenceNumber(num);
-}
-
-SequenceNumber SequenceNumber::createRandomSeqNum_Long() 
-{
-    uint64_t num = distribution_full32bit(rng_32bit);
-    num << 32;
-    num += seqnum_distribution_32bit(rng_32bit);
-    
-    return SequenceNumber(num);
-}
-
-bool SequenceNumber::isShortSeqNum() const 
-{
-    return seqnum_32 >= MIN_SEQ_NUM && seqnum_64 == SEQ_NUM_DISABLED;
-}
-
-bool SequenceNumber::isLongSeqNum() const 
-{
-    return seqnum_32 == SEQ_NUM_DISABLED && seqnum_64 >= MIN_SEQ_NUM;
-}
-
-bool SequenceNumber::isDisabled() const 
-{
-    return seqnum_32 == SEQ_NUM_DISABLED && seqnum_64 == SEQ_NUM_DISABLED;
-}
-
-bool SequenceNumber::isValid() const 
-{
-    return isShortSeqNum() || isLongSeqNum();
-}
-
-void SequenceNumber::increment() 
-{
-    // BRANCH: short seqnum
-    if ( isShortSeqNum() )
-    {
-        seqnum_32++;
-        
-        // wrap overflow
-        if ( seqnum_32 < MIN_SEQ_NUM )
-        {
-            seqnum_32 = MIN_SEQ_NUM;
-        }
-    }
-    
-    // BRANCH: long seqnum
-    else if ( isLongSeqNum() )
-    {
-        seqnum_64++;
-        
-        // wrap overflow
-        if ( seqnum_64 < MIN_SEQ_NUM )
-        {
-            seqnum_64 = MIN_SEQ_NUM;
-        }
-    }
-}
-
-bool SequenceNumber::operator==(const SequenceNumber& rhs) const 
-{
-    return seqnum_32 + seqnum_64 == rhs.seqnum_32 + rhs.seqnum_64;
-}
-
-bool SequenceNumber::operator<(const SequenceNumber& rhs) const 
-{
-    return seqnum_32 + seqnum_64 < rhs.seqnum_32 + rhs.seqnum_64;
-}
-
-bool SequenceNumber::isSuccessor(const SequenceNumber& rhs) 
-{
-    // TODO implement
-    
-    return false;
-}
-
-bool SequenceNumber::isPredecessor(const SequenceNumber& rhs) 
-{
-    // TODO implement
-    
-    return false;
-}
-
-uint32_t SequenceNumber::getShortSeqNum() const 
-{
-    return seqnum_32;
-}
-
-uint64_t SequenceNumber::getLongSeqNum() const 
-{
-    return seqnum_64;
-}
-
-
-std::ostream& operator<<(std::ostream& stream, const SequenceNumber& rhs) 
-{
-    if ( rhs.isDisabled() )
-    {
-        return stream << "DISABLED";
-    }
-    
-    else if ( ! rhs.isValid() )
-    {
-        return stream << "INVALID";
-    }
-    
-    else if ( rhs.isShortSeqNum() )
-    {
-        return stream << rhs.seqnum_32;
-    }
-    
-    else if ( rhs.isLongSeqNum() )
-    {
-        return stream << rhs.seqnum_64;
-    }
-    
-    else
-    {
-        return stream << "ERROR";
-    }
-}
-
-}} // [namespace ariba::overlay]
Index: urce/ariba/overlay/SequenceNumber.h
===================================================================
--- /source/ariba/overlay/SequenceNumber.h	(revision 12775)
+++ 	(revision )
@@ -1,81 +1,0 @@
-
-#ifndef SEQUENCENUMBER_H
-#define SEQUENCENUMBER_H
-
-#include <stdint.h>
-#include <iostream>
-
-// random
-#include <boost/random/mersenne_twister.hpp>
-#include <boost/random/uniform_int.hpp>
-
-namespace ariba {
-namespace overlay {
-
-#define MIN_SEQ_NUM           100
-#define SEQ_NUM_DISABLED        0
-
-class SequenceNumber
-{
-public:
-    static const SequenceNumber DISABLED;
-    
-    /// constructors
-    SequenceNumber();
-    SequenceNumber(uint32_t seqnum);
-    SequenceNumber(uint64_t seqnum);
-    
-    /// factories
-    static SequenceNumber createRandomSeqNum_Short();
-    static SequenceNumber createRandomSeqNum_Long();
-
-
-    /// get type information
-    bool isShortSeqNum() const;
-    bool isLongSeqNum() const;
-    bool isDisabled() const;
-    bool isValid() const;
-
-    
-    /// operators
-    void increment();
-    
-    /// NOTE: this is also Â»trueÂ« if the long seq_num matches the short seq_num
-    bool operator== (const SequenceNumber& rhs) const;
-    
-    /// NOTE: return value is only meaningful if Â»isValid() == trueÂ« for both values
-    bool operator< (const SequenceNumber& rhs) const;
-
-    bool isSuccessor(const SequenceNumber& rhs);
-    bool isPredecessor(const SequenceNumber& rhs);
-    
-    
-    /// getter
-    uint32_t getShortSeqNum() const;
-    uint64_t getLongSeqNum() const;
-
-    
-    /// to string
-    friend std::ostream& operator<< (std::ostream& stream, const SequenceNumber& rhs);
-    
-private:
-    uint32_t seqnum_32;
-    uint64_t seqnum_64;
-
-    /// static random_number_generator
-    static boost::mt19937 rng_32bit;
-    static boost::uniform_int<uint32_t> seqnum_distribution_32bit;
-    
-    // XXX NOTE: on later boost versions these are:
-    //   boost::random::mt19937
-    //   boost::random::uniform_int_distribution<>
-        
-    // NOTE: since the mt19937_64 is not available in this boost version, we 
-    //   need an addition distribution
-    static boost::uniform_int<uint32_t> distribution_full32bit;
-};
-
-
-}} // [namespace ariba::overlay]
-
-#endif // SEQUENCENUMBER_H
Index: urce/ariba/overlay/messages/CMakeLists.txt
===================================================================
--- /source/ariba/overlay/messages/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,49 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    JoinReply.h
-    JoinRequest.h
-    OverlayMsg.h
-    )
-
-add_sources(
-    JoinReply.cpp
-    JoinRequest.cpp
-    OverlayMsg.cpp
-    )
Index: /source/ariba/overlay/messages/JoinReply.cpp
===================================================================
--- /source/ariba/overlay/messages/JoinReply.cpp	(revision 12775)
+++ /source/ariba/overlay/messages/JoinReply.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "JoinReply.h"
@@ -44,7 +44,6 @@
 vsznDefault(JoinReply);
 
-JoinReply::JoinReply(const SpoVNetID _spovnetid, const OverlayParameterSet _param, bool _joinAllowed)
-	: spovnetid( _spovnetid ), param( _param ), joinAllowed( _joinAllowed )
-{
+JoinReply::JoinReply(const SpoVNetID _spovnetid, const OverlayParameterSet _param, bool _joinAllowed, const EndpointDescriptor _bootstrapEp)
+	: spovnetid( _spovnetid ), param( _param ), joinAllowed( _joinAllowed ), bootstrapEp( _bootstrapEp ){
 }
 
@@ -65,7 +64,7 @@
 }
 
-//const EndpointDescriptor& JoinReply::getBootstrapEndpoint(){
-//	return bootstrapEp;
-//}
+const EndpointDescriptor& JoinReply::getBootstrapEndpoint(){
+	return bootstrapEp;
+}
 
 }} // ariba::overlay
Index: /source/ariba/overlay/messages/JoinReply.h
===================================================================
--- /source/ariba/overlay/messages/JoinReply.h	(revision 12775)
+++ /source/ariba/overlay/messages/JoinReply.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,16 +35,15 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef JOIN_REPLY_H__
 #define JOIN_REPLY_H__
 
-//#include "ariba/utility/messages.h"
-#include "ariba/utility/messages/Message.h"
+#include "ariba/utility/messages.h"
 #include "ariba/utility/serialization.h"
 #include "ariba/utility/types/SpoVNetID.h"
 #include "ariba/utility/types/NodeID.h"
 #include "ariba/utility/types/OverlayParameterSet.h"
-//#include "ariba/communication/EndpointDescriptor.h"
+#include "ariba/communication/EndpointDescriptor.h"
 
 using ariba::utility::OverlayParameterSet;
@@ -52,5 +51,5 @@
 using ariba::utility::SpoVNetID;
 using ariba::utility::NodeID;
-//using ariba::communication::EndpointDescriptor;
+using ariba::communication::EndpointDescriptor;
 
 namespace ariba {
@@ -65,5 +64,5 @@
 	OverlayParameterSet param; //< overlay parameters
 	bool joinAllowed; //< join successfull or access denied
-//	EndpointDescriptor bootstrapEp; //< the endpoint for bootstrapping the overlay interface
+	EndpointDescriptor bootstrapEp; //< the endpoint for bootstrapping the overlay interface
 
 public:
@@ -71,6 +70,6 @@
 		const SpoVNetID _spovnetid = SpoVNetID::UNSPECIFIED,
 		const OverlayParameterSet _param = OverlayParameterSet::DEFAULT,
-		bool _joinAllowed = false  /*,
-		const EndpointDescriptor _bootstrapEp = EndpointDescriptor::UNSPECIFIED()*/
+		bool _joinAllowed = false,
+		const EndpointDescriptor _bootstrapEp = EndpointDescriptor::UNSPECIFIED
 	);
 
@@ -80,5 +79,5 @@
 	const OverlayParameterSet& getParam();
 	bool getJoinAllowed();
-//	const EndpointDescriptor& getBootstrapEndpoint();
+	const EndpointDescriptor& getBootstrapEndpoint();
 };
 
@@ -86,9 +85,5 @@
 
 sznBeginDefault( ariba::overlay::JoinReply, X ) {
-	uint8_t ja = joinAllowed;
-	X && &spovnetid && param;
-//	X && bootstrapEp;
-	X && ja;
-	if (X.isDeserializer()) joinAllowed = ja;
+	X && &spovnetid && param && bootstrapEp && joinAllowed && cI(0,7);
 } sznEnd();
 
Index: /source/ariba/overlay/messages/JoinRequest.cpp
===================================================================
--- /source/ariba/overlay/messages/JoinRequest.cpp	(revision 12775)
+++ /source/ariba/overlay/messages/JoinRequest.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "JoinRequest.h"
Index: /source/ariba/overlay/messages/JoinRequest.h
===================================================================
--- /source/ariba/overlay/messages/JoinRequest.h	(revision 12775)
+++ /source/ariba/overlay/messages/JoinRequest.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef JOIN_REQUEST_H__
Index: /source/ariba/overlay/messages/OverlayMsg.cpp
===================================================================
--- /source/ariba/overlay/messages/OverlayMsg.cpp	(revision 12775)
+++ /source/ariba/overlay/messages/OverlayMsg.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "OverlayMsg.h"
@@ -44,6 +44,30 @@
 vsznDefault(OverlayMsg);
 
+OverlayMsg::OverlayMsg(OverlayMessageType _type, const ServiceID _service, const NodeID _sourceNode)
+	: type( (uint8_t)_type), service( _service ), sourceNode( _sourceNode ) {
+}
+
+OverlayMsg::OverlayMsg(OverlayMessageType _type, const NodeID _sourceNode)
+	: type( (uint8_t)_type), service( ServiceID::UNSPECIFIED ), sourceNode( _sourceNode ){
+}
+
 OverlayMsg::~OverlayMsg(){
 }
 
+OverlayMsg::OverlayMessageType OverlayMsg::getType(){
+	return (OverlayMessageType)type;
+}
+
+const ServiceID& OverlayMsg::getService(){
+	return service;
+}
+
+bool OverlayMsg::isType(OverlayMessageType _type){
+	return (OverlayMessageType)type == _type;
+}
+
+const NodeID& OverlayMsg::getSourceNode(){
+	return sourceNode;
+}
+
 }} // ariba::overlay
Index: /source/ariba/overlay/messages/OverlayMsg.h
===================================================================
--- /source/ariba/overlay/messages/OverlayMsg.h	(revision 12775)
+++ /source/ariba/overlay/messages/OverlayMsg.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef OVERLAY_MSG_H__
@@ -41,5 +41,4 @@
 
 #include <boost/cstdint.hpp>
-
 #include "ariba/utility/messages.h"
 #include "ariba/utility/serialization.h"
@@ -47,9 +46,4 @@
 #include "ariba/utility/types/NodeID.h"
 #include "ariba/utility/types/LinkID.h"
-// #include <ariba/utility/misc/sha1.h>
-#include "ariba/overlay/SequenceNumber.h"
-
-namespace ariba {
-namespace overlay {
 
 using ariba::utility::LinkID;
@@ -57,382 +51,51 @@
 using ariba::utility::ServiceID;
 using ariba::utility::Message;
-//using ariba::communication::EndpointDescriptor;
+
+namespace ariba {
+namespace overlay {
+
 using_serialization;
 
-/**
- * A general purpose overlay message that is used to exchange messages
- * between nodes.
- *
- * @author Sebastian Mies <mies@tm.uka.de>, Mario Hock
- */
-class OverlayMsg: public Message { VSERIALIZEABLE;
+class OverlayMsg : public Message {
+	VSERIALIZEABLE;
 public:
-	/// message types, is: uint8_t
-	enum type_ { // is: uint8_t
-		typeInvalid     = 0x00, ///< invalid, unspecified type
 
-		// data transfer
-		maskTransfer    = 0x10, ///< bit mask for transfer messages
-		typeData        = 0x11, ///< message contains data for higher layers
-		typeMessageLost = 0x12, ///< message contains info about a dropped message
+	typedef enum _OverlayMessageType {
+		OverlayMessageTypeInvalid     = 0, // invalid type (no encapsulated messages)
+		OverlayMessageTypeData        = 1, // message contains data for higher layers
+		OverlayMessageTypeJoinRequest = 2, // spovnet join request
+		OverlayMessageTypeJoinReply   = 3, // spovnet join reply
+		OverlayMessageTypeUpdate      = 4, // update message for link association
+		OverlayMessageTypeBye         = 5, // spovnet leave (no encapsulated messages)
+	} OverlayMessageType;
 
-		// join signaling
-		maskJoin        = 0x20, ///< bit mask for join messages
-		typeJoinRequest = 0x21, ///< join request
-		typeJoinReply   = 0x22, ///< join reply
+	OverlayMsg(
+		OverlayMessageType _type       = OverlayMessageTypeInvalid,
+		const ServiceID    _service    = ServiceID::UNSPECIFIED,
+		const NodeID       _sourceNode = NodeID::UNSPECIFIED
+	);
 
-		// link messages
-		maskLink        = 0x30, ///< bit mask for link messages
-		typeLinkRequest = 0x31, ///< request a new link
-		typeLinkReply   = 0x32, ///< link request reply
-		typeLinkUpdate  = 0x33, ///< update message for link association
-		typeLinkDirect  = 0x34, ///< direct connection has been established
-		typeKeepAlive   = 0x35, ///< keep-alive message
-		typeKeepAliveReply   = 0x36, ///< keep-alive message (replay)
-		typeLinkClose   = 0x37,
+	OverlayMsg(
+		OverlayMessageType _type,
+		const NodeID       _sourceNode
+	);
 
-		/// DHT routed messages
-		/// @deprecated because the DHT has been moved into a separate service
-		maskDHT			= 0x40, ///< bit mask for dht messages
-		typeDHTPut      = 0x41, ///< DHT put operation
-		typeDHTGet      = 0x42, ///< DHT get operation
-		typeDHTRemove   = 0x43, ///< DHT remove operation
+	virtual ~OverlayMsg();
 
-		/// DHT response messages
-		/// @deprecated because the DHT has been moved into a separate service
-		maskDHTResponse = 0x50, ///< bit mask for dht responses
-		typeDHTData     = 0x51, ///< DHT get data
-        
-        /// misc message types
-        typePing        = 0x44,
-        typePong        = 0x45,
-
-		// topology signaling
-		typeSignalingStart = 0x80, ///< start of the signaling types
-		typeSignalingEnd = 0xFF    ///< end of the signaling types
-	};
-    
-    /// message flags (uint8_t)
-    enum flags_
-    {
-        flagRelayed         = 1 << 0,
-        flagRegisterRelay   = 1 << 1,
-        flagRouteRecord     = 1 << 2,
-        flagSeqNum1         = 1 << 3,
-        flagSeqNum2         = 1 << 4,
-        flagAutoLink        = 1 << 5,
-        flagLinkMessage     = 1 << 6,
-        flagHasMoreFlags    = 1 << 7
-    };
-
-	/// default constructor
-	OverlayMsg(
-		uint8_t type = typeInvalid,
-		const ServiceID& _service      = ServiceID::UNSPECIFIED,
-		const NodeID& _sourceNode      = NodeID::UNSPECIFIED,
-		const NodeID& _destinationNode = NodeID::UNSPECIFIED,
-		const LinkID& _sourceLink      = LinkID::UNSPECIFIED,
-		const LinkID& _destinationLink = LinkID::UNSPECIFIED )
-    :	type(type), flags(0), extended_flags(0), hops(0), ttl(10), priority(0),
-		service(_service),
-		sourceNode(_sourceNode), destinationNode(_destinationNode),
-		sourceLink(_sourceLink), destinationLink(_destinationLink),
-		routeRecord() {
-		if (!_sourceLink.isUnspecified() || !_destinationLink.isUnspecified())
-			setLinkMessage(true);
-	}
-
-	// copy constructor
-	OverlayMsg(const OverlayMsg& rhs)
-    :	type(rhs.type), flags(rhs.flags), extended_flags(rhs.extended_flags), 
-        hops(rhs.hops), ttl(rhs.ttl),
-		priority(rhs.priority), service(rhs.service),
-		sourceNode(rhs.sourceNode), destinationNode(rhs.destinationNode),
-		sourceLink(rhs.sourceLink), destinationLink(rhs.destinationLink),
-		routeRecord(rhs.routeRecord) {
-	}
-
-	/// destructor
-	~OverlayMsg();
-
-	/// type -------------------------------------------------------------------
-
-	type_ getType() const {
-		return (type_) type;
-	}
-
-	void setType( type_ type ) {
-		this->type = type;
-	}
-
-	bool hasTypeMask( type_ mask ) const {
-		return (type & (uint8_t)mask) == (uint8_t)mask;
-	}
-
-	/// priority ------------------------------------------------------------------
-	
-	uint8_t getPriority() const {
-	    return priority;
-	}
-	
-	void setPriority(uint8_t priority) {
-	    this->priority = priority;
-	}
-	
-	/// flags ------------------------------------------------------------------
-
-	bool isRelayed() const {
-        return (flags & flagRelayed)!=0;
-	}
-
-	void setRelayed( bool relayed = true ) {
-        if (relayed) flags |= flagRelayed; else flags &= ~flagRelayed;
-	}
-
-	bool isRegisterRelay() const {
-		return (flags & flagRegisterRelay)!=0;
-	}
-
-	void setRegisterRelay( bool relayed = true ) {
-        if (relayed) flags |= flagRegisterRelay; else flags &= ~flagRegisterRelay;
-	}
-
-	bool isRouteRecord() const {
-		return (flags & flagRouteRecord)!=0;
-	}
-
-	void setRouteRecord( bool route_record = true ) {
-        if (route_record) flags |= flagRouteRecord; else flags &= ~flagRouteRecord;
-	}
-
-	bool isAutoLink() const {
-        return (flags & flagAutoLink) == flagAutoLink;
-	}
-
-	void setAutoLink(bool auto_link = true ) {
-        if (auto_link) flags |= flagAutoLink; else flags &= ~flagAutoLink;
-	}
-
-	bool isLinkMessage() const {
-		return (flags & flagLinkMessage)!=0;
-	}
-
-	void setLinkMessage(bool link_info = true ) {
-        if (link_info) flags |= flagLinkMessage; else flags &= ~flagLinkMessage;
-	}
-	
-	bool hasExtendedFlags() const {
-        return (flags & flagHasMoreFlags) == flagHasMoreFlags;
-    }
-
-	/// number of hops and time to live ----------------------------------------
-
-	uint8_t getNumHops() const {
-		return hops;
-	}
-
-	void setNumHops( uint8_t hops ) {
-		this->hops = hops;
-	}
-
-	uint8_t increaseNumHops() {
-		hops++;
-		return hops;
-	}
-
-	uint8_t getTimeToLive() const {
-		return ttl;
-	}
-
-	void setTimeToLive( uint8_t ttl ) {
-		this->ttl = ttl;
-	}
-
-	/// addresses and links ----------------------------------------------------
-
-	const ServiceID& getService() const {
-		return service;
-	}
-
-	void setService( const ServiceID& service ) {
-		this->service = service;
-	}
-
-	const NodeID& getSourceNode() const {
-		return sourceNode;
-	}
-
-	void setSourceNode( const NodeID& node ) {
-		this->sourceNode = node;
-	}
-
-	const NodeID& getDestinationNode() const {
-		return destinationNode;
-	}
-
-	void setDestinationNode( const NodeID& node ) {
-		this->destinationNode = node;
-	}
-
-	const LinkID& getSourceLink() const {
-		return sourceLink;
-	}
-
-	void setSourceLink( const LinkID& link ) {
-		this->sourceLink = link;
-		setLinkMessage();
-	}
-
-	const LinkID& getDestinationLink() const {
-		return destinationLink;
-	}
-
-	void setDestinationLink( const LinkID& link ) {
-		this->destinationLink = link;
-		setLinkMessage();
-	}
-
-	/// swaps source and destination
-	void swapRoles() {
-		NodeID dummyNode = sourceNode;
-		sourceNode = destinationNode;
-		destinationNode = dummyNode;
-		LinkID dummyLink = sourceLink;
-		sourceLink = destinationLink;
-		destinationLink = dummyLink;
-		hops = 0;
-		routeRecord.clear();
-	}
-
-	const vector<NodeID> getRouteRecord() const {
-		return routeRecord;
-	}
-
-	void addRouteRecord( const NodeID& node ) {
-		if (isRouteRecord())
-			routeRecord.push_back(node);
-	}
-	
-	/// sequence numbers
-	bool hasShortSeqNum() const
-    {
-        return (flags & (flagSeqNum1 | flagSeqNum2)) == flagSeqNum1;
-    }
-    
-    bool hasLongSeqNum() const
-    {
-        return (flags & (flagSeqNum1 | flagSeqNum2)) == flagSeqNum2;
-    }
-    
-    void setSeqNum(const SequenceNumber& sequence_number)
-    {
-        this->seqnum = sequence_number;
-        
-        // short seqnum
-        if ( sequence_number.isShortSeqNum() )
-        {
-            flags |= flagSeqNum1;
-            flags &= ~flagSeqNum2;
-        }
-        // longseqnum
-        else if ( sequence_number.isShortSeqNum() )
-        {
-            flags &= ~flagSeqNum1;
-            flags |= flagSeqNum2;
-        }
-        // no seqnum
-        else
-        {
-            flags &= ~flagSeqNum1;
-            flags &= ~flagSeqNum2;
-        }
-    }
-    
-    const SequenceNumber& getSeqNum() const
-    {
-        return seqnum;
-    }
-    
+	bool isType(OverlayMessageType _type);
+	OverlayMessageType getType();
+	const ServiceID& getService();
+	const NodeID& getSourceNode();
 
 private:
-	uint8_t type, flags, extended_flags, hops, ttl, priority;
+	uint8_t type;
 	ServiceID service;
 	NodeID sourceNode;
-	NodeID destinationNode;
-	LinkID sourceLink;
-	LinkID destinationLink;
-//	EndpointDescriptor sourceEndpoint;
-	vector<NodeID> routeRecord;
-    SequenceNumber seqnum;
 };
 
 }} // ariba::overlay
 
-/// serialization
-sznBeginDefault( ariba::overlay::OverlayMsg, X ){
-	// header
-	X && type && flags;
-    
-    if ( hasExtendedFlags() )
-        X && extended_flags;
-    
-    X && hops && ttl;
-
-	// addresses
-	X && &service && &sourceNode && &destinationNode;
-	
-	// priority
-	X && priority;
-
-	// message is associated with a end-to-end link
-	if (isLinkMessage())
-		X && &sourceLink && &destinationLink;
-
-    
-    /* seqnum */
-    // serialize
-    if ( X.isSerializer() )
-    {
-        if ( hasShortSeqNum() )
-        {
-            uint32_t short_seqnum;
-            short_seqnum = seqnum.getShortSeqNum();
-            X && short_seqnum;
-        }
-        if ( hasLongSeqNum() )
-        {
-            uint64_t long_seqnum;
-            long_seqnum = seqnum.getLongSeqNum();
-            X && long_seqnum;
-        }
-    }
-    // deserialize
-    else
-    {
-        if ( hasShortSeqNum() )
-        {
-            uint32_t short_seqnum;
-            X && short_seqnum;
-            seqnum = ariba::overlay::SequenceNumber(short_seqnum);
-        }
-        if ( hasLongSeqNum() )
-        {
-            uint64_t long_seqnum;
-            X && long_seqnum;
-            seqnum = ariba::overlay::SequenceNumber(long_seqnum);
-        }        
-    }
-    
-    
-	// message should record its route
-	if (isRouteRecord()) {
-		uint8_t size = routeRecord.size();
-		X && size;
-		if (X.isDeserializer()) routeRecord.resize(size);
-		for (uint8_t i=0;i<size; i++) X && &routeRecord[i];
-	}
-
-	// payload
-//	X && Payload();
+sznBeginDefault( ariba::overlay::OverlayMsg, X ) {
+	X && type && &service && &sourceNode && Payload();
 } sznEnd();
 
Index: urce/ariba/overlay/modules/CMakeLists.txt
===================================================================
--- /source/ariba/overlay/modules/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,51 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_sources(
-    OverlayFactory.h
-    OverlayInterface.h
-    OverlayStructureEvents.h
-    )
-
-add_sources(
-    OverlayFactory.cpp
-    OverlayInterface.cpp
-    OverlayStructureEvents.cpp
-    )
-
-add_subdir_sources(chord onehop)
Index: /source/ariba/overlay/modules/OverlayFactory.cpp
===================================================================
--- /source/ariba/overlay/modules/OverlayFactory.cpp	(revision 12775)
+++ /source/ariba/overlay/modules/OverlayFactory.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,11 +35,7 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "OverlayFactory.h"
-
-// structured overlays
-#include "chord/Chord.h"
-//#include "onehop/OneHop.h"  //DEPRECATED
 
 namespace ariba {
@@ -53,21 +49,17 @@
 
 	switch( param.getOverlayStructure() ){
+		case OverlayParameterSet::OverlayStructureOneHop:
+			return new OneHop( baseoverlay, nodeid, routeReceiver );
 
 		case OverlayParameterSet::OverlayStructureChord:
-			return new Chord( baseoverlay, nodeid, routeReceiver, param );
+			return NULL;
 
-//		case OverlayParameterSet::OverlayStructureOneHop:
-//			return new OneHop( baseoverlay, nodeid, routeReceiver, param );
+		case OverlayParameterSet::OverlayStructureKademlia:
+			return NULL;
 
 		default:
-		    // NEVER return "NULL"
-		    assert(false);
-		    throw 42;
 			return NULL;
 	}
 
-	// NEVER return "NULL"
-	assert(false);
-	throw 42;
 	return NULL;
 }
Index: /source/ariba/overlay/modules/OverlayFactory.h
===================================================================
--- /source/ariba/overlay/modules/OverlayFactory.h	(revision 12775)
+++ /source/ariba/overlay/modules/OverlayFactory.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __OVERLAY_FACTORY_H
@@ -41,8 +41,10 @@
 
 #include "ariba/utility/types/OverlayParameterSet.h"
-
-#include "OverlayInterface.h"
+#include "ariba/overlay/modules/OverlayInterface.h"
+#include "ariba/overlay/modules/onehop/OneHop.h"
 
 using ariba::utility::OverlayParameterSet;
+using ariba::overlay::OverlayInterface;
+using ariba::overlay::OneHop;
 
 namespace ariba {
Index: /source/ariba/overlay/modules/OverlayInterface.cpp
===================================================================
--- /source/ariba/overlay/modules/OverlayInterface.cpp	(revision 12775)
+++ /source/ariba/overlay/modules/OverlayInterface.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,61 +35,26 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "OverlayInterface.h"
 #include "ariba/overlay/BaseOverlay.h"
 
-// namespace ariba::overlay
 namespace ariba {
 namespace overlay {
 
-ServiceID OverlayInterface::OVERLAY_SERVICE_ID(0);
+ServiceID OverlayInterface::OVERLAY_SERVICE_ID (0);
 
-OverlayInterface::OverlayInterface(BaseOverlay& _baseoverlay, const NodeID& _nodeid,
-			OverlayStructureEvents* _eventsReceiver, OverlayParameterSet _parameters) :
-	baseoverlay(_baseoverlay), nodeid(_nodeid),
-	eventsReceiver(_eventsReceiver), parameters(_parameters) {
+OverlayInterface::OverlayInterface(
+	BaseOverlay& _baseoverlay,
+	const NodeID& _nodeid,
+	OverlayStructureEvents* _eventsReceiver )
+	: 	baseoverlay( _baseoverlay ),
+		nodeid( _nodeid ),
+		eventsReceiver( _eventsReceiver ) {
 
-	_baseoverlay.bind(this, OVERLAY_SERVICE_ID);
+	ServiceInterface::initialize( &_baseoverlay, OVERLAY_SERVICE_ID );
 }
 
-OverlayInterface::~OverlayInterface() {
-	baseoverlay.unbind(this, OVERLAY_SERVICE_ID);
-}
-
-void OverlayInterface::onLinkUp(const LinkID& lnk, const NodeID& remote) {
-}
-
-void OverlayInterface::onLinkDown(const LinkID& lnk, const NodeID& remote) {
-}
-
-void OverlayInterface::onLinkChanged(const LinkID& lnk, const NodeID& remote) {
-}
-
-void OverlayInterface::onLinkFail(const LinkID& lnk, const NodeID& remote) {
-    onLinkDown(lnk, remote);
-}
-
-void OverlayInterface::onLinkQoSChanged(const LinkID& lnk,
-		const NodeID& remote, const LinkProperties& prop) {
-}
-
-bool OverlayInterface::onLinkRequest(const NodeID& remote,
-		const DataMessage& msg) {
-	return true;
-}
-
-void OverlayInterface::onMessage(OverlayMsg* msg,
-        reboost::shared_buffer_t sub_msg,
-        const NodeID& remote,
-		const LinkID& lnk) {
-}
-
-std::string OverlayInterface::debugInformation() const {
-	return "No Information Available.";
-}
-
-const OverlayParameterSet& OverlayInterface::getParameters() const {
-	return parameters;
+OverlayInterface::~OverlayInterface(){
 }
 
Index: /source/ariba/overlay/modules/OverlayInterface.h
===================================================================
--- /source/ariba/overlay/modules/OverlayInterface.h	(revision 12775)
+++ /source/ariba/overlay/modules/OverlayInterface.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,22 +35,20 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __OVERLAY_INTERFACE_H
 #define __OVERLAY_INTERFACE_H
 
-#include "ariba/CommunicationListener.h"
 #include "ariba/communication/EndpointDescriptor.h"
+#include "ariba/interface/ServiceInterface.h"
 #include "ariba/overlay/modules/OverlayStructureEvents.h"
 #include "ariba/utility/types/NodeID.h"
 #include "ariba/utility/types/ServiceID.h"
-#include "ariba/utility/types/OverlayParameterSet.h"
 
-using ariba::CommunicationListener;
 using ariba::communication::EndpointDescriptor;
+using ariba::interface::ServiceInterface;
 using ariba::overlay::OverlayStructureEvents;
 using ariba::utility::NodeID;
 using ariba::utility::ServiceID;
-using ariba::utility::OverlayParameterSet;
 
 namespace ariba {
@@ -59,165 +57,31 @@
 class BaseOverlay;
 
-/**
- * This class declares an interface for an structured overlay.
- */
-class OverlayInterface: public CommunicationListener {
-	friend class BaseOverlay;
+class OverlayInterface : public ServiceInterface {
+public:
+	OverlayInterface(
+		BaseOverlay& _baseoverlay,
+		const NodeID& _nodeid,
+		OverlayStructureEvents* _eventsReceiver
+	);
 
-public:
-	/**
-	 * A node list
-	 */
+	virtual ~OverlayInterface();
+
 	typedef vector<NodeID> NodeList;
 
-	/**
-	 * Constructs a new overlay.
-	 */
-	OverlayInterface( BaseOverlay& _baseoverlay, const NodeID& _nodeid,
-		OverlayStructureEvents* _eventsReceiver, OverlayParameterSet _parameters
-	);
-
-	/**
-	 * Destructs the overlay.
-	 */
-	virtual ~OverlayInterface();
-
-	/**
-	 * Creates the overlay.
-	 */
 	virtual void createOverlay() = 0;
-
-	/**
-	 * Destroys the overlay.
-	 */
 	virtual void deleteOverlay() = 0;
 
-	/**
-	 * Joins the overlay. Starts integration and stabilization of the overlay
-	 * Node.
-	 *
-	 * @param bootstrap The bootstrap end-point descriptor or the default
-	 *    end-point, if this node is the initiator
-	 */
-	virtual void joinOverlay(
-		const EndpointDescriptor& bootstrap = EndpointDescriptor::UNSPECIFIED()) = 0;
-
-	/**
-	 * Leaves the overlay gracefully.
-	 */
+	virtual void joinOverlay( const EndpointDescriptor& bootstrapEp = EndpointDescriptor::UNSPECIFIED) = 0;
 	virtual void leaveOverlay() = 0;
 
-	/**
-	 * Resolves a overlay neighbor.
-	 *
-	 * @param node The node to resolve
-	 * @return Endpoint descriptor of local neighbor or UNSPECIFIED
-	 */
-	virtual const EndpointDescriptor& resolveNode(const NodeID& node) = 0;
+	virtual const EndpointDescriptor& resolveNode( const NodeID& node ) = 0;
+	virtual void routeMessage( const NodeID& destnode, Message* msg ) = 0;
 
-
-	/**
-	 * Returns true if this is the closest node to the given node
-	 * identifier.
-	 *
-	 * @param node The node identifier to compare with
-	 * @return True if this is the closest node to the given node identifier
-	 */
-	virtual bool isClosestNodeTo( const NodeID& node ) = 0;
-
-	/**
-	 * Returns the nodes known to this overlay.
-	 *
-	 * Usually this are the direct neighbors in the overlay structure.
-	 * For instance, Chord would return his predecessor, successor and finger
-	 * nodes. On the other hand OneHop would likely return all participating
-	 * nodes in the overlay.
-	 *
-	 * @return The list of all known nodes
-	 */
-	virtual NodeList getKnownNodes(bool deep = true) const = 0;
-
-	/**
-	 * Returns the link id of the next hop a route message would take.
-	 *
-	 * @param id The destination node id
-	 * @return The link id of the next hop
-	 */
-	virtual const LinkID& getNextLinkId( const NodeID& id ) const = 0;
-
-    /**
-     * Returns link ids of possible next hops a route message could take,
-     * sorted by "quality" (e.g. overlay-distance).
-     *
-     * The Â»numÂ« parameter can be used to specify the desired number of elements 
-     * in the returned vector. This is intendet for optimizations. The
-     * implementation may choose to return a different number of elements than
-     * requested.
-     * 
-     * NOTE: The returned vector may contain Â»unspecifiedÂ« links. These refer to 
-     * to the own node. (e.g. If there's no closer node, the top element in the 
-     * returned vector is unsoecified.)
-     * 
-     * @param id The destination node id
-     * @param num The desired number of elements in the returned vector.
-     *            (0 means Â»not specified/max)Â«
-     * @return A sorted vector of link ids to possible next hops.
-     */
-    virtual std::vector<const LinkID*> getSortedLinkIdsTowardsNode(
-        const NodeID& id, int num = 0 ) const = 0;
-
-	/**
-	 * Returns the NodeID of the next hop a route message would take.
-	 * 
-	 * @param id The destination node id
-	 * @return The node id of the next hop
-	 */
-	virtual const NodeID& getNextNodeId( const NodeID& id ) const = 0;
-
-	//--- functions from CommunicationListener that we _can_ use as overlay ---
-
-	/// @see CommunicationListener
-	virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
-
-	/// @see CommunicationListener
-	virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
-
-	/// @see CommunicationListener
-	virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote);
-
-	/// @see CommunicationListener
-	virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
-
-	/// @see CommunicationListener
-	virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote,
-			const LinkProperties& prop);
-
-	/// @see CommunicationListener
-	virtual bool onLinkRequest(const NodeID& remote, const DataMessage& msg);
-
-	/// @see CommunicationListener
-	virtual void onMessage(OverlayMsg* msg,
-	        reboost::shared_buffer_t sub_msg,
-	        const NodeID& remote,
-			const LinkID& lnk = LinkID::UNSPECIFIED);
-
-	const OverlayParameterSet& getParameters() const;
-
-	virtual std::string debugInformation() const;
+	virtual NodeList getKnownNodes() const = 0;
 
 protected:
-	/// Reference to an active base overlay
 	BaseOverlay& baseoverlay;
-
-	/// The node identifier to use with this overlay
 	const NodeID& nodeid;
-
-	/// The listener used to inform about overlay structure changes
 	OverlayStructureEvents* eventsReceiver;
-
-	/// The parameters of the overlay structure
-	OverlayParameterSet parameters;
-
-	/// The service identifer of this overlay
 	static ServiceID OVERLAY_SERVICE_ID;
 };
Index: /source/ariba/overlay/modules/OverlayStructureEvents.cpp
===================================================================
--- /source/ariba/overlay/modules/OverlayStructureEvents.cpp	(revision 12775)
+++ /source/ariba/overlay/modules/OverlayStructureEvents.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 #include "OverlayStructureEvents.h"
 
@@ -47,5 +47,5 @@
 }
 
-void OverlayStructureEvents::incomingRouteMessage(Message* msg, const LinkID& link, const NodeID& source ){
+void OverlayStructureEvents::incomingRouteMessage(Message* msg){
 }
 
Index: /source/ariba/overlay/modules/OverlayStructureEvents.h
===================================================================
--- /source/ariba/overlay/modules/OverlayStructureEvents.h	(revision 12775)
+++ /source/ariba/overlay/modules/OverlayStructureEvents.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __OVERLAY_STRUCTURE_EVENTS_H
@@ -41,9 +41,7 @@
 
 #include "ariba/utility/types/NodeID.h"
-#include "ariba/utility/types/LinkID.h"
-#include "ariba/utility/messages/Message.h"
+#include "ariba/utility/messages.h"
 
 using ariba::utility::NodeID;
-using ariba::utility::LinkID;
 using ariba::utility::Message;
 
@@ -52,10 +50,9 @@
 
 class OverlayInterface;
-//class OneHop;
+class OneHop;
 
 class OverlayStructureEvents {
 	friend class ariba::overlay::OverlayInterface;
-//	friend class ariba::overlay::OneHop;
-
+	friend class ariba::overlay::OneHop;
 public:
 	OverlayStructureEvents();
@@ -63,5 +60,5 @@
 
 protected:
-	virtual void incomingRouteMessage( Message* msg, const LinkID& link = LinkID::UNSPECIFIED, const NodeID& source = NodeID::UNSPECIFIED );
+	virtual void incomingRouteMessage( Message* msg );
 	virtual void onNodeJoin( const NodeID& node );
 };
Index: urce/ariba/overlay/modules/chord/CMakeLists.txt
===================================================================
--- /source/ariba/overlay/modules/chord/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,43 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(Chord.h)
-
-add_sources(Chord.cpp)
-
-add_subdir_sources(detail messages)
Index: /source/ariba/overlay/modules/chord/Chord.cpp
===================================================================
--- /source/ariba/overlay/modules/chord/Chord.cpp	(revision 12775)
+++ /source/ariba/overlay/modules/chord/Chord.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,222 +35,23 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
-
-#include "ariba/overlay/BaseOverlay.h"
-#include "ariba/overlay/messages/OverlayMsg.h"
+// [Licence]
 
 #include "Chord.h"
-#include "detail/chord_routing_table.hpp"
-
-//#include "messages/Discovery.h"  // XXX DEPRECATED
 
 namespace ariba {
 namespace overlay {
 
-enum signalMessageTypes {
-	typeDiscovery = OverlayMsg::typeSignalingStart + 0x01,
-	typeLeave = OverlayMsg::typeSignalingStart + 0x02,
-};
-
-typedef chord_routing_table::item route_item;
-
-using ariba::transport::system_priority;
-
-use_logging_cpp( Chord );
-
-
-////// Messages
-struct DiscoveryMessage
-{
-    /**
-     * DiscoveryMessage
-     * - type
-     * - data
-     * - Endpoint
-     */
-
-    // type enum
-    enum type_ {
-        invalid = 0,
-        normal = 1,
-        successor = 2,
-        predecessor = 3
-    };
-
-    
-    // data
-    uint8_t type;
-    uint8_t ttl;
-    EndpointDescriptor endpoint;
-
-    // serialize
-    reboost::message_t serialize()
-    {
-        // serialize endpoint
-        reboost::message_t msg = endpoint.serialize();
-        
-        // serialize type and ttl
-        uint8_t* buff1 = msg.push_front(2*sizeof(uint8_t)).mutable_data();
-        buff1[0] = type;
-        buff1[1] = ttl;
-        
-        return msg;
-    }
-    
-    //deserialize
-    reboost::shared_buffer_t deserialize(reboost::shared_buffer_t buff)
-    {
-        // deserialize type and ttl
-        const uint8_t* bytes = buff.data();
-        type = bytes[0];
-        ttl = bytes[1];
-        
-        // deserialize endpoint
-        return endpoint.deserialize(buff(2*sizeof(uint8_t)));
-    }
-};
-
+use_logging_cpp( OneHop );
 
 Chord::Chord(BaseOverlay& _baseoverlay, const NodeID& _nodeid,
-		OverlayStructureEvents* _eventsReceiver, const OverlayParameterSet& param) :
-	OverlayInterface(_baseoverlay, _nodeid, _eventsReceiver, param) {
-
-	// create routing table
-	this->table = new chord_routing_table(_nodeid, 4);
-	orphan_removal_counter = 0;
-	discovery_count = 0;
-	stabilize_counter = 0;
-	stabilize_finger = 0;
+		OverlayStructureEvents* _eventsReceiver) :
+	OverlayInterface( _baseoverlay, _nodeid, _eventsReceiver ) {
 }
 
 Chord::~Chord() {
-
-	// delete routing table
-	delete table;
 }
 
-/// helper: sets up a link using the base overlay
-LinkID Chord::setup(const EndpointDescriptor& endpoint, const NodeID& remote ) {
+void Chord::createOverlay() {
 
-	// check if we already have a connection
-	for (size_t i=0; i<table->size(); i++)
-		if ((*table)[i]->ref_count > 0 && (*table)[i]->id == remote && !((*table)[i]->info.isUnspecified()))
-			return LinkID::UNSPECIFIED;
-
-	// check if we are already trying to establish a link
-	for (size_t i=0; i<pending.size(); i++)
-		if ( pending[i] == remote ) {
-			logging_debug("Already trying to establish a link to node "
-				<< remote.toString() );
-			return LinkID::UNSPECIFIED;
-		}
-
-	// adding node to list of pending connections
-	pending.push_back( remote );
-
-	logging_info("Request to setup link to " << endpoint.toString() );
-
-	// establish link via base overlay
-	return baseoverlay.establishLink( endpoint, remote,
-			OverlayInterface::OVERLAY_SERVICE_ID );
-}
-
-/// helper: sends a message using the "base overlay"
-void Chord::send( OverlayMsg* msg, const LinkID& link ) {
-	if (link.isUnspecified())
-        return;
-    
-    try
-    {
-        baseoverlay.send_link( msg, link, system_priority::OVERLAY );
-    }
-    catch ( message_not_sent& e )
-    {
-        logging_warn("Chord: Could not send message over link " << link
-                << ": " << e.what());
-    }
-}
-
-void Chord::send_node( OverlayMsg* message, const NodeID& remote )
-{
-    try
-    {
-        baseoverlay.send( message, remote, system_priority::OVERLAY );
-    }
-    catch ( message_not_sent& e )
-    {
-        logging_warn("Chord: Could not send message to " << remote
-                << ": " << e.what());
-    }
-}
-
-/// sends a discovery message
-void Chord::send_discovery_to(const NodeID& remote, int ttl) {
-	LinkID link = getNextLinkId(remote);
-	if ( remote == nodeid || link.isUnspecified()) return;
-	if ( table->size() == 0 ) return;
-	ttl = 2;
-
-	OverlayMsg msg( typeDiscovery );
-	msg.setRegisterRelay(true);
-	
-	// create DiscoveryMessage
-	DiscoveryMessage dmsg;
-	dmsg.type = DiscoveryMessage::normal;
-	dmsg.ttl = ttl;
-	dmsg.endpoint = baseoverlay.getEndpointDescriptor();
-
-	msg.set_payload_message(dmsg.serialize());
-
-	// send to node
-    try
-    {
-        baseoverlay.send_node( &msg, remote, system_priority::OVERLAY );
-    }
-    catch ( message_not_sent& e )
-    {
-        logging_warn("Chord: Could not send message to " << remote
-                << ": " << e.what());
-    }
-}
-
-void Chord::discover_neighbors( const LinkID& link ) {
-	uint8_t ttl = 1;
-	
-    // FIXME try-catch for the send operations
-    
-    // create DiscoveryMessage
-    DiscoveryMessage dmsg;
-    dmsg.ttl = ttl;
-    dmsg.endpoint = baseoverlay.getEndpointDescriptor();
-	{
-		// send predecessor discovery
-		OverlayMsg msg( typeDiscovery );
-		msg.setRegisterRelay(true);
-
-		// set type
-	    dmsg.type = DiscoveryMessage::predecessor;
-
-	    // send
-	    msg.set_payload_message(dmsg.serialize());
-		send(&msg, link);
-	}
-	{
-		// send successor discovery
-		OverlayMsg msg( typeDiscovery );
-//		msg.setSourceEndpoint( baseoverlay.getEndpointDescriptor() );  // XXX this was redundand, wasn't it?
-		msg.setRegisterRelay(true);
-
-		// set type
-        dmsg.type = DiscoveryMessage::successor;
-
-        // send
-        msg.set_payload_message(dmsg.serialize());
-		send(&msg, link);
-	}
-}
-
-
-void Chord::createOverlay() {
 }
 
@@ -259,437 +60,26 @@
 }
 
-void Chord::joinOverlay(const EndpointDescriptor& boot) {
-	logging_info( "joining Chord overlay structure through end-point " <<
-			(boot.isUnspecified() ? "local" : boot.toString()) );
+void Chord::joinOverlay(
+	const EndpointDescriptor& bootstrapEp = EndpointDescriptor::UNSPECIFIED
+) {
 
-	// initiator? no->setup first link
-	if (!boot.isUnspecified())
-		bootstrapLinks.push_back( setup(boot) );
-
-	// timer for stabilization management
-//	Timer::setInterval(1000);  // TODO find an appropriate interval!
-	Timer::setInterval(10000);  // XXX testing...
-	Timer::start();
 }
 
 void Chord::leaveOverlay() {
-	Timer::stop();
-	for (size_t i = 0; i < table->size(); i++) {
-		route_item* it = (*table)[i];
-		OverlayMsg msg( typeLeave );
-		send( &msg, it->info );
-	}
+
 }
 
-/// @see OverlayInterface.h
-const EndpointDescriptor& Chord::resolveNode(const NodeID& node) {
-	const route_item* item = table->get(node);
-	if (item == NULL || item->info.isUnspecified()) return EndpointDescriptor::UNSPECIFIED();
-	return baseoverlay.getEndpointDescriptor(item->info);
+const EndpointDescriptor& Chord::resolveNode( const NodeID& node ) {
+
 }
 
-/// @see OverlayInterface.h
-bool Chord::isClosestNodeTo( const NodeID& node ) {
-	return table->is_closest_to(node);
+void Chord::routeMessage( const NodeID& destnode, Message* msg ) {
+
 }
 
-/// @see OverlayInterface.h
-const LinkID& Chord::getNextLinkId( const NodeID& id ) const {
-	// get next hop
-	const route_item* item = table->get_next_hop(id);
+NodeList Chord::getKnownNodes() const {
 
-	// returns a unspecified id when this is itself
-	if (item == NULL || item->id == nodeid)
-		return LinkID::UNSPECIFIED;
-
-	/// return routing info
-	return item->info;
-}
-
-std::vector<const LinkID*> Chord::getSortedLinkIdsTowardsNode(
-    const NodeID& id, int num ) const
-{
-    std::vector<const LinkID*> ret;
-    
-    switch ( num )
-    {
-        // special case: just call Â»getNextLinkIdÂ«
-        case 1:
-        {
-            ret.push_back(&getNextLinkId(id));
-            
-            break;
-        }
-        
-        // * calculate top 2 *
-        case 0:
-        case 2:
-        {
-            std::vector<const route_item*> items = table->get_next_2_hops(id);
-            
-            ret.reserve(items.size());
-            
-            BOOST_FOREACH( const route_item* item, items )
-            {
-                ret.push_back(&item->info);
-            }
-            
-            break;
-        }
-        
-        // NOTE: implement real sorting, if needed (and handle "case 0" properly, then)
-        default:
-        {
-            throw std::runtime_error("Not implemented. (Chord::getSortedLinkIdsTowardsNode with num != 2)");
-            
-            break;
-        }
-    }
-    
-    return ret;
 }
 
 
-/// @see OverlayInterface.h
-const NodeID& Chord::getNextNodeId( const NodeID& id ) const {
-	// get next hop
-	const route_item* item = table->get_next_hop(id);
-	
-	// return unspecified if no next hop could be found
-	if (item == NULL) {
-		return NodeID::UNSPECIFIED;
-	}
-	
-	return item->id;
-}
-
-OverlayInterface::NodeList Chord::getKnownNodes(bool deep) const {
-	OverlayInterface::NodeList nodelist;
-
-	if( deep ){
-		// all nodes that I know, fingers, succ/pred
-		for (size_t i = 0; i < table->size(); i++){
-			if ((*table)[i]->ref_count != 0
-					&& !(*table)[i]->info.isUnspecified())
-				nodelist.push_back((*table)[i]->id);
-		}
-	} else {
-		// only succ and pred
-		if( table->get_predesessor() != NULL ){
-			nodelist.push_back( *(table->get_predesessor()) );
-		}
-		if( table->get_successor() != NULL ){
-			OverlayInterface::NodeList::iterator i =
-				std::find( nodelist.begin(), nodelist.end(), *(table->get_successor()) );
-			if( i == nodelist.end() )
-				nodelist.push_back( *(table->get_successor()) );
-		}
-	}
-
-	return nodelist;
-}
-
-/// @see CommunicationListener.h
-/// @see OverlayInterface.h
-void Chord::onLinkUp(const LinkID& lnk, const NodeID& remote) {
-	logging_info("link_up: link=" << lnk.toString() << " remote=" <<
-			remote.toString() );
-	for (vector<NodeID>::iterator i=pending.begin(); i!=pending.end(); i++)
-		if (*i == remote) {
-			pending.erase(i);
-			break;
-		}
-
-	if (remote==nodeid) {
-		logging_warn("dropping link that has been established to myself (nodes have same nodeid?)");
-		logging_warn("NodeID: " << remote);
-		baseoverlay.dropLink(lnk);
-		return;
-	}
-
-	route_item* item = table->insert(remote);
-
-	// item added to routing table?
-	if (item != NULL) { // yes-> add to routing table
-		logging_info("new routing neighbor: " << remote.toString()
-				<< " with link " << lnk.toString());
-
-		// replace with new link if link is "better"
-		if (item->info!=lnk && item->info.isUnspecified()==false) {
-			if (baseoverlay.compare( item->info, lnk ) == 1) {
-				logging_info("Replacing link due to concurrent link establishment.");
-				baseoverlay.dropLink(item->info);
-				item->info = lnk;
-			}
-		} else {
-			item->info = lnk;
-		}
-
-		// discover neighbors of new overlay neighbor
-		showLinks();
-	} else { // no-> add orphan entry to routing table
-		logging_info("new orphan: " << remote.toString()
-				<< " with link " << lnk.toString());
-		table->insert_orphan(remote)->info = lnk;
-	}
-
-	// erase bootstrap link
-	vector<LinkID>::iterator it = std::find(bootstrapLinks.begin(), bootstrapLinks.end(), lnk);
-	if( it != bootstrapLinks.end() ) bootstrapLinks.erase( it );
-}
-
-/// @see CommunicationListener.h or @see OverlayInterface.h
-void Chord::onLinkDown(const LinkID& lnk, const NodeID& remote) {
-    // XXX logging_debug
-	logging_info("link_down (Chord): link=" << lnk.toString() << " remote=" <<
-			remote.toString() );
-
-	// remove link from routing table
-	route_item* item = table->get(remote);
-	if (item!=NULL && item->info==lnk) {
-		item->info = LinkID::UNSPECIFIED;
-		table->remove(remote);
-	}
-}
-
-/// @see CommunicationListener.h
-/// @see OverlayInterface.h
-void Chord::onMessage(OverlayMsg* msg,
-        reboost::shared_buffer_t sub_msg,
-        const NodeID& remote,
-		const LinkID& link) {
-
-	// handle messages
-	switch ((signalMessageTypes) msg->getType()) {
-
-	// discovery request
-	case typeDiscovery:
-	{
-		// deserialize discovery message
-		DiscoveryMessage dmsg;
-		dmsg.deserialize(sub_msg);
-		
-		logging_debug("Received discovery message with"
-			    << " src=" << msg->getSourceNode().toString()
-				<< " dst=" << msg->getDestinationNode().toString()
-				<< " ttl=" << (int)dmsg.ttl
-				<< " type=" << (int)dmsg.type
-		);
-
-		// add discovery node id
-		bool found = false;
-		BOOST_FOREACH( NodeID& value, discovery )
-			if (value == msg->getSourceNode()) {
-				found = true;
-				break;
-			}
-		if (!found) discovery.push_back(msg->getSourceNode());
-
-		// check if source node can be added to routing table and setup link
-		if (msg->getSourceNode() != nodeid)
-			setup( dmsg.endpoint, msg->getSourceNode() );
-
-		// process discovery message -------------------------- switch start --
-		switch ( dmsg.type )
-		{
-            // normal: route discovery message like every other message
-            case DiscoveryMessage::normal:
-            {
-                // closest node? yes-> split to follow successor and predecessor
-                if ( table->is_closest_to(msg->getDestinationNode()) )
-                {
-                    logging_debug("Discovery split:");
-                    if (!table->get_successor()->isUnspecified())
-                    {
-                        OverlayMsg omsg(*msg);
-                        
-                        dmsg.type = DiscoveryMessage::successor;
-                        omsg.set_payload_message(dmsg.serialize());
-
-                        logging_debug("* Routing to successor "
-                                << table->get_successor()->toString() );
-                        send_node( &omsg, *table->get_successor() );
-                    }
-    
-                    // send predecessor message
-                    if (!table->get_predesessor()->isUnspecified())
-                    {
-                        OverlayMsg omsg(*msg);
-                        
-                        dmsg.type = DiscoveryMessage::predecessor;
-                        omsg.set_payload_message(dmsg.serialize());
-
-                        logging_debug("* Routing to predecessor "
-                                << table->get_predesessor()->toString() );
-                        send_node( &omsg, *table->get_predesessor() );
-                    }
-                }
-                // no-> route message
-                else
-                {
-                    baseoverlay.route( msg );
-                }
-                break;
-            }
-    
-            // successor mode: follow the successor until TTL is zero
-            case DiscoveryMessage::successor:
-            case DiscoveryMessage::predecessor:
-            {
-                // reached destination? no->forward!
-                if (msg->getDestinationNode() != nodeid)
-                {
-                    OverlayMsg omsg(*msg);
-                    omsg.setService(OverlayInterface::OVERLAY_SERVICE_ID);
-                    
-                    omsg.set_payload_message(dmsg.serialize());
-                    
-                    baseoverlay.route( &omsg );
-                    break;
-                }
-    
-                // time to live ended? yes-> stop routing
-                if (dmsg.ttl == 0 || dmsg.ttl > 10) break;
-    
-                // decrease time-to-live
-                dmsg.ttl--;
-    
-                const route_item* item = NULL;
-                if (dmsg.type == DiscoveryMessage::successor &&
-                        table->get_successor() != NULL)
-                {
-                    item = table->get(*table->get_successor());
-                }
-                else if (table->get_predesessor() != NULL)
-                {
-                        item = table->get(*table->get_predesessor());
-                }
-                if (item == NULL)
-                    break;
-    
-                logging_debug("Routing discovery message to succ/pred "
-                    << item->id.toString() );
-                OverlayMsg omsg(*msg);
-                omsg.setService(OverlayInterface::OVERLAY_SERVICE_ID);
-                omsg.setDestinationNode(item->id);
-                
-                omsg.set_payload_message(dmsg.serialize());
-                
-                send_node( &omsg, omsg.getDestinationNode() );
-                break;
-            }
-            case DiscoveryMessage::invalid:
-                break;
-    
-            default:
-                break;
-            }
-            // process discovery message ---------------------------- switch end --
-    
-            break;
-        }
-    
-        // leave
-        case typeLeave: {
-            if (link!=LinkID::UNSPECIFIED) {
-                route_item* item = table->get(remote);
-                if (item!=NULL) item->info = LinkID::UNSPECIFIED;
-                table->remove(remote);
-                baseoverlay.dropLink(link);
-            }
-            break;
-        }
-	}
-}
-
-void Chord::eventFunction() {
-	stabilize_counter++;
-	if (stabilize_counter < 0 || stabilize_counter == 2) {
-
-		// reset counter
-		stabilize_counter = 0;
-
-		// clear pending connections
-		pending.clear();
-
-		// get number of real neighbors
-		size_t numNeighbors = 0;
-		for (size_t i = 0; i < table->size(); i++) {
-			route_item* it = (*table)[i];
-			if (it->ref_count != 0 && !it->info.isUnspecified()) numNeighbors++;
-		}
-		logging_info("Running stabilization: #links="
-				<< table->size() << " #neighbors=" << numNeighbors );
-
-		// updating neighbors
-		logging_debug("Discover new ring neighbors");
-		for (size_t i=0; i<table->size(); i++) {
-			LinkID id = (*table)[i]->info;
-			if (!id.isUnspecified()) discover_neighbors(id);
-		}
-
-		// sending discovery
-		logging_debug("Sending discovery message to my neighbors and fingers");
-		stabilize_finger = ((stabilize_finger+1) % table->get_finger_table_size() );
-		const NodeID disc = table->get_finger_table(stabilize_finger).get_compare().get_center();
-		if (disc != nodeid)
-			send_discovery_to(disc);
-
-		// remove orphan links
-		orphan_removal_counter++;
-		if (orphan_removal_counter <0 || orphan_removal_counter >= 2) {
-			logging_info("Discovered nodes: ");
-			BOOST_FOREACH( NodeID& id, discovery )
-				logging_info("* " << id.toString());
-			discovery.clear();
-			logging_info("Running orphan removal");
-			orphan_removal_counter = 0;
-			for (size_t i = 0; i < table->size(); i++) {
-				route_item* it = (*table)[i];
-				if (it->ref_count == 0 && !it->info.isUnspecified()) {
-					logging_info("Dropping orphaned link " << it->info.toString() << " to " << it->id.toString());
-					table->insert(it->id);
-					if (it->ref_count==0) {
-						LinkID id = it->info;
-						it->info = LinkID::UNSPECIFIED;
-						baseoverlay.dropLink(id);
-					}
-				}
-			}
-		}
-	}
-}
-
-void Chord::showLinks() {
-	logging_info("--- chord routing information ----------------------------------");
-	logging_info("predecessor: " << (table->get_predesessor()==NULL? "<none>" :
-		table->get_predesessor()->toString()) );
-	logging_info("node_id    : " << nodeid.toString() );
-	logging_info("successor  : " << (table->get_successor()==NULL? "<none>" :
-		table->get_successor()->toString()));
-	logging_info("----------------------------------------------------------------");
-}
-
-/// @see OverlayInterface.h
-std::string Chord::debugInformation() const {
-	std::ostringstream s;
-	s << "protocol   : Chord" << endl;
-	s << "node_id    : " << nodeid.toString() << endl;
-	s << "predecessor: " << (table->get_predesessor()==NULL? "<none>" :
-		table->get_predesessor()->toString()) << endl;
-	s << "successor  : " << (table->get_successor()==NULL? "<none>" :
-		table->get_successor()->toString()) << endl;
-	s << "nodes: " << endl;
-	for (size_t i = 0; i < table->size(); i++) {
-		route_item* it = (*table)[i];
-		if (it->ref_count != 0 && !it->info.isUnspecified()) {
-			s << it->id.toString().substr(0,6)
-			  << " using " << it->info.toString().substr(0,6) << endl;
-		}
-	}
-	return s.str();
-}
-
-
-
 }} // namespace ariba, overlay
Index: /source/ariba/overlay/modules/chord/Chord.h
===================================================================
--- /source/ariba/overlay/modules/chord/Chord.h	(revision 12775)
+++ /source/ariba/overlay/modules/chord/Chord.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,127 +35,42 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef CHORD_H_
 #define CHORD_H_
 
-#include "ariba/utility/system/Timer.h"
 #include "ariba/utility/logging/Logging.h"
 #include "ariba/communication/EndpointDescriptor.h"
-#include "../OverlayInterface.h"
-#include <vector>
-#include <stdexcept>
-
-class chord_routing_table;
 
 namespace ariba {
 namespace overlay {
 
-class OverlayMsg;
+using ariba::overlay::OverlayInterface;
+using ariba::communication::EndpointDescriptor;
 
-using ariba::communication::EndpointDescriptor;
-using ariba::utility::Timer;
-
-using namespace std;
-
-/**
- * This class implements a structured overlay inspired by chord.
- * It differs to the original form of chord in the following manner:
- *
- * (1) The graph is bidirectional
- * (2) Stabilization is done in a reactive manner
- *
- * It therefore can be considered as a kind of Chorded-Kademlia :)
- *
- * The resulting overlay graph has a diameter of O(log N).
- *
- * @author Sebastian Mies <mies@tm.uka.de>
- */
-class Chord : public OverlayInterface, protected Timer {
+class Chord : public OverlayInterface {
 	use_logging_h( Chord );
 private:
-	chord_routing_table* table;
-	int orphan_removal_counter;
-	int stabilize_counter;
-	int stabilize_finger;
-	vector<LinkID> bootstrapLinks;
-	vector<NodeID> pending;
-	vector<NodeID> discovery;
-	int discovery_count;
-
-	// helper: sets up a link using the "base overlay"
-	LinkID setup( const EndpointDescriptor& endp,
-		const NodeID& node = NodeID::UNSPECIFIED );
-
-	// helper: sends a message over a link using the "base overlay"
-	void send( OverlayMsg* msg, const LinkID& link );
-
-	// helper: sends a message to a node using the "base overlay"
-	void send_node( OverlayMsg* message, const NodeID& remote );
-	        
-	// stabilization: sends a discovery message to the specified neighborhood
-	void send_discovery_to( const NodeID& destination, int ttl = 3 );
-
-	void discover_neighbors( const LinkID& lnk );
-
-	void showLinks();
 
 public:
 	Chord(BaseOverlay& _baseoverlay, const NodeID& _nodeid,
-			OverlayStructureEvents* _eventsReceiver, const OverlayParameterSet& param);
-	virtual ~Chord();
+			OverlayStructureEvents* _eventsReceiver);
+	~Chord();
 
-	/// @see OverlayInterface.h
-	virtual const LinkID& getNextLinkId( const NodeID& id ) const;
-	
-    /// @see OverlayInterface.h
-    /// NOTE: This implementation excepts num == 2
-    virtual std::vector<const LinkID*> getSortedLinkIdsTowardsNode(
-        const NodeID& id, int num = 0 ) const;
+	void createOverlay();
 
-	/// @see OverlayInterface.h
-	virtual const NodeID& getNextNodeId( const NodeID& id ) const;
+	void deleteOverlay();
 
-	/// @see OverlayInterface.h
-	virtual void createOverlay();
-
-	/// @see OverlayInterface.h
-	virtual void deleteOverlay();
-
-	/// @see OverlayInterface.h
-	virtual void joinOverlay(
-		const EndpointDescriptor& boot = EndpointDescriptor::UNSPECIFIED()
+	void joinOverlay(
+		const EndpointDescriptor& bootstrapEp = EndpointDescriptor::UNSPECIFIED
 	);
 
-	/// @see OverlayInterface.h
-	virtual void leaveOverlay();
+	void leaveOverlay();
 
-	/// @see OverlayInterface.h
-	virtual const EndpointDescriptor& resolveNode( const NodeID& node );
+	const EndpointDescriptor& resolveNode( const NodeID& node );
 
-	/// @see OverlayInterface.h
-	virtual bool isClosestNodeTo( const NodeID& node );
+	void routeMessage( const NodeID& destnode, Message* msg );
 
-	/// @see OverlayInterface.h
-	virtual NodeList getKnownNodes(bool deep = true) const;
-
-	/// @see CommunicationListener.h or @see OverlayInterface.h
-	virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
-
-	/// @see CommunicationListener.h or @see OverlayInterface.h
-	virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
-
-	/// @see CommunicationListener.h or @see OverlayInterface.h
-	virtual void onMessage(OverlayMsg* msg,
-	        reboost::shared_buffer_t sub_msg,
-	        const NodeID& remote,
-			const LinkID& lnk = LinkID::UNSPECIFIED);
-
-	/// @see OverlayInterface.h
-	virtual std::string debugInformation() const;
-
-	/// @see Timer.h
-	virtual void eventFunction();
-
+	NodeList getKnownNodes() const;
 };
 
Index: urce/ariba/overlay/modules/chord/messages/CMakeLists.txt
===================================================================
--- /source/ariba/overlay/modules/chord/messages/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,41 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-#add_headers(Discovery.h)
-
-#add_sources(Discovery.cpp)
Index: urce/ariba/overlay/modules/chord/messages/Discovery.cpp
===================================================================
--- /source/ariba/overlay/modules/chord/messages/Discovery.cpp	(revision 12775)
+++ 	(revision )
@@ -1,49 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "Discovery.h"
-
-namespace ariba {
-namespace overlay {
-
-vsznDefault(Discovery);
-
-Discovery::~Discovery(){
-}
-
-}} // ariba::overlay
Index: urce/ariba/overlay/modules/chord/messages/Discovery.h
===================================================================
--- /source/ariba/overlay/modules/chord/messages/Discovery.h	(revision 12775)
+++ 	(revision )
@@ -1,117 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef DISCOVERY_H__
-#define DISCOVERY_H__
-
-#include <vector>
-
-#include "ariba/utility/messages.h"
-#include "ariba/utility/serialization.h"
-#include "ariba/utility/types/NodeID.h"
-#include "ariba/communication/EndpointDescriptor.h"
-
-using std::pair;
-using std::make_pair;
-using std::vector;
-using ariba::utility::Message;
-using ariba::utility::NodeID;
-using ariba::communication::EndpointDescriptor;
-
-namespace ariba {
-namespace overlay {
-
-using_serialization;
-
-// XXX This whole message is DEPRECATED
-class Discovery : public Message {
-	VSERIALIZEABLE;
-public:
-	enum type_ {
-		invalid = 0,
-		normal = 1,
-		successor = 2,
-		predecessor = 3
-	};
-
-	Discovery( const Discovery& msg ) : type(msg.type), ttl(msg.ttl),
-		endpoint(msg.endpoint) {
-	}
-	Discovery( type_ type = invalid, uint8_t ttl = 4,
-		const EndpointDescriptor& endpoint = EndpointDescriptor::UNSPECIFIED() )
-	: type(type),  ttl(ttl), endpoint(endpoint) {
-	}
-	virtual ~Discovery();
-
-	inline type_ getType() const {
-		return (type_)type;
-	}
-
-	inline void setType( type_ type ) {
-		this->type = type;
-	}
-
-	inline uint8_t getTTL() const {
-		return ttl;
-	}
-
-	inline void setTTL( uint8_t ttl ) {
-		this->ttl = ttl;
-	}
-
-	inline const EndpointDescriptor& getEndpoint() const {
-		return endpoint;
-	}
-
-	inline void setEndpoint( const EndpointDescriptor& endpoint ) {
-		this->endpoint = endpoint;
-	}
-
-private:
-	uint8_t type;
-	uint8_t ttl;
-	EndpointDescriptor endpoint;
-};
-
-}} // ariba::overlay
-
-sznBeginDefault( ariba::overlay::Discovery, X ) {
-	X && type && ttl && endpoint;
-} sznEnd();
-
-#endif // DISCOVERY_H__
Index: urce/ariba/overlay/modules/onehop/CMakeLists.txt
===================================================================
--- /source/ariba/overlay/modules/onehop/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,45 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-
-## DEPRECATED
-#add_headers(OneHop.h)
-
-#add_sources(OneHop.cpp)
-
-#add_subdir_sources(messages)
Index: /source/ariba/overlay/modules/onehop/OneHop.cpp
===================================================================
--- /source/ariba/overlay/modules/onehop/OneHop.cpp	(revision 12775)
+++ /source/ariba/overlay/modules/onehop/OneHop.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,13 +35,9 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "OneHop.h"
 #include "ariba/overlay/BaseOverlay.h"
 
-#include "ariba/overlay/modules/onehop/messages/OneHopMessage.h"
-#include "ariba/overlay/modules/onehop/messages/NodeListingRequest.h"
-#include "ariba/overlay/modules/onehop/messages/NodeListingReply.h"
-
 namespace ariba {
 namespace overlay {
@@ -49,8 +45,9 @@
 use_logging_cpp( OneHop );
 
-OneHop::OneHop(BaseOverlay& _baseoverlay, const NodeID& _nodeid,
-		OverlayStructureEvents* _eventsReceiver, const OverlayParameterSet& param)
-	: 	OverlayInterface( _baseoverlay, _nodeid, _eventsReceiver, param ),
-		state( OneHopStateInvalid ) {
+OneHop::OneHop(BaseOverlay& _baseoverlay, const NodeID& _nodeid, OverlayStructureEvents* _eventsReceiver)
+	: 	OverlayInterface( _baseoverlay, _nodeid, _eventsReceiver ),
+		state		( OneHopStateInvalid ),
+		bootstrapLink	( LinkID::UNSPECIFIED ),
+		pendingLinks	( 0 ) {
 
 	//
@@ -58,11 +55,8 @@
 	//
 	overlayNodes.insert( make_pair(_nodeid, LinkID::UNSPECIFIED) );
-
-	Timer::setInterval(5000);
-	Timer::start();
 }
 
 OneHop::~OneHop(){
-	Timer::stop();
+
 	deleteOverlay();
 }
@@ -71,5 +65,5 @@
 
 	OverlayNodeMapping::const_iterator i = overlayNodes.find( node );
-	if (i == overlayNodes.end()) return EndpointDescriptor::UNSPECIFIED();
+	if (i == overlayNodes.end()) return EndpointDescriptor::UNSPECIFIED;
 
 	const EndpointDescriptor& ep = baseoverlay.getEndpointDescriptor( i->second );
@@ -79,11 +73,4 @@
 }
 
-
-/// @see OverlayInterface.h
-bool OneHop::isClosestNodeTo( const NodeID& node ) {
-	throw "NOT IMPLEMENTED!";
-	return false;
-}
-
 void OneHop::routeMessage(const NodeID& destnode, Message* msg){
 
@@ -93,9 +80,4 @@
 	logging_debug( "routing message to node " << destnode.toString() );
 
-	// msg for ourselfs
-	if(destnode == nodeid)
-		baseoverlay.incomingRouteMessage( msg, LinkID::UNSPECIFIED, nodeid );
-
-	// msg for other node
 	OverlayNodeMapping::const_iterator i = overlayNodes.find( destnode );
 	if (i == overlayNodes.end()) {
@@ -103,39 +85,15 @@
 		return;
 	}
-	OneHopMessage onehopRoute( OneHopMessage::OneHopMessageTypeRoute );
-	onehopRoute.encapsulate(msg);
-
-	baseoverlay.sendMessage( &onehopRoute, i->second );
-}
-
-void OneHop::routeMessage(const NodeID& node, const LinkID& link, Message* msg) {
-	OneHopMessage onehopRoute( OneHopMessage::OneHopMessageTypeRoute );
-	onehopRoute.encapsulate(msg);
-	baseoverlay.sendMessage( &onehopRoute, link );
-}
-
-/// @see OverlayInterface.h
-const LinkID& OneHop::getNextLinkId( const NodeID& id ) const {
-	OverlayNodeMapping::const_iterator i = overlayNodes.find( id );
-	if (i == overlayNodes.end()) return LinkID::UNSPECIFIED;
-	return i->second;
-}
-
-/// @see OverlayInterface.h
-const NodeID& OneHop::getNextNodeId( const NodeID& id ) const {
-	OverlayNodeMapping::const_iterator i = overlayNodes.find( id );
-	
-	// FIXME: in case the NodeID is not known we should return the nearest node
-	if (i == overlayNodes.end()) {
-		return NodeID::UNSPECIFIED;
-	}
-	
-	return i->first;
-}
-
-void OneHop::createOverlay() {
+
+	baseoverlay.sendMessage( msg, i->second );
+}
+
+void OneHop::createOverlay(){
+
 	// don't need to bootstrap against ourselfs.
 	// the create and join process is completed now.
+
 	logging_info( "creating onehop overlay structure" );
+	state = OneHopStateCompleted;
 }
 
@@ -144,7 +102,8 @@
 	logging_info( "deleting onehop overlay structure" );
 	state = OneHopStateInvalid;
-}
-
-OverlayInterface::NodeList OneHop::getKnownNodes(bool deep) const {
+	pendingLinks = 0;
+}
+
+OverlayInterface::NodeList OneHop::getKnownNodes() const {
 
 	OverlayInterface::NodeList retlist;
@@ -161,8 +120,12 @@
 void OneHop::joinOverlay(const EndpointDescriptor& bootstrapEp){
 
-	logging_info( "joining onehop overlay structure through end-point " <<
-			(bootstrapEp.isUnspecified() ? "local" : bootstrapEp.toString()) );
-
-	if( bootstrapEp.isUnspecified() ){
+	logging_info( "joining onehop overlay structure through endpoint " <<
+			(bootstrapEp == EndpointDescriptor::UNSPECIFIED ?
+					"local" : bootstrapEp.toString()) );
+
+	state = OneHopStateJoinInitiated;
+	pendingLinks = 0;
+
+	if( bootstrapEp == EndpointDescriptor::UNSPECIFIED ){
 
 		// we are the initiator and we are to bootstrap against
@@ -171,9 +134,10 @@
 
 		state = OneHopStateCompleted;
+
+
 	} else {
-		bootstrapLinks.push_back(
-				baseoverlay.establishDirectLink( bootstrapEp,
-					OverlayInterface::OVERLAY_SERVICE_ID )
-					);
+
+		bootstrapLink = baseoverlay.establishLink( bootstrapEp,
+					OverlayInterface::OVERLAY_SERVICE_ID );
 	}
 }
@@ -183,14 +147,6 @@
 	logging_info( "leaving onehop overlay structure" );
 
-	// set the state to invalid, this will prevent from
-	// handling onLinkDown events, as we are traversing the
-	// overlayNodes map and the onLinkDown function is called
-	// from the BaseOverlay and OneHop::onLinkDown will also
-	// try to access the overlayNodes structure.
-	state = OneHopStateInvalid;
-
-	//
-	// send leave messages to all nodes. the nodes
-	// will then drop the links
+	//
+	// close all links, this will indicate the other nodes that we left
 	//
 
@@ -199,21 +155,19 @@
 
 	for( ; i != iend; i++){
-		if( i->first != nodeid && i->second != LinkID::UNSPECIFIED ){
-
-			OneHopMessage msg (OneHopMessage::OneHopMessageTypeLeave);
-			baseoverlay.sendMessage( &msg, i->second );
-		}
-	}
-}
-
-
-void OneHop::onLinkDown(const LinkID& lnk, const NodeID& remote){
-
-	// don't handle when we are in state-invalid,
-	// see comment in OneHop::leaveOverlay
-	if( state == OneHopStateInvalid ) return;
-
+		if( i->first != nodeid && i->second != LinkID::UNSPECIFIED )
+			baseoverlay.dropLink( i->second );
+	}
+
+	state = OneHopStateInvalid;
+	pendingLinks = 0;
+}
+
+void OneHop::onLinkDown( const LinkID& link, const NodeID& local, const NodeID& remote ){
+
+	//
 	// node went down, remove from overlay mapping
-	logging_debug( "link " << lnk.toString() << " to node " << remote.toString() << " went down, removing node" );
+	//
+
+	logging_debug( "node " << remote.toString() << " left overlay structure" );
 
 	OverlayNodeMapping::iterator i = overlayNodes.begin();
@@ -221,15 +175,22 @@
 
 	for( ; i != iend; i++ ){
-		if( i->second == lnk ){
+		if( i->second == link ){
 			overlayNodes.erase( i );
 			break;
 		}
 	}
-
-	vector<LinkID>::iterator it = std::find( bootstrapLinks.begin(), bootstrapLinks.end(), lnk );
-	if( it != bootstrapLinks.end() ) bootstrapLinks.erase( it );
-}
-
-void OneHop::onLinkUp(const LinkID& lnk, const NodeID& remote){
+}
+
+void OneHop::onLinkUp(const LinkID& link, const NodeID& local, const NodeID& remote) {
+
+	//
+	// as soon as a link goes up, we always request the node listing.
+	// and try to get connections to as much nodes as possible in a greedy way.
+	//
+
+	if( link != bootstrapLink ){
+		if( pendingLinks > 0 )  pendingLinks--;
+		if( pendingLinks == 0 ) state = OneHopStateCompleted;
+	}
 
 	logging_debug( "link is up, sending out node listing request" );
@@ -239,11 +200,12 @@
 	onemsg.encapsulate( &requestmsg );
 
-	baseoverlay.sendMessage( &onemsg, lnk );
-}
-
-void OneHop::onMessage(const DataMessage& msg, const NodeID& remote, const LinkID& lnk){
-
-	OneHopMessage* onemsg = msg.getMessage()->convert<OneHopMessage>();
-	if( onemsg == NULL ) return;
+	state = OneHopStateJoinListingRequested;
+	baseoverlay.sendMessage( &onemsg, link );
+}
+
+bool OneHop::receiveMessage(const Message* message, const LinkID& link, const NodeID& node){
+
+	OneHopMessage* onemsg = const_cast<Message*>(message)->decapsulate<OneHopMessage>();
+	if( onemsg == NULL ) return false;
 
 	//
@@ -251,9 +213,9 @@
 	//
 
-	if( onemsg->isType( OneHopMessage::OneHopMessageTypeListingRequest ) ){
-
-		//NodeListingRequest* request = onemsg->decapsulate<NodeListingRequest>();
-
-		logging_info( "onehop received node listing request from node " << remote.toString() );
+	if( onemsg->isType( OneHopMessage::OneHopMessageTypeListingRequest) ){
+
+		NodeListingRequest* request = onemsg->decapsulate<NodeListingRequest>();
+
+		logging_info( "onehop received node listing request from node " << node.toString() );
 
 		//
@@ -261,5 +223,5 @@
 		//
 
-		overlayNodes.insert( make_pair(remote, lnk) );
+		overlayNodes.insert( make_pair(node, link) );
 
 		//
@@ -287,5 +249,5 @@
 
 		onehopReply.encapsulate( &listingReply );
-		baseoverlay.sendMessage( &onehopReply, lnk );
+		baseoverlay.sendMessage( &onehopReply, link );
 
 		//
@@ -294,7 +256,7 @@
 		//
 
-		eventsReceiver->onNodeJoin( remote );
-
-	} // OneHopMessageTypeListingRequest
+		eventsReceiver->onNodeJoin( node );
+
+	} // if( request != NULL )
 
 	//
@@ -306,5 +268,5 @@
 		NodeListingReply* reply = onemsg->decapsulate<NodeListingReply>();
 
-		logging_debug( "received node listing reply from node " << remote.toString()
+		logging_debug( "received node listing reply from node " << node.toString()
 					<< " with all overlay nodes. connecting to all of them" );
 
@@ -317,4 +279,5 @@
 		const NodeListingReply::NodeEndpointList& endpoints = reply->getList();
 		logging_debug( "received " << endpoints.size() << " nodes in listing" );
+		pendingLinks = 0;
 
 		NodeListingReply::NodeEndpointList::const_iterator i = endpoints.begin();
@@ -333,58 +296,13 @@
 
 			logging_debug( "building up link to node in overlay " << node.toString() );
-			const LinkID link = baseoverlay.establishDirectLink( *((*i).second),
+			const LinkID link = baseoverlay.establishLink( *((*i).second),
 							OverlayInterface::OVERLAY_SERVICE_ID );
 
 			overlayNodes.insert( make_pair(node, link) );
+			pendingLinks++;
 
 		} // for( ; i != iend; i++ )
 
-		delete reply;
-	} // OneHopMessageTypeListingReply
-
-	//
-	// handle node leaves
-	//
-
-	if( onemsg->isType(OneHopMessage::OneHopMessageTypeLeave) ){
-
-		logging_debug("received leave message from " <<
-				remote.toString() << " on link " << lnk.toString());
-
-		// drop the link to the node
-		baseoverlay.dropLink( lnk );
-
-	} // OneHopMessageTypeLeave
-
-	//
-	// handle kbr route messages
-	//
-
-	if( onemsg->isType( OneHopMessage::OneHopMessageTypeRoute) ){
-		logging_debug( "Route message arrived at destination node -> delegate to BaseOverlay" );
-		baseoverlay.incomingRouteMessage( onemsg, lnk, remote);
-	} // OneHopMessageTypeRoute
-
-	delete onemsg;
-}
-
-void OneHop::eventFunction(){
-
-	logging_debug("<<<<<<<<<<<<<<<<onehop-table<<<<<<<<<<<<<<<<<<<");
-
-		OverlayNodeMapping::iterator i = overlayNodes.begin();
-		OverlayNodeMapping::iterator iend = overlayNodes.end();
-
-		for( ; i != iend; i++ ){
-
-			const NodeID node = i->first;
-			const LinkID link = i->second;
-			const EndpointDescriptor& endpoint = baseoverlay.getEndpointDescriptor( link );
-
-			logging_debug( 	"node: " << node.toString() <<
-							", link_: " << link.toString() << ", endp: " << endpoint.toString());
-		}
-
-	logging_debug(">>>>>>>>>>>>>>>>>onehop-table>>>>>>>>>>>>>>>>>>>>>");
+	} // if( reply != NULL )
 
 }
Index: /source/ariba/overlay/modules/onehop/OneHop.h
===================================================================
--- /source/ariba/overlay/modules/onehop/OneHop.h	(revision 12775)
+++ /source/ariba/overlay/modules/onehop/OneHop.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef _ONE_HOP_H
@@ -42,18 +42,26 @@
 #include <map>
 #include "ariba/overlay/modules/OverlayInterface.h"
+#include "ariba/overlay/modules/onehop/messages/OneHopMessage.h"
+#include "ariba/overlay/modules/onehop/messages/NodeListingRequest.h"
+#include "ariba/overlay/modules/onehop/messages/NodeListingReply.h"
 #include "ariba/utility/logging/Logging.h"
-#include "ariba/utility/system/Timer.h"
 
 using std::map;
-using ariba::utility::Timer;
+using ariba::overlay::OverlayInterface;
+using ariba::overlay::OneHopMessage;
+using ariba::overlay::NodeListingRequest;
+using ariba::overlay::NodeListingReply;
 
 namespace ariba {
 namespace overlay {
 
-class OneHop : public OverlayInterface, protected Timer {
+class OneHop : public OverlayInterface {
 	use_logging_h( OneHop );
 public:
-	OneHop(BaseOverlay& _overlay, const NodeID& _nodeid,
-			OverlayStructureEvents* _eventsReceiver, const OverlayParameterSet& param);
+	OneHop(
+		BaseOverlay& _overlay,
+		const NodeID& _nodeid,
+		OverlayStructureEvents* _eventsReceiver
+	);
 
 	virtual ~OneHop();
@@ -61,64 +69,50 @@
 protected:
 
-	/// @see Timer.h
-	virtual void eventFunction();
+	//
+	// OverlayInterface.h
+	//
 
-	/// @see OverlayInterface.h
 	virtual void createOverlay();
-
-	/// @see OverlayInterface.h
 	virtual void deleteOverlay();
 
-	/// @see OverlayInterface.h
-	virtual void joinOverlay(const EndpointDescriptor& boot =
-			EndpointDescriptor::UNSPECIFIED());
-
-	/// @see OverlayInterface.h
+	virtual void joinOverlay(const EndpointDescriptor& bootstrapEp = EndpointDescriptor::UNSPECIFIED);
 	virtual void leaveOverlay();
 
-	/// @see OverlayInterface.h
-	virtual const EndpointDescriptor& resolveNode(const NodeID& node);
+	virtual const EndpointDescriptor& resolveNode( const NodeID& node );
+	virtual void routeMessage( const NodeID& destnode, Message* msg );
 
-	/// @see OverlayInterface.h
-	virtual bool isClosestNodeTo( const NodeID& node );
+	virtual NodeList getKnownNodes() const;
 
-	/// @see OverlayInterface.h
-	virtual const LinkID& getNextLinkId( const NodeID& id ) const;
-	
-	/// @see OverlayInterface.h
-	virtual const NodeID& getNextNodeId( const NodeID& id ) const;
+	//
+	// see ServiceInterface.h and OverlayInterface.h
+	//
 
-	/// @see OverlayInterface.h
-	virtual void routeMessage(const NodeID& destnode, Message* msg);
-
-	/// @see OverlayInterface.h
-	virtual void routeMessage(const NodeID& node, const LinkID& link, Message* msg);
-
-	/// @see OverlayInterface.h
-	virtual NodeList getKnownNodes(bool deep = true) const;
-
-	/// @see CommunicationListener.h or @see OverlayInterface.h
-	virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
-
-	/// @see CommunicationListener.h or @see OverlayInterface.h
-	virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
-
-	/// @see CommunicationListener.h or @see OverlayInterface.h
-	virtual void onMessage(const DataMessage& msg, const NodeID& remote,
-			const LinkID& lnk = LinkID::UNSPECIFIED);
+	virtual void onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual void onLinkDown( const LinkID& link, const NodeID& local, const NodeID& remote );
+	virtual bool receiveMessage( const Message* message, const LinkID& link, const NodeID& node );
 
 private:
-	/// The other nodes in the overlay
-	typedef map<const NodeID, const LinkID> OverlayNodeMapping;
+
+	/**
+	 * The other nodes in the overlay
+	 */
+	typedef map<const NodeID,const LinkID> OverlayNodeMapping;
 	OverlayNodeMapping overlayNodes;
 
-	/// The current state of the overlay
+	/**
+	 * The current state of the overlay
+	 */
 	typedef enum _OneHopState {
-		OneHopStateInvalid = 0,
-		OneHopStateCompleted = 1,
+		OneHopStateInvalid                = 0,
+		OneHopStateJoinInitiated          = 1,
+		OneHopStateJoinListingRequested   = 2,
+		OneHopStateCompleted              = 3,
 	} OneHopState;
 
 	OneHopState state;
-	vector<LinkID> bootstrapLinks;
+
+	uint16_t pendingLinks;
+	LinkID bootstrapLink;
+
 };
 
Index: urce/ariba/overlay/modules/onehop/messages/CMakeLists.txt
===================================================================
--- /source/ariba/overlay/modules/onehop/messages/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,49 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    NodeListingReply.h
-    NodeListingRequest.h
-    OneHopMessage.h
-    )
-
-add_sources(
-    NodeListingReply.cpp
-    NodeListingRequest.cpp
-    OneHopMessage.cpp
-    )
Index: /source/ariba/overlay/modules/onehop/messages/NodeListingReply.cpp
===================================================================
--- /source/ariba/overlay/modules/onehop/messages/NodeListingReply.cpp	(revision 12775)
+++ /source/ariba/overlay/modules/onehop/messages/NodeListingReply.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "NodeListingReply.h"
Index: /source/ariba/overlay/modules/onehop/messages/NodeListingReply.h
===================================================================
--- /source/ariba/overlay/modules/onehop/messages/NodeListingReply.h	(revision 12775)
+++ /source/ariba/overlay/modules/onehop/messages/NodeListingReply.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef NODE_LISTING_REPLY_H__
@@ -77,9 +77,13 @@
 
 sznBeginDefault( ariba::overlay::NodeListingReply, X ) {
-	uint16_t len = descriptors.size();
+	uint16_t len = X.isSerializer() ? descriptors.size() : 0;
 	X && len;
-	if (X.isDeserializer())	descriptors.resize(len);
-	for (int i=0; i<len; i++)
-		X && &descriptors[i].first && VO(descriptors[i].second);
+	if (X.isDeserializer()) {
+		descriptors.resize(len);
+	}
+	for (int i=0; i<len; i++) {
+		if (X.isDeserializer()) descriptors[i].second = new EndpointDescriptor();
+		X && &descriptors[i].first && reinterpret_cast<VSerializeable*>(descriptors[i].second);
+	}
 } sznEnd();
 
Index: /source/ariba/overlay/modules/onehop/messages/NodeListingRequest.cpp
===================================================================
--- /source/ariba/overlay/modules/onehop/messages/NodeListingRequest.cpp	(revision 12775)
+++ /source/ariba/overlay/modules/onehop/messages/NodeListingRequest.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "NodeListingRequest.h"
Index: /source/ariba/overlay/modules/onehop/messages/NodeListingRequest.h
===================================================================
--- /source/ariba/overlay/modules/onehop/messages/NodeListingRequest.h	(revision 12775)
+++ /source/ariba/overlay/modules/onehop/messages/NodeListingRequest.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef NODE_LISTING_REQUEST_H__
Index: /source/ariba/overlay/modules/onehop/messages/OneHopMessage.cpp
===================================================================
--- /source/ariba/overlay/modules/onehop/messages/OneHopMessage.cpp	(revision 12775)
+++ /source/ariba/overlay/modules/onehop/messages/OneHopMessage.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "OneHopMessage.h"
Index: /source/ariba/overlay/modules/onehop/messages/OneHopMessage.h
===================================================================
--- /source/ariba/overlay/modules/onehop/messages/OneHopMessage.h	(revision 12775)
+++ /source/ariba/overlay/modules/onehop/messages/OneHopMessage.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __ONE_HOP_MESSAGE_H
@@ -57,6 +57,4 @@
 		OneHopMessageTypeListingRequest = 1,
 		OneHopMessageTypeListingReply   = 2,
-		OneHopMessageTypeLeave          = 3,
-		OneHopMessageTypeRoute	        = 4,
 	} OneHopMessageType;
 
Index: /source/ariba/tidy/AribaModule.cpp
===================================================================
--- /source/ariba/tidy/AribaModule.cpp	(revision 2378)
+++ /source/ariba/tidy/AribaModule.cpp	(revision 2378)
@@ -0,0 +1,169 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#include "AribaModule.h"
+
+// boost/std includes
+#include <assert.h>
+#include <boost/regex.hpp>
+
+// ariba includes
+#include "ariba/utility/misc/Helper.h"
+
+// hack includes
+#include "ariba/interface/UnderlayAbstraction.h"
+#include "ariba/communication/EndpointDescriptor.h"
+#include "ariba/communication/modules/network/NetworkLocator.h"
+
+using namespace ariba::utility::Helper;
+using ariba::interface::UnderlayAbstraction;
+
+namespace ariba {
+
+AribaModule::AribaModule() {
+
+	// init with default values
+	this->underlay_abs = NULL;
+	this->ip_addr = NULL;
+	this->tcp_port = 41402;
+	this->udp_port = 41402;
+	this->started = false;
+}
+
+AribaModule::~AribaModule() {
+}
+
+SpoVNetID AribaModule::getSpoVNetId(const char* name, int len) const {
+	return SpoVNetID::UNSPECIFIED;
+}
+
+string AribaModule::getBootstrapHints(const Name& spoVNetName) const {
+
+}
+
+void AribaModule::addBootstrapHints(string boot_info) {
+	string str = boot_info;
+	static ::boost::regex boot_expr("<([^>:]+)[:]?([0-9]+)?>([^<]+)(.*)");
+	::boost::smatch what;
+	while (::boost::regex_match(str, what, boot_expr)) {
+		std::cout << what[1].str() << ":" << what[2].str() << "=" << what[3]
+				<< std::endl;
+		str = what[4].str();
+	}
+}
+
+void AribaModule::addBootstrapNode(const Name& spovnet, const Name& node,
+		communication::EndpointDescriptor* desc) {
+
+}
+
+const communication::EndpointDescriptor* AribaModule::getBootstrapNode(
+		const Name& spovnet) {
+	return NULL;
+}
+
+// @see Module.h
+void AribaModule::initialize() {
+
+	// preconditions
+	assert(!started);
+
+	// init variables
+	underlay_abs = NULL;
+}
+
+// @see Module.h
+void AribaModule::start() {
+
+	// preconditions
+	assert(underlay_abs == NULL);
+	assert(!started);
+
+	// create the base communication component
+	started = true;
+	underlay_abs = new interface::UnderlayAbstraction();
+}
+
+// @see Module.h
+void AribaModule::stop() {
+
+	// preconditions
+	assert(underlay_abs != NULL);
+	assert(started);
+
+	// delete base communication component
+	started = false;
+	delete underlay_abs;
+}
+
+// @see Module.h
+string AribaModule::getName() const {
+	return "ariba";
+}
+
+// @see Module.h
+void AribaModule::setProperty(string key, string value) {
+	if (key == "ip.addr") {
+		if (ip_addr != NULL) delete ip_addr;
+		communication::IPv4Locator* loc = new communication::IPv4Locator();
+		*loc = communication::IPv4Locator::fromString(value);
+		ip_addr = loc;
+	} else if (key == "tcp.port") tcp_port = stoi(value);
+	else if (key == "udp.port") udp_port = stoi(value);
+	else if (key == "bootstrap.hints") addBootstrapHints(value);
+}
+
+// @see Module.h
+const string AribaModule::getProperty(string key) const {
+	if (key == "ip.addr") return ip_addr->toString();
+	else if (key == "tcp.port") return ultos(tcp_port);
+	else if (key == "udp.port") return ultos(udp_port);
+	else if (key == "bootstrap.hints") return getBootstrapHints();
+}
+
+// @see Module.h
+const vector<string> AribaModule::getProperties() const {
+	vector<string> properties;
+	properties.push_back("ip.addr");
+	properties.push_back("tcp.port");
+	properties.push_back("udp.port");
+	properties.push_back("hints");
+	return properties;
+}
+
+} // namespace ariba
Index: /source/ariba/tidy/AribaModule.h
===================================================================
--- /source/ariba/tidy/AribaModule.h	(revision 2378)
+++ /source/ariba/tidy/AribaModule.h	(revision 2378)
@@ -0,0 +1,175 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#ifndef ARIBAMODULE_H_
+#define ARIBAMODULE_H_
+
+#include <string>
+#include <vector>
+
+// usings
+using std::vector;
+using std::string;
+
+// forward declaration
+namespace ariba {
+class AribaModule;
+}
+
+// local includes
+#include "Name.h"
+#include "Module.h"
+
+namespace ariba {
+
+// forward declarations of old interface
+namespace communication {
+class EndpointDescriptor;
+class NetworkLocator;
+}
+namespace interface {
+class UnderlayAbstraction;
+}
+
+/**
+ * This class implements a container class for ariba base services. Each node
+ * is a running using this base-module. It also manages Bootstrap information
+ * in a abstract simple way.
+ *
+ *        +---+   +---+
+ *        |N1 |   |N2 |
+ *     +--|   |---|   |--+
+ *     |  +---+   +---+  |
+ *     |                 |
+ *     |     AribaModule |
+ *     +-----------------+
+ *
+ * N1, N2 are nodes.
+ *
+ * @author Sebastian Mies <mies@tm.uka.de>
+ */
+class AribaModule: public Module {
+	friend class Node;
+public:
+	/**
+	 * Constructor of the ariba underlay module
+	 */
+	AribaModule();
+
+	/**
+	 * Destructor of the ariba underlay module
+	 */
+	virtual ~AribaModule();
+
+	/**
+	 * Returns all known bootstrap endpoints to this ariba module in
+	 * a human-readable string. This information can be used by other
+	 * nodes for bootstraping. It may also be used to publish this info
+	 * to other nodes via the web, for example.
+	 *
+	 * @param The name of the spovnet
+	 * @return A human-readable string containing all known bootstrap
+	 *   information known to this module.
+	 */
+	string getBootstrapHints(const Name& spoVNetName = Name::UNSPECIFIED) const;
+
+	/**
+	 * Adds bootstrap hints to the local database. The format of the string
+	 * must is the same as returned by <code>getBootstrapInfo</code>.
+	 *
+	 * @param bootinfo A string containing bootstrap information.
+	 */
+	void addBootstrapHints(string bootinfo);
+
+	// --- module implementation ---
+
+	/**
+	 * Module Property information:
+	 *
+	 * ip.addr  = preferred ip address (otherwise bind to all)
+	 * tcp.port = preferred tcp port (or use default value)
+	 * udp.port = preferred udp port (or use default value)
+	 * bootstrap.hints = used bootstrap hints
+	 * bootstrap.file  = used file for bootstrap information
+	 */
+	void initialize(); ///< @see Module.h
+	void start(); ///< @see Module.h
+	void stop(); ///< @see Module.h
+	string getName() const; ///< @see Module.h
+	void setProperty(string key, string value); ///< @see Module.h
+	const string getProperty(string key) const; ///< @see Module.h
+	const vector<string> getProperties() const; ///< @see Module.h
+
+private:
+	// bootstrap node
+	class BootstrapNode {
+	public:
+		uint32_t timestamp;
+		communication::EndpointDescriptor* desc;
+	};
+
+	// bootstrap info
+	class BootstrapInfo {
+	public:
+		Name spovnetName;
+		vector<BootstrapNode> desc;
+	};
+	vector<BootstrapInfo> bootstrapNodes;
+
+protected:
+	// members
+	string bootstrapFile; 	//< file with bootstrap information
+	bool started;			//< flag, if module has been started
+
+	// bootstrap node management
+	void addBootstrapNode(const Name& spovnet, const Name& node,
+			communication::EndpointDescriptor* desc);
+	const communication::EndpointDescriptor* getBootstrapNode(
+			const Name& spovnet);
+
+	// TODO: merge with old interface
+	interface::UnderlayAbstraction* underlay_abs;
+
+	// TODO: use "abstract" representations here!
+	communication::NetworkLocator* ip_addr;
+	uint16_t tcp_port, udp_port;
+};
+
+} // namespace ariba
+
+#endif /* ENVIRONMENT_H_ */
Index: /source/ariba/tidy/Identifiers.cpp
===================================================================
--- /source/ariba/tidy/Identifiers.cpp	(revision 2378)
+++ /source/ariba/tidy/Identifiers.cpp	(revision 2378)
@@ -0,0 +1,43 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "Identifiers.h"
+
+namespace ariba {
+
+} // namespace ariba
Index: /source/ariba/tidy/Identifiers.h
===================================================================
--- /source/ariba/tidy/Identifiers.h	(revision 2378)
+++ /source/ariba/tidy/Identifiers.h	(revision 2378)
@@ -0,0 +1,69 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#ifndef IDENTIFIERS_H_
+#define IDENTIFIERS_H_
+
+//#include "ariba.h"
+
+// TODO: implement via variable integers to support different node id sizes!!
+//#include "ariba/utility/vtypes/vint.hpp"
+
+// hack
+#include "ariba/utility/types/NodeID.h"
+#include "ariba/utility/types/ServiceID.h"
+#include "ariba/utility/types/LinkID.h"
+#include "ariba/utility/types/SpoVNetID.h"
+
+namespace ariba {
+
+// TODO: implement via variable integers to support different node id sizes!!
+//typedef vint<32> LinkID;
+//typedef vint<32> ServiceID;
+//typedef vint<> NodeID;
+//typedef vint<> SpoVNetID;
+
+// hack: for now, use old identifiers
+typedef utility::NodeID NodeID;
+typedef utility::LinkID LinkID;
+typedef utility::SpoVNetID SpoVNetID;
+typedef utility::ServiceID ServiceID;
+
+} // namespace ariba
+
+#endif /* IDENTIFIERS_H_ */
Index: /source/ariba/tidy/LinkProperties.cpp
===================================================================
--- /source/ariba/tidy/LinkProperties.cpp	(revision 2378)
+++ /source/ariba/tidy/LinkProperties.cpp	(revision 2378)
@@ -0,0 +1,54 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#include "LinkProperties.h"
+
+namespace ariba {
+
+const LinkProperties LinkProperties::DEFAULT;
+
+LinkProperties::LinkProperties() {
+	this->reliable = true;
+//	this->confidential = false;
+//	this->integrity = false;
+}
+
+LinkProperties::~LinkProperties() {
+}
+
+} // namespace ariba
Index: /source/ariba/tidy/LinkProperties.h
===================================================================
--- /source/ariba/tidy/LinkProperties.h	(revision 2378)
+++ /source/ariba/tidy/LinkProperties.h	(revision 2378)
@@ -0,0 +1,71 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#ifndef LINKPROPERTIES_H_
+#define LINKPROPERTIES_H_
+
+namespace ariba {
+// forward declaration
+class LinkProperties;
+}
+
+namespace ariba {
+
+class LinkProperties {
+public:
+	LinkProperties();
+	~LinkProperties();
+
+public:
+	static const LinkProperties DEFAULT;
+
+public:
+	bool reliable;
+
+	//TODO: to be extended!
+//	bool confidential;
+//	bool integrity;
+
+	//TODO: implement quality-of-service containers
+//	SpoQ qosUpstream;
+//	SpoQ qosDownstream;
+};
+
+} // namespace ariba
+
+#endif /* LINKPROPERTIES_H_ */
Index: /source/ariba/tidy/Module.cpp
===================================================================
--- /source/ariba/tidy/Module.cpp	(revision 2378)
+++ /source/ariba/tidy/Module.cpp	(revision 2378)
@@ -0,0 +1,82 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#include "Module.h"
+
+namespace ariba {
+
+// dummy
+Module::Module() {
+}
+
+// dummy
+Module::~Module() {
+}
+
+// dummy
+void Module::initialize() {
+}
+
+// dummy
+void Module::start() {
+}
+
+// dummy
+void Module::stop() {
+}
+
+// dummy
+string Module::getName() const {
+	return string("<empty module>");
+}
+
+// dummy
+void Module::setProperty( string key, string value ) {
+}
+
+// dummy
+const string Module::getProperty( string key ) const {
+	return string("<n/a>");
+}
+
+// dummy
+const vector<string> Module::getProperties() const {
+	return vector<string>();
+}
+
+} // namespace ariba
Index: /source/ariba/tidy/Module.h
===================================================================
--- /source/ariba/tidy/Module.h	(revision 2378)
+++ /source/ariba/tidy/Module.h	(revision 2378)
@@ -0,0 +1,112 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#ifndef MODULE_H_
+#define MODULE_H_
+
+#include <string>
+#include <vector>
+
+// usings
+using std::vector;
+using std::string;
+
+namespace ariba {
+
+/**
+ * This class serves as base class for generic modules that
+ * can be initialized, started, stopped and configured using standard
+ * human-readable properties.
+ *
+ * @author Sebastian Mies <mies@tm.uka.de>
+ */
+class Module {
+public:
+	Module();
+	virtual ~Module();
+
+	/**
+	 * This method (re-)initializes this module.
+	 */
+	virtual void initialize();
+
+	/**
+	 * This method (re-)starts this module
+	 */
+	virtual void start();
+
+	/**
+	 * This method stops this module
+	 */
+	virtual void stop();
+
+	/**
+	 * Returns the name of this module
+	 *
+	 * @return The name of this module
+	 */
+	virtual string getName() const;
+
+	/**
+	 * Sets a property in this module
+	 *
+	 * @param key The key of the property
+	 * @param value The value of the property
+	 */
+	virtual void setProperty( string key, string value );
+
+	/**
+	 * Returns the value of a specified property
+	 *
+	 * @param key The key of the property
+	 * @return The value of the property
+	 */
+	virtual const string getProperty( string key ) const;
+
+	/**
+	 * Returns a vector containing all possible property keys in a
+	 * human-readable form
+	 *
+	 * @return A vector containing all possible property keys
+	 */
+	virtual const vector<string> getProperties() const;
+};
+
+} // namespace ariba
+
+#endif /* MODULE_H_ */
Index: /source/ariba/tidy/Name.cpp
===================================================================
--- /source/ariba/tidy/Name.cpp	(revision 2378)
+++ /source/ariba/tidy/Name.cpp	(revision 2378)
@@ -0,0 +1,48 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#include "Name.h"
+
+namespace ariba {
+const Name Name::UNSPECIFIED;
+}
+
+std::ostream& operator<<( std::ostream& s, const ariba::Name& n ) {
+	return s << n.toString();
+}
+
Index: /source/ariba/tidy/Name.h
===================================================================
--- /source/ariba/tidy/Name.h	(revision 2378)
+++ /source/ariba/tidy/Name.h	(revision 2378)
@@ -0,0 +1,213 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#ifndef NAME_H_
+#define NAME_H_
+
+#include <iostream>
+#include <memory.h>
+
+// forward declaration
+namespace ariba { class Name; }
+
+std::ostream& operator<<( std::ostream&, const ariba::Name& );
+
+#include "Identifiers.h"
+
+namespace ariba {
+
+/**
+ * This class is a wrapper for canonical names.
+ * Currently only human readable names are supported.
+ *
+ * @author Sebastian Mies <mies@tm.uka.de>
+ */
+class Name {
+	friend std::ostream& operator<<( std::ostream&, const ::ariba::Name& );
+
+private:
+	bool _hreadable;
+	bool _copy;
+	int _length;
+	uint8_t* _bytes;
+
+	inline void init(const char* name, int len, bool copy, bool hreadable) {
+		if (len == -1)
+			len = strlen(name);
+
+		if (copy) {
+			_bytes = new uint8_t[len];
+			memcpy(_bytes, name, len);
+		} else {
+			_bytes = (uint8_t*)name;
+		}
+
+		_copy = copy;
+		_length = len;
+		_hreadable = hreadable;
+	}
+
+public:
+	static const Name UNSPECIFIED;
+
+public:
+	/**
+	 * Constructs a new, yet unspecified name.
+	 */
+	inline Name() {
+		_bytes = NULL;
+		_length = 0;
+		_copy = false;
+		_hreadable = false;
+	}
+
+	/**
+	 * Constructs a new name. If no length is specified, a human-readable
+	 * name is assumed.
+	 *
+	 * @param name The name
+	 * @param len The optional name length, if binary data is used as name
+	 * @param copy A flag, whether the name's memory needs to be copied
+	 */
+	inline Name(const char* name, int len = -1, bool copy = false) {
+		init(name, len, copy, len == -1);
+	}
+
+	/**
+	 * Constructs a new name out of a human readable string.
+	 *
+	 * @param name A human readable name
+	 */
+	inline Name(std::string name) {
+		init(name.c_str(), -1, true, true);
+	}
+
+	/**
+	 * The copy constructor.
+	 */
+	inline Name(const Name& name) {
+		init((const char*)name.bytes(), name.length(), true, name._hreadable);
+	}
+
+	/**
+	 * Destroys the name and releases underlying memory if this name is a copy.
+	 */
+	inline ~Name() {
+		if (_copy) delete _bytes;
+	}
+
+	/**
+	 * Returns the binary bytes of the name
+	 *
+	 * @return The binary data
+	 */
+	inline const uint8_t* bytes() const {
+		return _bytes;
+	}
+
+	/**
+	 * Returns the length of the name in bytes.
+	 *
+	 * @return The length of the name
+	 */
+	inline const size_t length() const {
+		return _length;
+	}
+
+	/**
+	 * The common implementation of the "equal" operator.
+	 */
+	inline bool operator==(const Name& name) const {
+		if (_bytes == NULL || name._bytes == NULL) return false;
+		if (name.length() != length()) return false;
+		return (memcmp(name.bytes(), bytes(), length()) == 0);
+	}
+
+	/**
+	 * The common implementation of the "unequal" operator.
+	 */
+	inline bool operator!=(const Name& name) const {
+		return !(*this == name);
+	}
+
+	/**
+	 * Returns true, if the name is yet unspecified
+	 */
+	inline bool isUnspecified() {
+		return *this == UNSPECIFIED;
+	}
+
+	/**
+	 * Returns a random name.
+	 */
+	inline static Name random() {
+		char name[17];
+		for (int i=0;i<16; i++)
+			name[i] = ("abcdefghijklmnopqrstuvwxyz")[((unsigned)rand())%26];
+		name[16] = 0;
+		return Name(name);
+	}
+
+	/**
+	 * Returns a human-readable representation of this name
+	 */
+	inline std::string toString() const {
+		if (_hreadable) {
+			char str[256];
+			for (int i=0; i<length(); i++) str[i] = bytes()[i];
+			str[length()] = 0;
+			return std::string(str);
+		} else {
+			return std::string("<not readable>");
+		}
+	}
+
+	// hack: to be changed!
+	inline NodeID toNodeId() const {
+		return NodeID::sha1( bytes(), length() );
+	}
+
+	// hack: to be changed!
+	inline SpoVNetID toSpoVNetId() const {
+		return SpoVNetID::sha1(bytes(), length() );
+	}
+};
+
+} // namespace ariba
+
+#endif /* NAME_H_ */
Index: /source/ariba/tidy/Node.cpp
===================================================================
--- /source/ariba/tidy/Node.cpp	(revision 2378)
+++ /source/ariba/tidy/Node.cpp	(revision 2378)
@@ -0,0 +1,250 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+
+#include "Node.h"
+
+#include "ariba/overlay/BaseOverlay.h"
+#include "ariba/utility/types/OverlayParameterSet.h"
+#include "ariba/interface/AribaContext.h"
+#include "ariba/interface/ServiceInterface.h"
+#include "ariba/interface/UnderlayAbstraction.h"
+
+using ariba::interface::UnderlayAbstraction;
+
+namespace ariba {
+
+class ServiceInterfaceWrapper: public interface::ServiceInterface {
+private:
+	NodeListener* nodeListener;
+	CommunicationListener* commListener;
+public:
+	ServiceInterfaceWrapper(NodeListener* listener) :
+		nodeListener(listener), commListener(NULL) {
+
+	}
+	ServiceInterfaceWrapper(CommunicationListener* listener) :
+		nodeListener(NULL), commListener(listener) {
+	}
+
+protected:
+	void onOverlayCreate(const SpoVNetID& id) {
+
+	}
+	void onOverlayDestroy(const SpoVNetID& id) {
+
+	}
+
+	bool isJoinAllowed(const NodeID& nodeid, const SpoVNetID& spovnetid) {
+		return true;
+	}
+
+	void onNodeJoin(const NodeID& nodeid, const SpoVNetID& spovnetid) {
+		// not handled
+	}
+
+	void onNodeLeave(const NodeID& id, const SpoVNetID& spovnetid) {
+		// not handled
+	}
+
+	void onJoinSuccess(const SpoVNetID& spovnetid) {
+		if (nodeListener != NULL) nodeListener->onJoinCompleted(spovnetid);
+	}
+
+	void onJoinFail(const SpoVNetID& spovnetid) {
+		if (nodeListener != NULL) nodeListener->onJoinFailed(spovnetid);
+	}
+
+	void onLinkUp(const LinkID& link, const NodeID& local, const NodeID& remote) {
+		if (commListener != NULL) commListener->onLinkUp(link, remote);
+	}
+
+	void onLinkDown(const LinkID& link, const NodeID& local,
+			const NodeID& remote) {
+		if (commListener != NULL) commListener->onLinkDown(link, remote);
+	}
+
+	void onLinkChanged(const LinkID& link, const NodeID& local,
+			const NodeID& remote) {
+		if (commListener != NULL) commListener->onLinkChanged(link, remote);
+	}
+
+	void onLinkFail(const LinkID& id, const NodeID& local, const NodeID& remote) {
+		if (commListener != NULL) commListener->onLinkFail(id, remote);
+	}
+
+	void onLinkQoSChanged(const LinkID& id, const NodeID& local,
+			const NodeID& remote, const QoSParameterSet& qos) {
+		if (commListener != NULL) commListener->onLinkQoSChanged(id, remote,
+				LinkProperties::DEFAULT);
+	}
+
+	bool receiveMessage(const Message* message, const LinkID& link,
+			const NodeID& node) {
+		if (commListener != NULL) commListener->onMessage(
+				const_cast<Message*> (message), node, link);
+	}
+};
+
+const ServiceID Node::anonymousService = 0xFF00;
+
+Node::Node(AribaModule& ariba_mod, const Name& name) :
+	ariba_mod(ariba_mod), name(name) {
+	this->context = NULL;
+}
+
+Node::~Node() {
+}
+
+void Node::join(const Name& vnetname) {
+	spovnetId = vnetname.toSpoVNetId();
+	nodeId = name.toNodeId();
+	this->context = ariba_mod.underlay_abs->joinSpoVNet(spovnetId,
+			*ariba_mod.getBootstrapNode(name), nodeId);
+}
+
+void Node::initiate(const Name& vnetname, const SpoVNetProperties& parm) {
+	utility::OverlayParameterSet ovrpset =
+		(utility::OverlayParameterSet::_OverlayStructure) parm.getBaseOverlayType();
+	spovnetId = vnetname.toSpoVNetId();
+	nodeId = name.toNodeId();
+	this->context = ariba_mod.underlay_abs->createSpoVNet(spovnetId, nodeId,
+			ariba_mod.ip_addr, ariba_mod.tcp_port);
+}
+
+void Node::leave() {
+	// not implemeted yet.
+}
+
+void Node::bind(NodeListener* listener) {
+	this->context->getOverlay().bind(new ServiceInterfaceWrapper(listener),
+			Node::anonymousService);
+}
+
+void Node::unbind(NodeListener* listener) {
+	// TODO: allow unbinding
+}
+
+const SpoVNetProperties& Node::getSpoVNetProperties() const {
+	return SpoVNetProperties::DEFAULT;
+}
+
+const SpoVNetID& Node::getSpoVNetId() const {
+	return SpoVNetID::UNSPECIFIED;
+}
+
+const NodeID& Node::getNodeId(const LinkID& lid) const {
+	return NodeID::UNSPECIFIED;
+}
+
+NodeID Node::generateNodeId(const Name& name) const {
+	return name.toNodeId();
+}
+
+LinkID Node::establishLink(const NodeID& nid, const ServiceID& sid,
+		const LinkProperties& req, const Message* msg) {
+	return context->getOverlay().establishLink(nid, sid);
+}
+
+void Node::dropLink(const LinkID& lnk) {
+	context->getOverlay().dropLink(lnk);
+}
+
+seqnum_t Node::sendMessage(Message* msg, const NodeID& nid,
+		const ServiceID& sid, const LinkProperties& req) {
+	return context->getOverlay().sendMessage(msg, nid, sid);
+}
+
+seqnum_t Node::sendMessage(Message* msg, const LinkID& lnk) {
+	return context->getOverlay().sendMessage(msg, lnk);
+}
+
+void Node::bind(CommunicationListener* listener, const ServiceID& sid) {
+	this->context->getOverlay().bind(new ServiceInterfaceWrapper(listener), sid);
+}
+
+void Node::unbind(CommunicationListener* listener, const ServiceID& sid) {
+	// TODO
+}
+
+// service directory
+/*
+ void Node::put(const Identifier<>& key, Message* value) {
+ }
+
+ void Node::get(const Identifier<>& key) {
+
+ }
+ */
+
+// @see Module.h
+void Node::initialize() {
+
+}
+
+// @see Module.h
+void Node::start() {
+
+}
+
+// @see Module.h
+void Node::stop() {
+
+}
+
+// @see Module.h
+string Node::getName() const {
+
+}
+
+// @see Module.h
+void Node::setProperty(string key, string value) {
+
+}
+
+// @see Module.h
+const string Node::getProperty(string key) const {
+
+}
+
+// @see Module.h
+const vector<string> Node::getProperties() const {
+
+}
+
+} // namespace ariba
Index: /source/ariba/tidy/Node.h
===================================================================
--- /source/ariba/tidy/Node.h	(revision 2378)
+++ /source/ariba/tidy/Node.h	(revision 2378)
@@ -0,0 +1,323 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+
+#ifndef NODE_H_
+#define NODE_H_
+
+// forward declarations
+namespace ariba {
+class Node;
+}
+
+#include "Module.h"
+#include "Identifiers.h"
+#include "SpoVNetProperties.h"
+#include "NodeListener.h"
+#include "Name.h"
+#include "AribaModule.h"
+#include "TidyCommunicationListener.h"
+#include "TidyMessage.h"
+
+namespace ariba {
+
+// forward declaration
+namespace interface {
+class AribaContext;
+class ServiceInterface;
+}
+
+/**
+ * This class should implement all ariba node functionality.
+ *
+ * @author Sebastian Mies <mies@tm.uka.de>
+ */
+class Node: public Module {
+public:
+	/**
+	 * Constructs a new node using a given ariba module
+	 *
+	 * @param ariba_mod The ariba module
+	 * @param name The canonical node name of the new node. When NULL a
+	 *   randomly chosen name is created.
+	 * @param len The length of the canonical node name or -1, if the name
+	 *   is a zero-terminated char-string.
+	 */
+	Node(AribaModule& ariba_mod, const Name& name = Name::UNSPECIFIED);
+
+	/**
+	 * Destroys the node. Before destruction some pre-conditions
+	 * must be met:<br />
+	 *
+	 * 1. The node is not part of any SpoVNet <br />
+	 * 2. All listeners must be unbound from this node <br />
+	 * 3. The module has been stopped<br />
+	 */
+	~Node();
+
+	//--- node control ---
+
+	/**
+	 * This method instructs the node to join a particular spovnet.
+	 * Callees may bind with a NodeListener to receive events, when
+	 * a node has been successfully joined.
+	 *
+	 * @param vnetId The SpoVNet name
+	 */
+	void join(const Name& name);
+
+	/**
+	 * This method initiates a new SpoVNet with the given SpoVNetID and
+	 * parameters.
+	 *
+	 * @param name The SpoVNet name
+	 * @param param The SpoVNet properties
+	 */
+	void initiate(const Name& name, const SpoVNetProperties& parm =
+			SpoVNetProperties::DEFAULT);
+
+	/**
+	 * This method initiates the leave procedure of this node.
+	 */
+	void leave();
+
+	/**
+	 * This method is used to bind a node listener to this node.
+	 *
+	 * @param listener The node listener
+	 */
+	void bind(NodeListener* listener);
+
+	/**
+	 * This method is used to unbind a node listener to this node.
+	 *
+	 * @param listener The node listener
+	 */
+	void unbind(NodeListener* listener);
+
+	//--- spovnet properties ---
+
+	/**
+	 * Returns the properties of the spovnet the node has joined.
+	 *
+	 * @return The properties of the spovnet the node has joined
+	 */
+	const SpoVNetProperties& getSpoVNetProperties() const;
+
+	/**
+	 * Returns the spovnet identifier
+	 *
+	 * @return The spovnet idenfifier
+	 */
+	const SpoVNetID& getSpoVNetId() const;
+
+	/**
+	 * Returns true, if the node is part of a spovnet.
+	 *
+	 * @return True, if the node is part of a spovnet
+	 */
+	bool isJoined() const;
+
+	//--- addressing ---
+
+	/**
+	 * Returns the node id of this node if the link id is unspecified or
+	 * the node id of the remote node.
+	 *
+	 * @return The local or the remote node identifier
+	 */
+	const NodeID& getNodeId(const LinkID& lid = LinkID::UNSPECIFIED) const;
+
+	/**
+	 * Returns the node id to a node name according to the currently joined
+	 * spovnet (usually derives a node identifier by hashing the name).
+	 *
+	 * @return The node identifier to the given name
+	 */
+	NodeID generateNodeId(const Name& name) const;
+
+	/**
+	 * Returns the name of this node if the link id is unspecified or
+	 * the node name of the remote node, if known -- otherwise it returns
+	 * an unspecified name.
+	 *
+	 * TODO: RFE -- send request to remote node and inform service.
+	 *
+	 * @return A node's name or an unspecified name, if unknown
+	 */
+	const Name getNodeName(const LinkID& lid = LinkID::UNSPECIFIED) const;
+
+	//--- communication ---
+
+	/**
+	 * Establishes a new link to another node and service with the given
+	 * link properties. An optional message could be sent with the request.
+	 *
+	 * @param nid The remote node identifier
+	 * @param sid The remote service identifier
+	 * @param req The required link properties
+	 * @param msg An optional message that is sent with the request
+	 * @return A new link id
+	 */
+	LinkID establishLink(const NodeID& nid, const ServiceID& sid,
+			const LinkProperties& req = LinkProperties::DEFAULT,
+			const Message* msg = NULL);
+
+	/**
+	 * This method drops an established link.
+	 *
+	 * @param lnk The link identifier of an active link
+	 */
+	void dropLink(const LinkID& lnk);
+
+	// message sending
+
+	/**
+	 * Sends a one-shot message to a service. If link properties are specified,
+	 * the node tries to fulfill those requirements. This may cause the node
+	 * to first establish a temporary link, second sending the message and last
+	 * dropping the link. This would result in a small amount of extra latency
+	 * until the message is delivered. If reliable transport was selected,
+	 * the method returns a sequence number and a communication event is
+	 * triggered on message delivery or loss.
+	 *
+	 * @param msg The message to be sent
+	 * @param nid The remote node identifier
+	 * @param sid The remote service identifier
+	 * @param req The requirements associated with the message
+	 * @return A sequence number
+	 */
+	seqnum_t sendMessage(Message* msg, const NodeID& nid, const ServiceID& sid,
+			const LinkProperties& req = LinkProperties::DEFAULT);
+
+	/**
+	 * Sends a message via an established link. If reliable transport was
+	 * selected, the method returns a sequence number and a communication event
+	 * is triggered on message delivery or loss.
+	 *
+	 * @param msg The message to be sent
+	 * @param lnk The link to be used for sending the message
+	 */
+	seqnum_t sendMessage(Message* msg, const LinkID& lnk);
+
+	// --- communication listeners ---
+
+	/**
+	 * Binds a listener to a specifed service identifier.
+	 * Whenever a link is established/dropped or messages are received the
+	 * events inside the interface are called.
+	 *
+	 * @param listener The listener to be registered
+	 * @param sid The service identifier
+	 */
+	void bind(CommunicationListener* listener, const ServiceID& sid);
+
+	/**
+	 * Un-binds a listener from this node.
+	 *
+	 * @param The listener to be unbound
+	 */
+	void unbind(CommunicationListener* listener, const ServiceID& sid);
+
+	// --- extension proposal: service directory -- TODO
+	// main-idea: use this methods to register groups/rendevous points inside
+	// the base overlay via a distributed storage service.
+	//
+	//void put(const KeyID& key, Message* value);
+	//void get(const KeyID& key);
+	//-------------------------------------------------------------------------
+	//
+	// --- optimization proposal: allow direct endpoint descriptor exchange ---
+	// main-idea: directly allow exchanging endpoint descriptors to establish
+	// links. Depending on the overlay structure used in the base overlay, this
+	// allows a node to directly establish links between two nodes when an
+	// endpoint descriptor is known.
+	//
+	//const EndpointDescriptor& getEndpointDescriptor( const LinkID& lid );
+	//void sendMessage( EndpointDescriptor& epd, Message* msg );
+	//LinkID setupLink( const EndpointDescriptor& endpointDesc,
+	//		const LinkProperties& req = LinkProperties::UNSPECIFIED,
+	//		const Message* msg = NULL );
+	//
+	//-------------------------------------------------------------------------
+
+	// --- module implementation ---
+	//
+	// main-idea: use module properties to configure nodeid, spovnetid etc. and
+	// select start/stop procedures. This allows simulations to start a
+	// node without manually calling join etc.
+
+	/** @see Module.h */
+	void initialize();
+
+	/** @see Module.h */
+	void start();
+
+	/** @see Module.h */
+	void stop();
+
+	/** @see Module.h */
+	string getName() const;
+
+	/** @see Module.h */
+	void setProperty(string key, string value);
+
+	/** @see Module.h */
+	const string getProperty(string key) const;
+
+	/** @see Module.h */
+	const vector<string> getProperties() const;
+
+protected:
+	// friends
+	friend class AribaModule;
+
+	// member variables
+	Name name;				//< node name
+	AribaModule& ariba_mod;	//< ariba module
+	SpoVNetID spovnetId; 	//< current spovnet id
+	NodeID nodeId; 			//< current node id
+
+	// delegates
+	interface::AribaContext* context;
+	static const ServiceID anonymousService;
+};
+
+} // namespace ariba
+
+#endif /* NODE_H_ */
Index: /source/ariba/tidy/NodeListener.cpp
===================================================================
--- /source/ariba/tidy/NodeListener.cpp	(revision 2378)
+++ /source/ariba/tidy/NodeListener.cpp	(revision 2378)
@@ -0,0 +1,68 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+
+#include "NodeListener.h"
+
+namespace ariba {
+
+// dummy
+NodeListener::NodeListener() {
+}
+
+// dummy
+NodeListener::~NodeListener() {
+}
+
+// dummy
+void NodeListener::onJoinCompleted(const SpoVNetID& vid ) {
+}
+
+// dummy
+void NodeListener::onJoinFailed(const SpoVNetID& vid ) {
+}
+
+// dummy
+void NodeListener::onLeaveCompleted(const SpoVNetID& vid ) {
+}
+
+// dummy
+void NodeListener::onLeaveFailed(const SpoVNetID& vid ) {
+}
+
+} // namespace ariba
Index: /source/ariba/tidy/NodeListener.h
===================================================================
--- /source/ariba/tidy/NodeListener.h	(revision 2378)
+++ /source/ariba/tidy/NodeListener.h	(revision 2378)
@@ -0,0 +1,103 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#ifndef NODELISTENER_H_
+#define NODELISTENER_H_
+
+// forward declaration
+namespace ariba {
+class NodeListener;
+class Node;
+class ServiceInterfaceWrapper;
+}
+
+#include "Identifiers.h"
+
+namespace ariba {
+
+/**
+ * This class is used to inform a listener about node changes.
+ *
+ * @author Sebastian Mies <mies@tm.uka.de>
+ */
+class NodeListener {
+	friend class Node;
+	friend class ServiceInterfaceWrapper;
+public:
+
+	NodeListener();
+	virtual ~NodeListener();
+
+protected:
+	/**
+	 * This event method is called, when a node has completed its join
+	 * procedure.
+	 *
+	 * @param vid The spovnet id
+	 * @param nid The node id
+	 */
+	virtual void onJoinCompleted( const SpoVNetID& vid );
+
+	/**
+	 * This event method is called, when a node failed to join a spovnet.
+	 *
+	 * @param vid The spovnet id
+	 * @param nid The node id
+	 */
+	virtual void onJoinFailed( const SpoVNetID& vid );
+
+	/**
+	 * This event method is called, when a node succeeded to leave a spovnet.
+	 *
+	 * @param vid The spovnet id
+	 * @param nid The node id
+	 */
+	virtual void onLeaveCompleted( const SpoVNetID& vid );
+
+	/**
+	 * This event method is called, when a node failed to leave a spovnet.
+	 *
+	 * @param vid The spovnet id
+	 * @param nid The node id
+	 */
+	virtual void onLeaveFailed( const SpoVNetID& vid );
+};
+
+} // namespace ariba
+
+#endif /* NODELISTENER_H_ */
Index: /source/ariba/tidy/SpoVNetProperties.cpp
===================================================================
--- /source/ariba/tidy/SpoVNetProperties.cpp	(revision 2378)
+++ /source/ariba/tidy/SpoVNetProperties.cpp	(revision 2378)
@@ -0,0 +1,45 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#include "SpoVNetProperties.h"
+
+namespace ariba {
+
+const SpoVNetProperties SpoVNetProperties::DEFAULT;
+
+}
Index: /source/ariba/tidy/SpoVNetProperties.h
===================================================================
--- /source/ariba/tidy/SpoVNetProperties.h	(revision 2378)
+++ /source/ariba/tidy/SpoVNetProperties.h	(revision 2378)
@@ -0,0 +1,192 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#ifndef SPOVNETPROPERTIES_H_
+#define SPOVNETPROPERTIES_H_
+
+#include <string>
+#include <iostream>
+#include <streambuf>
+
+using std::string;
+
+namespace ariba {
+// forward declaration
+class SpoVNetProperties;
+}
+
+#include "Identifiers.h"
+#include "Name.h"
+
+namespace ariba {
+
+/**
+ * This class implements a container that holds all properties of a
+ * SpoVNet instance. It may evolve with new features when new features
+ * are introduced.
+ *
+ * @author Sebastian Mies <mies@tm.uka.de>
+ */
+class SpoVNetProperties {
+public:
+	enum OverlayType {
+		ONE_HOP_OVERLAY = 0,
+		CHORD_OVERLAY = 1,
+		KADEMLIA_OVERLAY = 2,
+	};
+private:
+	Name name;
+	SpoVNetID id;
+	uint8_t  type;
+	uint16_t idLength;
+	NodeID initiator;
+	bool hidden;
+
+public:
+	/**
+	 * This object holds the default settings for a newly created spovnet
+	 * instance.
+	 */
+	const static SpoVNetProperties DEFAULT;
+
+public:
+	/**
+	 * Constructs a new default SpoVnet property object.
+	 */
+	SpoVNetProperties() {
+		name = Name::random();
+		id = name.toSpoVNetId();
+		type = ONE_HOP_OVERLAY;
+		idLength = 192;
+		initiator = NodeID::UNSPECIFIED;
+		hidden = false;
+	}
+
+	/**
+	 * Constructs a new SpoVnet property object.
+	 *
+	 * TODO: replace with setters! for downwards compatibility
+	 */
+	/*
+	SpoVNetProperties(const Name& name, SpoVNetID id, OverlayType type,
+			uint16_t idLength, const NodeID& initiator, bool hidden = false) :
+		name(name), id(id), type(type), idLength(idLength),
+				initiator(initiator), hidden(hidden) {
+	}*/
+
+	/**
+	 * Copy constructor.
+	 */
+	SpoVNetProperties(const SpoVNetProperties& copy) {
+		this->name = copy.name;
+		this->id = copy.id;
+		this->type = copy.type;
+		this->idLength = copy.idLength;
+		this->initiator = copy.initiator;
+		this->hidden = copy.hidden;
+	}
+
+	/**
+	 * Destructor.
+	 */
+	~SpoVNetProperties() {
+	}
+
+	/**
+	 * Returns the canonical SpoVNet name
+	 */
+	const Name& getName() const {
+		return name;
+	}
+
+	/**
+	 * Returns the SpoVNet id
+	 */
+	const SpoVNetID& getId() const {
+		return id;
+	}
+
+	/**
+	 * Returns the node id of the initiator of the spovnet.
+	 * If the node id is unspecified, the initiator wanted to be anonymous.
+	 */
+	const NodeID& getInitiator() const {
+		return initiator;
+	}
+
+	/**
+	 * Returns the node identifier length in bites
+	 */
+	uint16_t getIdentifierLength() const {
+		return idLength;
+	}
+
+	/**
+	 * Returns the overlay type.
+	 */
+	const OverlayType getBaseOverlayType() const {
+		return (OverlayType)type;
+	}
+
+	/**
+	 * Returns true, if the spovnet is hidden
+	 */
+	bool isHidden() const {
+		return hidden;
+	}
+
+	/**
+	 * Returns a human readable string representation of the SpoVNet properties
+	 *
+	 * @return A human readable string representation of the SpoVNet properties
+	 */
+	std::string toString() const {
+		std::ostringstream buf;
+		buf << "spovnet"
+			<< " name=" << name.toString()
+			<< " id=" << id.toString()
+				<< " base_overlay_type=" << type << " id_length="
+				<< idLength << " initiator=" << initiator
+				<< " hidden=" << hidden;
+		return buf.str();
+	}
+};
+
+}
+
+#endif /* SPOVNETPROPERTIES_H_ */
Index: /source/ariba/tidy/TidyCommunicationListener.cpp
===================================================================
--- /source/ariba/tidy/TidyCommunicationListener.cpp	(revision 2378)
+++ /source/ariba/tidy/TidyCommunicationListener.cpp	(revision 2378)
@@ -0,0 +1,86 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#include "TidyCommunicationListener.h"
+
+namespace ariba {
+
+// dummy
+CommunicationListener::CommunicationListener() {
+}
+
+// dummy
+CommunicationListener::~CommunicationListener() {
+}
+
+// dummy
+void CommunicationListener::onLinkUp(const LinkID& l, const NodeID& r) {
+}
+
+// dummy
+void CommunicationListener::onLinkDown(const LinkID& l, const NodeID& r) {
+}
+
+// dummy
+void CommunicationListener::onLinkChanged(const LinkID& l, const NodeID& r) {
+}
+
+// dummy
+void CommunicationListener::onLinkFail(const LinkID& l, const NodeID& r) {
+}
+
+// dummy
+void CommunicationListener::onLinkQoSChanged(const LinkID& l, const NodeID& r,
+		const LinkProperties& p) {
+}
+
+// dummy
+bool CommunicationListener::onLinkRequest(const NodeID& remote, Message* msg) {
+	return false;
+}
+
+// dummy
+void CommunicationListener::onMessage(Message* msg, const NodeID& remote,
+		const LinkID& lnk) {
+}
+
+// dummy
+void CommunicationListener::onMessageSent(seqnum_t seq_num, bool failed, Message* msg) {
+}
+
+} // namespace ariba
Index: /source/ariba/tidy/TidyCommunicationListener.h
===================================================================
--- /source/ariba/tidy/TidyCommunicationListener.h	(revision 2378)
+++ /source/ariba/tidy/TidyCommunicationListener.h	(revision 2378)
@@ -0,0 +1,95 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#ifndef COMMUNICATIONLISTENER_H_
+#define COMMUNICATIONLISTENER_H_
+
+namespace ariba {
+// forward declaration
+class CommunicationListener;
+class ServiceInterfaceWrapper;
+}
+
+#include "TidyMessage.h"
+#include "Identifiers.h"
+#include "LinkProperties.h"
+
+namespace ariba {
+
+/**
+ *
+ */
+class CommunicationListener {
+	friend class Node;
+	friend class ServiceInterfaceWrapper;
+protected:
+	CommunicationListener();
+	virtual ~CommunicationListener();
+
+	// --- link events ---
+
+	virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
+
+	virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
+
+	virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote);
+
+	virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
+
+	virtual void onLinkQoSChanged(const LinkID& lnk, const NodeID& remote,
+			const LinkProperties& prop);
+
+	// --- service specific events ---
+
+	virtual bool onLinkRequest(const NodeID& remote, Message* msg);
+
+	// --- general receive method ---
+
+	virtual void onMessage(Message* msg, const NodeID& remote,
+			const LinkID& lnk = LinkID::UNSPECIFIED);
+
+	virtual void onMessageSent(seqnum_t seq_num, bool failed, Message* msg = NULL);
+
+	// --- dht functionality ---
+	//	virtual void onGetResponse( const Identifier<> id, const Message* msg );
+	//	virtual void onPutResponse( const Identifier<> id, const Message* msg );
+};
+
+} // namespace ariba
+
+#endif /* COMMUNICATIONLISTENER_H_ */
Index: /source/ariba/tidy/TidyMessage.cpp
===================================================================
--- /source/ariba/tidy/TidyMessage.cpp	(revision 2378)
+++ /source/ariba/tidy/TidyMessage.cpp	(revision 2378)
@@ -0,0 +1,44 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#include "TidyMessage.h"
+
+namespace ariba {
+
+
+} // namespace ariba
Index: /source/ariba/tidy/TidyMessage.h
===================================================================
--- /source/ariba/tidy/TidyMessage.h	(revision 2378)
+++ /source/ariba/tidy/TidyMessage.h	(revision 2378)
@@ -0,0 +1,50 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#ifndef TIDYMESSAGE_H_
+#define TIDYMESSAGE_H_
+
+#include <inttypes.h>
+#include "ariba/utility/messages.h"
+
+namespace ariba {
+typedef uint16_t seqnum_t;
+typedef utility::Message Message;
+} // namespace ariba
+
+#endif /* MESSAGE_H_ */
Index: /source/ariba/tidy/ariba.h
===================================================================
--- /source/ariba/tidy/ariba.h	(revision 2378)
+++ /source/ariba/tidy/ariba.h	(revision 2378)
@@ -0,0 +1,56 @@
+// [License]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [License]
+
+#ifndef ARIBA_H_
+#define ARIBA_H_
+
+/**
+ * This file includes all standard headers for a working ariba substrate
+ */
+#include "Module.h"
+#include "Identifiers.h"
+#include "AribaModule.h"
+#include "LinkProperties.h"
+#include "TidyMessage.h"
+#include "TidyCommunicationListener.h"
+#include "Name.h"
+#include "Node.h"
+#include "NodeListener.h"
+#include "SpoVNetProperties.h"
+
+#endif /* ARIBA_H_ */
Index: urce/ariba/utility/CMakeLists.txt
===================================================================
--- /source/ariba/utility/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,60 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    messages.h
-    serialization.h
-    types.h
-    )
-
-add_subdir_sources(
-    addressing
-    addressing2
-    bootstrap
-    configuration
-    internal
-    logging
-    messages
-    misc
-    serialization
-    system
-    transport
-    types
-    visual
-    vtypes
-    )
Index: urce/ariba/utility/configuration/CMakeLists.txt
===================================================================
--- /source/ariba/utility/configuration/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,47 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    ConfigFile.h
-    Configuration.h
-    )
-
-add_sources(
-    ConfigFile.cpp
-    Configuration.cpp
-    )
Index: /source/ariba/utility/configuration/ConfigFile.cpp
===================================================================
--- /source/ariba/utility/configuration/ConfigFile.cpp	(revision 12775)
+++ /source/ariba/utility/configuration/ConfigFile.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // ConfigFile.h
 // Class for reading named values from configuration files
@@ -23,13 +23,9 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // IN THE SOFTWARE.
-// [License]
+// [Licence]
 
 #include "ConfigFile.h"
 
 using std::string;
-
-namespace ariba {
-namespace utility {
-
 
 ConfigFile::ConfigFile( string filename, string delimiter,
@@ -169,4 +165,2 @@
 	return is;
 }
-
-}}
Index: /source/ariba/utility/configuration/ConfigFile.h
===================================================================
--- /source/ariba/utility/configuration/ConfigFile.h	(revision 12775)
+++ /source/ariba/utility/configuration/ConfigFile.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // ConfigFile.h
 // Class for reading named values from configuration files
@@ -23,5 +23,5 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // IN THE SOFTWARE.
-// [License]
+// [Licence]
 
 
@@ -54,7 +54,4 @@
 
 using std::string;
-
-namespace ariba {
-namespace utility {
 
 class ConfigFile {
@@ -238,6 +235,4 @@
 }
 
-}}
-
 #endif  // CONFIGFILE_H
 
Index: /source/ariba/utility/configuration/Configuration.cpp
===================================================================
--- /source/ariba/utility/configuration/Configuration.cpp	(revision 12775)
+++ /source/ariba/utility/configuration/Configuration.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "Configuration.h"
@@ -51,18 +51,9 @@
 void Configuration::setConfigFilename(string filename){
 	CONFIG_FILE = filename;
-	if(haveConfig())
-		instance().reload();
+	instance().reload();
 }
 
 Configuration::~Configuration(){
 	delete config;
-}
-
-bool Configuration::haveConfig(){
-	std::ifstream in( CONFIG_FILE.c_str() );
-	if( !in ) return false;
-
-	in.close();
-	return true;
 }
 
@@ -73,5 +64,4 @@
 
 bool Configuration::exists(const string& name){
-	if(config == NULL) return false;
 	return config->keyExists( name );
 }
Index: /source/ariba/utility/configuration/Configuration.h
===================================================================
--- /source/ariba/utility/configuration/Configuration.h	(revision 12775)
+++ /source/ariba/utility/configuration/Configuration.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __CONFIGURATION_H
@@ -63,5 +63,4 @@
 	static Configuration& instance();
 	static void setConfigFilename(string filename);
-	static bool haveConfig();
 
 	/**
Index: urce/ariba/utility/internal/CMakeLists.txt
===================================================================
--- /source/ariba/utility/internal/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,39 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(Utilities.hpp)
Index: /source/ariba/utility/internal/Utilities.hpp
===================================================================
--- /source/ariba/utility/internal/Utilities.hpp	(revision 12775)
+++ /source/ariba/utility/internal/Utilities.hpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,10 +35,9 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef UTILITIES_HPP_
 #define UTILITIES_HPP_
 
-#include "ariba/config.h"
 #include <boost/cstdint.hpp>
 #include <boost/type_traits.hpp>
@@ -47,9 +46,5 @@
 /* force inline macro */
 #ifndef finline
-	#ifdef HAVE_MAEMO
-		#define finline inline
-	#else
-		#define finline inline __attribute__((always_inline))
-	#endif
+#define finline inline __attribute__((always_inline))
 #endif
 
@@ -65,6 +60,6 @@
 /* check whether X is a signed integer */
 #define if_int(X) \
-	typename boost::enable_if<boost::is_integral<X>,void*>::type __i##X = NULL,\
-	typename boost::enable_if<boost::is_signed<X>,void*>::type __s##X = NULL
+	typename boost::enable_if<boost::is_integral<X>,int>::type __i##X = 0,\
+	typename boost::enable_if<boost::is_signed<X>,int>::type __s##X = 0
 
 /* signature conversion */
@@ -79,4 +74,3 @@
 CONVERT_SIGN( uint32_t, int32_t );
 CONVERT_SIGN( uint64_t, int64_t );
-
 #endif /* UTILITIES_HPP_ */
Index: urce/ariba/utility/logging/CMakeLists.txt
===================================================================
--- /source/ariba/utility/logging/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,39 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(Logging.h)
Index: /source/ariba/utility/logging/Logging.h
===================================================================
--- /source/ariba/utility/logging/Logging.h	(revision 12775)
+++ /source/ariba/utility/logging/Logging.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef LOGGING_H__
@@ -42,79 +42,25 @@
 #include <iostream>
 #include <cstdlib>
-#include "ariba/config.h"
+#include <log4cxx/logger.h>
+#include <log4cxx/basicconfigurator.h>
 
-#ifdef HAVE_LOG4CXX
-	#include <log4cxx/logger.h>
-	#include <log4cxx/basicconfigurator.h>
-#endif // HAVE_LOG4CXX
+#define colorDefault { std::cout << "\033[0m";  } /*reset*/
+#define colorDebug   { std::cout << "\033[37m"; } /*gray*/
+#define colorInfo    { std::cout << "\033[32m"; } /*green*/
+#define colorWarn    { std::cout << "\033[34m"; } /*blue*/
+#define colorError   { std::cout << "\033[31m"; } /*red*/
 
-#ifdef LOGCOLORS
-  #define colorDefault { std::cout << "\033[0m";    } /*reset*/
-  #define colorDebug   { std::cout << "\033[0;33m"; } /*cyan*/
-  #define colorInfo    { std::cout << "\033[0;32m"; } /*green*/
-  #define colorWarn    { std::cout << "\033[0;34m"; } /*blue*/
-  #define colorError   { std::cout << "\033[0;31m"; } /*red*/
-#else
-  #define colorDefault { }
-  #define colorDebug   { }
-  #define colorInfo    { }
-  #define colorWarn    { }
-  #define colorError   { }
-#endif // ENABLE_LOGCOLORS
+#define use_logging_h(x) \
+	private: static log4cxx::LoggerPtr logger;
 
-
-#ifdef HAVE_LOG4CXX
-
-  #define use_logging_h(x) \
-  	private: static log4cxx::LoggerPtr logger;
-
-  #define use_logging_cpp(x) \
+#define use_logging_cpp(x) \
 	log4cxx::LoggerPtr x::logger(log4cxx::Logger::getLogger(#x));
 
-  #define logging_trace(x)  {            LOG4CXX_TRACE(logger,x);                         }
-  #define logging_debug(x)  {colorDebug; LOG4CXX_DEBUG(logger,x); colorDefault;           }
-  #define logging_info(x)   {colorInfo;  LOG4CXX_INFO(logger,x);  colorDefault;           }
-  #define logging_warn(x)   {colorWarn;  LOG4CXX_WARN(logger,x);  colorDefault;           }
-  #define logging_error(x)  {colorError; LOG4CXX_ERROR(logger,x); colorDefault;           }
-  #define logging_fatal(x)  {colorError; LOG4CXX_FATAL(logger,x); colorDefault; exit(-1); }
-
-  #define logging_rootlevel_debug()	  {log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getDebug()); }
-  #define logging_rootlevel_info()	  {log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getInfo() ); }
-  #define logging_rootlevel_warn()	  {log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getWarn() ); }
-  #define logging_rootlevel_error()	  {log4cxx::Logger::getRootLogger()->setLevel(log4cxx::Level::getError()); }
-
-  #define logging_classlevel_debug(x) {log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(#x)); if(logger != NULL) logger->setLevel(log4cxx::Level::getDebug()); }
-  #define logging_classlevel_info(x)  {log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(#x)); if(logger != NULL) logger->setLevel(log4cxx::Level::getInfo());  }
-  #define logging_classlevel_warn(x)  {log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(#x)); if(logger != NULL) logger->setLevel(log4cxx::Level::getWarn());  }
-  #define logging_classlevel_error(x) {log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger(#x)); if(logger != NULL) logger->setLevel(log4cxx::Level::getError()); }
-
-#else // HAVE_LOG4CXX
-
-  #define use_logging_h(x)
-  #define use_logging_cpp(x)
-
-  #define logging_stdout(x) std::cout << x << std::endl;
-
-  static int __loglevel__ = 2; //default is info
-//  static int __loglevel__ = 1; // XXX use higher log level
-
-  #define logging_trace(x)  {                                   logging_stdout(x);                }
-  #define logging_debug(x)  {if(__loglevel__ <= 1){ colorDebug; logging_stdout(x); colorDefault; }}
-  #define logging_info(x)   {if(__loglevel__ <= 2){ colorInfo;  logging_stdout(x); colorDefault; }}
-  #define logging_warn(x)   {if(__loglevel__ <= 3){ colorWarn;  logging_stdout(x); colorDefault; }}
-  #define logging_error(x)  {                       colorError; logging_stdout(x); colorDefault;           }
-  #define logging_fatal(x)  {                       colorError; logging_stdout(x); colorDefault; exit(-1); }
-
-  #define logging_rootlevel_debug()	  {__loglevel__ = 1;}
-  #define logging_rootlevel_info()	  {__loglevel__ = 2;}
-  #define logging_rootlevel_warn()	  {__loglevel__ = 3;}
-  #define logging_rootlevel_error()	  {__loglevel__ = 4;}
-
-  #define logging_classlevel_debug(x) {std::cout << "individual class logging only available with log4cxx library" << std::endl;}
-  #define logging_classlevel_info(x)  {std::cout << "individual class logging only available with log4cxx library" << std::endl;}
-  #define logging_classlevel_warn(x)  {std::cout << "individual class logging only available with log4cxx library" << std::endl;}
-  #define logging_classlevel_error(x) {std::cout << "individual class logging only available with log4cxx library" << std::endl;}
-
-#endif // HAVE_LOG4CXX
+#define logging_trace(x)  {            LOG4CXX_TRACE(logger,x);              }
+#define logging_debug(x)  {colorDebug; LOG4CXX_DEBUG(logger,x); colorDefault;}
+#define logging_info(x)   {colorInfo;  LOG4CXX_INFO(logger,x);  colorDefault;}
+#define logging_warn(x)   {colorWarn;  LOG4CXX_WARN(logger,x);  colorDefault;}
+#define logging_error(x)  {colorError; LOG4CXX_ERROR(logger,x); colorDefault;}
+#define logging_fatal(x)  {colorError; LOG4CXX_FATAL(logger,x); exit(-1);    }
 
 #endif //LOGGING_H__
Index: /source/ariba/utility/measurement/PathloadMeasurement.cpp
===================================================================
--- /source/ariba/utility/measurement/PathloadMeasurement.cpp	(revision 2378)
+++ /source/ariba/utility/measurement/PathloadMeasurement.cpp	(revision 2378)
@@ -0,0 +1,188 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "PathloadMeasurement.h"
+
+namespace ariba {
+namespace utility {
+
+use_logging_cpp(PathloadMeasurement);
+
+PathloadMeasurement::PathloadMeasurement(BaseOverlay* _overlay)
+	: running( false ), resultNode( NodeID::UNSPECIFIED ),
+	  listener( NULL), serverpid( -1 ) {
+
+	if( _overlay != NULL ) // this is important due to the singleton interface!
+		baseoverlay = _overlay;
+
+	//
+	// start the pathload sender which acts as server
+	// the server is started in the child process
+	// if an instance is already running, the second
+	// will just fail starting up ...
+	//
+
+	const char* argv[4];
+	argv[0] = "pathload_snd";
+	argv[1] = "-q";
+	argv[2] = "-i";
+	argv[3] = 0;
+
+	if( (serverpid = vfork()) == 0 ){
+
+		// execute in child process
+		execvp( "pathload_snd", (char* const*)argv );
+
+		// if we reach here, the exec failed
+		// and we quit the child process
+		logging_warn( "no bandwidth measurement module found " <<
+				"(executing pathload_snd for bandwidth measurement server failed)" );
+	}
+}
+
+PathloadMeasurement::~PathloadMeasurement(){
+
+	// quit the pathload server
+	if( serverpid != -1 )
+		kill( serverpid, SIGQUIT );
+}
+
+void PathloadMeasurement::measure(const NodeID& destnode,  PathloadMeasurementListener* _listener){
+
+	if( running ){
+		logging_warn( "measurement already running" );
+		return;
+	}
+
+	logging_info( "starting new measurement for " << destnode.toString() );
+
+	listener = _listener;
+	resultNode = destnode;
+	resultMbps = -1;
+
+	runBlockingMethod();
+}
+
+void PathloadMeasurement::dispatchFunction(){
+	if( listener != NULL )
+		listener->onMeasurement( resultNode, resultMbps );
+}
+
+void PathloadMeasurement::blockingFunction(){
+
+	// get the endpoint for this node
+	const EndpointDescriptor& endp = baseoverlay->getEndpointDescriptor( resultNode );
+	if( endp == EndpointDescriptor::UNSPECIFIED ){
+		logging_warn( "can not measure node " << resultNode.toString() << ": can't resolve endpoint" );
+		return;
+	}
+
+	// if this is our local endpoint don't perform measurement
+	if( endp == baseoverlay->getEndpointDescriptor() ){
+		logging_debug( "don't perform measurement on local machine" );
+		resultMbps = -1;
+		dispatch();
+		return;
+	}
+
+	// currently we can be sure that this is
+	// an IPv4 and port format, or only IPv4
+	string endpoint = endp.toString();
+	string::size_type p = endpoint.find(':');
+	if( p != string::npos ) endpoint = endpoint.substr( 0, p );
+
+	logging_info( "measuring node " << resultNode.toString() <<
+					" on endpoint " << endpoint );
+
+	string cmdline = "pathload_rcv -s " + endpoint;
+
+	// execute the binary and open a stream to the executables output (stdout)
+	FILE* stream = popen( cmdline.c_str(), "r" );
+	if( stream == NULL || stream <= 0){
+		logging_warn( "no bandwidth measurement module found " <<
+				"(executing pathload_rvc for bandwidth measurement failed)" );
+		return;
+	}
+
+	char buf[128];
+	string content = "";
+	bool failed = true;
+
+	while( fgets(buf, 100, stream) != NULL ){
+		content += buf;
+	}
+
+	logging_debug("pathload measurment output:\n" << content );
+
+	//
+	// evaluate the output
+	//
+
+	if( content.find("Connection refused") != string::npos ){
+		logging_warn( "bandwidth measurement failed due to connection error" );
+		return;
+	}
+
+	if( content.find("Measurements terminated") != string::npos ){
+		logging_warn( "bandwidth measurement failed" );
+		return;
+	}
+
+	if( content.find("Measurements finished") == string::npos ){
+		logging_warn( "bandwidth measurement failed" );
+		return;
+	}
+
+	try {
+		content = content.substr( content.find("Available bandwidth range") );
+		content = content.substr( content.find("-")+2 );
+		content = content.erase( content.find("(")-1, string::npos );
+
+		resultMbps = strtod(content.c_str(), NULL);
+		logging_info( "measurement for node " << resultNode.toString() <<
+				" on endpoint " << endp.toString() << " ended with: " << resultMbps );
+	} catch(...) {
+		logging_warn( "bandwidth measurement failed" );
+	}
+
+	// dispatch into the main thread and async jump into
+	// void PathloadMeasurement::dispatchFunction()
+	dispatch();
+}
+
+}} // namespace ariba, utility
Index: /source/ariba/utility/measurement/PathloadMeasurement.h
===================================================================
--- /source/ariba/utility/measurement/PathloadMeasurement.h	(revision 2378)
+++ /source/ariba/utility/measurement/PathloadMeasurement.h	(revision 2378)
@@ -0,0 +1,104 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef __PATHLOAD_MEASUREMENT_H
+#define __PATHLOAD_MEASUREMENT_H
+
+#include <unistd.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <sys/wait.h>
+#include <boost/utility.hpp>
+#include "ariba/utility/logging/Logging.h"
+#include "ariba/utility/types/NodeID.h"
+#include "ariba/utility/system/BlockingMethod.h"
+#include "ariba/communication/EndpointDescriptor.h"
+#include "ariba/overlay/BaseOverlay.h"
+
+using ariba::utility::NodeID;
+using ariba::utility::BlockingMethod;
+using ariba::communication::EndpointDescriptor;
+using ariba::overlay::BaseOverlay;
+
+namespace ariba {
+namespace utility {
+
+//*************************************************
+
+class PathloadMeasurementListener {
+	friend class PathloadMeasurement;
+protected:
+	// mbps hols the MBit/s as floating point and -1 if the
+	// measurement was triggered by two nodes on our local machines
+	virtual void onMeasurement( NodeID node, double mbps ) = 0;
+};
+
+//*************************************************
+
+class PathloadMeasurement : private boost::noncopyable, public BlockingMethod {
+	use_logging_h( PathloadMeasurement );
+private:
+	volatile bool running;
+	PathloadMeasurementListener* listener;
+
+	double resultMbps;
+	NodeID resultNode;
+	BaseOverlay* baseoverlay;
+	pid_t serverpid;
+
+protected:
+	PathloadMeasurement(BaseOverlay* _overlay);
+	virtual ~PathloadMeasurement();
+
+	virtual void dispatchFunction();
+	virtual void blockingFunction();
+
+public:
+	static PathloadMeasurement& instance(BaseOverlay* _overlay = NULL) {
+		static PathloadMeasurement the_inst( _overlay );
+		return the_inst;
+	}
+
+	void measure( const NodeID& destnode,  PathloadMeasurementListener* _listener );
+};
+
+//*************************************************
+
+}} // namespace ariba, utility
+
+#endif // __PATHLOAD_MEASUREMENT_H
Index: /source/ariba/utility/messages.h
===================================================================
--- /source/ariba/utility/messages.h	(revision 12775)
+++ /source/ariba/utility/messages.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,18 +35,15 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef MESSAGES_H_
 #define MESSAGES_H_
 
-// TODO wÃŒrde sagen das brauchen wir nicht mehr
-//   ---> ÃŒberall dieses include rausnehmen und ggf  #include "messages/Message.h"   einfÃŒgen..
-
 #include "messages/Message.h"
-//#include "messages/MessageSender.h"  // TODO wird das noch genutzt..? Wenn nein, sollte es weg!
-//#include "messages/MessageReceiver.h"
-//#include "messages/MessageUtilities.h"
-////#include "messages/MessageProvider.h"  // DEPRECATED
-//#include "messages/TextMessage.h"
+#include "messages/MessageSender.h"
+#include "messages/MessageReceiver.h"
+#include "messages/MessageUtilities.h"
+#include "messages/MessageProvider.h"
+#include "messages/TextMessage.h"
 
 #endif /* MESSAGES_H_ */
Index: urce/ariba/utility/messages/CMakeLists.txt
===================================================================
--- /source/ariba/utility/messages/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,55 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    Message.h
-    MessageProvider.h
-    MessageReceiver.h
-    MessageSender.h
-    MessageUtilities.h
-    _namespace.h
-    TextMessage.h
-    )
-
-add_sources(
-    Message.cpp
-    MessageProvider.cpp
-    MessageReceiver.cpp
-    MessageSender.cpp
-    TextMessage.cpp
-    )
Index: /source/ariba/utility/messages/Message.cpp
===================================================================
--- /source/ariba/utility/messages/Message.cpp	(revision 12775)
+++ /source/ariba/utility/messages/Message.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,11 +35,9 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "Message.h"
 #include "ariba/utility/serialization/Data.hpp"
 #include "ariba/utility/serialization/DataStream.hpp"
-
-#include "ariba/utility/logging/Logging.h"
 
 NAMESPACE_BEGIN
@@ -54,5 +52,4 @@
 
 Message::~Message() {
-	dropPayload();
 //	if ( srcAddr != NULL) delete srcAddr;
 //	if ( destAddr != NULL) delete destAddr;
@@ -82,59 +79,15 @@
 }
 
-
-reboost::message_t Message::wrap_up_for_sending()
-{
-    assert( ! wrapped_up );
-    wrapped_up = true;
-    
-    //// Adapt to new message system ////
-    Data data = data_serialize(this, DEFAULT_V);
-    reboost::shared_buffer_t buf(data.getBuffer(), data.getLength() / 8);
-
-    newstyle_payload.push_front(buf);
-    
-    return newstyle_payload;
-}
-
-reboost::shared_buffer_t Message::serialize_into_shared_buffer()
-{
-    assert ( newstyle_payload.length() == 0 );
-    
-    //// Adapt to new message system ////
-    Data data = data_serialize(this, DEFAULT_V);
-    reboost::shared_buffer_t buf(data.getBuffer(), data.getLength() / 8);
-    
-    return buf;
-}
-
-
-reboost::shared_buffer_t Message::deserialize_from_shared_buffer(reboost::shared_buffer_t buff)
-{
-    // NOTE: legacy payload is not allowed when using shared buffers
-    this->legacy_payload_disabled = true;
-    
-    assert( buff.size() > 0 );
-    
-    // const_cast is necessary here, but without legacy payload we should be save here (more or less)
-    Data dat(const_cast<uint8_t*>(buff.data()), buff.size() * 8);
-    
-    size_t len = this->SERIALIZATION_METHOD_NAME(DESERIALIZE, dat) / 8;
-
-    // return remaining sub-buffer
-    return buff(len);
-}
-
-
-
 NAMESPACE_END
 
 std::ostream& operator<<(std::ostream& stream, const ariba::utility::Message& msg ) {
 	using_serialization;
-	stream << "msg(type=" << typeid(msg).name() << ",";
+	stream << "msg(type=" << typeid(msg).name();
 	stream << "len=" << (data_length(&msg)/8) << ",";
 	Data data = data_serialize(&msg);
-	stream << "data=" << data;
-	data.release();
+	stream << ",data=" << data;
+//	data.release();
 	stream << ")";
 	return stream;
 }
+
Index: /source/ariba/utility/messages/Message.h
===================================================================
--- /source/ariba/utility/messages/Message.h	(revision 12775)
+++ /source/ariba/utility/messages/Message.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef MESSAGE_H_
@@ -45,4 +45,8 @@
 #include<iostream>
 #include<boost/shared_array.hpp>
+
+
+// local includes
+#include "MessageControlInfo.h"
 
 // forward declaration
@@ -61,8 +65,4 @@
 #include "ariba/utility/types/Address.h"
 #include "ariba/utility/serialization.h"
-
-// reboost messages
-#include "ariba/utility/transport/messages/message.hpp"
-
 
 std::ostream& operator<<(std::ostream& stream, const ariba::utility::Message& msg );
@@ -86,16 +86,15 @@
 	friend std::ostream& ::operator<<(std::ostream& stream, const ariba::utility::Message& msg );
 
+	// root binary data
+	shared_array<uint8_t> root;
+
 	// payload
-	bool legacy_payload_disabled;
 	bool releasePayload;
 	Data payload; //< messages binary data
-	
-	// XXX testing...
-	reboost::message_t newstyle_payload;
-	bool wrapped_up;
 
 	// addresses and control info
 	const Address* srcAddr;
 	const Address* destAddr;
+	const MessageControlInfo* ctrlInfo;
 
 public:
@@ -104,6 +103,5 @@
 	 */
 	inline Message() :
-	    legacy_payload_disabled(false), releasePayload(true), payload(),
-	    newstyle_payload(), wrapped_up(false), srcAddr(NULL),destAddr(NULL) {
+		root(), releasePayload(true), payload(), srcAddr(NULL),destAddr(NULL),ctrlInfo(NULL) {
 	}
 
@@ -112,7 +110,6 @@
 	 * data.
 	 */
-	explicit inline Message( const Data& data ) :
-        legacy_payload_disabled(false), releasePayload(true),
-        newstyle_payload(), wrapped_up(false), srcAddr(NULL),destAddr(NULL) {  // FIXME newstyle_payload..?
+	inline Message( const Data& data ) :
+		srcAddr(NULL),destAddr(NULL),ctrlInfo(NULL) {
 		this->payload = data.clone();
 //		this->root = shared_array<uint8_t>((uint8_t*)data.getBuffer());
@@ -176,4 +173,22 @@
 	inline const Address* getSourceAddress() const {
 		return srcAddr;
+	}
+
+	/**
+	 * Set optional control information
+	 *
+	 * @parm ctrlInfo The optional control information
+	 */
+	inline void setControlInfo(const MessageControlInfo* ctrlInfo) {
+		this->ctrlInfo = ctrlInfo;
+	}
+
+	/**
+	 * Returns the optional control information or NULL
+	 *
+	 * @return The optional control information or NULL
+	 */
+	inline const MessageControlInfo* getControlInfo() const {
+		return ctrlInfo;
 	}
 
@@ -221,49 +236,4 @@
 		return NULL;
 	}
-
-	/**
-	 * The same as decapsulate, but this function
-	 * is used in the samples to make the semantics easier
-	 * to understand. The semantics is shown to be: you get
-	 * a message and convert it to your type. Not as: you
-	 * get a message and have to extract your message from it.
-	 */
-	template<class T>
-	inline T* convert() {
-		return decapsulate<T>();
-	}
-	
-	
-	// XXX testing
-	void set_payload_message(reboost::message_t msg)
-	{
-	    newstyle_payload = msg;
-	}
-	
-	void append_buffer(reboost::shared_buffer_t buff)
-	{
-	    newstyle_payload.push_back(buff);
-	}
-	
-	
-	// XXX testing... packs this message into the payload message (do not use twice!!)
-	virtual reboost::message_t wrap_up_for_sending();
-	
-	
-	/**
-	 * Uses the old serialization system to serialize itself into a (new style) shared buffer.
-	 */
-	virtual reboost::shared_buffer_t serialize_into_shared_buffer();
-	
-	/*
-	 * XXX experimental
-	 * 
-	 * Uses the old serialization system to deserialize itself out of a (new style) shared buffer.
-	 * @return remaining sub-buffer (the "payload")
-	 * 
-	 * Note: This is some kind of a hack! handle with care.
-	 */
-	virtual reboost::shared_buffer_t deserialize_from_shared_buffer(reboost::shared_buffer_t buff);
-	
 
 protected:
@@ -287,5 +257,5 @@
 			} else {
 				if (msg->payload.isUnspecified()) {
-					size_t l = ((len == ~(size_t)0) ? X.getRemainingLength() : len);
+					size_t l = ((len == ~0) ? X.getRemainingLength() : len);
 					msg->payload = X.getRemainingData(l);
 					msg->releasePayload = false;
@@ -303,8 +273,5 @@
 	 * @return A explicit payload serializer
 	 */
-	finline PayloadSerializer Payload( size_t length = ~0 )
-	{
-//	    assert( ! legacy_payload_disabled );  // FIXME aktuell
-	    
+	finline PayloadSerializer Payload( size_t length = ~0 ) {
 		return PayloadSerializer( this, length );
 	}
Index: /source/ariba/utility/messages/MessageControlInfo.cpp
===================================================================
--- /source/ariba/utility/messages/MessageControlInfo.cpp	(revision 2378)
+++ /source/ariba/utility/messages/MessageControlInfo.cpp	(revision 2378)
@@ -0,0 +1,58 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "MessageControlInfo.h"
+
+NAMESPACE_BEGIN
+
+MessageControlInfo::MessageControlInfo() {
+}
+
+MessageControlInfo::~MessageControlInfo() {
+}
+
+/**
+ * Returns true, if this object needs to be deleted
+ *
+ * @return True, if this object needs to be deleted
+ */
+bool MessageControlInfo::needsDeletion() {
+	return true;
+}
+
+NAMESPACE_END
Index: /source/ariba/utility/messages/MessageControlInfo.h
===================================================================
--- /source/ariba/utility/messages/MessageControlInfo.h	(revision 2378)
+++ /source/ariba/utility/messages/MessageControlInfo.h	(revision 2378)
@@ -0,0 +1,62 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef MESSAGECONTROLINFO_H_
+#define MESSAGECONTROLINFO_H_
+
+#include "_namespace.h"
+
+NAMESPACE_BEGIN
+
+class MessageControlInfo {
+public:
+	MessageControlInfo();
+
+	virtual ~MessageControlInfo();
+
+	/**
+	 * Returns true, if this object needs to be deleted
+	 *
+	 * @return True, if this object needs to be deleted
+	 */
+	virtual bool needsDeletion();
+};
+
+NAMESPACE_END
+
+#endif /* MESSAGECONTROLINFO_H_ */
Index: /source/ariba/utility/messages/MessageProvider.cpp
===================================================================
--- /source/ariba/utility/messages/MessageProvider.cpp	(revision 12775)
+++ /source/ariba/utility/messages/MessageProvider.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,34 +35,34 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
-//#include "MessageProvider.h"
-//
-//NAMESPACE_BEGIN
-//
-//MessageProvider::MessageProvider() {
-//}
-//
-//MessageProvider::~MessageProvider() {
-//}
-//
-//bool MessageProvider::sendMessageToReceivers( const Message* message ) {
-//	bool sent =  false;
-//	for (size_t i=0; i<receivers.size(); i++)
-//		if (receivers[i]->receiveMessage(message, LinkID::UNSPECIFIED, NodeID::UNSPECIFIED)) sent = true;
-//	return sent;
-//}
-//
-//void MessageProvider::addMessageReceiver( MessageReceiver* receiver ) {
-//	receivers.push_back(receiver);
-//}
-//
-//void MessageProvider::removeMessageReceiver( MessageReceiver* receiver ) {
-//	for (size_t i=0; i<receivers.size(); i++)
-//		if (receivers[i]==receiver) {
-//			receivers.erase( receivers.begin()+i );
-//			break;
-//		}
-//}
-//
-//NAMESPACE_END
+#include "MessageProvider.h"
+
+NAMESPACE_BEGIN
+
+MessageProvider::MessageProvider() {
+}
+
+MessageProvider::~MessageProvider() {
+}
+
+bool MessageProvider::sendMessageToReceivers( const Message* message ) {
+	bool sent =  false;
+	for (int i=0; i<receivers.size(); i++)
+		if (receivers[i]->receiveMessage(message, LinkID::UNSPECIFIED, NodeID::UNSPECIFIED)) sent = true;
+	return sent;
+}
+
+void MessageProvider::addMessageReceiver( MessageReceiver* receiver ) {
+	receivers.push_back(receiver);
+}
+
+void MessageProvider::removeMessageReceiver( MessageReceiver* receiver ) {
+	for (int i=0; i<receivers.size(); i++)
+		if (receivers[i]==receiver) {
+			receivers.erase( receivers.begin()+i );
+			break;
+		}
+}
+
+NAMESPACE_END
Index: /source/ariba/utility/messages/MessageProvider.h
===================================================================
--- /source/ariba/utility/messages/MessageProvider.h	(revision 12775)
+++ /source/ariba/utility/messages/MessageProvider.h	(revision 2378)
@@ -1,5 +1,3 @@
-// XXX DEPRECATED
-
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -37,64 +35,62 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
-
-// XXX DEPRECATED
+// [Licence]
 
 #ifndef MESSAGEPROVIDER_H_
 #define MESSAGEPROVIDER_H_
 
-//#include "_namespace.h"
-//#include "MessageReceiver.h"
-//#include "ariba/utility/types/LinkID.h"
-//#include "ariba/utility/types/NodeID.h"
-//#include <vector>
-//
-//using std::vector;
-//using ariba::utility::LinkID;
-//using ariba::utility::NodeID;
-//
-//NAMESPACE_BEGIN
-//
-//
-///**
-// * This class defines an interface for message providers.
-// * Implementing classes must allow receivers to register themselves.
-// *
-// * @author Sebastian Mies
-// */
-//class MessageProvider {
-//private:
-//	vector<MessageReceiver*> receivers;
-//
-//protected:
-//	bool sendMessageToReceivers( const Message* message );
-//
-//public:
-//	/**
-//	 * Constructor.
-//	 */
-//	MessageProvider();
-//
-//	/**
-//	 * Destructor.
-//	 */
-//	~MessageProvider();
-//
-//	/**
-//	 * Adds a message receiver.
-//	 *
-//	 * @param receiver The receiver.
-//	 */
-//	void addMessageReceiver( MessageReceiver* receiver );
-//
-//	/**
-//	 * Removes a message receiver.
-//	 *
-//	 * @param receiver The receiver.
-//	 */
-//	void removeMessageReceiver( MessageReceiver* receiver );
-//};
-//
-//NAMESPACE_END
+#include "_namespace.h"
+#include "MessageReceiver.h"
+#include "ariba/utility/types/LinkID.h"
+#include "ariba/utility/types/NodeID.h"
+#include <vector>
+
+using std::vector;
+using ariba::utility::LinkID;
+using ariba::utility::NodeID;
+
+NAMESPACE_BEGIN
+
+
+/**
+ * This class defines an interface for message providers.
+ * Implementing classes must allow receivers to register themselves.
+ *
+ * @author Sebastian Mies
+ */
+class MessageProvider {
+private:
+	vector<MessageReceiver*> receivers;
+
+protected:
+	bool sendMessageToReceivers( const Message* message );
+
+public:
+	/**
+	 * Constructor.
+	 */
+	MessageProvider();
+
+	/**
+	 * Destructor.
+	 */
+	~MessageProvider();
+
+	/**
+	 * Adds a message receiver.
+	 *
+	 * @param receiver The receiver.
+	 */
+	void addMessageReceiver( MessageReceiver* receiver );
+
+	/**
+	 * Removes a message receiver.
+	 *
+	 * @param receiver The receiver.
+	 */
+	void removeMessageReceiver( MessageReceiver* receiver );
+};
+
+NAMESPACE_END
 
 #endif /* MESSAGEPROVIDER_H_ */
Index: /source/ariba/utility/messages/MessageReceiver.cpp
===================================================================
--- /source/ariba/utility/messages/MessageReceiver.cpp	(revision 12775)
+++ /source/ariba/utility/messages/MessageReceiver.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "MessageReceiver.h"
@@ -49,8 +49,8 @@
 }
 
-//bool MessageReceiver::receiveMessage( reboost::shared_buffer_t message, const LinkID& link, const NodeID& node ) {
-//	//std::cout << "UNIMPLEMENTED MessageReceiver got Message:" << (Message*)message << std::endl;
-//	return false;
-//}
+bool MessageReceiver::receiveMessage( const Message* message, const LinkID& link, const NodeID& node ) {
+	std::cout << "UNIMPLEMENTED MessageReceiver got Message:" << (Message*)message << std::endl;
+	return false;
+}
 
 NAMESPACE_END
Index: /source/ariba/utility/messages/MessageReceiver.h
===================================================================
--- /source/ariba/utility/messages/MessageReceiver.h	(revision 12775)
+++ /source/ariba/utility/messages/MessageReceiver.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,12 +35,10 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef MESSAGERECEIVER_H__
 #define MESSAGERECEIVER_H__
 
-//#include "ariba/utility/messages/Message.h"
-// reboost messages
-#include "ariba/utility/transport/messages/message.hpp"
+#include "ariba/utility/messages/Message.h"
 #include "ariba/utility/types/LinkID.h"
 #include "ariba/utility/types/NodeID.h"
@@ -75,8 +73,5 @@
 	 * @return True, when the message has been accepted.
 	 */
-	virtual bool receiveMessage( reboost::shared_buffer_t message,
-	        const LinkID& link,
-	        const NodeID& node,
-	        bool bypass_overlay ) = 0;
+	virtual bool receiveMessage( const Message* message, const LinkID& link, const NodeID& node );
 };
 
Index: /source/ariba/utility/messages/MessageSender.cpp
===================================================================
--- /source/ariba/utility/messages/MessageSender.cpp	(revision 12775)
+++ /source/ariba/utility/messages/MessageSender.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "MessageSender.h"
Index: /source/ariba/utility/messages/MessageSender.h
===================================================================
--- /source/ariba/utility/messages/MessageSender.h	(revision 12775)
+++ /source/ariba/utility/messages/MessageSender.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef MESSAGESENDER_H_
Index: /source/ariba/utility/messages/MessageUtilities.h
===================================================================
--- /source/ariba/utility/messages/MessageUtilities.h	(revision 12775)
+++ /source/ariba/utility/messages/MessageUtilities.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef MESSAGEUTILITIES_H_
Index: /source/ariba/utility/messages/TextMessage.cpp
===================================================================
--- /source/ariba/utility/messages/TextMessage.cpp	(revision 12775)
+++ /source/ariba/utility/messages/TextMessage.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "TextMessage.h"
Index: /source/ariba/utility/messages/TextMessage.h
===================================================================
--- /source/ariba/utility/messages/TextMessage.h	(revision 12775)
+++ /source/ariba/utility/messages/TextMessage.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef TEXTMESSAGE_H_
Index: /source/ariba/utility/messages/_namespace.h
===================================================================
--- /source/ariba/utility/messages/_namespace.h	(revision 12775)
+++ /source/ariba/utility/messages/_namespace.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #undef NAMESPACE_BEGIN
Index: urce/ariba/utility/misc/CMakeLists.txt
===================================================================
--- /source/ariba/utility/misc/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,51 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    Demultiplexer.hpp
-    Helper.h
-    KeyMapping.hpp
-    sha1.h
-    StringFormat.h
-    )
-
-add_sources(
-    Helper.cpp
-    sha1.cpp
-    StringFormat.cpp
-    )
Index: /source/ariba/utility/misc/Demultiplexer.hpp
===================================================================
--- /source/ariba/utility/misc/Demultiplexer.hpp	(revision 12775)
+++ /source/ariba/utility/misc/Demultiplexer.hpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef DEMULTIPLEXER_H__
@@ -41,5 +41,4 @@
 
 #include <list>
-#include <iostream>
 #include <map>
 #include <boost/thread/mutex.hpp>
@@ -47,5 +46,4 @@
 #include "ariba/utility/messages/Message.h"
 
-using std::cout;
 using std::list;
 using std::map;
@@ -75,24 +73,4 @@
 	boost::mutex						mapMutex;
 
-	void debugprint() {
-		cout << "-------------start--------" << std::endl;
-		{
-			LISTENER_SERVICE_MAP_CITERATOR i = mapListenerService.begin();
-			LISTENER_SERVICE_MAP_CITERATOR iend = mapListenerService.end();
-
-			for( ; i != iend; i++ )
-				cout << "xxx" << i->first.toString() << " -> " << i->second << std::endl;
-		}
-		cout << "-----------------------" << std::endl;
-		{
-			SERVICE_LISTENER_MAP_CITERATOR i = mapServiceListener.begin();
-			SERVICE_LISTENER_MAP_CITERATOR iend = mapServiceListener.end();
-
-			for( ; i != iend; i++ )
-				cout << "xxx" << i->first << " -> " << i->second.toString() << std::endl;
-		}
-		cout << "-------------end---------" << std::endl;
-	}
-
 public:
 
@@ -105,14 +83,15 @@
 	void registerItem( S id, T listener ) {
 		boost::mutex::scoped_lock lock( mapMutex );
-
-		mapServiceListener.insert( SERVICE_LISTENER_PAIR( id, listener ) );
-		mapListenerService.insert( LISTENER_SERVICE_PAIR( listener, id ) );
+		{
+			mapServiceListener.insert( SERVICE_LISTENER_PAIR( id, listener ) );
+			mapListenerService.insert( LISTENER_SERVICE_PAIR( listener, id ) );
+		}
 	}
 
-	void unregisterItem( S id ) {
+	void unregisterItem( S id) {
 		T listener = get( id );
 
+		boost::mutex::scoped_lock lock( mapMutex );
 		{
-			boost::mutex::scoped_lock lock( mapMutex );
 			mapServiceListener.erase( id );
 			mapListenerService.erase( listener );
@@ -121,5 +100,5 @@
 
 	void unregisterItem( T listener ) {
-		S id = get( listener );
+		S id = get (listener);
 		unregisterItem( id );
 	}
@@ -127,29 +106,34 @@
 	S get( T listener ) {
 		boost::mutex::scoped_lock lock( mapMutex );
-
-		LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
-		return it->second;
+		{
+			LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
+			return it->second;
+		}
 	}
 
 	T get( S id ) {
 		boost::mutex::scoped_lock lock( mapMutex );
+		{
+			SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
 
-		SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
-		if( it == mapServiceListener.end() ) 	return 0;
-		else					return it->second;
+			if( it == mapServiceListener.end() ) 	return NULL;
+			else					return it->second;
+		}
 	}
 
 	bool contains( T listener ) {
 		boost::mutex::scoped_lock lock( mapMutex );
-
-		LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
-		return ( it != mapListenerService.end() );
+		{
+			LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
+			return ( it != mapListenerService.end() );
+		}
 	}
 
 	bool contains( S id ) {
 		boost::mutex::scoped_lock lock( mapMutex );
-
-		SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
-		return ( it != mapServiceListener.end() );
+		{
+			SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
+			return ( it != mapServiceListener.end() );
+		}
 	}
 
@@ -157,6 +141,5 @@
 	typedef list<T> TwoList;
 
-	OneList getOneList() {
-		boost::mutex::scoped_lock lock( mapMutex );
+	OneList getOneList() const {
 		OneList ret;
 
@@ -168,6 +151,5 @@
 	}
 
-	TwoList getTwoList() {
-		boost::mutex::scoped_lock lock( mapMutex );
+	TwoList getTwoList() const {
 		TwoList ret;
 
Index: /source/ariba/utility/misc/Helper.cpp
===================================================================
--- /source/ariba/utility/misc/Helper.cpp	(revision 12775)
+++ /source/ariba/utility/misc/Helper.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,10 +35,7 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "Helper.h"
-
-#include <boost/lexical_cast.hpp>
-#include <boost/algorithm/string/replace.hpp>
 
 namespace ariba {
@@ -52,5 +49,5 @@
 	_ultoa_s (val, buf, 16, 10);
 #else
-	sprintf (buf, "%lu", val);
+	sprintf (buf, "%u", val);
 #endif
 
@@ -65,5 +62,5 @@
 	_ltoa_s (val, buf, 16, 10);
 #else
-	sprintf (buf, "%li", val);
+	sprintf (buf, "%i", val);
 #endif
 
@@ -78,5 +75,5 @@
 	_ultoa_s (val, buf, 16, 16);
 #else
-	sprintf (buf, "%lx", val);
+	sprintf (buf, "%x", val);
 #endif
 
@@ -96,5 +93,5 @@
 	_ltoa_s (val, buf, 16, 16);
 #else
-	sprintf (buf, "%lx", val);
+	sprintf (buf, "%x", val);
 #endif
 
@@ -252,13 +249,5 @@
 unsigned long Helper::getElapsedMillis ()
 {
-	static unsigned long zero = 0;
-
-	struct timeb tp;
-	ftime( &tp );
-
-	unsigned long val = tp.time*1000 + tp.millitm;
-	if( zero == 0 ) zero = val;
-
-	return val-zero;
+	return static_cast<unsigned long>(((double)clock() / (double)(CLOCKS_PER_SEC)) * 1000.0);
 }
 
Index: /source/ariba/utility/misc/Helper.h
===================================================================
--- /source/ariba/utility/misc/Helper.h	(revision 12775)
+++ /source/ariba/utility/misc/Helper.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __HELPER_H
@@ -45,5 +45,4 @@
 #include <ctime>
 #include <ostream>
-#include <cstdio>
 #include <iomanip>
 #include <cassert>
@@ -53,5 +52,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/timeb.h>
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string/replace.hpp>
 
 #ifdef WIN32
@@ -67,4 +67,5 @@
 using std::setfill;
 using std::setw;
+using std::cout;
 using std::string;
 using std::ostream;
@@ -167,5 +168,5 @@
 
 	if (secondsSleep > 0)
-		::sleep(secondsSleep);
+		sleep(secondsSleep);
 
 	//
Index: /source/ariba/utility/misc/KeyMapping.hpp
===================================================================
--- /source/ariba/utility/misc/KeyMapping.hpp	(revision 12775)
+++ /source/ariba/utility/misc/KeyMapping.hpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef KEY_MAPPING_H__
@@ -69,5 +69,5 @@
 public:
 	inline KeyMapping(){
-		srand( time(NULL) );
+		srand(time(0));
 	}
 
Index: /source/ariba/utility/misc/OvlVis.cpp
===================================================================
--- /source/ariba/utility/misc/OvlVis.cpp	(revision 2378)
+++ /source/ariba/utility/misc/OvlVis.cpp	(revision 2378)
@@ -0,0 +1,670 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#include "OvlVis.h"
+
+namespace ariba {
+namespace utility {
+
+//*****************************************************
+//*****************************************************
+//*****************************************************
+
+use_logging_cpp(OvlVis);
+
+OvlVis::OvlVis() : socket(io_service), socketOpened(false) {
+
+	if( ! Configuration::instance().exists("DEMO_OvlVisIP") )   return;
+	if( ! Configuration::instance().exists("DEMO_OvlVisPort") ) return;
+
+	string serverIP = Configuration::instance().read<string>("DEMO_OvlVisIP");
+	string serverPort = Configuration::instance().read<string>("DEMO_OvlVisPort");
+	if( serverIP.length() == 0 || serverPort.length() == 0) return;
+
+	logging_debug( "connecting to ovlvis " + serverIP + " on " + serverPort );
+
+	tcp::resolver resolver(io_service);
+	tcp::resolver::query query(
+		serverIP,
+		serverPort,
+		tcp::resolver::query::passive |
+		tcp::resolver::query::address_configured |
+		tcp::resolver::query::numeric_service);
+
+	tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
+	tcp::resolver::iterator end;
+
+	boost::system::error_code error = boost::asio::error::host_not_found;
+	while (error && endpoint_iterator != end){
+		socket.close();
+		socket.connect(*endpoint_iterator++, error);
+	}
+
+	if (error){
+		logging_warn( "OvlVis could not connect to GUI" );
+	} else {
+		socketOpened = true;
+	}
+}
+
+OvlVis::~OvlVis(){
+
+	socket.close();
+
+}
+
+void OvlVis::sendMessage( const string msg, NETWORK_ID nid ) {
+
+	sendSocket( msg );
+
+// 	{
+// 		// auto layout
+// 		ostringstream out;
+//
+// 		out 	<< "VisMsgOptimizeView" << ";"
+// 			<< Helper::ultos(nid)     << ";" // network id is ignored in the message renderer, just renders the current viewed network
+// 			<< "0"                  << std::endl;
+//
+// 		sendSocket( out.str() );
+// 	}
+
+// 	{	// auto zoom
+// 		ostringstream out;
+//
+// 		out 	<< "VisMsgOptimizeView" << ";"
+// 			<< Helper::ultos(nid)     << ";" // network id is ignored in the message renderer, just renders the current viewed network
+// 			<< "1"                  << std::endl;
+//
+// 		sendSocket( out.str() );
+// 	}
+
+}
+
+void OvlVis::sendSocket(const string msg){
+	if( socket.is_open() && socketOpened )
+		socket.send( boost::asio::buffer(msg) );
+}
+
+//*****************************************************
+//*****************************************************
+//*****************************************************
+
+void OvlVis::visCreate(
+	NETWORK_ID network,
+	NodeID& node,
+	string nodename,
+	string info
+	){
+
+	ostringstream out;
+
+	out 	<< "VisMsgCreate"         << ";"
+		<< Helper::ultos(network) << ";"
+		<< node.toString()        << ";"
+		<< nodename               << ";"
+		<< "" /*netName*/         << ";"
+		<< "" /*ip*/              << ";"
+		<< "" /*port*/            << ";"
+		<< "0"                    << ";"
+		<< info                   << std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visChangeStatus(
+	NETWORK_ID network,
+	NodeID& node,
+	bool enable,
+	string info
+	){
+
+	ostringstream out;
+
+	out 	<< "VisMsgChangeStatus"   << ";"
+		<< Helper::ultos(network) << ";"
+		<< node.toString()        << ";"
+		<< (enable ? "1" : "0")   << ";"
+		<< info                   << std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visConnect(
+	NETWORK_ID network,
+	NodeID& srcnode,
+	NodeID& destnode,
+	string info
+	){
+
+	// if we already have a link between the two nodes
+	// we just ignore the call and leave the old link
+
+	if( networkLinks.exists( network, NodePair(srcnode,destnode) )) return;
+
+	ostringstream out;
+	unsigned long edgekey = networkLinks.insert( network, NodePair(srcnode,destnode) );
+
+	out 	<< "VisMsgConnect"        << ";"
+		<< Helper::ultos(network) << ";"
+		<< edgekey 		  << ";"
+		<< srcnode.toString()     << ";"
+		<< destnode.toString()    << ";"
+		<< "0"                    << ";"
+		<< info                   << std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visDisconnect(
+	NETWORK_ID network,
+	NodeID& srcnode,
+	NodeID& destnode,
+	string info
+	){
+
+	if( !networkLinks.exists(network, NodePair(srcnode, destnode)) ) return;
+
+	unsigned long edgekey = networkLinks.get( network, NodePair(srcnode, destnode) );
+	networkLinks.remove( network, NodePair(srcnode, destnode) );
+
+	ostringstream out;
+	out	<< "VisMsgDisconnect"     << ";"
+		<< Helper::ultos(network) << ";"
+		<< Helper::ultos(edgekey) << ";"
+		<< info                   << std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visFailedConnect(
+	NETWORK_ID network,
+	NodeID& srcnode,
+	NodeID& destnode,
+	string info
+	){
+
+	ostringstream out;
+
+	out 	<< "VisMsgFailedConnect"  << ";"
+		<< Helper::ultos(network) << ";"
+		<< srcnode.toString()     << ";"
+		<< destnode.toString()    << ";"
+		<< info                   << std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visShutdown(
+	NETWORK_ID network,
+	NodeID& node,
+	string info
+	){
+
+	ostringstream out;
+
+	out	<< "VisMsgShutdown"       << ";"
+		<< Helper::ultos(network) << ";"
+		<< node.toString()        << ";"
+		<< info                   << std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+//*****************************************************
+//*****************************************************
+//*****************************************************
+
+void OvlVis::visChangeNodeColor (
+	NETWORK_ID network,
+	NodeID& node,
+	unsigned char r,
+	unsigned char g,
+	unsigned char b
+	){
+
+	ostringstream out;
+
+	out	<< "VisMsgChangeNodeColor"       	<< ";"
+		<< Helper::ultos(network) 		<< ";"
+		<< node.toString()        		<< ";"
+		<< ariba::utility::Helper::ultos(r) 	<< ";"
+		<< ariba::utility::Helper::ultos(g) 	<< ";"
+		<< ariba::utility::Helper::ultos(b) 	<< std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visChangeNodeColor (
+	NETWORK_ID network,
+	NodeID& node,
+	NODE_COLORS color
+	){
+
+	unsigned char r = 0;
+	unsigned char g = 0;
+	unsigned char b = 0;
+
+	switch( color ) {
+		case NODE_COLORS_GREY: 	r = 128; g = 128; b = 128; break;
+		case NODE_COLORS_GREEN:	r = 0;   g = 200; b = 0;   break;
+		case NODE_COLORS_RED:	r = 255; g = 0;   b = 0;   break;
+	}
+
+	visChangeNodeColor( network, node, r, g, b );
+}
+
+void OvlVis::visChangeNodeIcon (
+                NETWORK_ID network,
+                NodeID& node,
+                ICON_ID icon
+                ){
+
+        ostringstream out;
+
+        out	<< "VisMsgChangeNodeIcon"               << ";"
+                << Helper::ultos(network) 		<< ";"
+                << node.toString()        		<< ";"
+                << Helper::ultos((unsigned int)icon)	<< std::endl;
+
+        sendMessage( out.str(), network );
+}
+
+void OvlVis::visShowNodeLabel (
+	NETWORK_ID network,
+	NodeID& node,
+	string label
+	){
+
+	ostringstream out;
+
+	out	<< "VisMsgShowNodeLabel"       		<< ";"
+		<< Helper::ultos(network) 		<< ";"
+		<< node.toString()        		<< ";"
+		<< label				<< std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visDeleteNodeLabel (
+	NETWORK_ID network,
+	NodeID& node
+	){
+
+	ostringstream out;
+
+	out	<< "VisMsgDeleteNodeLable"       	<< ";"
+		<< Helper::ultos(network) 		<< ";"
+		<< node.toString()        		<< std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visShowNodeBubble (
+                NETWORK_ID network,
+                NodeID& node,
+                string label
+                ){
+
+	unsigned long bubbleKey = nodeBubbles.insert( network, node );
+        ostringstream out;
+
+        out       << "VisMsgShowNodeBubble"     << ";"
+                  << Helper::ultos(network)     << ";"
+                  << Helper::ultos(bubbleKey)   << ";"
+                  << node.toString()            << ";"
+                  << label                      << std::endl;
+
+        sendMessage( out.str(), network );
+}
+
+
+void OvlVis::visDeleteNodeBubble (
+	NETWORK_ID network,
+	NodeID& node
+	){
+
+	if( !nodeBubbles.exists(network, node)) return;
+
+	unsigned long bubbleID = nodeBubbles.get( network, node );
+	nodeBubbles.remove( network, node );
+
+	ostringstream out;
+
+	out	<< "VisMsgDeleteBubble"         << ";"
+                << Helper::ultos(network) 	<< ";"
+                << Helper::ultos(bubbleID)      << std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visShowShiftedNodeIcon (
+                NETWORK_ID network,
+                NodeID& node,
+                ICON_ID iconID,
+		unsigned int timeout
+                ){
+
+	unsigned long iconKey = shiftedNodeIcons.insert( network, node );
+
+        ostringstream out;
+
+        out	<< "VisMsgShowNodeIcon"      	<< ";"
+                << Helper::ultos(network)   	<< ";"
+                << Helper::ultos(iconKey)       << ";"
+                << node.toString()       	<< ";"
+                << Helper::ultos(iconID)	<< std::endl;
+
+        sendMessage( out.str(), network );
+
+	if( timeout > 0 ){
+		TimedoutIcon* obj = new TimedoutIcon( network, node, timeout );
+		obj->startIcon();
+	}
+}
+
+void OvlVis::visDeleteShiftedNodeIcon (
+                NETWORK_ID network,
+                NodeID& node
+                ){
+
+	if( !shiftedNodeIcons.exists(network, node) )return;
+
+	unsigned long iconKey = shiftedNodeIcons.get( network, node );
+	shiftedNodeIcons.remove( network, node );
+
+	ostringstream out;
+
+	out	<< "VisMsgDeleteIcon"           << ";"
+                << Helper::ultos(network) 	<< ";"
+                << Helper::ultos(iconKey)       << std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+//*****************************************************
+//*****************************************************
+//*****************************************************
+
+void OvlVis::visChangeLinkWidth (
+	NETWORK_ID network,
+	NodeID& srcnode,
+	NodeID& destnode,
+	unsigned int width
+	){
+
+	unsigned long edgekey = networkLinks.get( network, NodePair(srcnode, destnode) );
+
+	ostringstream out;
+	out	<< "VisMsgChangeLinkWidth"       	<< ";"
+		<< Helper::ultos(network) 		<< ";"
+		<< Helper::ultos(edgekey)		<< ";"
+		<< Helper::ultos(width)			<< std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visChangeLinkColor (
+	NETWORK_ID network,
+	NodeID& srcnode,
+	NodeID& destnode,
+	unsigned char r,
+	unsigned char g,
+	unsigned char b
+	){
+
+	ostringstream out;
+	unsigned long edgekey = networkLinks.get( network, NodePair(srcnode, destnode) );
+
+	out	<< "VisMsgChangeLinkColor"       	<< ";"
+		<< Helper::ultos(network) 		<< ";"
+		<< Helper::ultos(edgekey)			<< ";"
+		<< Helper::ultos(r)			<< ";"
+		<< Helper::ultos(g)			<< ";"
+		<< Helper::ultos(b)			<< std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visChangeLinkColor (
+	NETWORK_ID network,
+	NodeID& srcnode,
+	NodeID& destnode,
+	NODE_COLORS color
+	){
+
+	unsigned char r = 0;
+	unsigned char g = 0;
+	unsigned char b = 0;
+
+	switch( color ) {
+		case NODE_COLORS_GREY: 	r = 128; g = 128; b = 128; break;
+		case NODE_COLORS_GREEN:	r = 0;   g = 200; b = 0;   break;
+		case NODE_COLORS_RED:	r = 255; g = 0;   b = 0;   break;
+	}
+
+	visChangeLinkColor( network, srcnode, destnode, r, g, b );
+}
+
+void OvlVis::visShowLinkLabel (
+	NETWORK_ID network,
+	NodeID& srcnode,
+	NodeID& destnode,
+	string label
+	){
+
+	ostringstream out;
+	unsigned long edgekey = networkLinks.get( network, NodePair(srcnode, destnode) );
+
+	out	<< "VisMsgShowLinkLabel"       		<< ";"
+		<< Helper::ultos(network) 		<< ";"
+		<< Helper::ultos(edgekey)			<< ";"
+		<< label				<< std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visDeleteLinkLabel (
+	NETWORK_ID network,
+	NodeID& srcnode,
+	NodeID& destnode
+	){
+
+	if( !networkLinks.exists(network, NodePair(srcnode, destnode))) return;
+
+	unsigned long edgekey = networkLinks.get( network, NodePair(srcnode, destnode) );
+	ostringstream out;
+
+	out	<< "VisMsgDeleteLinkLabel"       	<< ";"
+		<< Helper::ultos(network) 		<< ";"
+		<< Helper::ultos(edgekey)		<< std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visShowOnLinkIcon (
+                NETWORK_ID network,
+                NodeID& srcnode,
+                NodeID& destnode,
+                ICON_ID iconID
+                ){
+
+	unsigned long iconKey = onLinkIcons.insert(network, NodePair(srcnode, destnode));
+        ostringstream out;
+
+        out	<< "VisMsgShowLinkIcon"      	<< ";"
+                << Helper::ultos(network)   	<< ";"
+                << Helper::ultos(iconKey)       << ";"
+                << srcnode.toString()   	<< ";"
+                << destnode.toString()   	<< ";"
+                << Helper::ultos(iconID)	<< std::endl;
+
+        sendMessage( out.str(), network );
+}
+
+void OvlVis::visDeleteOnLinkIcon (
+                NETWORK_ID network,
+                NodeID& srcnode,
+		NodeID& destnode
+                ){
+
+	if( !onLinkIcons.exists(network, NodePair(srcnode, destnode))) return;
+
+	unsigned long iconKey = onLinkIcons.get( network, NodePair(srcnode, destnode) );
+	onLinkIcons.remove( network, NodePair(srcnode, destnode) );
+
+	ostringstream out;
+
+	out	<< "VisMsgDeleteIcon"           << ";"
+                << Helper::ultos(network) 	<< ";"
+                << Helper::ultos(iconKey)       << std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visShowLinkBubble (
+	NETWORK_ID network,
+	NodeID& srcnode,
+	NodeID& destnode,
+	string label
+	){
+
+	ostringstream out;
+	unsigned long bubble = linkBubbles.insert( network, NodePair(srcnode, destnode) );
+
+	out	<< "VisMsgShowLinkBubble"	<< ";"
+		<< Helper::ultos(network)	<< ";"
+		<< Helper::ultos(bubble)	<< ";"
+		<< srcnode.toString()   	<< ";"
+		<< destnode.toString()   	<< ";"
+		<< label			<< std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visDeleteLinkBubble (
+	NETWORK_ID network,
+	NodeID& srcnode,
+	NodeID& destnode
+	){
+
+	if( !linkBubbles.exists(network, NodePair(srcnode, destnode))) return;
+
+	ostringstream out;
+	unsigned long bubble = linkBubbles.get( network, NodePair(srcnode, destnode) );
+	linkBubbles.remove( network, NodePair(srcnode, destnode) );
+
+	out	<< "VisMsgDeleteBubble"		<< ";"
+		<< Helper::ultos(network)	<< ";"
+		<< Helper::ultos(bubble)	<< std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+//*****************************************************
+//*****************************************************
+//*****************************************************
+
+void OvlVis::visSendMessage (
+	NETWORK_ID network,
+	NodeID& startnode,
+	NodeID& endnode
+	){
+
+	ostringstream out;
+
+	out	<< "VisMsgSendMessage"       		<< ";"
+		<< Helper::ultos(network) 		<< ";"
+		<< startnode.toString()        		<< ";"
+		<< endnode.toString()			<< std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+//*****************************************************
+//*****************************************************
+//*****************************************************
+
+void OvlVis::visCLIOInitMeasurement(
+	NETWORK_ID network,
+	unsigned long edgekey,
+	NodeID& srcnode,
+	NodeID& destnode,
+	string info
+	){
+
+	ostringstream out;
+
+	out << "VisMsgCLIOInitMeasurement" << ";"
+		<< Helper::ultos(network)      << ";"
+		<< Helper::ultos(edgekey)      << ";"
+		<< srcnode.toString()          << ";"
+		<< destnode.toString()         << ";"
+		<< info                        << std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+void OvlVis::visCLIOEndMeasurement(
+	NETWORK_ID network,
+	unsigned long edgekey,
+	NodeID& srcnode,
+	NodeID& destnode,
+	string info,
+	string value,
+	string unit
+	){
+
+	ostringstream out;
+
+	out << "VisMsgCLIOEndMeasurement" << ";"
+		<< Helper::ultos(network)     << ";"
+		<< Helper::ultos(edgekey)     << ";"
+		<< srcnode.toString()         << ";"
+		<< destnode.toString()        << ";"
+		<< info                       << ";"
+		<< value		      << ";"
+		<< unit			      << std::endl;
+
+	sendMessage( out.str(), network );
+}
+
+//*****************************************************
+//*****************************************************
+//*****************************************************
+
+}} // namespace ariba, common
Index: /source/ariba/utility/misc/OvlVis.h
===================================================================
--- /source/ariba/utility/misc/OvlVis.h	(revision 2378)
+++ /source/ariba/utility/misc/OvlVis.h	(revision 2378)
@@ -0,0 +1,443 @@
+// [Licence]
+// The Ariba-Underlay Copyright
+//
+// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
+//
+// Institute of Telematics
+// UniversitÃ€t Karlsruhe (TH)
+// Zirkel 2, 76128 Karlsruhe
+// Germany
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// The views and conclusions contained in the software and documentation
+// are those of the authors and should not be interpreted as representing
+// official policies, either expressed or implied, of the Institute of
+// Telematics.
+// [Licence]
+
+#ifndef OVLVIS_H__
+#define OVLVIS_H__
+
+#include <sstream>
+#include <iostream>
+#include <string>
+#include <map>
+#include <boost/utility.hpp>
+#include <boost/asio.hpp>
+#include "ariba/utility/types/NodeID.h"
+#include "ariba/utility/logging/Logging.h"
+#include "ariba/utility/system/Timer.h"
+#include "ariba/utility/misc/Helper.h"
+#include "ariba/utility/misc/KeyMapping.hpp"
+#include "ariba/utility/configuration/Configuration.h"
+
+using std::string;
+using std::map;
+using std::pair;
+using std::make_pair;
+using std::cout;
+using std::ostringstream;
+using boost::asio::ip::tcp;
+using ariba::utility::NodeID;
+using ariba::utility::Configuration;
+using ariba::utility::KeyMapping;
+using ariba::utility::Timer;
+
+namespace ariba {
+namespace utility {
+
+class OvlVis : private boost::noncopyable {
+	use_logging_h(OvlVis);
+public:
+	static OvlVis& instance() { static OvlVis the_inst; return the_inst; }
+
+	typedef enum _NETWORK_ID {
+		NETWORK_ID_BASE_COMMUNICATION 	= 1,
+		NETWORK_ID_BASE_OVERLAY 	= 2,
+		NETWORK_ID_EONSON 		= 3,
+		NETWORK_ID_MCPO 		= 4,
+		NETWORK_ID_CLIO 		= 5,
+		NETWORK_ID_VIDEOSTREAM 		= 6,
+		NETWORK_ID_GAME 		= 7,
+		NETWORK_ID_SECURITY 		= 8,
+	} NETWORK_ID;
+
+	//****************************************************************
+	// Node creation, node connections, status, node deletion, ...
+	//****************************************************************
+
+	/**
+	 * Create a node in the network that is initially unconnected.
+	 */
+	void visCreate (
+		NETWORK_ID network,
+		NodeID& node,
+		string nodename,
+		string info
+		);
+
+	/**
+	 * Change the status of a node -> enable/disable a node.
+	 */
+	void visChangeStatus(
+		NETWORK_ID network,
+		NodeID& node,
+		bool enable,
+		string info
+		);
+
+	/**
+	 * Connect two nodes using a link.
+	 */
+	void visConnect (
+		NETWORK_ID network,
+		NodeID& srcnode,
+		NodeID& destnode,
+		string info
+		);
+
+	/**
+	 * Disconnect the link between two nodes.
+	 */
+	void visDisconnect (
+		NETWORK_ID network,
+		NodeID& srcnode,
+		NodeID& destnode,
+		string info
+		);
+
+	/**
+	 * Indicate that the connection procedure
+	 * between two nodes failed.
+	 */
+	void visFailedConnect (
+		NETWORK_ID network,
+		NodeID& srcnode,
+		NodeID& destnode,
+		string info
+		);
+
+	/**
+	 * Delete a node from the network.
+	 */
+	void visShutdown (
+		NETWORK_ID network,
+		NodeID& node,
+		string info
+		);
+
+	//****************************************************************
+	// Node manipulation: change color, change icon
+	//****************************************************************
+
+	/**
+	 * Change the color of the node.
+	 */
+	void visChangeNodeColor (
+		NETWORK_ID network,
+		NodeID& node,
+		unsigned char r,
+		unsigned char g,
+		unsigned char b
+		);
+
+	typedef enum _NODE_COLORS {
+		NODE_COLORS_GREY,
+		NODE_COLORS_GREEN,
+		NODE_COLORS_RED,
+	} NODE_COLORS;
+
+	/**
+	 * Change the color of the node.
+	 */
+	void visChangeNodeColor (
+		NETWORK_ID network,
+		NodeID& node,
+		NODE_COLORS color
+		);
+
+	/**
+	 * The available icons for changing the
+	 * icon of a node, showing an icon besides
+	 * a node and showing an icon at a link.
+	 */
+	typedef enum _ICON_ID {
+		ICON_ID_DEFAULT_NODE 	= 0,
+		ICON_ID_PC 		= 1,
+		ICON_ID_PC_WORLD 	= 2,
+		ICON_ID_FAILURE 	= 3,
+		ICON_ID_RED_CROSS 	= 4,
+		ICON_ID_CHARACTER_A 	= 5,
+		ICON_ID_CHARACTER_W 	= 6,
+		ICON_ID_CAMERA          = 7,
+	} ICON_ID;
+
+	/**
+	 * Change the icon of a node.
+	 */
+        void visChangeNodeIcon (
+                NETWORK_ID network,
+                NodeID& node,
+                ICON_ID icon
+                );
+
+	/**
+	 * Show the label of the node.
+	 */
+	void visShowNodeLabel (
+		NETWORK_ID network,
+		NodeID& node,
+		string label
+		);
+
+	/**
+	 * Delete the label of the node.
+	 */
+	void visDeleteNodeLabel (
+		NETWORK_ID network,
+		NodeID& node
+		);
+
+	/**
+	 * Show a bubble at the node.
+	 */
+        void visShowNodeBubble (
+                NETWORK_ID network,
+                NodeID& node,
+                string label
+                );
+
+	/**
+	 * Delete a bubble at the node.
+	 */
+	void visDeleteNodeBubble (
+                NETWORK_ID network,
+		NodeID& node
+                );
+
+	/**
+	 * Show an icon besides the node.
+	 */
+        void visShowShiftedNodeIcon (
+                NETWORK_ID network,
+                NodeID& node,
+                ICON_ID iconID,
+		unsigned int timeout = 0
+                );
+
+	/**
+	 * Delete an icon besides the node
+	 */
+        void visDeleteShiftedNodeIcon (
+                NETWORK_ID network,
+                NodeID& node
+                );
+
+	//****************************************************************
+	// Link manipulation: change width, color, show bubbles, icons, ...
+	//****************************************************************
+
+	/**
+	 * Change the link width
+	 */
+	void visChangeLinkWidth (
+		NETWORK_ID network,
+		NodeID& srcnode,
+		NodeID& destnode,
+		unsigned int width
+		);
+
+	/**
+	 * Change the link color
+	 */
+	void visChangeLinkColor (
+		NETWORK_ID network,
+		NodeID& srcnode,
+		NodeID& destnode,
+		unsigned char r,
+		unsigned char g,
+		unsigned char b
+		);
+
+	/**
+	 * Change the link color
+	 */
+	void visChangeLinkColor (
+		NETWORK_ID network,
+		NodeID& srcnode,
+		NodeID& destnode,
+		NODE_COLORS color
+		);
+
+	/**
+	 * Show a link label
+	 */
+	void visShowLinkLabel (
+		NETWORK_ID network,
+		NodeID& srcnode,
+		NodeID& destnode,
+		string label
+		);
+
+	/**
+	 * Delete a link label
+	 */
+	void visDeleteLinkLabel (
+		NETWORK_ID network,
+		NodeID& srcnode,
+		NodeID& destnode
+		);
+
+	/**
+	 * Show an icon at the link
+	 */
+        void visShowOnLinkIcon (
+                NETWORK_ID network,
+                NodeID& srcnode,
+                NodeID& destnode,
+                ICON_ID iconID
+                );
+
+	/**
+	 * Delete an icon at the link
+	 */
+        void visDeleteOnLinkIcon (
+                NETWORK_ID network,
+                NodeID& srcnode,
+		NodeID& destnode
+                );
+
+	/**
+	 * Show a bubble besides the link
+	 */
+	void visShowLinkBubble (
+		NETWORK_ID network,
+		NodeID& srcnode,
+		NodeID& destnode,
+		string label
+		);
+
+	/**
+	 * Delete a bubble besides the link
+	 */
+	void visDeleteLinkBubble (
+		NETWORK_ID network,
+		NodeID& srcnode,
+		NodeID& destnode
+		);
+
+	//****************************************************************
+	// Send message between two nodes
+	//****************************************************************
+
+	/**
+	 * Animate the message sending between two nodes
+	 */
+	void visSendMessage (
+		NETWORK_ID network,
+		NodeID& startnode,
+		NodeID& endnode
+		);
+
+//*******************************************************
+//*
+	void visCLIOInitMeasurement (
+		NETWORK_ID network,
+		unsigned long edgekey,
+		NodeID& srcnode,
+		NodeID& destnode,
+		string info
+		);
+
+	void visCLIOEndMeasurement (
+		NETWORK_ID network,
+		unsigned long edgekey,
+		NodeID& srcnode,
+		NodeID& destnode,
+		string info,
+		string value,
+		string unit
+		);
+//*
+//*******************************************************
+
+protected:
+	OvlVis();
+	~OvlVis();
+
+private:
+	void sendMessage( const string msg, NETWORK_ID nid );
+	void sendSocket( const string msg );
+
+	/**
+	 * boost asio stuff for connecting to ovlvis
+	 */
+	boost::asio::io_service io_service;
+	tcp::socket socket;
+	volatile bool socketOpened;
+
+	typedef pair<NodeID, NodeID> NodePair;
+	typedef KeyMapping<NodePair> NetworkLinks;
+	typedef KeyMapping<NodePair> LinkBubbles;
+	typedef KeyMapping<NodeID>   NodeBubbles;
+	typedef KeyMapping<NodeID>   ShiftedNodeIcons;
+	typedef KeyMapping<NodePair> OnLinkIcons;
+
+	NetworkLinks 		networkLinks;
+	LinkBubbles 		linkBubbles;
+	NodeBubbles 		nodeBubbles;
+	ShiftedNodeIcons 	shiftedNodeIcons;
+	OnLinkIcons 		onLinkIcons;
+
+	class TimedoutIcon : public Timer {
+	private:
+		NETWORK_ID network;
+		NodeID node;
+		unsigned int timeout;
+	public:
+		TimedoutIcon(NETWORK_ID _network, NodeID _node, unsigned int _timeout) :
+			network(_network), node(_node), timeout(_timeout) {
+		}
+
+		virtual ~TimedoutIcon(){
+			Timer::stop();
+		}
+
+		void startIcon(){
+			Timer::setInterval( timeout, true );
+			Timer::start();
+		}
+
+	protected:
+		virtual void eventFunction(){
+			OvlVis::instance().visDeleteShiftedNodeIcon( network, node );
+			delete this;
+		}
+	};
+
+};
+
+}} // namespace ariba, common
+
+#endif // OVLVIS_H__
Index: urce/ariba/utility/misc/StringFormat.cpp
===================================================================
--- /source/ariba/utility/misc/StringFormat.cpp	(revision 12775)
+++ 	(revision )
@@ -1,48 +1,0 @@
-
-#include "StringFormat.h"
-
-#include "boost/xpressive/xpressive.hpp"
-
-namespace ariba {
-namespace utility {
-namespace string_format {
-
-using namespace boost::xpressive;
-
-// regex: string
-const sregex rstring = '"' >> keep(*~(boost::xpressive::set = '"'))
-		>> '"';
-
-// regex: base64 encoding
-const sregex rbase64 = '!' >> +(range('a', 'z') | range('A', 'Z')
-		| range('0', '9') | '/' | '+') >> *(boost::xpressive::set = '=');
-
-// regex: raw alphabet
-const sregex rchars = +(range('a', 'z') | range('A', 'Z'));
-
-// regex: integer
-const sregex rint = '0' | (range('1', '9') >> !(range('0', '9')));
-
-// regex: binary label
-const sregex rlabel = rchars | rstring | rbase64;
-
-// regex: dot separated identifier
-const sregex rid = rlabel >> *('.' >> rlabel) >> *('.' >> rint);
-
-// regex: "leaf" data
-const sregex rdata = !(boost::xpressive::set = '!') >> '{'
-		>> *(keep(+~(boost::xpressive::set = '{', '}')) | by_ref(rdata))
-		>> '}';
-
-// regex: fields
-const sregex rfield_label = rlabel >> '=';
-const sregex rfield = !rfield_label >> (rid | rdata);
-const sregex rfields = '(' >> rfield >> *(',' >> rfield) >> ')';
-
-// regex objects
-const sregex robject_data = (rdata | rfields);
-const sregex robject_id = rid;
-const sregex robject = robject_id >> robject_data;
-const sregex robjects = robject >> *(',' >> robject);
-
-}}}
Index: urce/ariba/utility/misc/StringFormat.h
===================================================================
--- /source/ariba/utility/misc/StringFormat.h	(revision 12775)
+++ 	(revision )
@@ -1,94 +1,0 @@
-
-#ifndef STRINGFORMAT_H_
-#define STRINGFORMAT_H_
-
-#include "boost/xpressive/xpressive.hpp"
-
-namespace ariba {
-namespace utility {
-namespace string_format {
-
-using boost::xpressive::sregex;
-
-class regex_nav {
-private:
-	typedef boost::xpressive::smatch _match;
-	typedef _match::nested_results_type nested_results;
-	typedef nested_results::const_iterator nested_iterator;
-	const _match& match;
-
-public:
-	regex_nav(const _match& match) :
-		match(match) {
-	}
-
-	regex_nav() :
-		match(*((const _match*) NULL)) {
-	}
-
-	bool matched() const {
-		return &match != NULL;
-	}
-
-	regex_nav operator[] (const sregex& type) const {
-		const nested_results& nr = match.nested_results();
-		for (nested_iterator i = nr.begin(); i != nr.end(); i++) {
-			if (i->regex_id() == type.regex_id()) return regex_nav(*i);
-		}
-		return regex_nav();
-	}
-
-	regex_nav operator[](int index) const {
-		const nested_results& nr = match.nested_results();
-		for (nested_iterator i = nr.begin(); i != nr.end() && index >= 0; i++) {
-			if (index == 0) return regex_nav(*i);
-			index--;
-		}
-		return regex_nav();
-	}
-
-	int size() const {
-		return match.nested_results().size();
-	}
-
-	std::string str() const {
-		if (!matched()) return std::string("<no match>");
-		return match[0].str();
-	}
-};
-
-// regex: string
-extern const sregex rstring;
-
-// regex: base64 encoding
-extern const sregex rbase64;
-
-// regex: raw alphabet
-extern const sregex rchars;
-
-// regex: integer
-extern const sregex rint;
-
-// regex: binary label
-extern const sregex rlabel;
-
-// regex: dot separated identifier
-extern const sregex rid;
-
-// regex: "leaf" data
-extern const sregex rdata;
-
-// regex: fields
-extern const sregex rfield_label;
-extern const sregex rfield;
-extern const sregex rfields;
-
-// regex: objects
-extern const sregex robject_data;
-extern const sregex robject_id;
-extern const sregex robject;
-extern const sregex robjects;
-
-}}}
-
-#endif /* STRINGFORMAT_H_ */
Index: /source/ariba/utility/misc/sha1.cpp
===================================================================
--- /source/ariba/utility/misc/sha1.cpp	(revision 12775)
+++ /source/ariba/utility/misc/sha1.cpp	(revision 2378)
@@ -1,6 +1,6 @@
-// [License]
+// [licence]
 // 100% free public domain implementation of the SHA-1 algorithm
 // by Dominik Reichl <dominik.reichl@t-online.de>
-// [License]
+// [licence]
 /*
       Version 1.5 - 2005-01-01
@@ -242,16 +242,11 @@
     }
 
-	bool ret = true;
-	size_t rets = -1;
-
     for(i = 0; i < ulBlocks; i++) {
-        rets = fread(uData, 1, SHA1_MAX_FILE_BUFFER, fIn);
-        ret &= (rets > 0 );
+        fread(uData, 1, SHA1_MAX_FILE_BUFFER, fIn);
         Update((UINT_8 *)uData, SHA1_MAX_FILE_BUFFER);
     }
 
     if(ulRest != 0) {
-        rets = fread(uData, 1, ulRest, fIn);
-        ret &= (rets > 0 );
+        fread(uData, 1, ulRest, fIn);
         Update((UINT_8 *)uData, ulRest);
     }
@@ -259,5 +254,5 @@
     fclose(fIn);
     fIn = NULL;
-    return ret;
+    return true;
 }
 #endif
Index: /source/ariba/utility/misc/sha1.h
===================================================================
--- /source/ariba/utility/misc/sha1.h	(revision 12775)
+++ /source/ariba/utility/misc/sha1.h	(revision 2378)
@@ -1,6 +1,6 @@
-// [License]
+// [licence]
 // 100% free public domain implementation of the SHA-1 algorithm
 // by Dominik Reichl <dominik.reichl@t-online.de>
-// [License]
+// [licence]
 /*
         Version 1.5 - 2005-01-01
Index: /source/ariba/utility/serialization.h
===================================================================
--- /source/ariba/utility/serialization.h	(revision 12775)
+++ /source/ariba/utility/serialization.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef SERIALIZATION_H_
Index: urce/ariba/utility/serialization/CMakeLists.txt
===================================================================
--- /source/ariba/utility/serialization/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,50 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    Data.hpp
-    DataStream.hpp
-    DataUtilities.hpp
-    Serialization.hpp
-    TestSerialization.h
-    )
-
-add_sources(
-    Serialization.cpp
-    TestSerialization.cpp
-    )
Index: /source/ariba/utility/serialization/Data.hpp
===================================================================
--- /source/ariba/utility/serialization/Data.hpp	(revision 12775)
+++ /source/ariba/utility/serialization/Data.hpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef DATA_HPP_
@@ -41,9 +41,7 @@
 
 //== library includes ==
-#include <string.h>
 #include <stdlib.h>
 #include <iostream>
 #include <boost/cstdint.hpp>
-#include <boost/type_traits/make_unsigned.hpp>
 
 // forward declaration
@@ -51,5 +49,5 @@
 template<typename T = uint8_t, typename DataModel = DefaultDataModel<uint8_t> > class DataTpl;
 typedef DataTpl<> Data;
-template<typename T, typename DataModel> std::ostream& operator<<(std::ostream& stream, const DataTpl<T, DataModel>& data);
+template<typename T, typename DataModel> std::ostream& operator<<(std::ostream& stream, DataTpl<T, DataModel>& data);
 
 //== internal includes ==
@@ -121,6 +119,5 @@
 		template<typename X>
 		finline void get(X& value, size_t length = sizeof(X) * 8, if_int(X)) const {
-			typedef typename boost::make_unsigned<X>::type unsigned_type;
-			_unsigned(value) = bitget<unsigned_type> (bits.buffer(), index, length);
+			_unsigned(value) = bitget<X> (bits.buffer(), index, length);
 		}
 
@@ -326,4 +323,18 @@
 	}
 };
+
+/* default human readable text output */
+template<typename T, typename DataModel>
+std::ostream& operator<<(std::ostream& stream, DataTpl<T, DataModel>& data) {
+	stream << "[" << bitstr(data.getBuffer(), data.getLength(), 4)
+			<< "|'";
+	char* buffer = (char*) data.getBuffer();
+	for (size_t i = 0; i < data.getLength() / 8; i++) {
+		char c = buffer[i] < 32 ? '.' : buffer[i];
+		stream << c;
+	}
+	stream << "']";
+	return stream;
+}
 
 /* unspecified type */
@@ -386,5 +397,5 @@
 
 	finline int32_t length() const {
-		return (bufferLen == -1) ? 0 : bufferLen;
+		return bufferLen;
 	}
 
@@ -397,25 +408,17 @@
 		size_t res_length = calcLength(new_length);
 		if (old_length != res_length) {
-
-			if(res_length <= 0){
-				if (bufferPtr != NULL) delete [] bufferPtr;
-				bufferPtr = NULL;
-				bufferLen = 0;
-			}else{
-				T* new_buffer = new T[res_length];
-				if (new_buffer != NULL) memset(new_buffer, 0, res_length*sizeof(T));
-				if (bufferPtr != NULL) {
-					size_t clength = res_length < old_length ? res_length : old_length;
-					memcpy( new_buffer, bufferPtr, clength*sizeof(T) );
-					delete [] bufferPtr;
-				}
-				bufferPtr = new_buffer;
-				bufferLen = new_length;
+			T* new_buffer = new T[res_length];
+			if (bufferPtr != NULL) {
+				size_t clength = res_length < old_length ? res_length : old_length;
+				memcpy( new_buffer, bufferPtr, clength*sizeof(T) );
+				delete [] bufferPtr;
 			}
+			bufferPtr = new_buffer;
+			bufferLen = new_length;
 		}
 	}
 
 	finline void release() {
-		if (bufferPtr!=NULL && bufferLen>=0) delete [] bufferPtr;
+		delete [] bufferPtr;
 		bufferPtr = NULL;
 		bufferLen = -1;
@@ -439,16 +442,3 @@
 }sznEnd();
 
-/* default human readable text output */
-template<typename T, typename DataModel>
-std::ostream& operator<<(std::ostream& stream, const DataTpl<T, DataModel>& data) {
-	stream << "[" << bitstr(data.getBuffer(), data.getLength(), 4)
-			<< "|'";
-	const char* buffer = (const char*) data.getBuffer();
-	for (size_t i = 0; i < data.getLength() / 8; i++) {
-		char c = buffer[i] < 32 ? '.' : buffer[i];
-		stream << c;
-	}
-	stream << "']";
-	return stream;
-}
 #endif /* DATA_HPP_ */
Index: /source/ariba/utility/serialization/DataStream.hpp
===================================================================
--- /source/ariba/utility/serialization/DataStream.hpp	(revision 12775)
+++ /source/ariba/utility/serialization/DataStream.hpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef DATASTREAM_HPP_
@@ -42,7 +42,4 @@
 //== Library includes ==
 #include <boost/cstdint.hpp>
-#include <boost/type_traits/make_unsigned.hpp>
-
-#include <cassert>
 #include <iostream>
 #include <vector>
@@ -150,6 +147,5 @@
 	finline void add(X& obj, if_uint(X)) {
 		if (!isMeasure())
-//			bitcpy( obj, 0, bits.getBuffer(), index);
-			bitcpy( obj, 0, bits.getBuffer(), index, sizeof(X)*8 );
+		bitcpy( obj, 0, bits.getBuffer(), index);
 		index += sizeof(X) * 8;
 	}
@@ -157,24 +153,4 @@
 	template<typename X>
 	finline void remove(X& obj, if_uint(X)) {
-		//if (!isMeasure()) bits[index].get(obj);
-		if (!isMeasure())
-			bitcpy( bits.getBuffer(), index, obj, 0, sizeof(X)*8 );
-		index += sizeof(X) * 8;
-	}
-
-	/* support signed ints */
-	template<typename X>
-	finline void add(X& sobj, if_int(X)) {
-		typedef typename boost::make_unsigned<X>::type UX;
-		UX& obj = *((UX*)&sobj);
-		if (!isMeasure())
-		bitcpy( sobj, 0, bits.getBuffer(), index);
-		index += sizeof(X) * 8;
-	}
-
-	template<typename X>
-	finline void remove(X& sobj, if_int(X)) {
-		typedef typename boost::make_unsigned<X>::type UX;
-		UX& obj = *((UX*)&sobj);
 		if (!isMeasure()) bits[index].get(obj);
 		index += sizeof(X) * 8;
@@ -332,17 +308,4 @@
 		bits.setLength(index);
 		return bits;
-	}
-
-	finline uint8_t* bytes( size_t length ) {
-		assert((index%bits.word_width)==0);
-		if (!isMeasure()) {
-			bits.ensureLength( index + length * 8);
-			uint8_t* buffer = (uint8_t*)bits.getBuffer()+(index/bits.word_width);
-			index += length*8;
-			return buffer;
-		} else {
-			index += length*8;
-			return NULL;
-		}
 	}
 
@@ -509,6 +472,5 @@
 				i++;
 			}
-			if (isCharP) *text = strdup(s.c_str());
-			else string->assign(s);
+			if (isCharP) *text = strdup(s.c_str()); else *string = s;
 		}
 		sznMethodEnd()
@@ -524,24 +486,9 @@
 	public:
 		finline ArrayTpl( T*& array, size_t length ) :
-		v(array), l(length) {}
+		v(0), l(length) {}
 
 		sznMethodBegin(X)
 		if (X.isDeserializer()) v = new T[l];
 		for (size_t i=0; i<l; i++) X && v[i];
-		sznMethodEnd()
-	};
-
-	template<typename T>
-	class StaticArrayTpl : public ExplicitSerializer {
-	private:
-		T* v;
-		size_t l;
-
-	public:
-		finline StaticArrayTpl( T* array, size_t length ) :
-		v(array), l(length) {}
-
-		sznMethodBegin(X)
-			for (size_t i=0; i<l; i++) X && v[i];
 		sznMethodEnd()
 	};
@@ -571,9 +518,4 @@
 	finline ArrayTpl<T> A( T*& array, size_t length ) {
 		return ArrayTpl<T>(array,length);
-	}
-
-	template<typename T>
-	finline StaticArrayTpl<T> static_A( T* array, size_t length ) {
-		return StaticArrayTpl<T>(array,length);
 	}
 
Index: /source/ariba/utility/serialization/DataUtilities.hpp
===================================================================
--- /source/ariba/utility/serialization/DataUtilities.hpp	(revision 12775)
+++ /source/ariba/utility/serialization/DataUtilities.hpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 /* This file implements some common bit operations for unsigned integer types
@@ -71,14 +71,4 @@
 #include <string>
 
-template<typename X> finline
-static X shr( const X& value, unsigned int bits ) {
-	return (sizeof(X)*8 == bits) ? 0 : (value >> bits);
-}
-
-template<typename X> finline
-static X shl( const X& value, unsigned int bits ) {
-	return (sizeof(X)*8 == bits) ? 0 : (value << bits);
-}
-
 /**
  * TODO: Doc
@@ -87,5 +77,5 @@
 static X bitblk(size_t index, size_t length, bool value, if_uint(X)) {
 	if (index == 0 && length >= sizeof(X) * 8) return value ? ~0 : 0;
-	X x = shl(( shl( ((X) 1), length) - 1), index);
+	X x = ((((X) 1) << length) - 1) << index;
 	return value ? x : ~x;
 }
@@ -117,5 +107,5 @@
 	if (srcInvert) srcIdx = sizeof(X) * 8 - srcIdx - len;
 	if (dstInvert) dstIdx = sizeof(Y) * 8 - dstIdx - len;
-	Y value = ((Y)shr(src, srcIdx)) << dstIdx;
+	Y value = ((Y) (src >> srcIdx)) << dstIdx;
 	Y mask = bitblk<Y, 0> (dstIdx, len);
 	return (dst & mask) | (value & ~mask);
@@ -146,5 +136,5 @@
 	// check if first word only is affected
 	if ((dwp + len) <= w) {
-		X fw = shl(src[0],swp) | shr(src[1],iswp);
+		X fw = (src[0] << swp) | (src[1] >> iswp);
 		*dst = bitcpy(fw, 0, *dst, dwp, len, true, true);
 		return;
@@ -153,6 +143,6 @@
 	// set first word
 	if (idwp != 0) {
-		X fw = shl(src[0],swp) | shr(src[1],iswp);
-		*dst = (*dst & ~(((X) 1 << idwp) - 1)) | shr(fw,dwp);
+		X fw = (src[0] << swp) | (src[1] >> iswp);
+		*dst = (*dst & ~(((X) 1 << idwp) - 1)) | (fw >> dwp);
 
 		// recalculate indexes & lengths
@@ -179,5 +169,5 @@
 		a = src[0], b = src[1];
 		while (len >= w) {
-			*dst = shl(a,swp) | shr(b,iswp);
+			*dst = (a << swp) | (b >> iswp);
 			dst++;
 			src++;
@@ -189,9 +179,7 @@
 
 	// set last word
-	X lw = shl(a,swp) | shr(b,iswp), lm = (shl((X) 1,(w - len)) - 1);
+	X lw = (a << swp) | (b >> iswp), lm = (((X) 1 << (w - len)) - 1);
 	*dst = (*dst & lm) | (lw & ~lm);
 }
-
-
 
 /**
@@ -217,5 +205,5 @@
 		src++;
 		while (len >= w) {
-			X x = shl(a,swp) | shr(b,iswp);
+			X x = (a << swp) | (b >> iswp);
 			value <<= w;
 			value |= x;
@@ -228,5 +216,5 @@
 		if ( len> 0 ) {
 			value <<= len;
-			value |= ((shl(a,swp) | shr(b,iswp)) >> (w - len)) & (shl(1,len)-1);
+			value |= (((a << swp) | (b >> iswp)) >> (w - len)) & ((1 << len)-1);
 		}
 
@@ -266,8 +254,8 @@
 		size_t idwp = w - dwp;
 		src >>= srcIdx;
-		X mask1 = ~(shl(1,idwp) - 1);
-		dst[0] = (dst[0] & mask1) | (shr(src,(len - idwp)) & ~mask1);
-		X mask2 = shl(1,(w - len + idwp)) - 1;
-		dst[1] = (dst[1] & mask2) | (shl(src, (w - len + idwp)) & ~mask2);
+		X mask1 = ~((1 << idwp) - 1);
+		dst[0] = (dst[0] & mask1) | ((src >> (len - idwp)) & ~mask1);
+		X mask2 = (1 << (w - len + idwp)) - 1;
+		dst[1] = (dst[1] & mask2) | ((src << (w - len + idwp)) & ~mask2);
 	}
 }
@@ -289,9 +277,9 @@
 		// check inversion
 		if (srcInvert) srcIdx = sizeof(Y) * 8 - srcIdx - len;
-		src = shr(src, srcIdx);
+		src >>= srcIdx;
 
 		const size_t dw = sizeof(X)*8;
 		while (len >= dw) {
-			X word = (X)shr(src,(len-dw));
+			X word = (X)(src >> (len-dw));
 			bitcpy(word,0,dst,dstIdx,dw);
 			dstIdx += dw;
Index: /source/ariba/utility/serialization/Serialization.cpp
===================================================================
--- /source/ariba/utility/serialization/Serialization.cpp	(revision 12775)
+++ /source/ariba/utility/serialization/Serialization.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "Serialization.hpp"
Index: /source/ariba/utility/serialization/Serialization.hpp
===================================================================
--- /source/ariba/utility/serialization/Serialization.hpp	(revision 12775)
+++ /source/ariba/utility/serialization/Serialization.hpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef SERIALIZATION_HPP_
@@ -200,5 +200,4 @@
 #include <typeinfo>
 #include <iostream>
-#include <cstdio>
 
 //---------------------------------------------------------------------------
Index: /source/ariba/utility/serialization/TestSerialization.cpp
===================================================================
--- /source/ariba/utility/serialization/TestSerialization.cpp	(revision 12775)
+++ /source/ariba/utility/serialization/TestSerialization.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,7 +35,6 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
-#include "TestSerialization.h"
 #include "Data.hpp"
 #include "DataStream.hpp"
@@ -55,10 +54,7 @@
 	Aclass* vclass;
 	bool vcls;
-	uint8_t* static_array;
 
 	Aclass(bool vcls = false) {
 		text = new char[80];
-		static_array = new uint8_t[20];
-		for (size_t i=0; i<20; i++) static_array[i] = i;
 		strcpy(text, "Hallo!");
 		str = "std::string:)";
@@ -98,8 +94,5 @@
 
 sznBeginDefault( Aclass, X ){
-	double xpos;
 	X && x && b && I(y,6) && T(text) && T(str) && A(v,4) && I(z) && vcls;
-	X && static_A(static_array,20);
-	X && static_A( (uint8_t*)&xpos, 8 );
 	if (vcls) X && VO(vclass);
 }sznEnd()
@@ -107,5 +100,5 @@
 vsznDefault( Aclass );
 
-int test_serialization() {
+int main() {
 	using namespace std;
 
Index: urce/ariba/utility/serialization/TestSerialization.h
===================================================================
--- /source/ariba/utility/serialization/TestSerialization.h	(revision 12775)
+++ 	(revision )
@@ -1,8 +1,0 @@
-// TestSerialization.h, created on 13.11.2009 by Sebastian Mies
-
-#ifndef TESTSERIALIZATION_H_
-#define TESTSERIALIZATION_H_
-
-int test_serialization();
-
-#endif /* TESTSERIALIZATION_H_ */
Index: /source/ariba/utility/system/BlockingMethod.cpp
===================================================================
--- /source/ariba/utility/system/BlockingMethod.cpp	(revision 12775)
+++ /source/ariba/utility/system/BlockingMethod.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "BlockingMethod.h"
@@ -80,7 +80,3 @@
 }
 
-void BlockingMethod::joinThread(){
-	this->threadObj->join();
-}
-
 }} // namespace ariba, common
Index: /source/ariba/utility/system/BlockingMethod.h
===================================================================
--- /source/ariba/utility/system/BlockingMethod.h	(revision 12775)
+++ /source/ariba/utility/system/BlockingMethod.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef BLOCKING_METHOD_H__
@@ -63,7 +63,4 @@
 	void runBlockingMethod();
 
-	// block until thread ended
-	void joinThread();
-
 protected:
 
@@ -82,5 +79,4 @@
 	virtual void blockingFunction() = 0;
 
-
 private:
 	boost::thread* threadObj;
Index: urce/ariba/utility/system/CMakeLists.txt
===================================================================
--- /source/ariba/utility/system/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,60 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    BlockingMethod.h
-    EnterMethod.h
-    StartupInterface.h
-    StartupWrapper.h
-    SystemEvent.h
-    SystemEventListener.h
-    SystemEventType.h
-    SystemQueue.h
-    Timer.h
-    )
-
-add_sources(
-    BlockingMethod.cpp
-    EnterMethod.cpp
-    StartupWrapper.cpp
-    SystemEvent.cpp
-    SystemEventListener.cpp
-    SystemEventType.cpp
-    SystemQueue.cpp
-    Timer.cpp
-    )
Index: urce/ariba/utility/system/EnterMethod.cpp
===================================================================
--- /source/ariba/utility/system/EnterMethod.cpp	(revision 12775)
+++ 	(revision )
@@ -1,90 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "EnterMethod.h"
-
-namespace ariba {
-namespace utility {
-
-//SystemEventType EnterMethodType("EnterMethod");
-
-EnterMethod::EnterMethod(){
-}
-
-EnterMethod::~EnterMethod(){
-}
-
-void EnterMethod::enter(){
-
-	SystemQueue::instance().enterMethod();
-
-	/*
-	{ boost::mutex::scoped_lock lock( waitForEnterMutex );
-
-		SystemQueue::instance().scheduleEvent(
-			SystemEvent( this, EnterMethodType, NULL), 0 );
-		waitForEnter.wait( lock );
-	}
-	*/
-}
-
-void EnterMethod::leave(){
-
-	SystemQueue::instance().leaveMethod();
-
-	/*
-	{ boost::mutex::scoped_lock lock( waitForLeaveMutex );
-		waitForLeave.notify_one();
-	}
-	*/
-}
-
-/*
-void EnterMethod::handleSystemEvent( const SystemEvent& event ){
-
-	{ boost::mutex::scoped_lock lock( waitForLeaveMutex );
-
-		{ boost::mutex::scoped_lock lock2( waitForEnterMutex );
-			waitForEnter.notify_one();
-		}
-
-		waitForLeave.wait( lock );
-	}
-}
-*/
-}} // namespace ariba, common
Index: urce/ariba/utility/system/EnterMethod.h
===================================================================
--- /source/ariba/utility/system/EnterMethod.h	(revision 12775)
+++ 	(revision )
@@ -1,80 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef ENTER_METHOD_H__
-#define ENTER_METHOD_H__
-
-#include "ariba/utility/system/SystemEventListener.h"
-#include "ariba/utility/system/SystemQueue.h"
-#include "ariba/utility/system/SystemEvent.h"
-#include "ariba/utility/system/SystemEventType.h"
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/thread.hpp>
-#include <boost/bind.hpp>
-
-using ariba::utility::SystemEventType;
-using ariba::utility::SystemQueue;
-using ariba::utility::SystemEventListener;
-
-namespace ariba {
-namespace utility {
-
-class EnterMethod /*: public SystemEventListener */{
-public:
-	EnterMethod();
-	virtual ~EnterMethod();
-
-	void enter();
-	void leave();
-	
-protected:
-	//void handleSystemEvent(const SystemEvent& event);
-	
-private:
-	/*
-	boost::condition_variable waitForEnter;
-	boost::condition_variable waitForLeave;
-
-	boost::mutex waitForEnterMutex;
-	boost::mutex waitForLeaveMutex;
-	*/
-};
-
-}} // namespace ariba, common
-
-#endif // ENTER_METHOD_H__
Index: urce/ariba/utility/system/OldSystemQueue.cpp
===================================================================
--- /source/ariba/utility/system/OldSystemQueue.cpp	(revision 12775)
+++ 	(revision )
@@ -1,469 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-
-#include "SystemQueue.h"
-#include <stdexcept>
-
-namespace ariba {
-namespace utility {
-
-use_logging_cpp(SystemQueue);
-
-// /// Singleton
-// SystemQueue::_inst(NULL);
-
-
-SystemQueue::SystemQueue()
-#ifndef UNDERLAY_OMNET
- : delayScheduler( &directScheduler ),
-   systemQueueRunning( false )
-#endif
-{
-	logging_info("Creating SystemQueue at: " << this);
-}
-
-SystemQueue::~SystemQueue()
-{
-}
-
-
-SystemQueue& SystemQueue::instance()
-{
-	static SystemQueue _inst;
-	return _inst;
-
-// 	/// create singleton instance
-// 	if ( _inst == NULL )
-// 	{
-// 		_inst = new SystemQueue();
-// 		
-// 		logging_info("Creating SystemQueue at: " << _inst);
-// 	}
-// 	
-// 	return *_inst;
-}
-
-
-void SystemQueue::scheduleEvent( const SystemEvent& event, uint32_t delay ) {
-#ifndef UNDERLAY_OMNET
-	if( delay == 0 ) directScheduler.insert( event, delay );
-	else delayScheduler.insert ( event, delay );
-#else
-	Enter_Method_Silent();
-	cMessage* msg = new cMessage();
-	msg->setContextPointer( new SystemEvent(event) );
-
-	if( delay == 0 )
-		cSimpleModule::scheduleAt( cSimpleModule::simTime(), msg );
-	else
-		cSimpleModule::scheduleAt( cSimpleModule::simTime()+((double)delay/1000.0), msg );
-#endif
-}
-
-// maps to function call internally to the Event-system
-void SystemQueue::scheduleCall( const boost::function0<void>& function, uint32_t delay)
-{
-    // copy function object
-    boost::function0<void>* function_ptr = new boost::function0<void>();
-    (*function_ptr) = function; 
-
-    // schedule special call-event
-    scheduleEvent( SystemEvent(&internal_function_caller, SystemEventType::DEFAULT, function_ptr), delay );
-
-}
-
-#ifdef UNDERLAY_OMNET
-void SystemQueue::handleMessage(cMessage* msg){
-	SystemEvent* event = (SystemEvent*)msg->contextPointer();
-
-	event->listener->handleSystemEvent( *event );
-
-	delete event; delete msg;
-}
-#endif
-
-void SystemQueue::run() {
-	systemQueueRunning = true;
-	directScheduler.run();
-	delayScheduler.run();
-}
-
-void SystemQueue::cancel() {
-#ifndef UNDERLAY_OMNET
-	systemQueueRunning = false;
-	directScheduler.cancel();
-	delayScheduler.cancel();
-#endif
-}
-
-void SystemQueue::dropAll( const SystemEventListener* mlistener){
-#ifndef UNDERLAY_OMNET
-	directScheduler.dropAll(mlistener);
-	delayScheduler.dropAll(mlistener);
-#endif
-}
-
-bool SystemQueue::isEmpty() {
-#ifndef UNDERLAY_OMNET
-	return directScheduler.isEmpty() || delayScheduler.isEmpty();
-#else
-	return false;
-#endif
-}
-
-bool SystemQueue::isRunning() {
-#ifndef UNDERLAY_OMNET
-	return systemQueueRunning;
-#else
-	return true;
-#endif
-}
-
-void SystemQueue::enterMethod(){
-	// TODO: omnet case and delay scheduler
-	directScheduler.enter();
-}
-
-void SystemQueue::leaveMethod(){
-	// TODO: omnet case and delay scheduler
-	directScheduler.leave();
-}
-
-//***************************************************************
-#ifndef UNDERLAY_OMNET
-
-SystemQueue::QueueThread::QueueThread(QueueThread* _transferQueue)
-	: transferQueue( _transferQueue ), running( false ) {
-}
-
-SystemQueue::QueueThread::~QueueThread(){
-}
-
-void SystemQueue::QueueThread::run(){
-	running = true;
-
-	queueThread = new boost::thread(
-		boost::bind(&QueueThread::threadFunc, this) );
-}
-
-void SystemQueue::QueueThread::cancel(){
-
-	logging_debug("cancelling system queue");
-
-	// cause the thread to exit
-	{
-		// get the lock, when we got the lock the
-		// queue thread must be in itemsAvailable.wait()
-		boost::mutex::scoped_lock lock(queueMutex);
-
-		// set the running indicator and signal to run on
-		// this will run the thread and quit it
-		running = false;
-		itemsAvailable.notify_all();
-	}
-
-	// wait until the thread has exited
-	logging_debug("joining system queue thread");
-	queueThread->join();
-
-	// delete pending events
-	logging_debug("deleting pending system queue events");
-	while( eventsQueue.size() > 0 ){
-		eventsQueue.erase( eventsQueue.begin() );
-	}
-
-	// delete the thread, so that a subsuquent run() can be called
-	delete queueThread;
-	queueThread = NULL;
-}
-
-bool SystemQueue::QueueThread::isEmpty(){
-	boost::mutex::scoped_lock lock( queueMutex );
-	return eventsQueue.empty();
-}
-
-void SystemQueue::QueueThread::insert( const SystemEvent& event, uint32_t delay ){
-
-	// if this is called from a module that is currently handling
-	// a thread (called from SystemQueue::onNextQueueItem), the
-	// thread is the same anyway and the mutex will be already
-	// aquired, otherwise we aquire it now
-
-	boost::mutex::scoped_lock lock( queueMutex );
-
-	if ( delay > 0 )
-	{
-		logging_debug("SystemQueue(" << this << ") : Schedule event in: " << delay << " ms; Events in queue (before insert): " << eventsQueue.size() );
-	}
-
-	eventsQueue.push_back( event );
-	eventsQueue.back().scheduledTime = boost::posix_time::microsec_clock::local_time();
-	eventsQueue.back().delayTime = delay;
-	eventsQueue.back().remainingDelay = delay;
-	
-	if ( delay > 0 )
-	{
-		logging_debug("SystemQueue(" << this << ") : Events in queue (after insert): " << eventsQueue.size() );
-	}
-
-	onItemInserted( event );
-	itemsAvailable.notify_all();
-}
-
-void SystemQueue::QueueThread::dropAll( const SystemEventListener* mlistener) {
-	boost::mutex::scoped_lock lock( queueMutex );
-
-	bool deleted;
-	do{
-		deleted = false;
-		EventQueue::iterator i = eventsQueue.begin();
-		EventQueue::iterator iend = eventsQueue.end();
-
-		for( ; i != iend; i++){
-			if((*i).getListener() == mlistener){
-				eventsQueue.erase(i);
-				deleted = true;
-				break;
-			}
-		}
-	}while(deleted);
-}
-
-void SystemQueue::QueueThread::threadFunc( QueueThread* obj ) {
-
-	boost::mutex::scoped_lock lock( obj->queueMutex );
-
-	while( obj->running ) {
-
-		// wait until an item is in the queue or we are notified
-		// to quit the thread. in case the thread is about to
-		// quit, the queueThreadRunning variable will indicate
-		// this and cause the thread to exit
-
-		while ( obj->running && obj->eventsQueue.empty() ){
-
-//			const boost::system_time duration =
-//					boost::get_system_time() +
-//					boost::posix_time::milliseconds(100);
-//			obj->itemsAvailable.timed_wait( lock, duration );
-
-			obj->itemsAvailable.wait( lock );
-		}
-
-		//
-		// work all the items that are currently in the queue
-		//
-
-		while( obj->running && (!obj->eventsQueue.empty()) ) {
-
-			// fetch the first item in the queue
-			// and deliver it to the queue handler
-			SystemEvent ev = obj->eventsQueue.front();
-
-			// XXX debugging the delay-scheduler..
-			if ( ev.delayTime > 0 )
-				logging_debug("SystemQueue(" << obj << ") : Events in queue (before execution): " << obj->eventsQueue.size());
-
-			obj->eventsQueue.erase( obj->eventsQueue.begin() );
-
-			// call the queue and this will
-			// call the actual event handler
-			obj->queueMutex.unlock();
-			obj->onNextQueueItem( ev );
-			obj->queueMutex.lock();
-
-			// XXX debugging the delay-scheduler..
-			if ( ev.delayTime > 0 )
-				logging_debug("SystemQueue(" << obj << ") : Remaining events in queue (after execution): " << obj->eventsQueue.size());
-
-		} // !obj->eventsQueue.empty() )
-	} // while (obj->running)
-
-	logging_debug("system queue exited");
-}
-
-void SystemQueue::QueueThread::enter(){
-	queueMutex.lock();
-}
-
-void SystemQueue::QueueThread::leave(){
-	queueMutex.unlock();
-}
-
-
-//***************************************************************
-
-SystemQueue::QueueThreadDirect::QueueThreadDirect(){
-}
-
-SystemQueue::QueueThreadDirect::~QueueThreadDirect(){
-}
-
-void SystemQueue::QueueThreadDirect::onItemInserted( const SystemEvent& event ){
-	// do nothing here
-}
-
-void SystemQueue::QueueThreadDirect::onNextQueueItem( const SystemEvent& event ){
-	// directly deliver the item to the
-	event.getListener()->handleSystemEvent( event );
-}
-
-//***************************************************************
-
-SystemQueue::QueueThreadDelay::QueueThreadDelay(QueueThread* _transferQueue)
-	: QueueThread( _transferQueue ), isSleeping( false ) {
-
-	assert( _transferQueue != NULL );
-}
-
-SystemQueue::QueueThreadDelay::~QueueThreadDelay(){
-}
-
-void SystemQueue::QueueThreadDelay::onItemInserted( const SystemEvent& event ){
-
-	if( !isSleeping)
-	{
-		logging_warn("SystemQueue(" << this << ") : No, I'm not asleep!! New item inserted."); 
-		return;  // TODO Mario: shouldn't we sort anyway..?
-	}
-
-	// break an existing sleep and
-	// remember the time that was actually slept for
-	// and change it for every event in the queue
-
-	assert( !eventsQueue.empty());
-	sleepCond.notify_all();
-
-	ptime sleepEnd = boost::posix_time::microsec_clock::local_time();
-	boost::posix_time::time_duration duration = sleepEnd - sleepStart;
-	uint32_t sleptTime = duration.total_milliseconds();
-
-	EventQueue::iterator i = eventsQueue.begin();
-	EventQueue::iterator iend = eventsQueue.end();
-
-	logging_debug("SystemQueue(" << this << ") : Adjusting remaining delays:");
-	
-	// TODO Mario: What about the just inserted event..?
-	for( ; i != iend; i++ ) {
-
-		if( sleptTime >= i->remainingDelay)
-			i->remainingDelay = 0;
-		else
-		{
-			i->remainingDelay -= sleptTime;
-			
-			// XXX Mario: Testcode, just to find a bug...
-			boost::posix_time::time_duration time_passed = sleepEnd - i->getScheduledTime();
-			logging_debug("SystemQueue(" << this << ") : Total: " <<
-					i->delayTime << ", remainingDelay: " << i->remainingDelay <<
-					", time already passed: " << time_passed.total_milliseconds() );
-		}
-
-	} // for( ; i != iend; i++ )
-
-	// now we have to reorder the events
-	// in the queue with respect to their remaining delay
-	// the SystemQueue::operator< takes care of the
-	// ordering with respect to the remaining delay
-
-	std::sort( eventsQueue.begin(), eventsQueue.end() );
-
-}
-
-void SystemQueue::QueueThreadDelay::onNextQueueItem( const SystemEvent& event ){
-
-	// sleeps will be cancelled in the
-	// onItemInserted function when a new
-	// event arrives during sleeping
-
-	assert( !isSleeping );
-
-	// the given item is the one with the least
-	// amount of sleep time left. because all
-	// items are reordered in onItemInserted
-
-	if( event.remainingDelay > 0 ) {
-
-		const boost::system_time duration =
-			boost::get_system_time() +
-			boost::posix_time::milliseconds(event.remainingDelay);
-
-		logging_debug("SystemQueue(" << this << ") : Sleeping for: " << event.remainingDelay << " ms");
-		
-		{
-			boost::unique_lock<boost::mutex> lock( sleepMutex );
-
-			sleepStart = boost::posix_time::microsec_clock::local_time();
-			isSleeping = true;
-			
-			sleepCond.timed_wait( lock, duration );
-
-			isSleeping = false;
-		}
-
-	} // if( event.remainingDelay > 0 )
-
-	// if the sleep succeeded and was not
-	// interrupted by a new incoming item
-	// we can now deliver this event
-
-	ptime sleepEnd = boost::posix_time::microsec_clock::local_time();
-	boost::posix_time::time_duration duration = sleepEnd - sleepStart;
-	uint32_t sleptTime = duration.total_milliseconds();
-
-	logging_debug("SystemQueue(" << this << ") : Slept for: " << sleptTime << " ms; until: " << sleepEnd);
-	
-	// TODO MARIO: find the bug that loses events...
-	if (event.remainingDelay <= sleptTime)
-	{
-		logging_debug("SystemQueue(" << this << ") : Transferring scheduled event into the direct queue. Scheduled time: " << event.getScheduledTime() );
-		transferQueue->insert( event, 0 );
-	}
-	else
-	{
-		logging_warn("SystemQueue(" << this << ") : Scheduled event lost!! :-(   (Sleep should have been " << event.remainingDelay - sleptTime << " ms longer..)");
-		logging_debug("SystemQueue(" << this << ") : Total delay: " << event.delayTime << "; remaining delay: " << event.remainingDelay);
-		
-// 		throw std::logic_error("Scheduled event lost!! :-(");
-	}
-}
-
-#endif // #ifndef UNDERLAY_OMNET
-
-//***************************************************************
-
-}} // spovnet, common
Index: urce/ariba/utility/system/OldSystemQueue.h
===================================================================
--- /source/ariba/utility/system/OldSystemQueue.h	(revision 12775)
+++ 	(revision )
@@ -1,284 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef SYSTEMQUEUE_H_
-#define SYSTEMQUEUE_H_
-
-#include <vector>
-#include <cassert>
-#include "SystemEvent.h"
-#include "SystemEventListener.h"
-#include "ariba/utility/logging/Logging.h"
-#include <boost/date_time.hpp>
-#include <boost/cstdint.hpp>
-
-#ifdef UNDERLAY_OMNET
-  #include <csimplemodule.h>
-  #include <cmessage.h>
-  #include <macros.h>
-#else
-  #include <boost/thread/mutex.hpp>
-  #include <boost/thread/thread.hpp>
-  #include <boost/thread/condition_variable.hpp>
-  #include <boost/utility.hpp>
-  #include <boost/bind.hpp>
-#endif
-
-#include <boost/function.hpp>
-
-
-using std::vector;
-using boost::posix_time::ptime;
-
-namespace ariba {
-namespace utility {
-
-/**
- * This class implements a simple system event queue to allow
- * a simulation of cooperative multitasking. It also allows
- * events to be scheduled from other tasks. This allows
- * dispatching asynchronous tasks.
- *
- * @author Christoph Mayer, Sebastian Mies
- */
-
-class SystemQueue : private boost::noncopyable
-{
-	use_logging_h(SystemQueue);
-	friend class EnterMethod;
-public:
-	/**
-	 * Get the SystemQueue singleton instance.
-	 */
-	static SystemQueue& instance();
-
-	/**
-	 * This methods schedules a given event.
-	 *
-	 * @param The event to be scheduled
-	 * @param The delay in milli-seconds
-	 */
-	void scheduleEvent( const SystemEvent& event, uint32_t delay = 0 );
-	
-	/**
-	 * This method schedules a function call in the SystemQueue.
-	 * (Like scheduleEvent, but to be used with boost::bind.)
-	 * 
-	 * @param function: The function to be called [void function()]
-	 * @param The delay in milli-seconds
-	 */
-	void scheduleCall( const boost::function0<void>& function, uint32_t delay = 0 );
-
-	/**
-	 * Starts the processing and waiting for events.
-	 * Use <code>cancel()</code> to end system queue processing and
-	 * <code>isEmpty()</code> to check wheter the queue is empty.
-	 */
-	void run();
-
-	/**
-	 * Cancels the system queue and ends the processing after the
-	 * currently processed event is processed.
-	 *
-	 * This method is thread-safe.
-	 */
-	void cancel();
-
-	/**
-	 * Drop all queued events for that listener
-	 */
-	void dropAll( const SystemEventListener* mlistener);
-
-	/**
-	 * Check wheter this queue has items or not.
-	 *
-	 * @return True, if this queue is empty.
-	 */
-	bool isEmpty();
-
-	/**
-	 * Is the system queue already started and running?
-	 *
-	 * @return True, if the system queue is running.
-	 */
-	bool isRunning();
-
-protected:
-
-	/**
-	 * Aqcuire the mutex
-	 */
-	void enterMethod();
-
-	/**
-	 * Leave the mutex
-	 */
-	void leaveMethod();
-
-	/**
-	 * Constructs a system queue.
-	 */
-	SystemQueue();
-
-	/**
-	 * Destroys the system queue. Beware that all events
-	 * are canceled
-	 */
-	~SystemQueue();
-	
-	
-private:
-
-#ifndef UNDERLAY_OMNET
-	typedef vector<SystemEvent> EventQueue;
-
-	//********************************************************
-
-	class QueueThread {
-	public:
-		QueueThread(QueueThread* _transferQueue = NULL);
-		virtual ~QueueThread();
-		void run();
-		void cancel();
-		bool isEmpty();
-		void insert( const SystemEvent& event, uint32_t delay );
-		void enter();
-		void leave();
-		void dropAll( const SystemEventListener* mlistener);
-
-	protected:
-		virtual void onItemInserted( const SystemEvent& event ) = 0;
-		virtual void onNextQueueItem( const SystemEvent& event ) = 0;
-		QueueThread* transferQueue;
-		EventQueue eventsQueue;
-		boost::mutex queueMutex;
-	private:
-		boost::thread* queueThread;
-		static void threadFunc( QueueThread* obj );
-		boost::condition_variable itemsAvailable;
-		volatile bool running;
-	}; // class QueueThread
-
-	//********************************************************
-
-	class QueueThreadDirect : public QueueThread {
-	public:
-		QueueThreadDirect();
-		~QueueThreadDirect();
-	protected:
-		virtual void onItemInserted( const SystemEvent& event );
-		virtual void onNextQueueItem( const SystemEvent& event );
-	}; // class QueueThreadDirect
-
-	//********************************************************
-
-	class QueueThreadDelay : public QueueThread {
-	public:
-		QueueThreadDelay(QueueThread* _transferQueue = NULL);
-		~QueueThreadDelay();
-	protected:
-		virtual void onItemInserted( const SystemEvent& event );
-		virtual void onNextQueueItem( const SystemEvent& event );
-	private:
-		volatile bool isSleeping;
-		ptime sleepStart;
-		boost::mutex sleepMutex;
-		boost::condition_variable sleepCond;
-	}; // class QueueThreadDelay
-
-	//********************************************************
-
-	
-// 	/// Singleton
-// 	static SystemQueue* _inst;
-
-	QueueThreadDirect directScheduler;
-	QueueThreadDelay delayScheduler;
-	volatile bool systemQueueRunning;
-#endif
-	
-	
-private:
-    /**
-     * This inner class handles the function-call events.
-     * @see SystemQueue::scheduleCall
-     */
-    class FunctionCaller  :  public SystemEventListener
-    {
-        void handleSystemEvent(const SystemEvent& event)
-        {
-            boost::function0<void>* function_ptr = event.getData< boost::function0<void> >();
-            (*function_ptr)();
-            delete function_ptr;
-        }
-    };
-
-    FunctionCaller internal_function_caller;
-}; // class SystemQueue
-
-#ifdef UNDERLAY_OMNET
-
-#if 0
-	//
-	// the system queue must be a singleton in simulations, too.
-	// and to include it in the simulation the module is defined
-	// as submodule in every SpoVNet host. Therefore we hack the
-	// Define_Module (see omnet/includes/macros.h) the way we need
-	// it with our singleton ...
-	//
-	// this is the macro definition from macros.h
-	//
-	// #define Define_Module(CLASSNAME) /backslash
-	//   static cModule *CLASSNAME##__create() {return new CLASSNAME();} /backslash
-	//   EXECUTE_ON_STARTUP(CLASSNAME##__mod, modtypes.instance()->add(new cModuleType(#CLASSNAME,#CLASSNAME,(ModuleCreateFunc)CLASSNAME##__create));)
-	//
-	// and this is how we do it :)
-	//
-#endif
-
-  	static cModule* SystemQueue__create() {
-		return &SystemQueue::instance();
-	}
-
- 	EXECUTE_ON_STARTUP(SystemQueue__mod, modtypes.instance()->add(new cModuleType("SystemQueue","SystemQueue",(ModuleCreateFunc)SystemQueue__create));)
-
-#endif
-
-}} // spovnet, common
-
-#endif /* SYSTEMQUEUE_H_ */
Index: /source/ariba/utility/system/README
===================================================================
--- /source/ariba/utility/system/README	(revision 2378)
+++ /source/ariba/utility/system/README	(revision 2378)
@@ -0,0 +1,6 @@
+This directory contains utility classes that help to adapt ariba
+to realworld and simulation environments. This especially includes
+a SystemQueue for scheduling. A timer class for commonly used timers. A 
+StartupWrapper that is used to start the initial application or service, 
+as well as some convenience classes, like BlockingMethod, that allows
+an easier integration of blocking calls in real world applications.
Index: /source/ariba/utility/system/StartupInterface.h
===================================================================
--- /source/ariba/utility/system/StartupInterface.h	(revision 12775)
+++ /source/ariba/utility/system/StartupInterface.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __STARTUP_INTERFACE_H
@@ -45,8 +45,16 @@
 
 namespace ariba {
+namespace interface {
+	class UnderlayAbstraction;
+}}
+
+using ariba::interface::UnderlayAbstraction;
+
+namespace ariba {
 namespace utility {
 
-class StartupWrapper;
-
+/**
+ * TODO: Mies -- to be replaced by a general Module!
+ */
 class StartupInterface
 #ifdef UNDERLAY_OMNET
@@ -59,9 +67,7 @@
 	virtual ~StartupInterface(){};
 
+protected:
 	virtual void startup() = 0;
 	virtual void shutdown() = 0;
-
-protected:
-	StartupWrapper* wrapper;
 };
 
Index: /source/ariba/utility/system/StartupWrapper.cpp
===================================================================
--- /source/ariba/utility/system/StartupWrapper.cpp	(revision 12775)
+++ /source/ariba/utility/system/StartupWrapper.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,15 +35,7 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
-
-// XXX NOTE: Use this class with caution! Config support is outdated.
+// [Licence]
 
 #include "StartupWrapper.h"
-#include "ariba/config.h"
-
-#ifdef HAVE_LOG4CXX
-	#include <log4cxx/logger.h>
-	#include <log4cxx/basicconfigurator.h>
-#endif // HAVE_LOG4CXX
 
 namespace ariba {
@@ -55,7 +47,8 @@
 #endif
 
-SystemEventType StartupWrapperEventStartup("StartupWrapperEventStartup");
+SystemEventType StartupWrapperEventType("StartupWrapperEventType");
 
-StartupWrapper::StartupWrapper(StartupInterface* _service) : service( _service ){
+StartupWrapper::StartupWrapper(StartupInterface* _service, bool _block)
+	: blocking( _block ), service( _service ){
 }
 
@@ -80,11 +73,9 @@
 #endif
 
-void StartupWrapper::startSystem(){
+void StartupWrapper::initSystem(){
 
-	//
-	// having seeded the pseudo rng is always good
-	//
-
-	srand( time(NULL) );
+	static bool initialized = false;
+	if( initialized ) return;
+	initialized = true;
 
 	//
@@ -98,18 +89,24 @@
 	// init the logging system
 	//
-
-#ifdef HAVE_LOG4CXX
-	log4cxx::BasicConfigurator::configure();
-#endif //HAVE_LOG4CXX
-
-	//
-	// configure the default logging level to info
+	// configure the logging
 	//
 
-	logging_rootlevel_info();
-}
+	log4cxx::BasicConfigurator::configure();
 
-void StartupWrapper::stopSystem(){
-	SystemQueue::instance().cancel();
+	// set the global log level
+	{
+		log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger());
+		logger->setLevel(log4cxx::Level::getDebug());
+	}
+
+	// set up again an individual level if you like
+	{
+ 		// log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("BaseOverlay"));
+ 		// logger->setLevel(log4cxx::Level::getInfo());
+	}
+
+	//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
+	// DON'T SVN COMMIT YOUR CHANTED LOGGING! THE ABOVE CODE MUST REMAIN AS IS!
+	//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 }
 
@@ -119,68 +116,51 @@
 }
 
-void StartupWrapper::handleSystemEvent(const SystemEvent& event){
-
-	if( event.getType() == StartupWrapperEventStartup ){
-
-		if(!configurations.empty()){
-			string config = configurations.front();
-			configurations.pop();
-			Configuration::setConfigFilename( config );
-		}
-
-		//
-		// start the actual application
-		//
-
-		// TODO: im falle von omnet ist service = null, da von SpoVNetOmnetModule so ÃŒbergeben
-		// wie wird im Falle von omnet die anwendung erstellt?
-
-		service->startup();
-
-	}
-
-}
-
 void StartupWrapper::startup(StartupInterface* service, bool block){
 
-	StartupWrapper* startup = new StartupWrapper(service);
-	service->wrapper = startup;
+	StartupWrapper* spovnet = new StartupWrapper(service, block);
 
+#ifdef UNDERLAY_OMNET
 	SystemQueue::instance().scheduleEvent(
-		SystemEvent( startup, StartupWrapperEventStartup, NULL), 0 );
-
-#ifndef UNDERLAY_OMNET
-	if( block ) getchar();
+		SystemEvent( spovnet, StartupWrapperEventType, NULL), 0 );
+#else
+	spovnet->handleSystemEvent(
+		SystemEvent( spovnet, StartupWrapperEventType, NULL));
 #endif
 }
 
-void StartupWrapper::shutdown(StartupInterface* service, bool block){
+void StartupWrapper::handleSystemEvent(const SystemEvent& event){
 
-	if( service == NULL || service->wrapper == NULL ) return;
+	string config = configurations.front();
+	configurations.pop();
+	Configuration::setConfigFilename( config );
 
+	//
+	// start the actual application
+	//
+
+	// TODO: im falle von omnet ist service = null, da von SpoVNetOmnetModule so ÃŒbergeben
+	// wie wird im Falle von omnet die anwendung erstellt?
+
+	service->startup();
+	waitForExit();
+
+#ifndef UNDERLAY_OMNET
+	service->shutdown();
+	delete event.getListener();
+#endif
+}
+
+void StartupWrapper::waitForExit(){
+#ifndef UNDERLAY_OMNET
+	if( blocking ) getchar();
+#endif
+}
+
+void StartupWrapper::shutdown(){
 #ifdef UNDERLAY_OMNET
 	//TODO: service->shutdown();
 #endif
 
-	if(block){
-		// call directly
-		service->shutdown();
-	}else{
-		// call async, but not using systemqueue! // TODO: mem leak
-		AsyncShutdown* async = new AsyncShutdown(service);
-		async->runBlockingMethod();
-	}
-}
-
-StartupWrapper::AsyncShutdown::AsyncShutdown(StartupInterface* _service)
-	: service(_service){
-}
-
-void StartupWrapper::AsyncShutdown::blockingFunction(){
-	service->shutdown();
-}
-
-void StartupWrapper::AsyncShutdown::dispatchFunction(){
-	//unused
+	SystemQueue::instance().cancel();
 }
 
Index: /source/ariba/utility/system/StartupWrapper.h
===================================================================
--- /source/ariba/utility/system/StartupWrapper.h	(revision 12775)
+++ /source/ariba/utility/system/StartupWrapper.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,7 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
-
-// XXX NOTE: Use this class with caution! Config support is outdated.
+// [Licence]
 
 #ifndef __STARTUP_WRAPPER_H
@@ -46,6 +44,5 @@
 #include "SystemQueue.h"
 #include "StartupInterface.h"
-#include "ariba/utility/configuration/Configuration.h"
-#include "BlockingMethod.h"
+#include "../configuration/Configuration.h"
 
 #ifdef UNDERLAY_OMNET
@@ -72,10 +69,8 @@
 class StartupWrapper : public SystemEventListener {
 public:
-	static void startSystem();
-	static void stopSystem();
-
+	static void initSystem();
 	static void initConfig(string filename);
 	static void startup(StartupInterface* service, bool block = true);
-	static void shutdown(StartupInterface* service, bool block = true);
+	static void shutdown();
 
 #ifdef UNDERLAY_OMNET
@@ -85,5 +80,5 @@
 
 protected:
-	StartupWrapper(StartupInterface* _service);
+	StartupWrapper(StartupInterface* _service, bool _block);
 	virtual ~StartupWrapper();
 
@@ -99,17 +94,7 @@
 #endif
 
+	volatile bool blocking;
 	void waitForExit();
 	StartupInterface* service;
-
-	class AsyncShutdown : public BlockingMethod {
-	public:
-		AsyncShutdown(StartupInterface* _service);
-	protected:
-		virtual void dispatchFunction();
-		virtual void blockingFunction(); // unused
-	private:
-		StartupInterface* service;
-	};
-
 };
 
Index: /source/ariba/utility/system/SystemEvent.cpp
===================================================================
--- /source/ariba/utility/system/SystemEvent.cpp	(revision 12775)
+++ /source/ariba/utility/system/SystemEvent.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "SystemEvent.h"
Index: /source/ariba/utility/system/SystemEvent.h
===================================================================
--- /source/ariba/utility/system/SystemEvent.h	(revision 12775)
+++ /source/ariba/utility/system/SystemEvent.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef SYSTEMEVENT_H_
@@ -49,10 +49,14 @@
 namespace utility {
 
-class SystemQueue;
 class SystemEventListener;
 
 class SystemEvent {
 	friend class SystemQueue;
+
 private:
+	ptime scheduledTime; //< time the event was originally given to the queue
+	uint32_t delayTime; //< time the event is scheduled at, or 0 if it is to be fired immediately
+	uint32_t remainingDelay; //< remaining delay time for sleeping
+
 	SystemEventListener* listener; //< handler of the event
 	SystemEventType type; //< type of the event
@@ -60,40 +64,32 @@
 
 public:
-	// TODO: these should be private, but the gcc 3.4 in scratchbox for cross-compiling
-	// for Maemo (Nokia N810) gets confused when the friend class SystemQueue has a 
-	// private class that accesses these variables. Therefore they are public for now.
-	ptime scheduledTime; //< time the event was originally given to the queue
-	ptime deadline; //< time when the event should be executed  TODO Mario 
-	uint32_t delayTime; //< time the event is scheduled at, or 0 if it is to be fired immediately
-	uint32_t remainingDelay; //< remaining delay time for sleeping
-
-public:
-	inline SystemEvent(SystemEventListener* mlistener, SystemEventType mtype =
-			SystemEventType::DEFAULT, void* mdata = NULL) :
-		listener(mlistener), 
-		type(mtype), 
-		data(mdata), 
-		scheduledTime(boost::posix_time::not_a_date_time),
-		deadline(boost::posix_time::not_a_date_time),
-		delayTime(0),
-		remainingDelay(0)
-	{
+	inline SystemEvent(
+			SystemEventListener* mlistener,
+			SystemEventType mtype = SystemEventType::DEFAULT,
+			void* mdata = NULL)
+			:	scheduledTime(boost::posix_time::not_a_date_time),
+				delayTime(0),
+				remainingDelay(0),
+				listener(mlistener),
+				type(mtype),
+				data(mdata) {
 	}
 
 	template<typename T>
-	inline SystemEvent(SystemEventListener* mlistener, SystemEventType mtype =
-			SystemEventType::DEFAULT, T* mdata = NULL) :
-		listener(mlistener), 
-		type(mtype), 
-		data((void*) mdata), 
-		scheduledTime(boost::posix_time::not_a_date_time),
-		deadline(boost::posix_time::not_a_date_time),
-		delayTime(0),
-		remainingDelay(0) {
+	inline SystemEvent( SystemEventListener* mlistener,
+			SystemEventType mtype = SystemEventType::DEFAULT,
+			T* mdata = NULL)
+				:	scheduledTime(boost::posix_time::not_a_date_time),
+					delayTime(0),
+					remainingDelay(0),
+					listener(mlistener),
+					type(mtype),
+					data((void*)mdata) {
 	}
+
+
 
 	inline SystemEvent(const SystemEvent& copy) {
 		this->scheduledTime = copy.scheduledTime;
-        this->deadline = copy.deadline;
 		this->delayTime = copy.delayTime;
 		this->remainingDelay = copy.remainingDelay;
@@ -105,5 +101,4 @@
 	inline void operator=(const SystemEvent& right) {
 		this->scheduledTime = right.scheduledTime;
-        this->deadline = right.deadline;
 		this->delayTime = right.delayTime;
 		this->remainingDelay = right.remainingDelay;
@@ -121,5 +116,5 @@
 	}
 
-	inline SystemEventListener* getListener() const {
+	inline const SystemEventListener* getListener() const {
 		return listener;
 	}
@@ -127,5 +122,5 @@
 	template<typename T>
 	inline T* getData() const {
-		return (T*) *this;
+		return (T*)*this;
 	}
 
@@ -142,18 +137,11 @@
 	}
 
-	bool operator<(const SystemEvent& right) const
-	{
-		return this->deadline < right.deadline;
+	inline bool operator<(const SystemEvent& right) const {
+		return remainingDelay < right.remainingDelay;
 	}
-
-    bool operator>(const SystemEvent& right) const
-    {
-        return this->deadline > right.deadline;
-    }
 
 };
 
-}
-} // spovnet, common
+}} // spovnet, common
 
 #endif /* SYSTEMEVENT_H_ */
Index: /source/ariba/utility/system/SystemEventListener.cpp
===================================================================
--- /source/ariba/utility/system/SystemEventListener.cpp	(revision 12775)
+++ /source/ariba/utility/system/SystemEventListener.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "SystemEventListener.h"
Index: /source/ariba/utility/system/SystemEventListener.h
===================================================================
--- /source/ariba/utility/system/SystemEventListener.h	(revision 12775)
+++ /source/ariba/utility/system/SystemEventListener.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef SYSTEMEVENTLISTENER_H_
@@ -51,5 +51,5 @@
 	virtual ~SystemEventListener() = 0;
 
-public: // should be private, see comments in SystemEvent.h
+protected:
 	virtual void handleSystemEvent( const SystemEvent& event ) = 0;
 };
Index: /source/ariba/utility/system/SystemEventType.cpp
===================================================================
--- /source/ariba/utility/system/SystemEventType.cpp	(revision 12775)
+++ /source/ariba/utility/system/SystemEventType.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "SystemEventType.h"
Index: /source/ariba/utility/system/SystemEventType.h
===================================================================
--- /source/ariba/utility/system/SystemEventType.h	(revision 12775)
+++ /source/ariba/utility/system/SystemEventType.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,16 +35,13 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef SYSTEMEVENTTYPE_H_
 #define SYSTEMEVENTTYPE_H_
 
-#include <iostream>
-#include <vector>
-#include <string>
-#include <boost/cstdint.hpp>
-#include <boost/foreach.hpp>
+#include<iostream>
+#include<vector>
+#include<boost/cstdint.hpp>
 
-using std::string;
 using std::vector;
 using std::ostream;
@@ -64,16 +61,9 @@
 	class Descriptor {
 	public:
-		string description;
+		const char* description;
 		eventid_t parent;
 
-		Descriptor(string _d, eventid_t _p = 0) :
+		Descriptor(const char* _d, eventid_t _p = 0) :
 			description(_d), parent(_p) {
-		}
-		
-		Descriptor(const Descriptor& rh) 
-			: description( rh.description ), parent( rh.parent ) {
-		}
-
-		~Descriptor() {
 		}
 	};
@@ -85,5 +75,5 @@
 
 public:
-	inline SystemEventType(string description,
+	inline SystemEventType(const char* description,
 			const SystemEventType parent = DEFAULT) {
 		if (ids.size() == 0) ids.push_back(Descriptor(
@@ -104,7 +94,8 @@
 
 	inline ~SystemEventType() {
+
 	}
 
-	inline string getDescription() const {
+	inline const char* getDescription() const {
 		return ids[id].description;
 	}
@@ -156,5 +147,5 @@
 
 	inline bool isDefault() {
-		return ( id == 0 );
+		return (id == 0);
 	}
 
Index: /source/ariba/utility/system/SystemQueue.cpp
===================================================================
--- /source/ariba/utility/system/SystemQueue.cpp	(revision 12775)
+++ /source/ariba/utility/system/SystemQueue.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -37,165 +37,83 @@
 
 #include "SystemQueue.h"
-#include <ariba/utility/misc/sha1.h>
-#include <stdexcept>
-
-// TODO Mario:
-// check if there is any debug out left to remove
 
 namespace ariba {
 namespace utility {
-    
-typedef boost::mutex::scoped_lock scoped_lock;
-
-using boost::posix_time::microsec_clock;
-using boost::posix_time::time_duration;
-using boost::date_time::not_a_date_time;
-using boost::scoped_ptr;
-    
 
 use_logging_cpp(SystemQueue);
 
-SystemQueue::SystemQueue() :
-    SysQ( new QueueThread() )
+SystemQueue::SystemQueue()
+#ifndef UNDERLAY_OMNET
+ : delayScheduler( &directScheduler ), systemQueueRunning( false )
+#endif
 {
-	logging_debug("Creating SystemQueue at: " << this);
-}
-
-SystemQueue::~SystemQueue()
-{
-}
-
-
-SystemQueue& SystemQueue::instance()
-{
-	static SystemQueue _inst;
-	return _inst;
-}
-
-
-void SystemQueue::scheduleEvent( const SystemEvent& event, uint32_t delay )
-{
-//     assert ( SysQ->running );  // should we really enforce this?
-    if ( ! SysQ->running )
-    {
-        logging_debug("/// WARNING: The SystemQueue is NOT RUNNING!");
-    }
-    
-    // copy
-    SystemEvent ev(event);
-    
-    SysQ->insert(ev, delay);
-}
-
-// maps to function call internally to the Event-system
-void SystemQueue::scheduleCall( const boost::function0<void>& function, uint32_t delay)
-{
-    // copy function object
-    boost::function0<void>* function_ptr = new boost::function0<void>();
-    (*function_ptr) = function; 
-
-    // schedule special call-event
-    scheduleEvent( SystemEvent(&internal_function_caller, SystemEventType::DEFAULT, function_ptr), delay );
-}
-
-
-
-
-void SystemQueue::run()
-{
-    // TODO should these be assertion or exceptions..? (exceptions => unit test)
-    assert ( ! SysQ->running );
-    assert ( ! SysQ->unclean );
-    
-    SysQ->running = true;
-    
-    // start thread
-    sysq_thread.reset( new boost::thread(boost::ref(*SysQ)) );
-}
-
-void SystemQueue::cancel()
-{
-    // CHECK: this function must not be called from within a SystemQueue-Event
-    if ( am_I_in_the_SysQ_thread() )
-//     if ( sysq_thread && boost::this_thread::get_id() == sysq_thread->get_id() )
-    {
-        logging_warn("SystemQueue::cancel() was called from within a SystemQueue-Event. This is not allowed!");
-        throw std::logic_error("SystemQueue::cancel() was called from within a SystemQueue-Event. This is not allowed!");
-    }
-
-    
-    // signal SysQ to quit (and abort queued events)
-    SysQ->cancel();
-    
-    // wait till actually completes
-    //   (should be fast, but the current event is allowed to finish)
-    if ( sysq_thread )
-    {
-        logging_debug("/// ... joining SysQ thread");
-        sysq_thread->join();
-    }
-    
-    // delete thread object
-    sysq_thread.reset();
-    
-    assert ( ! SysQ->isRunning() );
-
-    
-    // clean up and respawn
-    logging_debug("/// respawning SysQ");
-    SysQ.reset( new QueueThread() );
-}
-
-
-void SystemQueue::leave()
-{
-    // signal SysQ to quit (and abort queued events)
-    SysQ->cancel();
-}
-
-void SystemQueue::join()
-{
-    if ( sysq_thread )
-    {
-        logging_debug("/// ... joining SysQ thread");
-        sysq_thread->join();
-    }
-}
-
-
-
-void SystemQueue::dropAll( const SystemEventListener* mlistener)
-{
-//  TODO
-// 	directScheduler.dropAll(mlistener);
-// 	delayScheduler.dropAll(mlistener);
-}
-
-bool SystemQueue::isEmpty()
-{
-    return SysQ->isEmpty();
-}
-
-bool SystemQueue::isRunning()
-{
-    return SysQ->isRunning();
-}
-
-bool SystemQueue::am_I_in_the_SysQ_thread()
-{
-    return sysq_thread && boost::this_thread::get_id() == sysq_thread->get_id();
-}
-
-
-//********************************************************
-
-
-/// constructor
-SystemQueue::QueueThread::QueueThread() : 
-    processing_event( false ),
-    running( false ),
-    aborted( false ),
-    unclean( false )
-{
+}
+
+SystemQueue::~SystemQueue() {
+}
+
+void SystemQueue::scheduleEvent( const SystemEvent& event, uint32_t delay ) {
+#ifndef UNDERLAY_OMNET
+	if( delay == 0 ) directScheduler.insert( event, delay );
+	else delayScheduler.insert ( event, delay );
+#else
+	Enter_Method_Silent();
+	cMessage* msg = new cMessage();
+	msg->setContextPointer( new SystemEvent(event) );
+
+	if( delay == 0 )
+		cSimpleModule::scheduleAt( cSimpleModule::simTime(), msg );
+	else
+		cSimpleModule::scheduleAt( cSimpleModule::simTime()+((double)delay/1000.0), msg );
+#endif
+}
+
+#ifdef UNDERLAY_OMNET
+void SystemQueue::handleMessage(cMessage* msg){
+	SystemEvent* event = (SystemEvent*)msg->contextPointer();
+
+	event->listener->handleSystemEvent( *event );
+
+	delete event; delete msg;
+}
+#endif
+
+void SystemQueue::run() {
+#ifndef UNDERLAY_OMNET
+	systemQueueRunning = true;
+	directScheduler.run();
+	delayScheduler.run();
+#endif
+}
+
+void SystemQueue::cancel() {
+#ifndef UNDERLAY_OMNET
+	systemQueueRunning = false;
+	directScheduler.cancel();
+	delayScheduler.cancel();
+#endif
+}
+
+bool SystemQueue::isEmpty() {
+#ifndef UNDERLAY_OMNET
+	return directScheduler.isEmpty() || delayScheduler.isEmpty();
+#else
+	return false;
+#endif
+}
+
+bool SystemQueue::isRunning() {
+#ifndef UNDERLAY_OMNET
+	return systemQueueRunning;
+#else
+	return true;
+#endif
+}
+
+//***************************************************************
+#ifndef UNDERLAY_OMNET
+
+SystemQueue::QueueThread::QueueThread(QueueThread* _transferQueue)
+	: running( false ), transferQueue( _transferQueue ) {
 }
 
@@ -203,248 +121,199 @@
 }
 
-
-void SystemQueue::QueueThread::operator()()
-{
-    logging_debug( "/// SysQ thread is alive." );
-    
-    assert( running );  // this is set before the thread starts
-    
-    // main loop
-    while ( ! aborted )
-    {
-        // run next immediate event (only one)
-        run_immediate_event();
-        
-        // maintain timed events (move to immediateEventsQ, when deadline expired)
-        check_timed_queue();
-        
-        // wait for next deadline (if no immediate events pending)
-        wait_for_next_deadline();
-    }
-    
-    logging_debug( "/// SysQ thread is quitting." );
-    
-    unclean = true;
-    running = false;
-}
-
-
-
-
-
-/// main loop functions
-
-void SystemQueue::QueueThread::run_immediate_event()
-{
-    // get next event and process it
-    if ( ! immediateEventsQ.empty() )
-    {
-        scoped_ptr<SystemEvent> currently_processed_event;
-        
-        /* dequeue event */
-        // SYNCHRONIZED
-        {
-            scoped_lock lock( queue_mutex );
-            
-            this->processing_event = true;
-            
-            // * dequeue first event *
-            currently_processed_event.reset( new SystemEvent(immediateEventsQ.front()) );   // copy
-            immediateEventsQ.pop_front();
-        }
-        
-        /* dispatch event */
-//         logging_debug("/// SysQ: dispatching event");
-        
-        // measure execution time (1/2)
-        ptime start_time = get_clock();
-
-        // * dispatch event *
-        currently_processed_event->getListener()->handleSystemEvent( *currently_processed_event );
-        
-        // measure execution time (2/2)
-        time_duration execution_time = get_clock() - start_time;
-        
-        // DEBUG OUTPUT: warning when execution takes too much time
-        //   [ TODOx how long is "too much time"? ]
-        if ( execution_time.total_milliseconds() > 50 )
-        {
-            logging_info("WARNING: Last event took " << execution_time.total_milliseconds() << " ms to complete.");
-        }
-
-        /*  [ TODOx ]
-        * 
-        *  - we could also measure how long an event has been waiting in the queue before it's dispatched
-        *  (in order to detect overload)
-        * 
-        *  - especially for timed events, the displacement could be calculated
-        *  (and, e.g., put in relation with the actual intended sleep time)
-        */
-    }
-    
-    this->processing_event = false;
-}
-
-void SystemQueue::QueueThread::check_timed_queue()
-{
-    // this whole function is SYNCHRONIZED
-    scoped_lock lock( queue_mutex );
-
-    ptime now = get_clock();
-    bool not_expired_events_reached = false;
-    
-    // move all expired events into the immediateEventsQ
-    while ( ! timedEventsQ.empty() && ! not_expired_events_reached )
-    {
-        const SystemEvent& ev = timedEventsQ.top();
-        
-        time_duration remaining_sleep_time = ev.deadline - now;
-        
-        // BRANCH: deadline reached
-        if ( remaining_sleep_time.is_negative() )
-        {
-            // move to immediateEventsQ
-            immediateEventsQ.push_back(ev);
-            timedEventsQ.pop();
-        }
-        // BRANCH: deadline not reached
-        else
-        {
-            // okay, that's all for now.
-            not_expired_events_reached = true;
-        }
-    } // while
-}
-
-void SystemQueue::QueueThread::wait_for_next_deadline()
-{
-    // SYNCHRONIZED
-    boost::mutex::scoped_lock lock(queue_mutex);
-
-    if ( immediateEventsQ.empty() )
-    {
-         // don't sleep when the SystemQueue is not already canceled
-        if ( aborted )
-            return;
-
-        
-        // BRANCH: no timed events: sleep "forever" (until new events are scheduled)
-        if ( timedEventsQ.empty() )
-        {
-//             logging_debug("/// SysQ is going to sleep.");
-            
-            this->system_queue_idle.wait( lock );
-        }
-        // BRANCH: sleep till next timed event
-        else
-        {
-//             logging_debug( "/// SysQ is going to sleep for "
-//                         << ( timedEventsQ.top().deadline - get_clock() ).total_milliseconds()
-//                         << "ms. Deadline: " 
-//                         << timedEventsQ.top().deadline
-//                         << ", Clock: "
-//                         << get_clock() );
-
-            this->system_queue_idle.timed_wait( lock, timedEventsQ.top().deadline );
-        }
-    }
-}
-
-
-/// uniform clock interface
-ptime SystemQueue::QueueThread::get_clock()
-{
-    return microsec_clock::universal_time();
-}
-
-
-
-/// external interface
-
-bool SystemQueue::QueueThread::isRunning()
-{
-    return running;
-}
-
-
-void SystemQueue::QueueThread::cancel()
-{
-    logging_debug("/// Cancelling system queue... ");
-
-    // SYNCHRONIZED
-    {
-        scoped_lock lock(queue_mutex);
-        aborted = true;
-    }
-    
-    logging_debug("/// SysQ: " << immediateEventsQ.size() << " immediate event(s) + "
-                              << timedEventsQ.size() << " timed event(s) left.");
-    
-    system_queue_idle.notify_all();
-}
-
-
-void SystemQueue::QueueThread::insert( SystemEvent& event, uint32_t delay )
-{
-    event.scheduledTime = get_clock();
-    
-    // SYNCHRONIZED
-    {
-        scoped_lock lock( queue_mutex );
-        
-        // BRANCH: immediate event
-        if ( delay == 0 )
-        {
-            immediateEventsQ.push_back(event);
-        }
-        // BRANCH: timed event
-        else
-        {
-            event.deadline = event.scheduledTime + boost::posix_time::milliseconds(delay);
-            event.delayTime = delay;  // ( I think this is no longer needed.. )
-            
-//             // debug output
-//             logging_debug("/// inserting timed event, due at: " << event.deadline << " (in " << delay << " ms)");
-            
-            timedEventsQ.push(event);
-        }
-    }
-    
-    // wake SysQ thread
-    system_queue_idle.notify_one();  // NOTE: there is only one thread
-                                     // (so it doesn't matter whether to call notify_one, or notify_all)
-}
-
-
-bool SystemQueue::QueueThread::isEmpty()
-{
-    // SYNCHRONIZED
-    scoped_lock lock( queue_mutex );
-    
-    return immediateEventsQ.empty() && timedEventsQ.empty() && ! processing_event;
-}
-
-
-
-// FIXME
-void SystemQueue::enterMethod()
-{
-    assert( false );
-}
-void SystemQueue::leaveMethod()
-{
-    assert( false );
-}
-
-
-
-// XXX code from old system queue
-// void SystemQueue::QueueThread::enter(){
-// 	queueMutex.lock();
-// }
-// 
-// void SystemQueue::QueueThread::leave(){
-// 	queueMutex.unlock();
-// }
+void SystemQueue::QueueThread::run(){
+	running = true;
+	queueThread = new boost::thread(
+		boost::bind(&QueueThread::threadFunc, this) );
+}
+
+void SystemQueue::QueueThread::cancel(){
+
+	// cause the thread to exit
+	running = false;
+	itemsAvailable.notify_all();
+
+	// wait that the thread has exited
+	// and delete it, so that a subsuquent run() can be called
+
+	queueThread->join();
+	delete queueThread;
+	queueThread = NULL;
+
+	while( eventsQueue.size() > 0 ){
+		eventsQueue.erase( eventsQueue.begin() );
+	}
+}
+
+bool SystemQueue::QueueThread::isEmpty(){
+	boost::mutex::scoped_lock lock( queueMutex );
+	return eventsQueue.empty();
+}
+
+void SystemQueue::QueueThread::insert( const SystemEvent& event, uint32_t delay ){
+	{
+		boost::mutex::scoped_lock lock( queueMutex );
+
+		eventsQueue.push_back( event );
+		eventsQueue.back().scheduledTime = boost::posix_time::microsec_clock::local_time();
+		eventsQueue.back().delayTime = delay;
+		eventsQueue.back().remainingDelay = delay;
+
+		onItemInserted( event );
+		itemsAvailable.notify_all();
+	}
+}
+
+void SystemQueue::QueueThread::threadFunc( QueueThread* obj ) {
+
+	boost::mutex::scoped_lock lock( obj->queueMutex );
+
+	while( obj->running ) {
+
+		// wait until an item is in the queue or we are notified
+		// to quit the thread. in case the thread is about to
+		// quit, the queueThreadRunning variable will indicate
+		// this and cause the thread to exit
+
+		while ( obj->eventsQueue.empty() && obj->running ){
+
+			const boost::system_time duration =
+					boost::get_system_time() +
+					boost::posix_time::milliseconds(40);
+
+			obj->itemsAvailable.wait( lock );
+//			obj->itemsAvailable.timed_wait( lock, duration );
+		}
+
+		// work all the items that are currently in the queue
+
+		while( !obj->eventsQueue.empty() ) {
+
+			// fetch the first item in the queue and deliver it to the
+			// queue handler
+			SystemEvent ev = obj->eventsQueue.front();
+			obj->eventsQueue.erase( obj->eventsQueue.begin() );
+
+			{
+				// unlock the queue to that an event handler
+				// can insert new items into the queue
+//				obj->queueMutex.unlock();
+				obj->onNextQueueItem( ev );
+//				obj->queueMutex.lock();
+			}
+
+		} // !obj->eventsQueue.empty() )
+	} // while (obj->running)
+}
+
+//***************************************************************
+
+SystemQueue::QueueThreadDirect::QueueThreadDirect(){
+}
+
+SystemQueue::QueueThreadDirect::~QueueThreadDirect(){
+}
+
+void SystemQueue::QueueThreadDirect::onItemInserted( const SystemEvent& event ){
+	// do nothing here
+}
+
+void SystemQueue::QueueThreadDirect::onNextQueueItem( const SystemEvent& event ){
+	// directly deliver the item to the
+	event.listener->handleSystemEvent( event );
+}
+
+//***************************************************************
+
+SystemQueue::QueueThreadDelay::QueueThreadDelay(QueueThread* _transferQueue)
+	: QueueThread( _transferQueue ), isSleeping( false ) {
+
+	assert( _transferQueue != NULL );
+}
+
+SystemQueue::QueueThreadDelay::~QueueThreadDelay(){
+}
+
+void SystemQueue::QueueThreadDelay::onItemInserted( const SystemEvent& event ){
+
+	if( !isSleeping) return;
+
+	// break an existing sleep and
+	// remember the time that was actually slept for
+	// and change it for every event in the queue
+
+	assert( !eventsQueue.empty());
+	sleepCond.notify_all();
+
+	ptime sleepEnd = boost::posix_time::microsec_clock::local_time();
+	boost::posix_time::time_duration duration = sleepEnd - sleepStart;
+	uint32_t sleptTime = duration.total_milliseconds();
+
+	EventQueue::iterator i = eventsQueue.begin();
+	EventQueue::iterator iend = eventsQueue.end();
+
+	for( ; i != iend; i++ ) {
+
+		if( sleptTime >= i->remainingDelay)
+			i->remainingDelay = 0;
+		else
+			i->remainingDelay -= sleptTime;
+
+	} // for( ; i != iend; i++ )
+
+	// now we have to reorder the events
+	// in the queue with respect to their remaining delay
+	// the SystemQueue::operator< takes care of the
+	// ordering with respect to the remaining delay
+
+	std::sort( eventsQueue.begin(), eventsQueue.end() );
+
+}
+
+void SystemQueue::QueueThreadDelay::onNextQueueItem( const SystemEvent& event ){
+
+	// sleeps will be cancelled in the
+	// onItemInserted function when a new
+	// event arrives during sleeping
+
+	assert( !isSleeping );
+
+	// the given item is the one with the least
+	// amount of sleep time left. because all
+	// items are reordered in onItemInserted
+
+	if( event.remainingDelay > 0 ) {
+
+		const boost::system_time duration =
+			boost::get_system_time() +
+			boost::posix_time::milliseconds(event.remainingDelay);
+
+		{
+			boost::unique_lock<boost::mutex> lock( sleepMutex );
+
+			sleepStart = boost::posix_time::microsec_clock::local_time();
+			isSleeping = true;
+
+			sleepCond.timed_wait( lock, duration );
+
+			isSleeping = false;
+		}
+
+	} // if( event.remainingDelay > 0 )
+
+	// if the sleep succeeded and was not
+	// interrupted by a new incoming item
+	// we can now deliver this event
+
+	ptime sleepEnd = boost::posix_time::microsec_clock::local_time();
+	boost::posix_time::time_duration duration = sleepEnd - sleepStart;
+	uint32_t sleptTime = duration.total_milliseconds();
+
+	if (event.remainingDelay <= sleptTime)
+		transferQueue->insert( event, 0 );
+}
+
+#endif // #ifndef UNDERLAY_OMNET
+
+//***************************************************************
 
 }} // spovnet, common
Index: /source/ariba/utility/system/SystemQueue.h
===================================================================
--- /source/ariba/utility/system/SystemQueue.h	(revision 12775)
+++ /source/ariba/utility/system/SystemQueue.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,37 +35,34 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef SYSTEMQUEUE_H_
 #define SYSTEMQUEUE_H_
 
+#include <vector>
+#include <cassert>
 #include "SystemEvent.h"
 #include "SystemEventListener.h"
 #include "ariba/utility/logging/Logging.h"
-
-#include <cassert>
-#include <list>
-#include <vector>
-#include <queue>          // std::priority_queue
-#include <functional>     // std::greater
-
 #include <boost/date_time.hpp>
 #include <boost/cstdint.hpp>
-#include <boost/scoped_ptr.hpp>
-
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/thread.hpp>
-#include <boost/thread/condition_variable.hpp>
-#include <boost/utility.hpp>
-#include <boost/bind.hpp>
-
-#include <boost/function.hpp>
+
+#ifdef UNDERLAY_OMNET
+  #include <csimplemodule.h>
+  #include <cmessage.h>
+  #include <macros.h>
+#else
+  #include <boost/thread/mutex.hpp>
+  #include <boost/thread/thread.hpp>
+  #include <boost/thread/condition_variable.hpp>
+  #include <boost/utility.hpp>
+  #include <boost/bind.hpp>
+#endif
+
+using std::vector;
+using boost::posix_time::ptime;
 
 namespace ariba {
 namespace utility {
-
-using std::list;
-using boost::posix_time::ptime;
-
 
 /**
@@ -77,16 +74,28 @@
  * @author Christoph Mayer, Sebastian Mies
  */
-/**  XXX Mario Hock  --  reworking the entire module  **/
-
-
-class SystemQueue : private boost::noncopyable
-{
+
+#ifndef UNDERLAY_OMNET
+class SystemQueue : private boost::noncopyable {
+#else
+class SystemQueue : public cSimpleModule {
+#endif
 	use_logging_h(SystemQueue);
-	friend class EnterMethod;
 public:
 	/**
 	 * Get the SystemQueue singleton instance.
 	 */
-	static SystemQueue& instance();
+	static SystemQueue& instance() {
+		static SystemQueue _inst;
+		return _inst;
+	}
+
+#ifdef UNDERLAY_OMNET
+	/**
+	 * Prevent deletion of this module
+	 * by implementing the virtual method
+	 * and doing nothing in it
+	 */
+	virtual void deleteModule(){}
+#endif
 
 	/**
@@ -97,13 +106,4 @@
 	 */
 	void scheduleEvent( const SystemEvent& event, uint32_t delay = 0 );
-	
-	/**
-	 * This method schedules a function call in the SystemQueue.
-	 * (Like scheduleEvent, but to be used with boost::bind.)
-	 * 
-	 * @param function: The function to be called [void function()]
-	 * @param The delay in milli-seconds
-	 */
-	void scheduleCall( const boost::function0<void>& function, uint32_t delay = 0 );
 
 	/**
@@ -117,37 +117,8 @@
 	 * Cancels the system queue and ends the processing after the
 	 * currently processed event is processed.
-     * 
-     * NOTE: Do not call this function from within a SystemQueue-Event.
-     *   Use SystemQueue::leave() instead.
 	 *
 	 * This method is thread-safe.
 	 */
 	void cancel();
-    
-    /**
-     * Like SystemQueue::cancel(), but may only be called from within a SystemQueue-Event.
-     * 
-     * NOTE: In this case some cleanup can not be made. -- If the SystemQueue is 
-     *   restarted, SystemQueue::cancel() must be called before SystemQueue::run()
-     *   can be called again.
-     */
-    void leave();
-    
-    /**
-     * Join the SystemQueue thread -- the current thread is blocked until the
-     * SystemQueue finishes.
-     * 
-     * NOTE: Use this only in combination with SystemQueue::leave()
-     * 
-     * [ There is a possible race condition with SystemQueue::cancel(), but 
-     *   SystemQueue::join() should not be used at the same time as 
-     *   SystemQueue::cancel() anyway. (SystemQueue::leave() is fine, though.)
-     */
-    void join();
-
-	/**
-	 * Drop all queued events for that listener
-	 */
-	void dropAll( const SystemEventListener* mlistener);
 
 	/**
@@ -161,27 +132,9 @@
 	 * Is the system queue already started and running?
 	 *
-	 * @return TRUE, if the system queue is running. | FALSE otherwise
+	 * @return True, if the system queue is running.
 	 */
 	bool isRunning();
-    
-    /**
-     *  NOTE: This function is for debugging and asserts only!!
-     * 
-     *  @return TRUE if called from the SysQ thread (from inside a SystemEvent)
-     *          | FALSE if it's called from another thread
-     */
-    bool am_I_in_the_SysQ_thread();
 
 protected:
-
-	/**
-	 * Aqcuire the mutex
-	 */
-	void enterMethod();
-
-	/**
-	 * Leave the mutex
-	 */
-	void leaveMethod();
 
 	/**
@@ -195,95 +148,100 @@
 	 */
 	~SystemQueue();
-	
-
-/**
- *  inner class of class SystemQueue:
- * 
- *  QueueThread  --  the class the does the actual work
- */
+
+#ifdef UNDERLAY_OMNET
+	virtual void handleMessage( cMessage* msg );
+#endif
+
 private:
 
-typedef list<SystemEvent> EventQueue;
-typedef std::priority_queue<SystemEvent, 
-                            std::vector<SystemEvent>,  // [ TODO is vector the best underlay? ]
-                            std::greater<SystemEvent> > PriorityEventQueue;
-
-	//********************************************************
-
-	class QueueThread
-	{
-        friend class SystemQueue;
-        
+#ifndef UNDERLAY_OMNET
+	typedef vector<SystemEvent> EventQueue;
+
+	//********************************************************
+
+	class QueueThread {
 	public:
-		QueueThread();
+		QueueThread(QueueThread* _transferQueue = NULL);
 		virtual ~QueueThread();
-        
-        /// main loop -- called from boost::thread
-        void operator()();
-        
-// 		void run();
+		void run();
 		void cancel();
 		bool isEmpty();
-		void insert( SystemEvent& event, uint32_t delay );
-		void enter();
-		void leave();
-		void dropAll( const SystemEventListener* mlistener);
-        bool isRunning();
-
-    private:
-        
-        /// main loop functions
-        void run_immediate_event();
-        void check_timed_queue();
-        void wait_for_next_deadline();
-        
-        /// makes sure that always the same clock is used
-        ptime get_clock();
-        
-        
+		void insert( const SystemEvent& event, uint32_t delay );
+
+	protected:
+		virtual void onItemInserted( const SystemEvent& event ) = 0;
+		virtual void onNextQueueItem( const SystemEvent& event ) = 0;
+		QueueThread* transferQueue;
+		EventQueue eventsQueue;
+		boost::mutex queueMutex;
 	private:
-        EventQueue immediateEventsQ;
-        PriorityEventQueue timedEventsQ;
-        
-        boost::condition_variable system_queue_idle;
-        boost::mutex queue_mutex;
-
-        bool processing_event;
-        
+		boost::thread* queueThread;
+		static void threadFunc( QueueThread* obj );
+		boost::condition_variable itemsAvailable;
 		volatile bool running;
-        volatile bool aborted;
-        volatile bool unclean;
 	}; // class QueueThread
 
-	
-/// inner class of class SystemQueue
-private:
-    /**
-     * This inner class handles the function-call events.
-     * @see SystemQueue::scheduleCall
-     */
-    class FunctionCaller  :  public SystemEventListener
-    {
-        void handleSystemEvent(const SystemEvent& event)
-        {
-            boost::function0<void>* function_ptr = event.getData< boost::function0<void> >();
-            (*function_ptr)();
-            delete function_ptr;
-        }
-    };
-
-    FunctionCaller internal_function_caller;
-    
-    
-    
-    /// member variables of class SystemQueue
-private:
-    boost::scoped_ptr<QueueThread> SysQ;
-    boost::scoped_ptr<boost::thread> sysq_thread;
-    
-//  volatile bool systemQueueRunning;
+	//********************************************************
+
+	class QueueThreadDirect : public QueueThread {
+	public:
+		QueueThreadDirect();
+		~QueueThreadDirect();
+	protected:
+		virtual void onItemInserted( const SystemEvent& event );
+		virtual void onNextQueueItem( const SystemEvent& event );
+	}; // class QueueThreadDirect
+
+	//********************************************************
+
+	class QueueThreadDelay : public QueueThread {
+	public:
+		QueueThreadDelay(QueueThread* _transferQueue = NULL);
+		~QueueThreadDelay();
+	protected:
+		virtual void onItemInserted( const SystemEvent& event );
+		virtual void onNextQueueItem( const SystemEvent& event );
+	private:
+		volatile bool isSleeping;
+		ptime sleepStart;
+		boost::mutex sleepMutex;
+		boost::condition_variable sleepCond;
+	}; // class QueueThreadDelay
+
+	//********************************************************
+
+	QueueThreadDirect directScheduler;
+	QueueThreadDelay delayScheduler;
+	volatile bool systemQueueRunning;
+#endif
 
 }; // class SystemQueue
 
+#ifdef UNDERLAY_OMNET
+
+	//
+	// the system queue must be a singleton in simulations, too.
+	// and to include it in the simulation the module is defined
+	// as submodule in every SpoVNet host. Therefore we hack the
+	// Define_Module (see omnet/includes/macros.h) the way we need
+	// it with our singleton ...
+	//
+	// this is the macro definition from macros.h
+	//
+	// #define Define_Module(CLASSNAME) \
+	//   static cModule *CLASSNAME##__create() {return new CLASSNAME();} \
+	//   EXECUTE_ON_STARTUP(CLASSNAME##__mod, modtypes.instance()->add(new cModuleType(#CLASSNAME,#CLASSNAME,(ModuleCreateFunc)CLASSNAME##__create));)
+	//
+	// and this is how we do it :)
+	//
+
+  	static cModule* SystemQueue__create() {
+		return &SystemQueue::instance();
+	}
+
+ 	EXECUTE_ON_STARTUP(SystemQueue__mod, modtypes.instance()->add(new cModuleType("SystemQueue","SystemQueue",(ModuleCreateFunc)SystemQueue__create));)
+
+#endif
+
 }} // spovnet, common
 
Index: /source/ariba/utility/system/Timer.cpp
===================================================================
--- /source/ariba/utility/system/Timer.cpp	(revision 12775)
+++ /source/ariba/utility/system/Timer.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "Timer.h"
@@ -55,6 +55,8 @@
 Timer::~Timer() {
 #ifndef UNDERLAY_OMNET
-	stop();
-	if(timerThread != NULL){
+	if( running ){
+		running = false;
+
+		timerThread->join();
 		delete timerThread;
 		timerThread = NULL;
@@ -82,27 +84,10 @@
 }
 
-void Timer::reset(){
-#ifndef UNDERLAY_OMNET
-	if(timerThread == NULL) return;
-	timerThread->interrupt();
-#else
-	#error timer interruption not implemented for omnet
-#endif
-}
-
-bool Timer::isRunning(){
-	return running;
-}
-
 void Timer::stop() {
 	running = false;
-	reset(); // cause the sleep to abort
-	SystemQueue::instance().dropAll(this);
-	if(timerThread != NULL)
-		timerThread->join();
 }
 
 void Timer::eventFunction() {
-	logging_warn("unimplemented eventFunction Timer(" << millis << ")");
+	std::cout << "Timer(" << millis << ")" << std::endl;
 }
 
@@ -112,29 +97,16 @@
 
 	while( obj->running ) {
-
-		try{
-
-			boost::this_thread::sleep( boost::posix_time::milliseconds(obj->millis) );
-			if (obj->running)
-				SystemQueue::instance().scheduleEvent( SystemEvent( obj, TimerEventType, NULL), 0 );
-
-		}catch(boost::thread_interrupted e){
-			// exception called when Timer::reset is called
-			// don't need to handle the exception
-		}
-
+		boost::this_thread::sleep( boost::posix_time::milliseconds(obj->millis) );
+		if (obj->running) SystemQueue::instance().scheduleEvent( SystemEvent( obj, TimerEventType, NULL), 0 );
 		if( obj->oneshot ) break;
 	}
 
-	if(! obj->oneshot )
-		obj->running = false;
+	obj->running = false;
 }
 #endif // UNDERLAY_OMNET
 
 void Timer::handleSystemEvent( const SystemEvent& event ) {
-	if( running ){
-		if( oneshot ) running = false;
+	if( running )
 		eventFunction();
-	}
 
 #ifdef UNDERLAY_OMNET
Index: /source/ariba/utility/system/Timer.h
===================================================================
--- /source/ariba/utility/system/Timer.h	(revision 12775)
+++ /source/ariba/utility/system/Timer.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,10 +35,9 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __TIMER_H
 #define __TIMER_H
 
-#include <stdint.h>
 #include "ariba/utility/system/SystemEventListener.h"
 #include "ariba/utility/system/SystemQueue.h"
@@ -64,35 +63,9 @@
 public:
 	Timer();
-	virtual ~Timer();
+	~Timer();
 
-	/**
-	 * Set the interval for the timer
-	 *
-	 * @param millis Timer interval in milliseconds
-	 * @param oneshot Is this a one-shot or periodic timer
-	 */
 	void setInterval(unsigned int millis, bool oneshot=false);
-
-	/**
-	 * Start the timer
-	 */
 	void start();
-
-	/**
-	 * Stop the timer
-	 */
 	void stop();
-
-	/**
-	 * Reset a running timer and ignore the remaining interval
-	 * time. Does not fire the timer event and start the timer
-	 * with a new interval.
-	 */
-	void reset();
-
-	/**
-	 * Is the timer already running?
-	 */
-	bool isRunning();
 
 protected:
Index: /source/ariba/utility/types.h
===================================================================
--- /source/ariba/utility/types.h	(revision 12775)
+++ /source/ariba/utility/types.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef TYPES_H_
Index: /source/ariba/utility/types/Address.cpp
===================================================================
--- /source/ariba/utility/types/Address.cpp	(revision 12775)
+++ /source/ariba/utility/types/Address.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "Address.h"
Index: /source/ariba/utility/types/Address.h
===================================================================
--- /source/ariba/utility/types/Address.h	(revision 12775)
+++ /source/ariba/utility/types/Address.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef ADDRESS_H_
Index: urce/ariba/utility/types/CMakeLists.txt
===================================================================
--- /source/ariba/utility/types/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,67 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    Address.h
-    Data.hpp
-    Identifier.h
-    LinkID.h
-    Locator.h
-    _namespace.h
-    NodeID.h
-    OverlayParameterSet.h
-    PeerID.h
-    QoSParameterSet.h
-    SecurityParameterSet.h
-    ServiceID.h
-    SpoVNetID.h
-    )
-
-add_sources(
-    Address.cpp
-    Identifier.cpp
-    LinkID.cpp
-    Locator.cpp
-    NodeID.cpp
-    OverlayParameterSet.cpp
-    PeerID.cpp
-    QoSParameterSet.cpp
-    SecurityParameterSet.cpp
-    ServiceID.cpp
-    SpoVNetID.cpp
-    )
Index: /source/ariba/utility/types/Data.hpp
===================================================================
--- /source/ariba/utility/types/Data.hpp	(revision 12775)
+++ /source/ariba/utility/types/Data.hpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "../serialization/Data.hpp"
Index: /source/ariba/utility/types/Identifier.cpp
===================================================================
--- /source/ariba/utility/types/Identifier.cpp	(revision 12775)
+++ /source/ariba/utility/types/Identifier.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "Identifier.h"
@@ -70,5 +70,5 @@
 
 void Identifier::clearAddress() {
-	for (size_t i = 0; i < array_size; i++)
+	for (int i = 0; i < array_size; i++)
 		key[i] = 0;
 	isUnspec = false;
@@ -77,5 +77,5 @@
 
 bool Identifier::setAddress(string address) {
-	return false;
+	// TODO
 }
 
@@ -204,5 +204,5 @@
 	if (isUnspec) return std::string("<unspec>");
 
-	char temp[250];
+	char temp[80];
 	if (base == 16) {
 		int k = 0;
@@ -238,5 +238,4 @@
 }
 #endif
-	return "<not supported>";
 }
 
@@ -320,9 +319,5 @@
 }
 bool Identifier::operator==(const Identifier& compKey) const {
-
-	if( this->isUnspecified() && compKey.isUnspecified() )
-		return true;
-	else
-		return compareTo(compKey) == 0;
+	return compareTo(compKey) == 0;
 }
 bool Identifier::operator!=(const Identifier& compKey) const {
@@ -601,27 +596,27 @@
 Identifier Identifier::random() {
 	Identifier newKey = ZERO;
-	newKey.clearAddress();
 
 	//as mpn_random has no seeding function
-	// we mess aroung here a little to achive some randomness
-	// using the rand function that _is_ seeded in the
-	// StartupWrapper::initSystem function
-
+	// we mess aroung here a little to achive randomness
 	Identifier keyRandom = ZERO;
 	mpn_random(keyRandom.key, aSize);
-	Identifier keyrnd( rand() );
-	mpn_mul_1( newKey.key, keyRandom.key, aSize, *keyrnd.key );
+	Identifier keyTime( time(NULL) );
+	mpn_mul_1( newKey.key, keyRandom.key, aSize, *keyTime.key );
 
 	newKey.trim();
-	assert(!newKey.isUnspecified());
-
 	return newKey;
 }
 
+
+// README: due to some problems with serialization the keylength
+// was changed to 192 bit! As none of the hashing functions
+// can provide 160 bit output, and we currently don't use any
+// hashing for identifiers in the demo at all ... this is all commented out!!
+
+
+// generate sha1 hash
 Identifier Identifier::sha1(const string& input) {
 	Identifier newKey;
-	newKey.clearAddress();
-	uint8_t temp[40];
-	for (int i=0; i<40; i++) temp[i] = 0;
+	uint8_t temp[20];
 	const char* c_str = input.c_str();
 
@@ -641,6 +636,5 @@
 Identifier Identifier::sha1(const uint8_t* value, size_t length ) {
 	Identifier newKey;
-	uint8_t temp[40];
-	for (int i=0; i<40; i++) temp[i] = 0;
+	uint8_t temp[20];
 
 	CSHA1 sha;
@@ -655,4 +649,6 @@
 }
 
+
+
 // generate a key=2**exponent
 Identifier Identifier::pow2(uint exponent) {
Index: /source/ariba/utility/types/Identifier.h
===================================================================
--- /source/ariba/utility/types/Identifier.h	(revision 12775)
+++ /source/ariba/utility/types/Identifier.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef IDENTIFIER_H_
@@ -42,6 +42,4 @@
 #include <memory>
 #include <string>
-#include <cassert>
-#include <iostream>
 #include <gmp.h>
 #include <boost/cstdint.hpp>
@@ -49,7 +47,4 @@
 #include "ariba/utility/types/Address.h"
 #include "ariba/utility/serialization.h"
-
-// XXX EXPERIMENTAL
-#include "ariba/utility/transport/messages/shared_buffer.hpp"
 
 /**< maximum length of the key */
@@ -72,24 +67,4 @@
 	use_logging_h( Identifier );
 public:
-	
-	// XXX EXPERIMENTAL
-	reboost::shared_buffer_t serialize() const
-	{
-	    Data data = data_serialize(this, DEFAULT_V);
-	    reboost::shared_buffer_t buf(data.getBuffer(), data.getLength() / 8);
-	    
-	    return buf;
-	}
-	
-	reboost::shared_buffer_t deserialize(reboost::shared_buffer_t buff)
-	{
-	    Data dat(const_cast<uint8_t*>(buff.data()), buff.size() * 8);
-	    
-	    size_t len = this->SERIALIZATION_METHOD_NAME(DESERIALIZE, dat) / 8;
-
-	    // return remaining sub-buffer
-	    return buff(len);
-	}
-	
 
 	//-------------------------------------------------------------------------
@@ -592,5 +567,4 @@
 /* serializers */
 sznBeginDefault( ariba::utility::Identifier, X ) {
-
 	// calculate length of key
 	uint16_t len = array_size*sizeof(mp_limb_t);
@@ -603,9 +577,6 @@
 	for (int i=array_size-1; i>=0; i--) X && key[i];
 
-	// when deserializing set unspec flag
-	if (X.isDeserializer()){
-		isUnspec = unspec;
-	}
-
+	// when deserializing reset unspec flag
+	if (X.isDeserializer()) isUnspec = unspec;
 } sznEnd();
 
Index: /source/ariba/utility/types/LinkID.cpp
===================================================================
--- /source/ariba/utility/types/LinkID.cpp	(revision 12775)
+++ /source/ariba/utility/types/LinkID.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "LinkID.h"
Index: /source/ariba/utility/types/LinkID.h
===================================================================
--- /source/ariba/utility/types/LinkID.h	(revision 12775)
+++ /source/ariba/utility/types/LinkID.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef LINKID_H_
Index: /source/ariba/utility/types/Locator.cpp
===================================================================
--- /source/ariba/utility/types/Locator.cpp	(revision 12775)
+++ /source/ariba/utility/types/Locator.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "Locator.h"
Index: /source/ariba/utility/types/Locator.h
===================================================================
--- /source/ariba/utility/types/Locator.h	(revision 12775)
+++ /source/ariba/utility/types/Locator.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef LOCATOR_H_
Index: /source/ariba/utility/types/NodeID.cpp
===================================================================
--- /source/ariba/utility/types/NodeID.cpp	(revision 12775)
+++ /source/ariba/utility/types/NodeID.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "NodeID.h"
Index: /source/ariba/utility/types/NodeID.h
===================================================================
--- /source/ariba/utility/types/NodeID.h	(revision 12775)
+++ /source/ariba/utility/types/NodeID.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef __NODEID_H
Index: /source/ariba/utility/types/OverlayParameterSet.cpp
===================================================================
--- /source/ariba/utility/types/OverlayParameterSet.cpp	(revision 12775)
+++ /source/ariba/utility/types/OverlayParameterSet.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "OverlayParameterSet.h"
@@ -55,5 +55,5 @@
 }
 
-void OverlayParameterSet::setOverlayStructure(OverlayStructure _structure){
+void OverlayParameterSet::getOverlayStructure(OverlayStructure _structure){
 	structure = (uint8_t)_structure;
 }
Index: /source/ariba/utility/types/OverlayParameterSet.h
===================================================================
--- /source/ariba/utility/types/OverlayParameterSet.h	(revision 12775)
+++ /source/ariba/utility/types/OverlayParameterSet.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef OVERLAYPARAMETERSET_H_
@@ -53,13 +53,14 @@
 
 	typedef enum _OverlayStructure {
-		OverlayStructureOneHop   = 0,   // DEPRECATED, DO NOT USE
-		OverlayStructureChord    = 1,
+		OverlayStructureOneHop   = 1,
+		OverlayStructureChord    = 2,
+		OverlayStructureKademlia = 3,
 	} OverlayStructure;
 
-	OverlayParameterSet(OverlayStructure _structure = OverlayStructureChord);
+	OverlayParameterSet(OverlayStructure _structure = OverlayStructureOneHop);
 	virtual ~OverlayParameterSet();
 
 	OverlayStructure getOverlayStructure() const;
-	void setOverlayStructure( OverlayStructure _structure );
+	void getOverlayStructure( OverlayStructure _structure );
 
 private:
Index: urce/ariba/utility/types/PeerID.cpp
===================================================================
--- /source/ariba/utility/types/PeerID.cpp	(revision 12775)
+++ 	(revision )
@@ -1,55 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#include "PeerID.h"
-
-namespace ariba {
-namespace utility {
-
-const PeerID PeerID::UNSPECIFIED;
-
-PeerID::PeerID() {
-}
-
-PeerID::PeerID(const Identifier& identifier) : Identifier(identifier){
-}
-
-PeerID::~PeerID() {
-}
-
-}} // namespace ariba, common
Index: urce/ariba/utility/types/PeerID.h
===================================================================
--- /source/ariba/utility/types/PeerID.h	(revision 12775)
+++ 	(revision )
@@ -1,60 +1,0 @@
-// [License]
-// The Ariba-Underlay Copyright
-//
-// Copyright (c) 2008-2009, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-//
-// Institute of Telematics
-// UniversitÃ€t Karlsruhe (TH)
-// Zirkel 2, 76128 Karlsruhe
-// Germany
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
-// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// The views and conclusions contained in the software and documentation
-// are those of the authors and should not be interpreted as representing
-// official policies, either expressed or implied, of the Institute of
-// Telematics.
-// [License]
-
-#ifndef __PEERID_H
-#define __PEERID_H
-
-#include "ariba/utility/types/Identifier.h"
-
-namespace ariba {
-namespace utility {
-
-class PeerID : public Identifier {
-public:
-
-	static const PeerID UNSPECIFIED;
-
-	PeerID();
-	PeerID(const Identifier& identifier);
-	virtual ~PeerID();
-
-};
-
-}} // namespace ariba, common
-
-#endif // __PEERID_H
Index: /source/ariba/utility/types/QoSParameterSet.cpp
===================================================================
--- /source/ariba/utility/types/QoSParameterSet.cpp	(revision 12775)
+++ /source/ariba/utility/types/QoSParameterSet.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "QoSParameterSet.h"
Index: /source/ariba/utility/types/QoSParameterSet.h
===================================================================
--- /source/ariba/utility/types/QoSParameterSet.h	(revision 12775)
+++ /source/ariba/utility/types/QoSParameterSet.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef QOS_PARAMETER_SET_H__
Index: /source/ariba/utility/types/SecurityParameterSet.cpp
===================================================================
--- /source/ariba/utility/types/SecurityParameterSet.cpp	(revision 12775)
+++ /source/ariba/utility/types/SecurityParameterSet.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "SecurityParameterSet.h"
Index: /source/ariba/utility/types/SecurityParameterSet.h
===================================================================
--- /source/ariba/utility/types/SecurityParameterSet.h	(revision 12775)
+++ /source/ariba/utility/types/SecurityParameterSet.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef SECURITY_PARAMETER_SET_H
Index: /source/ariba/utility/types/ServiceID.cpp
===================================================================
--- /source/ariba/utility/types/ServiceID.cpp	(revision 12775)
+++ /source/ariba/utility/types/ServiceID.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -24,5 +24,5 @@
 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-// EXEMPLARY, OR CONSEQUENTIAL	 DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "ServiceID.h"
@@ -50,5 +50,5 @@
 }
 
-ServiceID::ServiceID(uint32_t _id) : id( _id ){
+ServiceID::ServiceID(unsigned int _id) : id( _id ){
 }
 
@@ -57,9 +57,4 @@
 
 ServiceID::~ServiceID() {
-}
-
-ServiceID& ServiceID::operator=(const ServiceID &rh) {
-	id = rh.id;
-	return *this;
 }
 
@@ -76,9 +71,5 @@
 }
 
-string ServiceID::toString() const
-{
-    if ( *this == ServiceID::UNSPECIFIED )
-        return "UNSPEC";
-    
+string ServiceID::toString() const {
 	return ariba::utility::Helper::ultos( id );
 }
Index: /source/ariba/utility/types/ServiceID.h
===================================================================
--- /source/ariba/utility/types/ServiceID.h	(revision 12775)
+++ /source/ariba/utility/types/ServiceID.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef SERVICEID_H_
@@ -72,8 +72,7 @@
 	bool operator<(const ServiceID& rh) const;
 	bool operator!=(const ServiceID& rh) const;
-	ServiceID& operator=(const ServiceID &rh);
 
 	inline bool isUnspecified() const {
-		return (id==~(uint32_t)0);
+		return (id==~0);
 	}
 
Index: /source/ariba/utility/types/SpoVNetID.cpp
===================================================================
--- /source/ariba/utility/types/SpoVNetID.cpp	(revision 12775)
+++ /source/ariba/utility/types/SpoVNetID.cpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #include "SpoVNetID.h"
Index: /source/ariba/utility/types/SpoVNetID.h
===================================================================
--- /source/ariba/utility/types/SpoVNetID.h	(revision 12775)
+++ /source/ariba/utility/types/SpoVNetID.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef SPOVNETID_H_
Index: /source/ariba/utility/types/_namespace.h
===================================================================
--- /source/ariba/utility/types/_namespace.h	(revision 12775)
+++ /source/ariba/utility/types/_namespace.h	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #undef NAMESPACE_BEGIN
Index: urce/ariba/utility/vtypes/CMakeLists.txt
===================================================================
--- /source/ariba/utility/vtypes/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,45 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    varray.hpp
-    vfacade.hpp
-    vint.hpp
-    )
-
-add_subdir_sources(detail)
Index: urce/ariba/utility/vtypes/detail/CMakeLists.txt
===================================================================
--- /source/ariba/utility/vtypes/detail/CMakeLists.txt	(revision 12775)
+++ 	(revision )
@@ -1,43 +1,0 @@
-# [License]
-# The Ariba-Underlay Copyright
-#
-# Copyright (c) 2008-2012, Institute of Telematics, UniversitÃ€t Karlsruhe (TH)
-#
-# Institute of Telematics
-# UniversitÃ€t Karlsruhe (TH)
-# Zirkel 2, 76128 Karlsruhe
-# Germany
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# The views and conclusions contained in the software and documentation
-# are those of the authors and should not be interpreted as representing
-# official policies, either expressed or implied, of the Institute of
-# Telematics.
-# [License]
-
-add_headers(
-    helper.hpp
-    vint_big.hpp
-    vint_small.hpp
-    )
Index: ash/bootstrap_libs
===================================================================
--- /trash/bootstrap_libs	(revision 12775)
+++ 	(revision )
@@ -1,54 +1,0 @@
-#!/bin/sh
-
-cd lib
-
-echo "SPOVNET: preparing ..."
-rm -rf ./boost*
-rm -rf ./gmp*
-rm -rf ./log*
-
-echo "SPOVNET: downloading libraries needed by SpoVNet ..."
-wget http://www.tm.uka.de/~mayer/spovnet/spovnet_libs_v2.tar.gz
-
-echo "SPOVNET: unpacking libraries ..."
-tar xfz ./spovnet_libs_v2.tar.gz
-rm ./spovnet_libs_v2.tar.gz
-
-echo "SPOVNET: start building libraries ..."
-
-echo "SPOVNET: building boost ..."
-cd boost_1_35_0
-mkdir build
-./configure --prefix=$PWD/build --with-libraries=thread,serialization,filesystem,system
-make -j2
-make install
-cd build/lib
-ln ./libboost_thread-*-1_35.so.1.35.0 ./libboost_thread.so
-ln ./libboost_serialization-*-1_35.so.1.35.0 ./libboost_serialization.so
-ln ./libboost_filesystem-*-1_35.so.1.35.0 ./libboost_filesystem.so
-ln ./libboost_system-*-1_35.so.1.35.0 ./libboost_system.so
-cd ..
-cd ..
-cd ..
-echo "SPOVNET: building boost done!"
-
-echo "SPOVNET: building gmp ..."
-cd gmp_4_2_2
-mkdir build
-./configure --prefix=$PWD/build 
-make -j2
-make install
-cd ..
-echo "SPOVNET: building gmp done!"
-
-echo "SPOVNET: building log4cxx ..."
-cd log4cxx_0_10_0
-mkdir build
-./configure --prefix=$PWD/build 
-make -j2
-make install
-cd ..
-echo "SPOVNET: building log4cxx done!"
-
-echo "Built all libraries needed by SpoVNet!";
-cd ..
Index: ash/bootstrap_libs_path
===================================================================
--- /trash/bootstrap_libs_path	(revision 12775)
+++ 	(revision )
@@ -1,3 +1,0 @@
-#!/bin/sh
-
-echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:'"$PWD/lib/boost_1_35_0/build/lib:$PWD/lib/gmp_4_2_2/build/lib:$PWD/lib/log4cxx_0_10_0/build/lib" >> ~/.bashrc
