Index: sample/AribaTunnel/CMakeLists.txt
===================================================================
--- sample/AribaTunnel/CMakeLists.txt	(revision 12457)
+++ sample/AribaTunnel/CMakeLists.txt	(revision 12457)
@@ -0,0 +1,42 @@
+cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
+project(ariba-tunnel)
+
+
+# Provide some choices for CMAKE_BUILD_TYPE
+set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
+    "" Release Debug RelWithDebInfo MinSizeRel)
+
+
+### Find Ariba
+find_package(ariba 0.8.99 REQUIRED)
+if(NOT ariba_FOUND)
+    message(FATAL_ERROR "Could not find ariba. "
+            "Please have a look at the ariba_* cache variables.")
+endif(NOT ariba_FOUND)
+
+include_directories(${ariba_INCLUDE_DIRS})
+list(APPEND ariba-tunnel_LINK_LIBRARIES ariba ariba_dht)
+
+
+### Executable
+add_executable(ariba-tunnel Udp.cpp Tunnel.cpp
+    main.cc
+)
+
+
+### LINKER
+target_link_libraries(ariba-tunnel ${ariba-tunnel_LINK_LIBRARIES})
+
+# ### INSTALL
+# INSTALL(TARGETS ariba-tunnel
+#     RUNTIME DESTINATION bin
+# )
+
+
+## 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("---> Current build type is: ${CMAKE_BUILD_TYPE}")
Index: sample/AribaTunnel/LICENSE.txt
===================================================================
--- sample/AribaTunnel/LICENSE.txt	(revision 12457)
+++ sample/AribaTunnel/LICENSE.txt	(revision 12457)
@@ -0,0 +1,27 @@
+/*
+ * The MIT License (MIT)
+ * 
+ * Copyright (c) 2013 Mario Hock mails2013@omnifile.org
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ */
Index: sample/AribaTunnel/MessageSenderInterface.h
===================================================================
--- sample/AribaTunnel/MessageSenderInterface.h	(revision 12457)
+++ sample/AribaTunnel/MessageSenderInterface.h	(revision 12457)
@@ -0,0 +1,15 @@
+#ifndef MESSAGESENDERINTERFACE_H
+#define MESSAGESENDERINTERFACE_H
+
+#include "ariba/utility/transport/messages/message.hpp"
+
+class MessageSenderInterface
+{
+public:
+    virtual ~MessageSenderInterface() {}
+    
+    virtual void SendMessage(reboost::message_t msg) = 0;
+    virtual void SendMessage(reboost::shared_buffer_t msg) = 0;
+};
+
+#endif // MESSAGESENDERINTERFACE_H
Index: sample/AribaTunnel/Tunnel.cpp
===================================================================
--- sample/AribaTunnel/Tunnel.cpp	(revision 12457)
+++ sample/AribaTunnel/Tunnel.cpp	(revision 12457)
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2013 Mario Hock mails2013@omnifile.org
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ */
+
+#include "Tunnel.h"
+
+#include <ariba/utility/system/SystemQueue.h>
+
+#include <iostream>
+#include <boost/property_tree/ptree.hpp>
+
+
+using namespace std;
+using ariba::utility::SystemQueue;
+
+const ariba::ServiceID Tunnel::TUNNEL_SERVICE_ID(99);
+
+
+Tunnel::Tunnel()  :
+    udp_sender(NULL)
+{
+}
+
+Tunnel::~Tunnel()
+{
+
+}
+
+void Tunnel::init_ariba(ptree config)
+{
+    string my_name;
+    string remote_name;
+    
+    logging_info( "[TUNNEL]\t starting up Tunnel service ... " );
+
+    // use node name also in the application
+    my_name = config.get("ariba.node_name", "NO_NAME");
+    
+    // bind communication and node listener
+    node.bind( this );                      /*NodeListener*/
+    node.bind( this, TUNNEL_SERVICE_ID);    /*CommunicationListener*/
+
+    // connecting
+    logging_debug( "connecting ... " );
+
+    node.connect(config.get_child("ariba"));
+
+    logging_info( "[TUNNEL]\t ariba-tunnel starting up with"
+            << " [spovnetid " << node.getSpoVNetId().toString() << "]"
+            << " and [nodeid " << node.getNodeId().toString() << "]" );
+    
+    
+    // get the other tunnel endpoint from config
+    try
+    {
+        remote_name = config.get<string>("tunnel.connect_to_node");
+    
+        tunnel_endpoint = ariba::Name(remote_name).toNodeId();
+
+        logging_info( "[TUNNEL]\t I am Â»" << my_name << "Â« and I'll try to connect to: Â»" << remote_name << "Â«");
+    }
+    catch ( boost::property_tree::ptree_bad_path& e )
+    {
+        logging_warn( "[TUNNEL]\t I am Â»" << my_name << "Â« but I don't know the other tunnel endpoint!");
+    }
+}
+
+
+
+/* communication listener interface */
+void Tunnel::onMessage(reboost::shared_buffer_t message,
+        const NodeID& remote,
+        const LinkID& lnk,
+        const SequenceNumber& seqnum,
+        const ariba::overlay::OverlayMsg* overlay_msg)
+{
+    logging_info( "[ARIBA] received " << message.size() << " bytes from node: " << remote.toString() );
+    
+    /// forward ariba message over UDP
+    if ( udp_sender != NULL )
+    {
+        udp_sender->SendMessage(message);
+    }
+    else
+    {
+        logging_warn("/// NO UDP SENDER REGISTERED");
+    }
+}
+
+void Tunnel::onLinkUp(const LinkID& lnk, const NodeID& remote)
+{
+    logging_info("[TUNNEL]\t LINK UP");
+    
+    // TODO Maybe we should decide for one link instead of maintaining several..
+    
+    // only accept links to the other tunnel endpoint
+    if ( remote == tunnel_endpoint )
+    {
+        links.push_back(lnk);
+    }
+    else
+    {
+        node.dropLink(lnk);
+    }
+}
+
+void Tunnel::onLinkDown(const LinkID& lnk, const NodeID& remote)
+{
+    std::vector<LinkID>::iterator it = find(links.begin(), links.end(), lnk);
+    
+    if ( it != links.end() )
+        links.erase(it);
+}
+
+
+
+/* node listener interface */
+void Tunnel::onOverlayConnected(const SpoVNetID& vid)
+{
+    logging_info( "/// OverlayConnected" );
+    
+    // establish link to the other tunnel endpoint
+    node.establishLink(tunnel_endpoint, TUNNEL_SERVICE_ID);
+}
+
+void Tunnel::onOverlayDisconnected(const SpoVNetID& vid)
+{
+    logging_info( "/// OverlayDisconnected" );
+}
+
+
+
+
+/// * to be called from an EXTERNAL THREAD *
+void Tunnel::SendMessage(reboost::message_t msg)
+{
+    /// synchronize with the Ariba Thread
+    SystemQueue::instance().scheduleCall(
+        boost::bind(
+                &Tunnel::send_message,
+                this,
+                msg)
+    );
+}
+void Tunnel::SendMessage(reboost::shared_buffer_t msg)
+{
+    reboost::message_t message;
+    message.push_back(msg);
+
+    this->SendMessage(message);
+}
+
+
+
+/// * to be called within the ARIBA THREAD *
+void Tunnel::send_message(reboost::message_t msg)
+{
+    if ( ! links.empty() )
+    {
+        logging_info( "[ARIBA] sending " << msg.size() << " bytes over link: " << links[0].toString() );
+        
+        node.sendMessage(msg, links[0]);
+    }
+    else
+    {
+        logging_warn( "[ARIBA] would like to send " << msg.size() << " bytes. But there is no active link!" );
+    }    
+}
+
+
+void Tunnel::register_udp_sender(MessageSenderInterface* udp_sender)
+{
+    this->udp_sender = udp_sender;
+}
+
+
+
+
+// /// XXX this is only for debug output
+// void Tunnel::print_message(const string& prefix, reboost::message_t msg)
+// {
+//     // XXX testing (debug output)
+//     reboost::shared_buffer_t buf = msg.linearize();
+//     print_message(prefix, buf);
+// }
+// void Tunnel::print_message(const string& prefix, reboost::shared_buffer_t buf)
+// {
+//     string s((const char*) buf.data(), buf.size() - 1);
+//     std::cout << prefix << "Â»" << s << "Â«" << std::endl;
+// }
+
Index: sample/AribaTunnel/Tunnel.h
===================================================================
--- sample/AribaTunnel/Tunnel.h	(revision 12457)
+++ sample/AribaTunnel/Tunnel.h	(revision 12457)
@@ -0,0 +1,105 @@
+/*
+ * The MIT License (MIT)
+ * 
+ * Copyright (c) 2013 Mario Hock mails2013@omnifile.org
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ */
+
+#ifndef TUNNEL_H
+#define TUNNEL_H
+
+#include <ariba/ariba.h>
+#include "MessageSenderInterface.h"
+
+#include <boost/noncopyable.hpp>
+
+using namespace ariba;
+using boost::property_tree::ptree;
+
+class Tunnel : 
+    private boost::noncopyable,
+    public ariba::NodeListener,
+    public ariba::CommunicationListener,
+    public MessageSenderInterface
+{
+public:
+    Tunnel();
+    virtual ~Tunnel();
+
+    void init_ariba(ptree config);
+    
+    /*
+     * Sends a message via ariba.
+     *
+     * This function is intended to be called from an EXTERNAL THREAD.
+     * --> It synchronizes with the System Qeueue.
+     */
+    virtual void SendMessage(reboost::message_t msg);
+    virtual void SendMessage(reboost::shared_buffer_t msg);
+    
+    void register_udp_sender(MessageSenderInterface* udp_sender);
+
+protected:
+    /* [ariba] communication listener interface */
+    virtual void onMessage(reboost::shared_buffer_t message,
+        const NodeID& remote,
+        const LinkID& lnk,
+        const SequenceNumber& seqnum,
+        const ariba::overlay::OverlayMsg* overlay_msg);
+
+    virtual void onLinkUp(const LinkID& lnk, const NodeID& remote);
+    virtual void onLinkDown(const LinkID& lnk, const NodeID& remote);
+//     virtual bool onLinkRequest(const NodeID& remote);
+//     virtual void onLinkChanged(const LinkID& lnk, const NodeID& remote);
+//     virtual void onLinkFail(const LinkID& lnk, const NodeID& remote);
+
+    /* [ariba] node listener interface */
+    virtual void onOverlayConnected( const SpoVNetID& vid );
+    virtual void onOverlayDisconnected( const SpoVNetID& vid );
+
+    
+private:
+    /* 
+     * Sends a message via ariba.
+     * 
+     * This function must be called within the ARIBA THREAD!
+     * It's the counterpart to Tunnel::SendMessage.
+     */
+    void send_message(reboost::message_t msg);
+    
+//     /// XXX this is only for debug output
+//     void print_message(const string& prefix, reboost::message_t msg);
+//     void print_message(const string& prefix, reboost::shared_buffer_t buf);
+
+public:
+    static const ariba::ServiceID TUNNEL_SERVICE_ID;
+    
+private:
+    ariba::Node node;
+    ariba::NodeID tunnel_endpoint;
+    std::vector<LinkID> links;
+    MessageSenderInterface* udp_sender;
+};
+
+#endif // TUNNEL_H
Index: sample/AribaTunnel/Udp.cpp
===================================================================
--- sample/AribaTunnel/Udp.cpp	(revision 12457)
+++ sample/AribaTunnel/Udp.cpp	(revision 12457)
@@ -0,0 +1,88 @@
+#include "Udp.h"
+
+using namespace std;
+
+udp_server::~udp_server()
+{
+}
+
+void udp_server::listen_on(uint16_t port)
+{
+    std::cout << "[UDP] listening on port: " << port << std::endl;
+    
+    socket_.open(udp::v4());
+    socket_.bind(udp::endpoint(udp::v4(), port));
+    start_receive();
+}
+
+void udp_server::connect_to(uint16_t port)
+{
+    std::cout << "[UDP] connecting to port: " << port << " (on localhost)" << std::endl;
+
+    remote_endpoint_ = udp::endpoint(boost::asio::ip::address::from_string("127.0.0.1"), port);
+    
+    socket_.open(udp::v4());
+    socket_.connect(remote_endpoint_);
+    start_receive();
+}
+
+
+/* MessageSenderInterface */
+void udp_server::SendMessage(reboost::shared_buffer_t msg)
+{
+    cout << "[UDP] sending " << msg.size() << " bytes to " << remote_endpoint_ << endl;
+    
+    // send over udp
+    socket_.async_send_to(
+        boost::asio::buffer(msg.data(), msg.size()),
+        remote_endpoint_,
+        boost::bind(&udp_server::handle_send, this, msg,
+            boost::asio::placeholders::error,
+            boost::asio::placeholders::bytes_transferred));
+}
+void udp_server::SendMessage(reboost::message_t msg)
+{
+    reboost::shared_buffer_t buf = msg.linearize();
+    this->SendMessage(buf);
+}
+
+
+
+/* asio udp */
+void udp_server::start_receive()
+{
+    recv_buffer_ = reboost::shared_buffer_t(3000);
+    
+    socket_.async_receive_from(
+        boost::asio::buffer(recv_buffer_.mutable_data(), recv_buffer_.size()),
+        remote_endpoint_,
+        boost::bind(&udp_server::handle_receive, this,
+        boost::asio::placeholders::error,
+        boost::asio::placeholders::bytes_transferred));
+}
+
+void udp_server::handle_receive(const boost::system::error_code& error, std::size_t bytes_transferred)
+{
+    if (!error || error == boost::asio::error::message_size)
+    {
+        cout << "[UDP] received " << bytes_transferred << " bytes from " << remote_endpoint_ << endl;
+
+        // send sub-buffer trough tunnel
+        send_via_ariba( recv_buffer_(0, bytes_transferred) );
+
+        // wait for further messages...
+        start_receive();
+    }
+}
+
+void udp_server::handle_send(reboost::shared_buffer_t msg, const boost::system::error_code& , std::size_t )
+{
+    // empty
+}
+
+
+/// forward data over ariba
+void udp_server::send_via_ariba(reboost::shared_buffer_t buffer)
+{
+    tunnel.SendMessage(buffer);
+}
Index: sample/AribaTunnel/Udp.h
===================================================================
--- sample/AribaTunnel/Udp.h	(revision 12457)
+++ sample/AribaTunnel/Udp.h	(revision 12457)
@@ -0,0 +1,89 @@
+/*
+ * The MIT License (MIT)
+ * 
+ * Copyright (c) 2013 Mario Hock mails2013@omnifile.org
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ */
+
+#ifndef UDP_H
+#define UDP_H
+
+#include "MessageSenderInterface.h"
+
+#include <ctime>
+#include <iostream>
+#include <string>
+#include <boost/array.hpp>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/asio.hpp>
+
+using boost::asio::ip::udp;
+
+class udp_server  :
+    public MessageSenderInterface
+{
+public:
+    /// constructor
+    udp_server(boost::asio::io_service& io_service,
+             MessageSenderInterface& tunnel) :
+        socket_(io_service),
+        tunnel(tunnel)
+    {
+    }
+    
+    virtual ~udp_server();
+    
+    /// opens an udp "server-socket" on the given port
+    void listen_on(uint16_t port);
+    
+    /// connects an udp "client-socket" to the given port (on localhost)
+    void connect_to(uint16_t port);
+    
+    
+    /// MessageSenderInterface
+    virtual void SendMessage(reboost::message_t msg);
+    virtual void SendMessage(reboost::shared_buffer_t msg);
+
+private:
+    void start_receive();
+
+    void handle_receive(const boost::system::error_code& error,
+            std::size_t bytes_transferred);
+    
+    void handle_send(reboost::shared_buffer_t msg,
+        const boost::system::error_code& /*error*/,
+        std::size_t /*bytes_transferred*/);
+    
+    /// forward data over ariba
+    void send_via_ariba(reboost::shared_buffer_t buffer);
+
+private:
+    udp::socket socket_;
+    MessageSenderInterface& tunnel;
+    udp::endpoint remote_endpoint_;
+    reboost::shared_buffer_t recv_buffer_;
+};
+
+#endif // UDP_H
Index: sample/AribaTunnel/main.cc
===================================================================
--- sample/AribaTunnel/main.cc	(revision 12457)
+++ sample/AribaTunnel/main.cc	(revision 12457)
@@ -0,0 +1,133 @@
+/*
+ * The MIT License (MIT)
+ * 
+ * Copyright (c) 2013 Mario Hock mails2013@omnifile.org
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ */
+
+#include <iostream>
+#include "ariba/utility/system/StartupWrapper.h"
+#include <boost/property_tree/json_parser.hpp>
+#include <stdexcept>
+
+#include "Tunnel.h"
+#include "Udp.h"
+
+using ariba::utility::StartupWrapper;
+
+
+/**
+ * This program tunnels an (bidirectional) UDP connection over ARIBA:
+ * 
+ *  /------------/      UDP       /-------------/
+ *  | UDP-Client |  <-----------> | AribaTunnel |
+ *  /------------/               /--------------/
+ *        .                              ^ 
+ *        .                              | ARIBA
+ *        .                              V
+ *  /------------/      UDP       /-------------/
+ *  | UDP-Server |  <-----------> | AribaTunnel |
+ *  /------------/               /--------------/
+ * 
+ */
+int main(int argc, char **argv)
+{
+    Tunnel tunnel;
+    string config_file;
+    
+    // parameter: config file
+    if ( argc == 2 )
+    {
+        config_file = argv[1];
+        
+        std::cout << "Using config: " << config_file << std::endl;
+    }
+    
+    // read config
+    ptree config;
+    try
+    {
+        using boost::property_tree::json_parser::read_json;
+        
+        read_json(config_file, config);
+    }
+    catch ( std::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", "tunnel");
+    }
+
+    
+    // start System Queue
+    StartupWrapper::startSystem();
+
+    // ARIBA
+    // TODO fix/update startup wrapper? -- but scheduleCall does basically the same
+    SystemQueue::instance().scheduleCall(
+        boost::bind(
+                &Tunnel::init_ariba,
+                &tunnel,
+                config)
+    );
+
+    
+    // ASIO (UDP)
+    uint16_t listen_port = config.get<uint16_t>("tunnel.udp_listen_on_port", 0);
+    uint16_t connect_port = config.get<uint16_t>("tunnel.udp_connect_to_port", 0);
+    
+    boost::asio::io_service io_service;
+    udp_server server(io_service, tunnel);
+    
+    // client-side (use server-socket)
+    if ( listen_port > 0 )
+    {
+        server.listen_on(listen_port);
+    }
+    // server side (use client_socket)
+    else if ( connect_port > 0 )
+    {
+        server.connect_to(connect_port);
+    }
+    
+    tunnel.register_udp_sender(&server);
+
+    try
+    {
+        io_service.run();
+    }
+    catch (std::exception& e)
+    {
+        std::cerr << e.what() << std::endl;
+    }
+    
+    // TODO stop tunnel gracefully.... fix/update startup wrapper?
+    
+    // stop System Queue
+    StartupWrapper::stopSystem();
+    
+    return 0;
+}
Index: sample/AribaTunnel/settings_client_side.cnf
===================================================================
--- sample/AribaTunnel/settings_client_side.cnf	(revision 12457)
+++ sample/AribaTunnel/settings_client_side.cnf	(revision 12457)
@@ -0,0 +1,27 @@
+//JSON
+{
+    "tunnel": {
+        "connect_to_node": "ServerSide",
+        "udp_listen_on_port": 1313
+    },
+
+    "ariba": {
+        "node_name": "ClientSide",
+        "spovnet_name": "tunnel",
+        
+        "listen_on": [
+            {"category": "TCPIP", "addr": "::", "port": 5005 }
+        ],
+        
+        "bootstrap": {
+            "direct": [
+                {"category": "TCPIP", "addr": "127.0.0.1", "port": 5006 }
+            ],
+            
+            "broadcast": false,
+            "mdns": false,
+            "sdp": false
+        }
+    }
+}
+
Index: sample/AribaTunnel/settings_server_side.cnf
===================================================================
--- sample/AribaTunnel/settings_server_side.cnf	(revision 12457)
+++ sample/AribaTunnel/settings_server_side.cnf	(revision 12457)
@@ -0,0 +1,23 @@
+//JSON
+{
+    "tunnel": {
+        "connect_to_node": "ClientSide",
+        "udp_connect_to_port": 1314
+    },
+    
+    "ariba": {
+        "node_name": "ServerSide",
+        "spovnet_name": "tunnel",
+
+        "listen_on": [
+            {"category": "TCPIP", "addr": "::", "port": 5006 }
+        ],
+        
+        "bootstrap": {
+            "direct": [
+                {"category": "TCPIP", "addr": "127.0.0.1", "port": 5005 }
+            ]
+        }
+    }
+}
+
Index: sample/CMakeLists.txt
===================================================================
--- sample/CMakeLists.txt	(revision 12351)
+++ sample/CMakeLists.txt	(revision 12457)
@@ -38,4 +38,6 @@
 
 add_subdirectory(pingpong)
-#add_subdirectory(debugging)
 
+## NOTE: "AribaTunnel" is not part of the ariba build process. 
+#        It has to be compiled separately!
+
