Index: source/ariba/overlay/BaseOverlay.cpp
===================================================================
--- source/ariba/overlay/BaseOverlay.cpp	(revision 2803)
+++ source/ariba/overlay/BaseOverlay.cpp	(revision 3037)
@@ -107,9 +107,10 @@
 
 	logging_info( "leaving spovnet " << spovnetId );
+	bool ret = ( state != this->BaseOverlayStateInvalid );
 
 	logging_debug( "dropping all auto-links ..." );
-	
+
 	BOOST_FOREACH( LinkPair item, linkMapping ){
-		if( item.second.autolink ) 
+		if( item.second.autolink )
 			dropLink( item.first );
 	}
@@ -135,5 +136,6 @@
 	// inform all registered services of the event
 	BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
-		i->onOverlayDestroy( spovnetId );
+		if( ret ) i->onLeaveSuccess( spovnetId );
+		else      i->onLeaveFail( spovnetId );
 	}
 }
@@ -159,13 +161,4 @@
 
 	//
-	// create the overlay
-	//
-
-	overlayInterface->createOverlay();
-	BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
-		i->onOverlayCreate( spovnetId );
-	}
-
-	//
 	// bootstrap against ourselfs
 	//
@@ -286,5 +279,5 @@
 				node.toString() << " for service " << service.toString() <<
 				". creating auto link ...");
-		
+
 		const LinkID link = establishLink( node, service );
 		LinkMapping::iterator i = linkMapping.find( link );
@@ -328,5 +321,5 @@
 	ServiceInterface* iface = listenerMux.get( sid );
 	listenerMux.unregisterItem( sid );
-	
+
 	return NULL; //iface;
 }
@@ -385,8 +378,8 @@
 				" on link " << id.toString() );
 
-		OverlayMsg overMsg( 
-			OverlayMsg::OverlayMessageTypeUpdate, 
-			i->second.service, 
-			nodeId 
+		OverlayMsg overMsg(
+			OverlayMsg::OverlayMessageTypeUpdate,
+			i->second.service,
+			nodeId
 			);
 
@@ -655,10 +648,4 @@
 
 		overlayInterface->createOverlay();
-
-		// inform all registered services of the event
-		BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
-			i->onOverlayCreate( spovnetId );
-		}
-
 		overlayInterface->joinOverlay( replyMsg->getBootstrapEndpoint() );
 
@@ -765,5 +752,5 @@
 			// inform all registered services of the event
 			BOOST_FOREACH( ServiceInterface* i, listenerMux.getOneList() ){
-				i->onOverlayDestroy( spovnetId );
+				i->onLeaveFail( spovnetId );
 			}
 
@@ -815,4 +802,15 @@
 		sendMessage( message, *i, service ); // TODO: sollte auto links aufbauen fÃŒr sowas
 	}
+}
+
+vector<NodeID> BaseOverlay::getOverlayNeighbors() const {
+	// the known nodes _can_ also include our
+	// node, so we remove ourselfs
+
+	vector<NodeID> nodes = overlayInterface->getKnownNodes();
+	vector<NodeID>::iterator i = find( nodes.begin(), nodes.end(), this->nodeId );
+	if( i != nodes.end() ) nodes.erase( i );
+
+	return nodes;
 }
 
Index: source/ariba/overlay/BaseOverlay.h
===================================================================
--- source/ariba/overlay/BaseOverlay.h	(revision 2803)
+++ source/ariba/overlay/BaseOverlay.h	(revision 3037)
@@ -44,4 +44,6 @@
 #include <algorithm>
 #include <ctime>
+#include <list>
+#include <vector>
 #include <boost/foreach.hpp>
 
@@ -66,8 +68,11 @@
 #include "ariba/overlay/messages/JoinReply.h"
 
+using std::vector;
+using std::list;
 using std::cout;
 using std::map;
 using std::make_pair;
 using std::pair;
+using std::find;
 
 using ariba::communication::EndpointDescriptor;
@@ -103,7 +108,6 @@
 // in different namespace
 namespace ariba {
-namespace interface {
-	class UnderlayAbstraction;
-}}
+	class Node;
+}
 
 namespace ariba {
@@ -117,5 +121,5 @@
 
 	use_logging_h( BaseOverlay );
-	friend class ariba::interface::UnderlayAbstraction;
+	friend class ariba::Node;
 
 public:
@@ -166,4 +170,9 @@
 		const ServiceID& service
 	);
+
+	/**
+	 * Get a list of overlay neighboring nodes.
+	 */
+	vector<NodeID> getOverlayNeighbors() const;
 
 	/**
@@ -324,7 +333,7 @@
 		static const LinkItem UNSPECIFIED;
 
-		LinkItem( const LinkID& _link, const NodeID& _node, 
+		LinkItem( const LinkID& _link, const NodeID& _node,
 				const ServiceID& _service, ServiceInterface* _interface )
-			: link( _link ), node( _node ), service( _service ), interface( _interface ), 
+			: link( _link ), node( _node ), service( _service ), interface( _interface ),
 				autolink( false ), lastuse( time(NULL) ) {
 		}
@@ -350,5 +359,5 @@
 	typedef pair<const LinkID,LinkItem> LinkPair;
 	LinkMapping linkMapping;
-	
+
 	// nodes with pending joines. TODO: should be cleaned every some seconds
 	// add timestamps to each, and check on occasion
Index: source/ariba/overlay/OverlayEvents.cpp
===================================================================
--- source/ariba/overlay/OverlayEvents.cpp	(revision 2803)
+++ source/ariba/overlay/OverlayEvents.cpp	(revision 3037)
@@ -48,10 +48,4 @@
 }
 
-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
@@ -71,4 +65,10 @@
 }
 
+void OverlayEvents::onLeaveSuccess( const SpoVNetID& spovnetid ){
+}
+
+void OverlayEvents::onLeaveFail( const SpoVNetID& spovnetid ){
+}
+
 void OverlayEvents::onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote ){
 }
Index: source/ariba/overlay/OverlayEvents.h
===================================================================
--- source/ariba/overlay/OverlayEvents.h	(revision 2803)
+++ source/ariba/overlay/OverlayEvents.h	(revision 3037)
@@ -58,8 +58,4 @@
 
 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 );
@@ -70,4 +66,6 @@
 	virtual void onJoinSuccess( const SpoVNetID& spovnetid );
 	virtual void onJoinFail( const SpoVNetID& spovnetid );
+	virtual void onLeaveSuccess( const SpoVNetID& spovnetid );
+	virtual void onLeaveFail( const SpoVNetID& spovnetid );
 
 	virtual void onLinkUp( const LinkID& link, const NodeID& local, const NodeID& remote );
