Index: source/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: source/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: source/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: source/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: source/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: source/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: source/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;
 
