gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated (92c6b1ae0 -> 898b9a01a)


From: gnunet
Subject: [gnunet] branch master updated (92c6b1ae0 -> 898b9a01a)
Date: Thu, 05 Oct 2023 08:57:03 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a change to branch master
in repository gnunet.

    from 92c6b1ae0 BUILD: Fix bug where we accidentally cleared LDFLAGS
     new 01cf7af53 NEWS: Added __attribute__((deprecated)) to the old transport 
API
     new 664286d70 NEWS: Added __attribute__((deprecated)) to the old transport 
API
     new 823fbe0ec News: Merge branch 'l20integration' of 
ssh://git.gnunet.org/gnunet into l20integration
     new b78f99388 NEWS: Removed all usage of old transport api, beside 
peerinfo tool, gnunet-transport cli and usage in transport layer itself.
     new 72b4f42f4 TNG: Deactivated all tests which rely on the old transport 
api.
     new b138491b9 TNG: Accidentally removed code.
     new 40a5a650d NEWS: Added command to execute a script.
     new 80971b632 TNG: Added generic start script for test cases.
     new 03a5d1747 NEWS: Moved start peer command to testing subsystem.
     new 4ba7b5f6c TNG: Added Testcase that just runs two peers, and blocks.
     new 61bbc04e9 CORE: Fixed bug that core is not calling 
GNUNET_TRANSPORT_core_receive_continue
     new aec63bfd2 TNG: Fixed bug that QueueEntry of another queue still holds 
reference to PendingMessage.
     new 39bcd0fd0 NEWS: Changed new hello uri api to allow to change the 
expiration time
     new 0f8b71280 NEWS: Added api to store hellos with peerstore service.
     new 55a25efea NEWS: Added api to get notified when hellos are stored with 
peerstore service.
     new 23a2640fa TOPOLOGY: Exchanged peerinfo api to store hellos with new 
peerstore api.
     new 86ae84f76 PEERSTORE: change watch to return actual values, before 
watching.
     new a362cd5a2 NEWS: The old hello design replaced by the new  hello design.
     new 8ea92236d HELLO: Cli tool for changing hello files in contrib can 
change file from old to new hello design.
     new 20d6f3742 PEERSTORE: Moved code to scan and import hello file into 
peerstore from peerinfo.
     new 02a1fdad3 NEWS: Moved code to testing to have more generic test setup, 
which can be used not only from within transport.
     new 1016d6d19 NEWS: Code moved to the core package to get rid of circular 
dependencies.
     new 84913ba15 NEWS: Changed method 
GNUNET_HELLO_builder_get_expiration_time to not need parameter 
GNUNET_HELLO_Builder.
     new e1341d1dc Peerstore: Changed the behavior of GNUNET_PEERSTORE_watch to 
also return the values allready stored for the key.
     new 66ecfe29c Hello: Changed address and hello format to new TNG format.
     new 3bd35e8e0 Peerstore: Fixed bug in bootstrap code
     new 88cb4be25 TNG: Fixed validation bug.
     new 8127d51de DHT: Fixed wrong group name
     new ed76bf2ec TNG: Fixed syntax.
     new 6f68c34aa Merge branch 'master' into l20integration
     new 61527ff1d BUILD: Make meson build without ats, tesbed, peerinfo
     new 7f9ddac03 Merge branch 'master' into l20integration
     new 9ff663cc0 Merge branch 'master' into l20integration
     new 5df045103 Remove most of old transport, ATS and PEERINFO. Disable 
TESTBED and related tests
     new 96c6d62c6 Remove old transport struct definitions
     new 53e3a0e32 Fix warnings; CADET not FTBFS because old hello removed
     new 614ed461b Remove more traces of ATS
     new 09f0c2576 Remove more traces of old transport
     new 64da53284 Make fs and cadet build again; cadet hello handling 
suspicious
     new 898b9a01a Update to new transport binary

The 40 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 configure.ac                                       |    8 -
 contrib/Makefile.am                                |    4 +-
 contrib/testing-ng/block.sh                        |   11 +
 pkgconfig/Makefile.am                              |    4 -
 po/POTFILES.in                                     |   70 +-
 src/Makefile.am                                    |    7 +-
 src/abd/Makefile.am                                |    8 +-
 src/abd/abd_api.c                                  |    1 -
 src/ats-tool/.gitignore                            |    1 -
 src/ats-tool/Makefile.am                           |   19 -
 src/ats-tool/gnunet-ats.c                          |  992 -----
 src/ats-tool/meson.build                           |   15 -
 src/ats/.gitignore                                 |    6 -
 src/ats/Makefile.am                                |  102 -
 src/ats/ats.conf.in                                |   44 -
 src/ats/ats.h                                      |  492 ---
 src/ats/ats_api_connectivity.c                     |  362 --
 src/ats/ats_api_performance.c                      |  946 -----
 src/ats/ats_api_scanner.c                          |   65 -
 src/ats/ats_api_scheduling.c                       |  781 ----
 src/ats/experiments/example.exp                    |  104 -
 src/ats/experiments/gnunet_ats_sim_default.conf    |   18 -
 src/ats/experiments/set_preference.exp             |   95 -
 src/ats/gnunet-ats-solver-eval.c                   | 3588 ------------------
 src/ats/gnunet-ats-solver-eval.h                   |  335 --
 src/ats/gnunet-service-ats.c                       |  538 ---
 src/ats/gnunet-service-ats.h                       |   42 -
 src/ats/gnunet-service-ats_addresses.c             |  686 ----
 src/ats/gnunet-service-ats_addresses.h             |  490 ---
 src/ats/gnunet-service-ats_connectivity.c          |  222 --
 src/ats/gnunet-service-ats_connectivity.h          |   92 -
 src/ats/gnunet-service-ats_normalization.c         |  299 --
 src/ats/gnunet-service-ats_normalization.h         |   60 -
 src/ats/gnunet-service-ats_performance.c           |  282 --
 src/ats/gnunet-service-ats_performance.h           |   96 -
 src/ats/gnunet-service-ats_plugins.c               |  582 ---
 src/ats/gnunet-service-ats_plugins.h               |  149 -
 src/ats/gnunet-service-ats_preferences.c           |  771 ----
 src/ats/gnunet-service-ats_preferences.h           |   93 -
 src/ats/gnunet-service-ats_reservations.c          |  211 --
 src/ats/gnunet-service-ats_reservations.h          |   72 -
 src/ats/gnunet-service-ats_scheduling.c            |  195 -
 src/ats/gnunet-service-ats_scheduling.h            |  100 -
 src/ats/meson.build                                |   58 -
 src/ats/perf_ats_simplistic_bandwidth.conf         |   27 -
 src/ats/perf_ats_simplistic_delay.conf             |    8 -
 src/ats/perf_ats_solver.c                          | 1510 --------
 src/ats/perf_ats_solver.conf                       |   28 -
 src/ats/perf_ats_solver_proportional.conf          |    0
 src/ats/plugin_ats_proportional.c                  | 1243 ------
 src/ats/test_ats_api.c                             |  296 --
 src/ats/test_ats_api.conf                          |   35 -
 src/ats/test_ats_api_delayed.conf                  |   36 -
 src/ats/test_ats_api_proportional.conf             |   24 -
 src/ats/test_ats_lib.c                             | 1107 ------
 src/ats/test_ats_lib.h                             |  512 ---
 src/ats/test_ats_reservation_api.c                 |  181 -
 src/ats/test_ats_solver_default.conf               |    2 -
 src/ats/test_ats_solver_delayed_proportional.conf  |   20 -
 src/ats/test_ats_solver_proportional.conf          |   19 -
 src/ats/test_delay                                 |   18 -
 src/cadet/Makefile.am                              |  139 +-
 src/cadet/gnunet-service-cadet.c                   |   15 +-
 src/cadet/gnunet-service-cadet.h                   |    4 +-
 src/cadet/gnunet-service-cadet_dht.c               |   11 +-
 src/cadet/gnunet-service-cadet_hello.c             |   47 +-
 src/cadet/gnunet-service-cadet_hello.h             |    4 +-
 src/cadet/gnunet-service-cadet_peer.c              |  112 +-
 src/cadet/gnunet-service-cadet_peer.h              |    4 +-
 src/cadet/meson.build                              |   10 +-
 src/consensus/Makefile.am                          |   23 +-
 src/core/Makefile.am                               |   98 +-
 src/core/core.h                                    |    1 -
 .../core_api_cmd_connecting_peers.c}               |  153 +-
 src/core/gnunet-service-core.c                     |    1 +
 src/core/gnunet-service-core_kx.c                  |   65 +-
 src/core/gnunet-service-core_kx.h                  |    1 -
 src/core/gnunet-service-core_typemap.c             |    1 -
 src/core/gnunet-service-core_typemap.h             |    1 -
 src/core/meson.build                               |    2 +-
 .../test_core_plugin_cmd_just_run.c}               |  259 +-
 .../test_core_start_testcase.sh}                   |    6 +-
 src/dht/Makefile.am                                |  109 +-
 src/dht/dht_api.c                                  |    1 -
 src/dht/gnunet-service-dht.c                       |    4 +-
 src/dht/gnunet-service-dht.h                       |    1 -
 src/dht/gnunet-service-dht_neighbours.c            |    9 +-
 src/dht/plugin_block_dht.c                         |   99 -
 src/dhtu/Makefile.am                               |    5 +-
 src/dhtu/meson.build                               |    5 +-
 src/dhtu/plugin_dhtu_gnunet.c                      |  240 +-
 src/fs/Makefile.am                                 |  203 +-
 src/fs/gnunet-service-fs.c                         |   58 +-
 src/fs/gnunet-service-fs.h                         |    2 -
 src/fs/gnunet-service-fs_cp.c                      |  138 +-
 src/fs/meson.build                                 |    1 -
 src/gns/Makefile.am                                |   40 +-
 src/gns/gns_api.c                                  |    1 -
 src/gns/gns_tld_api.c                              |    1 -
 src/gnsrecord/gnsrecord_misc.c                     |    1 -
 src/hello/Makefile.am                              |   20 +-
 src/hello/gnunet-hello.c                           |  282 +-
 src/hello/hello-ng.c                               |    1 -
 src/hello/hello-uri.c                              |   81 +-
 src/hello/test_hello-uri.c                         |   12 +-
 src/hostlist/Makefile.am                           |   41 +-
 src/hostlist/gnunet-daemon-hostlist_client.c       |   36 +-
 src/hostlist/gnunet-daemon-hostlist_server.c       |  138 +-
 src/hostlist/meson.build                           |    3 +-
 src/identity/Makefile.am                           |    8 +-
 src/include/Makefile.am                            |    9 +-
 src/include/gnunet_ats_application_service.h       |  109 -
 src/include/gnunet_ats_plugin.h                    |  492 ---
 src/include/gnunet_ats_service.h                   |  631 ----
 src/include/gnunet_ats_transport_service.h         |  241 --
 src/include/gnunet_cadet_service.h                 |    2 -
 src/include/gnunet_core_service.h                  |    1 -
 src/include/gnunet_hello_uri_lib.h                 |   27 +-
 src/include/gnunet_peerstore_service.h             |   81 +-
 src/include/gnunet_testing_netjail_lib.h           |   21 +
 src/include/gnunet_testing_ng_lib.h                |  311 +-
 src/include/gnunet_testing_plugin.h                |    8 +-
 src/include/gnunet_transport_hello_service.h       |   12 +-
 .../gnunet_transport_manipulation_service.h        |  123 -
 src/include/gnunet_transport_monitor_service.h     |    1 -
 src/include/gnunet_transport_plugin.h              |  733 ----
 src/include/gnunet_transport_service.h             |  715 ----
 src/include/gnunet_transport_testing_ng_lib.h      |   81 +
 src/integration-tests/Makefile.am                  |   10 +-
 src/meson.build                                    |   13 +-
 src/messenger/Makefile.am                          |   25 +-
 src/nse/Makefile.am                                |   25 +-
 src/nse/nse_api.c                                  |    1 -
 src/peerinfo-tool/.gitignore                       |    2 -
 src/peerinfo-tool/Makefile.am                      |   64 -
 src/peerinfo-tool/gnunet-peerinfo.c                |  864 -----
 src/peerinfo-tool/gnunet-peerinfo_plugins.c        |  196 -
 src/peerinfo-tool/gnunet-peerinfo_plugins.h        |   58 -
 src/peerinfo-tool/meson.build                      |   31 -
 src/peerinfo-tool/plugin_rest_peerinfo.c           |  842 -----
 src/peerinfo-tool/test_gnunet_peerinfo.py.in       |  143 -
 src/peerinfo-tool/test_gnunet_peerinfo_data.conf   |   13 -
 src/peerinfo/.gitignore                            |    6 -
 src/peerinfo/Makefile.am                           |  105 -
 src/peerinfo/gnunet-service-peerinfo.c             | 1370 -------
 src/peerinfo/meson.build                           |   41 -
 src/peerinfo/peerinfo.conf.in                      |   31 -
 src/peerinfo/peerinfo.h                            |  122 -
 src/peerinfo/peerinfo_api.c                        |  557 ---
 src/peerinfo/peerinfo_api_notify.c                 |  291 --
 src/peerinfo/perf_peerinfo_api.c                   |  193 -
 src/peerinfo/test_peerinfo_api.c                   |  172 -
 src/peerinfo/test_peerinfo_api_data.conf           |   15 -
 src/peerinfo/test_peerinfo_api_friend_only.c       |  172 -
 .../test_peerinfo_api_notify_friend_only.c         |  261 --
 src/peerinfo/test_peerinfo_shipped_hellos.c        |  144 -
 src/peerstore/Makefile.am                          |    4 +-
 src/peerstore/gnunet-service-peerstore.c           |  115 +
 src/peerstore/meson.build                          |    6 +-
 src/peerstore/peerstore_api.c                      |  500 ++-
 src/regex/Makefile.am                              |   16 +-
 src/revocation/Makefile.am                         |    6 +-
 src/rps/Makefile.am                                |   13 +-
 src/rps/gnunet-service-rps.c                       |   34 +-
 src/scalarproduct/Makefile.am                      |    2 +-
 .../gnunet-service-scalarproduct-ecc_alice.c       |    1 +
 .../gnunet-service-scalarproduct_alice.c           |    1 +
 .../gnunet-service-scalarproduct_bob.c             |    1 +
 src/secretsharing/Makefile.am                      |   23 +-
 src/set/Makefile.am                                |    6 +-
 src/seti/Makefile.am                               |    2 +-
 src/setu/Makefile.am                               |    4 +-
 src/sq/sq.c                                        |    1 -
 src/sq/sq_prepare.c                                |    1 -
 src/testbed/meson.build                            |   38 +-
 src/testing/Makefile.am                            |   27 +-
 .../test_testing_start_with_config.c}              |   13 +-
 src/testing/testing_api_cmd_barrier_reached.c      |    2 +-
 .../testing_api_cmd_block_until_external_trigger.c |    4 +-
 ..._start.c => testing_api_cmd_exec_bash_script.c} |  183 +-
 .../testing_api_cmd_start_peer.c}                  |  217 +-
 .../testing_api_cmd_stop_peer.c}                   |   32 +-
 src/topology/Makefile.am                           |   13 +-
 src/topology/gnunet-daemon-topology.c              |  339 +-
 src/topology/meson.build                           |    5 +-
 src/transport/Makefile.am                          | 1337 +------
 src/transport/communicator-unix.conf               |    2 -
 src/transport/gnunet-helper-transport-bluetooth.c  | 2286 -----------
 src/transport/gnunet-helper-transport-wlan-dummy.c |  520 ---
 src/transport/gnunet-helper-transport-wlan.c       | 2165 -----------
 src/transport/gnunet-service-tng.c                 |  241 +-
 src/transport/gnunet-service-transport.c           | 2778 --------------
 src/transport/gnunet-service-transport_ats.c       |  906 -----
 src/transport/gnunet-service-transport_ats.h       |  203 -
 src/transport/gnunet-service-transport_hello.c     |  358 --
 src/transport/gnunet-service-transport_hello.h     |  102 -
 .../gnunet-service-transport_manipulation.c        |  586 ---
 .../gnunet-service-transport_manipulation.h        |  121 -
 .../gnunet-service-transport_neighbours.c          | 3947 -------------------
 .../gnunet-service-transport_neighbours.h          |  321 --
 src/transport/gnunet-service-transport_plugins.c   |  437 ---
 src/transport/gnunet-service-transport_plugins.h   |  107 -
 .../gnunet-service-transport_validation.c          | 1819 ---------
 .../gnunet-service-transport_validation.h          |  146 -
 src/transport/gnunet-transport-wlan-receiver.c     |  114 -
 src/transport/gnunet-transport-wlan-sender.c       |  251 --
 src/transport/meson.build                          |  123 +-
 src/transport/perf_http_peer1.conf                 |   37 -
 src/transport/perf_http_peer2.conf                 |   40 -
 src/transport/perf_https_peer1.conf                |   37 -
 src/transport/perf_https_peer2.conf                |   40 -
 src/transport/perf_tcp_peer1.conf                  |   31 -
 src/transport/perf_tcp_peer2.conf                  |   34 -
 src/transport/perf_udp_peer1.conf                  |   43 -
 src/transport/perf_udp_peer2.conf                  |   48 -
 src/transport/perf_unix_peer1.conf                 |   52 -
 src/transport/perf_unix_peer2.conf                 |   56 -
 src/transport/plugin_transport_http.h              |  579 ---
 src/transport/plugin_transport_http_client.c       | 2523 -------------
 src/transport/plugin_transport_http_common.c       |  903 -----
 src/transport/plugin_transport_http_common.h       |  272 --
 src/transport/plugin_transport_http_server.c       | 3603 ------------------
 src/transport/plugin_transport_smtp.c              |  750 ----
 src/transport/plugin_transport_tcp.c               | 3967 --------------------
 src/transport/plugin_transport_template.c          |  565 ---
 src/transport/plugin_transport_udp.c               | 3897 -------------------
 src/transport/plugin_transport_udp.h               |  355 --
 src/transport/plugin_transport_udp_broadcasting.c  |  647 ----
 src/transport/plugin_transport_unix.c              | 1890 ----------
 src/transport/plugin_transport_wlan.c              | 2405 ------------
 src/transport/plugin_transport_wlan.h              |  276 --
 src/transport/tcp_connection_legacy.c              | 1597 --------
 src/transport/tcp_server_legacy.c                  | 1728 ---------
 src/transport/tcp_server_mst_legacy.c              |  307 --
 src/transport/tcp_service_legacy.c                 | 1646 --------
 ..._tcp_peer1.conf => template_tng_cfg_peer1.conf} |   15 +-
 src/transport/test_http_common.c                   |  266 --
 src/transport/test_plugin_transport.c              |  797 ----
 src/transport/test_plugin_transport_data.conf      |   47 -
 src/transport/test_plugin_transport_data_udp.conf  |    1 -
 src/transport/test_quota_compliance.c              |  321 --
 ...uota_compliance_bluetooth_asymmetric_peer1.conf |   12 -
 ...uota_compliance_bluetooth_asymmetric_peer2.conf |   11 -
 .../test_quota_compliance_bluetooth_peer1.conf     |   30 -
 .../test_quota_compliance_bluetooth_peer2.conf     |   29 -
 src/transport/test_quota_compliance_data.conf      |   24 -
 ...est_quota_compliance_http_asymmetric_peer1.conf |   28 -
 ...est_quota_compliance_http_asymmetric_peer2.conf |   32 -
 .../test_quota_compliance_http_peer1.conf          |   28 -
 .../test_quota_compliance_http_peer2.conf          |   32 -
 ...st_quota_compliance_https_asymmetric_peer1.conf |   28 -
 ...st_quota_compliance_https_asymmetric_peer2.conf |   31 -
 .../test_quota_compliance_https_peer1.conf         |   28 -
 .../test_quota_compliance_https_peer2.conf         |   31 -
 ...test_quota_compliance_tcp_asymmetric_peer1.conf |   32 -
 ...test_quota_compliance_tcp_asymmetric_peer2.conf |   29 -
 src/transport/test_quota_compliance_tcp_peer1.conf |   32 -
 src/transport/test_quota_compliance_tcp_peer2.conf |   29 -
 src/transport/test_quota_compliance_udp_peer1.conf |   29 -
 src/transport/test_quota_compliance_udp_peer2.conf |   30 -
 ...est_quota_compliance_unix_asymmetric_peer1.conf |   28 -
 ...est_quota_compliance_unix_asymmetric_peer2.conf |   28 -
 .../test_quota_compliance_unix_peer1.conf          |   27 -
 .../test_quota_compliance_unix_peer2.conf          |   31 -
 ...est_quota_compliance_wlan_asymmetric_peer1.conf |   29 -
 ...est_quota_compliance_wlan_asymmetric_peer2.conf |   29 -
 .../test_quota_compliance_wlan_peer1.conf          |   29 -
 .../test_quota_compliance_wlan_peer2.conf          |   29 -
 ...nsport_defaults.conf => test_tng_defaults.conf} |    6 -
 .../test_transport_address_switch_http_peer1.conf  |   26 -
 .../test_transport_address_switch_http_peer2.conf  |   26 -
 .../test_transport_address_switch_https_peer1.conf |   44 -
 .../test_transport_address_switch_https_peer2.conf |   44 -
 ...ode1.conf => test_transport_api2_tng_node.conf} |   13 +-
 src/transport/test_transport_api_blacklisting.c    |  206 -
 .../test_transport_api_blacklisting_tcp_peer1.conf |    9 -
 .../test_transport_api_blacklisting_tcp_peer2.conf |    9 -
 .../test_transport_api_bluetooth_peer1.conf        |   10 -
 .../test_transport_api_bluetooth_peer2.conf        |   10 -
 src/transport/test_transport_api_disconnect.c      |  134 -
 .../test_transport_api_disconnect_tcp_peer1.conf   |    7 -
 .../test_transport_api_disconnect_tcp_peer2.conf   |    8 -
 src/transport/test_transport_api_http_peer1.conf   |    6 -
 src/transport/test_transport_api_http_peer2.conf   |    6 -
 .../test_transport_api_http_reverse_peer1.conf     |   11 -
 .../test_transport_api_http_reverse_peer2.conf     |   12 -
 src/transport/test_transport_api_https_peer1.conf  |   26 -
 src/transport/test_transport_api_https_peer2.conf  |   32 -
 src/transport/test_transport_api_limited_sockets.c |  132 -
 ...st_transport_api_limited_sockets_tcp_peer1.conf |    7 -
 ...st_transport_api_limited_sockets_tcp_peer2.conf |    8 -
 .../test_transport_api_manipulation_cfg.c          |  186 -
 .../test_transport_api_manipulation_cfg_peer1.conf |    8 -
 .../test_transport_api_manipulation_cfg_peer2.conf |    8 -
 .../test_transport_api_manipulation_recv_tcp.c     |  203 -
 ..._transport_api_manipulation_recv_tcp_peer1.conf |   29 -
 ..._transport_api_manipulation_recv_tcp_peer2.conf |   29 -
 .../test_transport_api_manipulation_send_tcp.c     |  199 -
 ..._transport_api_manipulation_send_tcp_peer1.conf |   29 -
 ..._transport_api_manipulation_send_tcp_peer2.conf |   29 -
 src/transport/test_transport_api_reliability.c     |  321 --
 ..._transport_api_reliability_bluetooth_peer1.conf |   33 -
 ..._transport_api_reliability_bluetooth_peer2.conf |   32 -
 .../test_transport_api_reliability_http_peer1.conf |   33 -
 .../test_transport_api_reliability_http_peer2.conf |   30 -
 ...t_transport_api_reliability_http_xhr_peer1.conf |   34 -
 ...t_transport_api_reliability_http_xhr_peer2.conf |   30 -
 ...test_transport_api_reliability_https_peer1.conf |   27 -
 ...test_transport_api_reliability_https_peer2.conf |   31 -
 ..._transport_api_reliability_https_xhr_peer1.conf |   28 -
 ..._transport_api_reliability_https_xhr_peer2.conf |   31 -
 ...st_transport_api_reliability_tcp_nat_peer1.conf |   35 -
 ...st_transport_api_reliability_tcp_nat_peer2.conf |   34 -
 .../test_transport_api_reliability_tcp_peer2.conf  |   28 -
 .../test_transport_api_reliability_udp_peer1.conf  |   29 -
 .../test_transport_api_reliability_udp_peer2.conf  |   29 -
 .../test_transport_api_reliability_unix_peer1.conf |   28 -
 .../test_transport_api_reliability_unix_peer2.conf |   28 -
 .../test_transport_api_reliability_wlan_peer1.conf |   31 -
 .../test_transport_api_reliability_wlan_peer2.conf |   32 -
 .../test_transport_api_restart_1peer_peer1.conf    |    9 -
 .../test_transport_api_restart_1peer_peer2.conf    |    9 -
 .../test_transport_api_restart_2peers_peer1.conf   |    9 -
 .../test_transport_api_restart_2peers_peer2.conf   |    9 -
 .../test_transport_api_restart_reconnect.c         |  217 --
 .../test_transport_api_slow_ats_peer1.conf         |    7 -
 .../test_transport_api_slow_ats_peer2.conf         |    9 -
 src/transport/test_transport_api_timeout.c         |  164 -
 ...test_transport_api_timeout_bluetooth_peer1.conf |   35 -
 ...test_transport_api_timeout_bluetooth_peer2.conf |   34 -
 .../test_transport_api_timeout_http_peer1.conf     |   28 -
 .../test_transport_api_timeout_http_peer2.conf     |   31 -
 .../test_transport_api_timeout_https_peer1.conf    |   25 -
 .../test_transport_api_timeout_https_peer2.conf    |   31 -
 .../test_transport_api_timeout_tcp_peer1.conf      |   30 -
 .../test_transport_api_timeout_tcp_peer2.conf      |   32 -
 .../test_transport_api_timeout_udp_peer1.conf      |   33 -
 .../test_transport_api_timeout_udp_peer2.conf      |   31 -
 .../test_transport_api_timeout_unix_peer1.conf     |   28 -
 .../test_transport_api_timeout_unix_peer2.conf     |   28 -
 .../test_transport_api_timeout_wlan_peer1.conf     |   35 -
 .../test_transport_api_timeout_wlan_peer2.conf     |   34 -
 .../test_transport_api_unix_abstract_peer1.conf    |   31 -
 .../test_transport_api_unix_abstract_peer2.conf    |   31 -
 ...ransport_api_unreliability_bluetooth_peer1.conf |   30 -
 ...ransport_api_unreliability_bluetooth_peer2.conf |   29 -
 ...sport_api_unreliability_constant_udp_peer1.conf |   30 -
 ...sport_api_unreliability_constant_udp_peer2.conf |   30 -
 ...est_transport_api_unreliability_wlan_peer1.conf |   29 -
 ...est_transport_api_unreliability_wlan_peer2.conf |   29 -
 src/transport/test_transport_api_wlan_peer1.conf   |   35 -
 src/transport/test_transport_api_wlan_peer2.conf   |   34 -
 src/transport/test_transport_blacklisting.c        |  582 ---
 ..._transport_blacklisting_cfg_blp_peer1_full.conf |   16 -
 ...lacklisting_cfg_blp_peer1_multiple_plugins.conf |   13 -
 ...ransport_blacklisting_cfg_blp_peer1_plugin.conf |   13 -
 ..._transport_blacklisting_cfg_blp_peer2_full.conf |   12 -
 ...lacklisting_cfg_blp_peer2_multiple_plugins.conf |   12 -
 ...ransport_blacklisting_cfg_blp_peer2_plugin.conf |   12 -
 .../test_transport_blacklisting_cfg_peer1.conf     |   29 -
 .../test_transport_blacklisting_cfg_peer2.conf     |   28 -
 src/transport/test_transport_just_run_topo.conf    |    6 +
 ...upnp.c => test_transport_plugin_cmd_just_run.c} |  215 +-
 src/transport/test_transport_plugin_cmd_nat_upnp.c |   24 +-
 .../test_transport_plugin_cmd_simple_send.c        |    7 +-
 ...st_transport_plugin_cmd_simple_send_broadcast.c |    4 +-
 .../test_transport_plugin_cmd_simple_send_dv.c     |   11 +-
 ..._transport_plugin_cmd_simple_send_performance.c |   26 +-
 .../test_transport_plugin_cmd_udp_backchannel.c    |    5 +-
 ...le_send.sh => test_transport_start_testcase.sh} |    3 +-
 src/transport/test_transport_start_with_config.c   |    1 -
 src/transport/test_transport_testing_restart.c     |  163 -
 src/transport/transport-testing-cmds.h             |  173 +-
 src/transport/transport-testing-communicator.c     |    5 +-
 src/transport/transport-testing-communicator.h     |    2 +-
 src/transport/transport-testing-filenames.c        |  175 -
 src/transport/transport-testing-loggers.c          |   81 -
 src/transport/transport-testing-main.c             |  614 ---
 src/transport/transport-testing-send.c             |  241 --
 src/transport/transport-testing.c                  |  932 -----
 src/transport/transport-testing.h                  |  914 -----
 src/transport/transport-testing2.c                 |   50 +-
 src/transport/transport-testing2.h                 |   12 +-
 src/transport/transport.conf.in                    |    4 +-
 src/transport/transport.h                          |  423 ---
 src/transport/transport_api2_communication.c       |    1 -
 src/transport/transport_api2_core.c                |    8 +-
 src/transport/transport_api_address_to_string.c    |  264 --
 src/transport/transport_api_blacklist.c            |  197 -
 .../transport_api_cmd_backchannel_check.c          |    1 -
 src/transport/transport_api_cmd_connecting_peers.c |   49 +-
 src/transport/transport_api_cmd_start_peer.c       |   20 +-
 src/transport/transport_api_cmd_stop_peer.c        |    2 +-
 src/transport/transport_api_core.c                 |  968 -----
 src/transport/transport_api_hello_get.c            |  274 --
 src/transport/transport_api_manipulation.c         |  249 --
 src/transport/transport_api_monitor_peers.c        |  443 ---
 src/transport/transport_api_monitor_plugins.c      |  463 ---
 src/transport/transport_api_offer_hello.c          |  137 -
 src/util/bio.c                                     |    1 -
 src/util/configuration.c                           |    1 -
 src/util/container_heap.c                          |    1 -
 src/util/container_multihashmap.c                  |    1 -
 src/util/container_multihashmap32.c                |    1 -
 src/util/container_multishortmap.c                 |    1 -
 src/util/container_multiuuidmap.c                  |    1 -
 406 files changed, 3348 insertions(+), 89188 deletions(-)
 create mode 100755 contrib/testing-ng/block.sh
 delete mode 100644 src/ats-tool/.gitignore
 delete mode 100644 src/ats-tool/Makefile.am
 delete mode 100644 src/ats-tool/gnunet-ats.c
 delete mode 100644 src/ats-tool/meson.build
 delete mode 100644 src/ats/.gitignore
 delete mode 100644 src/ats/Makefile.am
 delete mode 100644 src/ats/ats.conf.in
 delete mode 100644 src/ats/ats.h
 delete mode 100644 src/ats/ats_api_connectivity.c
 delete mode 100644 src/ats/ats_api_performance.c
 delete mode 100644 src/ats/ats_api_scanner.c
 delete mode 100644 src/ats/ats_api_scheduling.c
 delete mode 100644 src/ats/experiments/example.exp
 delete mode 100644 src/ats/experiments/gnunet_ats_sim_default.conf
 delete mode 100644 src/ats/experiments/set_preference.exp
 delete mode 100644 src/ats/gnunet-ats-solver-eval.c
 delete mode 100644 src/ats/gnunet-ats-solver-eval.h
 delete mode 100644 src/ats/gnunet-service-ats.c
 delete mode 100644 src/ats/gnunet-service-ats.h
 delete mode 100644 src/ats/gnunet-service-ats_addresses.c
 delete mode 100644 src/ats/gnunet-service-ats_addresses.h
 delete mode 100644 src/ats/gnunet-service-ats_connectivity.c
 delete mode 100644 src/ats/gnunet-service-ats_connectivity.h
 delete mode 100644 src/ats/gnunet-service-ats_normalization.c
 delete mode 100644 src/ats/gnunet-service-ats_normalization.h
 delete mode 100644 src/ats/gnunet-service-ats_performance.c
 delete mode 100644 src/ats/gnunet-service-ats_performance.h
 delete mode 100644 src/ats/gnunet-service-ats_plugins.c
 delete mode 100644 src/ats/gnunet-service-ats_plugins.h
 delete mode 100644 src/ats/gnunet-service-ats_preferences.c
 delete mode 100644 src/ats/gnunet-service-ats_preferences.h
 delete mode 100644 src/ats/gnunet-service-ats_reservations.c
 delete mode 100644 src/ats/gnunet-service-ats_reservations.h
 delete mode 100644 src/ats/gnunet-service-ats_scheduling.c
 delete mode 100644 src/ats/gnunet-service-ats_scheduling.h
 delete mode 100644 src/ats/meson.build
 delete mode 100644 src/ats/perf_ats_simplistic_bandwidth.conf
 delete mode 100644 src/ats/perf_ats_simplistic_delay.conf
 delete mode 100644 src/ats/perf_ats_solver.c
 delete mode 100644 src/ats/perf_ats_solver.conf
 delete mode 100644 src/ats/perf_ats_solver_proportional.conf
 delete mode 100644 src/ats/plugin_ats_proportional.c
 delete mode 100644 src/ats/test_ats_api.c
 delete mode 100644 src/ats/test_ats_api.conf
 delete mode 100644 src/ats/test_ats_api_delayed.conf
 delete mode 100644 src/ats/test_ats_api_proportional.conf
 delete mode 100644 src/ats/test_ats_lib.c
 delete mode 100644 src/ats/test_ats_lib.h
 delete mode 100644 src/ats/test_ats_reservation_api.c
 delete mode 100644 src/ats/test_ats_solver_default.conf
 delete mode 100644 src/ats/test_ats_solver_delayed_proportional.conf
 delete mode 100644 src/ats/test_ats_solver_proportional.conf
 delete mode 100755 src/ats/test_delay
 copy src/{transport/transport_api_cmd_connecting_peers.c => 
core/core_api_cmd_connecting_peers.c} (70%)
 copy src/{transport/test_transport_plugin_cmd_nat_upnp.c => 
core/test_core_plugin_cmd_just_run.c} (68%)
 copy src/{transport/test_transport_simple_send.sh => 
core/test_core_start_testcase.sh} (71%)
 delete mode 100644 src/include/gnunet_ats_application_service.h
 delete mode 100644 src/include/gnunet_ats_plugin.h
 delete mode 100644 src/include/gnunet_ats_service.h
 delete mode 100644 src/include/gnunet_ats_transport_service.h
 delete mode 100644 src/include/gnunet_transport_manipulation_service.h
 delete mode 100644 src/include/gnunet_transport_plugin.h
 delete mode 100644 src/include/gnunet_transport_service.h
 create mode 100644 src/include/gnunet_transport_testing_ng_lib.h
 delete mode 100644 src/peerinfo-tool/.gitignore
 delete mode 100644 src/peerinfo-tool/Makefile.am
 delete mode 100644 src/peerinfo-tool/gnunet-peerinfo.c
 delete mode 100644 src/peerinfo-tool/gnunet-peerinfo_plugins.c
 delete mode 100644 src/peerinfo-tool/gnunet-peerinfo_plugins.h
 delete mode 100644 src/peerinfo-tool/meson.build
 delete mode 100644 src/peerinfo-tool/plugin_rest_peerinfo.c
 delete mode 100755 src/peerinfo-tool/test_gnunet_peerinfo.py.in
 delete mode 100644 src/peerinfo-tool/test_gnunet_peerinfo_data.conf
 delete mode 100644 src/peerinfo/.gitignore
 delete mode 100644 src/peerinfo/Makefile.am
 delete mode 100644 src/peerinfo/gnunet-service-peerinfo.c
 delete mode 100644 src/peerinfo/meson.build
 delete mode 100644 src/peerinfo/peerinfo.conf.in
 delete mode 100644 src/peerinfo/peerinfo.h
 delete mode 100644 src/peerinfo/peerinfo_api.c
 delete mode 100644 src/peerinfo/peerinfo_api_notify.c
 delete mode 100644 src/peerinfo/perf_peerinfo_api.c
 delete mode 100644 src/peerinfo/test_peerinfo_api.c
 delete mode 100644 src/peerinfo/test_peerinfo_api_data.conf
 delete mode 100644 src/peerinfo/test_peerinfo_api_friend_only.c
 delete mode 100644 src/peerinfo/test_peerinfo_api_notify_friend_only.c
 delete mode 100644 src/peerinfo/test_peerinfo_shipped_hellos.c
 copy src/{transport/test_transport_start_with_config.c => 
testing/test_testing_start_with_config.c} (89%)
 copy src/testing/{testing_api_cmd_netjail_start.c => 
testing_api_cmd_exec_bash_script.c} (50%)
 copy src/{transport/transport_api_cmd_start_peer.c => 
testing/testing_api_cmd_start_peer.c} (59%)
 copy src/{transport/transport_api_cmd_stop_peer.c => 
testing/testing_api_cmd_stop_peer.c} (79%)
 delete mode 100644 src/transport/communicator-unix.conf
 delete mode 100644 src/transport/gnunet-helper-transport-bluetooth.c
 delete mode 100644 src/transport/gnunet-helper-transport-wlan-dummy.c
 delete mode 100644 src/transport/gnunet-helper-transport-wlan.c
 delete mode 100644 src/transport/gnunet-service-transport.c
 delete mode 100644 src/transport/gnunet-service-transport_ats.c
 delete mode 100644 src/transport/gnunet-service-transport_ats.h
 delete mode 100644 src/transport/gnunet-service-transport_hello.c
 delete mode 100644 src/transport/gnunet-service-transport_hello.h
 delete mode 100644 src/transport/gnunet-service-transport_manipulation.c
 delete mode 100644 src/transport/gnunet-service-transport_manipulation.h
 delete mode 100644 src/transport/gnunet-service-transport_neighbours.c
 delete mode 100644 src/transport/gnunet-service-transport_neighbours.h
 delete mode 100644 src/transport/gnunet-service-transport_plugins.c
 delete mode 100644 src/transport/gnunet-service-transport_plugins.h
 delete mode 100644 src/transport/gnunet-service-transport_validation.c
 delete mode 100644 src/transport/gnunet-service-transport_validation.h
 delete mode 100644 src/transport/gnunet-transport-wlan-receiver.c
 delete mode 100644 src/transport/gnunet-transport-wlan-sender.c
 delete mode 100644 src/transport/perf_http_peer1.conf
 delete mode 100644 src/transport/perf_http_peer2.conf
 delete mode 100644 src/transport/perf_https_peer1.conf
 delete mode 100644 src/transport/perf_https_peer2.conf
 delete mode 100644 src/transport/perf_tcp_peer1.conf
 delete mode 100644 src/transport/perf_tcp_peer2.conf
 delete mode 100644 src/transport/perf_udp_peer1.conf
 delete mode 100644 src/transport/perf_udp_peer2.conf
 delete mode 100644 src/transport/perf_unix_peer1.conf
 delete mode 100644 src/transport/perf_unix_peer2.conf
 delete mode 100644 src/transport/plugin_transport_http.h
 delete mode 100644 src/transport/plugin_transport_http_client.c
 delete mode 100644 src/transport/plugin_transport_http_common.c
 delete mode 100644 src/transport/plugin_transport_http_common.h
 delete mode 100644 src/transport/plugin_transport_http_server.c
 delete mode 100644 src/transport/plugin_transport_smtp.c
 delete mode 100644 src/transport/plugin_transport_tcp.c
 delete mode 100644 src/transport/plugin_transport_template.c
 delete mode 100644 src/transport/plugin_transport_udp.c
 delete mode 100644 src/transport/plugin_transport_udp.h
 delete mode 100644 src/transport/plugin_transport_udp_broadcasting.c
 delete mode 100644 src/transport/plugin_transport_unix.c
 delete mode 100644 src/transport/plugin_transport_wlan.c
 delete mode 100644 src/transport/plugin_transport_wlan.h
 delete mode 100644 src/transport/tcp_connection_legacy.c
 delete mode 100644 src/transport/tcp_server_legacy.c
 delete mode 100644 src/transport/tcp_server_mst_legacy.c
 delete mode 100644 src/transport/tcp_service_legacy.c
 rename src/transport/{test_transport_api_reliability_tcp_peer1.conf => 
template_tng_cfg_peer1.conf} (64%)
 delete mode 100644 src/transport/test_http_common.c
 delete mode 100644 src/transport/test_plugin_transport.c
 delete mode 100644 src/transport/test_plugin_transport_data.conf
 delete mode 100644 src/transport/test_plugin_transport_data_udp.conf
 delete mode 100644 src/transport/test_quota_compliance.c
 delete mode 100644 
src/transport/test_quota_compliance_bluetooth_asymmetric_peer1.conf
 delete mode 100644 
src/transport/test_quota_compliance_bluetooth_asymmetric_peer2.conf
 delete mode 100644 src/transport/test_quota_compliance_bluetooth_peer1.conf
 delete mode 100644 src/transport/test_quota_compliance_bluetooth_peer2.conf
 delete mode 100644 src/transport/test_quota_compliance_data.conf
 delete mode 100644 
src/transport/test_quota_compliance_http_asymmetric_peer1.conf
 delete mode 100644 
src/transport/test_quota_compliance_http_asymmetric_peer2.conf
 delete mode 100644 src/transport/test_quota_compliance_http_peer1.conf
 delete mode 100644 src/transport/test_quota_compliance_http_peer2.conf
 delete mode 100644 
src/transport/test_quota_compliance_https_asymmetric_peer1.conf
 delete mode 100644 
src/transport/test_quota_compliance_https_asymmetric_peer2.conf
 delete mode 100644 src/transport/test_quota_compliance_https_peer1.conf
 delete mode 100644 src/transport/test_quota_compliance_https_peer2.conf
 delete mode 100644 
src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf
 delete mode 100644 
src/transport/test_quota_compliance_tcp_asymmetric_peer2.conf
 delete mode 100644 src/transport/test_quota_compliance_tcp_peer1.conf
 delete mode 100644 src/transport/test_quota_compliance_tcp_peer2.conf
 delete mode 100644 src/transport/test_quota_compliance_udp_peer1.conf
 delete mode 100644 src/transport/test_quota_compliance_udp_peer2.conf
 delete mode 100644 
src/transport/test_quota_compliance_unix_asymmetric_peer1.conf
 delete mode 100644 
src/transport/test_quota_compliance_unix_asymmetric_peer2.conf
 delete mode 100644 src/transport/test_quota_compliance_unix_peer1.conf
 delete mode 100644 src/transport/test_quota_compliance_unix_peer2.conf
 delete mode 100644 
src/transport/test_quota_compliance_wlan_asymmetric_peer1.conf
 delete mode 100644 
src/transport/test_quota_compliance_wlan_asymmetric_peer2.conf
 delete mode 100644 src/transport/test_quota_compliance_wlan_peer1.conf
 delete mode 100644 src/transport/test_quota_compliance_wlan_peer2.conf
 copy src/transport/{test_transport_defaults.conf => test_tng_defaults.conf} 
(78%)
 delete mode 100644 src/transport/test_transport_address_switch_http_peer1.conf
 delete mode 100644 src/transport/test_transport_address_switch_http_peer2.conf
 delete mode 100644 src/transport/test_transport_address_switch_https_peer1.conf
 delete mode 100644 src/transport/test_transport_address_switch_https_peer2.conf
 copy src/transport/{test_transport_api2_tcp_node1.conf => 
test_transport_api2_tng_node.conf} (88%)
 delete mode 100644 src/transport/test_transport_api_blacklisting.c
 delete mode 100644 src/transport/test_transport_api_blacklisting_tcp_peer1.conf
 delete mode 100644 src/transport/test_transport_api_blacklisting_tcp_peer2.conf
 delete mode 100644 src/transport/test_transport_api_bluetooth_peer1.conf
 delete mode 100644 src/transport/test_transport_api_bluetooth_peer2.conf
 delete mode 100644 src/transport/test_transport_api_disconnect.c
 delete mode 100644 src/transport/test_transport_api_disconnect_tcp_peer1.conf
 delete mode 100644 src/transport/test_transport_api_disconnect_tcp_peer2.conf
 delete mode 100644 src/transport/test_transport_api_http_peer1.conf
 delete mode 100644 src/transport/test_transport_api_http_peer2.conf
 delete mode 100644 src/transport/test_transport_api_http_reverse_peer1.conf
 delete mode 100644 src/transport/test_transport_api_http_reverse_peer2.conf
 delete mode 100644 src/transport/test_transport_api_https_peer1.conf
 delete mode 100644 src/transport/test_transport_api_https_peer2.conf
 delete mode 100644 src/transport/test_transport_api_limited_sockets.c
 delete mode 100644 
src/transport/test_transport_api_limited_sockets_tcp_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_limited_sockets_tcp_peer2.conf
 delete mode 100644 src/transport/test_transport_api_manipulation_cfg.c
 delete mode 100644 src/transport/test_transport_api_manipulation_cfg_peer1.conf
 delete mode 100644 src/transport/test_transport_api_manipulation_cfg_peer2.conf
 delete mode 100644 src/transport/test_transport_api_manipulation_recv_tcp.c
 delete mode 100644 
src/transport/test_transport_api_manipulation_recv_tcp_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_manipulation_recv_tcp_peer2.conf
 delete mode 100644 src/transport/test_transport_api_manipulation_send_tcp.c
 delete mode 100644 
src/transport/test_transport_api_manipulation_send_tcp_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_manipulation_send_tcp_peer2.conf
 delete mode 100644 src/transport/test_transport_api_reliability.c
 delete mode 100644 
src/transport/test_transport_api_reliability_bluetooth_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_reliability_bluetooth_peer2.conf
 delete mode 100644 src/transport/test_transport_api_reliability_http_peer1.conf
 delete mode 100644 src/transport/test_transport_api_reliability_http_peer2.conf
 delete mode 100644 
src/transport/test_transport_api_reliability_http_xhr_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_reliability_http_xhr_peer2.conf
 delete mode 100644 
src/transport/test_transport_api_reliability_https_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_reliability_https_peer2.conf
 delete mode 100644 
src/transport/test_transport_api_reliability_https_xhr_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_reliability_https_xhr_peer2.conf
 delete mode 100644 
src/transport/test_transport_api_reliability_tcp_nat_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_reliability_tcp_nat_peer2.conf
 delete mode 100644 src/transport/test_transport_api_reliability_tcp_peer2.conf
 delete mode 100644 src/transport/test_transport_api_reliability_udp_peer1.conf
 delete mode 100644 src/transport/test_transport_api_reliability_udp_peer2.conf
 delete mode 100644 src/transport/test_transport_api_reliability_unix_peer1.conf
 delete mode 100644 src/transport/test_transport_api_reliability_unix_peer2.conf
 delete mode 100644 src/transport/test_transport_api_reliability_wlan_peer1.conf
 delete mode 100644 src/transport/test_transport_api_reliability_wlan_peer2.conf
 delete mode 100644 src/transport/test_transport_api_restart_1peer_peer1.conf
 delete mode 100644 src/transport/test_transport_api_restart_1peer_peer2.conf
 delete mode 100644 src/transport/test_transport_api_restart_2peers_peer1.conf
 delete mode 100644 src/transport/test_transport_api_restart_2peers_peer2.conf
 delete mode 100644 src/transport/test_transport_api_restart_reconnect.c
 delete mode 100644 src/transport/test_transport_api_slow_ats_peer1.conf
 delete mode 100644 src/transport/test_transport_api_slow_ats_peer2.conf
 delete mode 100644 src/transport/test_transport_api_timeout.c
 delete mode 100644 
src/transport/test_transport_api_timeout_bluetooth_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_timeout_bluetooth_peer2.conf
 delete mode 100644 src/transport/test_transport_api_timeout_http_peer1.conf
 delete mode 100644 src/transport/test_transport_api_timeout_http_peer2.conf
 delete mode 100644 src/transport/test_transport_api_timeout_https_peer1.conf
 delete mode 100644 src/transport/test_transport_api_timeout_https_peer2.conf
 delete mode 100644 src/transport/test_transport_api_timeout_tcp_peer1.conf
 delete mode 100644 src/transport/test_transport_api_timeout_tcp_peer2.conf
 delete mode 100644 src/transport/test_transport_api_timeout_udp_peer1.conf
 delete mode 100644 src/transport/test_transport_api_timeout_udp_peer2.conf
 delete mode 100644 src/transport/test_transport_api_timeout_unix_peer1.conf
 delete mode 100644 src/transport/test_transport_api_timeout_unix_peer2.conf
 delete mode 100644 src/transport/test_transport_api_timeout_wlan_peer1.conf
 delete mode 100644 src/transport/test_transport_api_timeout_wlan_peer2.conf
 delete mode 100644 src/transport/test_transport_api_unix_abstract_peer1.conf
 delete mode 100644 src/transport/test_transport_api_unix_abstract_peer2.conf
 delete mode 100644 
src/transport/test_transport_api_unreliability_bluetooth_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_unreliability_bluetooth_peer2.conf
 delete mode 100644 
src/transport/test_transport_api_unreliability_constant_udp_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_unreliability_constant_udp_peer2.conf
 delete mode 100644 
src/transport/test_transport_api_unreliability_wlan_peer1.conf
 delete mode 100644 
src/transport/test_transport_api_unreliability_wlan_peer2.conf
 delete mode 100644 src/transport/test_transport_api_wlan_peer1.conf
 delete mode 100644 src/transport/test_transport_api_wlan_peer2.conf
 delete mode 100644 src/transport/test_transport_blacklisting.c
 delete mode 100644 
src/transport/test_transport_blacklisting_cfg_blp_peer1_full.conf
 delete mode 100644 
src/transport/test_transport_blacklisting_cfg_blp_peer1_multiple_plugins.conf
 delete mode 100644 
src/transport/test_transport_blacklisting_cfg_blp_peer1_plugin.conf
 delete mode 100644 
src/transport/test_transport_blacklisting_cfg_blp_peer2_full.conf
 delete mode 100644 
src/transport/test_transport_blacklisting_cfg_blp_peer2_multiple_plugins.conf
 delete mode 100644 
src/transport/test_transport_blacklisting_cfg_blp_peer2_plugin.conf
 delete mode 100644 src/transport/test_transport_blacklisting_cfg_peer1.conf
 delete mode 100644 src/transport/test_transport_blacklisting_cfg_peer2.conf
 create mode 100644 src/transport/test_transport_just_run_topo.conf
 copy src/transport/{test_transport_plugin_cmd_nat_upnp.c => 
test_transport_plugin_cmd_just_run.c} (72%)
 copy src/transport/{test_transport_simple_send.sh => 
test_transport_start_testcase.sh} (82%)
 delete mode 100644 src/transport/test_transport_testing_restart.c
 delete mode 100644 src/transport/transport-testing-filenames.c
 delete mode 100644 src/transport/transport-testing-loggers.c
 delete mode 100644 src/transport/transport-testing-main.c
 delete mode 100644 src/transport/transport-testing-send.c
 delete mode 100644 src/transport/transport-testing.c
 delete mode 100644 src/transport/transport-testing.h
 delete mode 100644 src/transport/transport_api_address_to_string.c
 delete mode 100644 src/transport/transport_api_blacklist.c
 delete mode 100644 src/transport/transport_api_core.c
 delete mode 100644 src/transport/transport_api_hello_get.c
 delete mode 100644 src/transport/transport_api_manipulation.c
 delete mode 100644 src/transport/transport_api_monitor_peers.c
 delete mode 100644 src/transport/transport_api_monitor_plugins.c
 delete mode 100644 src/transport/transport_api_offer_hello.c

diff --git a/configure.ac b/configure.ac
index 27fd913eb..04a366f31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1228,9 +1228,6 @@ po/Makefile.in
 src/Makefile
 src/arm/Makefile
 src/arm/arm.conf
-src/ats/Makefile
-src/ats/ats.conf
-src/ats-tool/Makefile
 src/auction/Makefile
 src/block/Makefile
 src/cadet/Makefile
@@ -1277,9 +1274,6 @@ src/nat-auto/nat-auto.conf
 src/nse/Makefile
 src/nse/nse.conf
 src/nt/Makefile
-src/peerinfo/Makefile
-src/peerinfo/peerinfo.conf
-src/peerinfo-tool/Makefile
 src/peerstore/Makefile
 src/peerstore/peerstore.conf
 src/pq/Makefile
@@ -1326,7 +1320,6 @@ src/messenger/Makefile
 src/messenger/messenger.conf
 pkgconfig/Makefile
 pkgconfig/gnunetarm.pc
-pkgconfig/gnunetats.pc
 pkgconfig/gnunetblock.pc
 pkgconfig/gnunetcadet.pc
 pkgconfig/gnunetconsensus.pc
@@ -1348,7 +1341,6 @@ pkgconfig/gnunetmicrophone.pc
 pkgconfig/gnunetnamestore.pc
 pkgconfig/gnunetnat.pc
 pkgconfig/gnunetnse.pc
-pkgconfig/gnunetpeerinfo.pc
 pkgconfig/gnunetpq.pc
 pkgconfig/gnunetregex.pc
 pkgconfig/gnunetrevocation.pc
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 4cbb38cb0..13fdcdd60 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -27,7 +27,8 @@ dist_pkgdata_DATA = \
   netjail/netjail_exec.sh \
   netjail/netjail_start.sh \
   netjail/netjail_stop.sh \
-  netjail/topo.sh
+  netjail/topo.sh \
+  testing-ng/block.sh
 
 INITD_FILES = \
   services/systemd/gnunet-user.service \
@@ -270,5 +271,6 @@ install-data-hook:
        chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_stop.sh'
        chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_exec.sh'
        chmod o+x '$(DESTDIR)$(pkgdatadir)/topo.sh'
+       chmod o+x '$(DESTDIR)$(pkgdatadir)/block.sh'
 
 ## EOF
diff --git a/contrib/testing-ng/block.sh b/contrib/testing-ng/block.sh
new file mode 100755
index 000000000..6edf18ede
--- /dev/null
+++ b/contrib/testing-ng/block.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+echo started > block.log
+while true
+do
+    if [ -f stop ]
+    then
+        break
+    fi
+    sleep 1
+done
+echo stopped >> block.log
diff --git a/pkgconfig/Makefile.am b/pkgconfig/Makefile.am
index eeb048fb8..1759ae5fc 100644
--- a/pkgconfig/Makefile.am
+++ b/pkgconfig/Makefile.am
@@ -1,7 +1,6 @@
 # This Makefile.am is in the public domain
 pcfiles = \
        gnunetarm.pc \
-       gnunetats.pc \
        gnunetblock.pc \
        gnunetconsensus.pc \
        gnunetconversation.pc \
@@ -23,7 +22,6 @@ pcfiles = \
        gnunetnamestore.pc \
        gnunetnat.pc \
        gnunetnse.pc \
-       gnunetpeerinfo.pc \
        gnunetregex.pc \
        gnunetrevocation.pc \
        gnunetrps.pc \
@@ -44,7 +42,6 @@ pkgconfig_DATA = $(pcfiles)
 
 EXTRA_DIST = \
        gnunetarm.pc.in \
-       gnunetats.pc.in \
        gnunetblock.pc.in \
        gnunetconsensus.pc.in \
        gnunetconversation.pc.in \
@@ -66,7 +63,6 @@ EXTRA_DIST = \
        gnunetnamestore.pc.in \
        gnunetnat.pc.in \
        gnunetnse.pc.in \
-       gnunetpeerinfo.pc.in \
        gnunetpostgres.pc.in \
        gnunetregex.pc.in \
        gnunetrevocation.pc.in \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 3d6c2f6d1..e275d112c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -9,22 +9,6 @@ src/arm/arm_monitor_api.c
 src/arm/gnunet-arm.c
 src/arm/gnunet-service-arm.c
 src/arm/mockup-service.c
-src/ats-tool/gnunet-ats.c
-src/ats/ats_api_connectivity.c
-src/ats/ats_api_performance.c
-src/ats/ats_api_scanner.c
-src/ats/ats_api_scheduling.c
-src/ats/gnunet-ats-solver-eval.c
-src/ats/gnunet-service-ats.c
-src/ats/gnunet-service-ats_addresses.c
-src/ats/gnunet-service-ats_connectivity.c
-src/ats/gnunet-service-ats_normalization.c
-src/ats/gnunet-service-ats_performance.c
-src/ats/gnunet-service-ats_plugins.c
-src/ats/gnunet-service-ats_preferences.c
-src/ats/gnunet-service-ats_reservations.c
-src/ats/gnunet-service-ats_scheduling.c
-src/ats/plugin_ats_proportional.c
 src/auction/gnunet-auction-create.c
 src/auction/gnunet-auction-info.c
 src/auction/gnunet-auction-join.c
@@ -72,6 +56,7 @@ src/conversation/microphone.c
 src/conversation/plugin_gnsrecord_conversation.c
 src/conversation/speaker.c
 src/core/core_api.c
+src/core/core_api_cmd_connecting_peers.c
 src/core/core_api_monitor_peers.c
 src/core/gnunet-core.c
 src/core/gnunet-service-core.c
@@ -272,12 +257,6 @@ src/nse/gnunet-nse.c
 src/nse/gnunet-service-nse.c
 src/nse/nse_api.c
 src/nt/nt.c
-src/peerinfo-tool/gnunet-peerinfo.c
-src/peerinfo-tool/gnunet-peerinfo_plugins.c
-src/peerinfo-tool/plugin_rest_peerinfo.c
-src/peerinfo/gnunet-service-peerinfo.c
-src/peerinfo/peerinfo_api.c
-src/peerinfo/peerinfo_api_notify.c
 src/peerstore/gnunet-peerstore.c
 src/peerstore/gnunet-service-peerstore.c
 src/peerstore/peerstore_api.c
@@ -428,6 +407,7 @@ src/testing/testing_api_cmd_barrier.c
 src/testing/testing_api_cmd_barrier_reached.c
 src/testing/testing_api_cmd_batch.c
 src/testing/testing_api_cmd_block_until_external_trigger.c
+src/testing/testing_api_cmd_exec_bash_script.c
 src/testing/testing_api_cmd_finish.c
 src/testing/testing_api_cmd_local_test_prepared.c
 src/testing/testing_api_cmd_netjail_start.c
@@ -435,6 +415,8 @@ src/testing/testing_api_cmd_netjail_start_cmds_helper.c
 src/testing/testing_api_cmd_netjail_stop.c
 src/testing/testing_api_cmd_netjail_stop_cmds_helper.c
 src/testing/testing_api_cmd_send_peer_ready.c
+src/testing/testing_api_cmd_start_peer.c
+src/testing/testing_api_cmd_stop_peer.c
 src/testing/testing_api_cmd_system_create.c
 src/testing/testing_api_cmd_system_destroy.c
 src/testing/testing_api_loop.c
@@ -445,64 +427,25 @@ src/transport/gnunet-communicator-quic.c
 src/transport/gnunet-communicator-tcp.c
 src/transport/gnunet-communicator-udp.c
 src/transport/gnunet-communicator-unix.c
-src/transport/gnunet-helper-transport-bluetooth.c
-src/transport/gnunet-helper-transport-wlan-dummy.c
-src/transport/gnunet-helper-transport-wlan.c
 src/transport/gnunet-service-tng.c
-src/transport/gnunet-service-transport.c
-src/transport/gnunet-service-transport_ats.c
-src/transport/gnunet-service-transport_hello.c
-src/transport/gnunet-service-transport_manipulation.c
-src/transport/gnunet-service-transport_neighbours.c
-src/transport/gnunet-service-transport_plugins.c
-src/transport/gnunet-service-transport_validation.c
 src/transport/gnunet-transport-profiler.c
-src/transport/gnunet-transport-wlan-receiver.c
-src/transport/gnunet-transport-wlan-sender.c
 src/transport/gnunet-transport.c
-src/transport/plugin_transport_http_client.c
-src/transport/plugin_transport_http_common.c
-src/transport/plugin_transport_http_server.c
-src/transport/plugin_transport_smtp.c
-src/transport/plugin_transport_tcp.c
-src/transport/plugin_transport_template.c
-src/transport/plugin_transport_udp.c
-src/transport/plugin_transport_udp_broadcasting.c
-src/transport/plugin_transport_unix.c
-src/transport/plugin_transport_wlan.c
-src/transport/tcp_connection_legacy.c
-src/transport/tcp_server_legacy.c
-src/transport/tcp_server_mst_legacy.c
-src/transport/tcp_service_legacy.c
 src/transport/transport-testing-communicator.c
-src/transport/transport-testing-filenames.c
 src/transport/transport-testing-filenames2.c
-src/transport/transport-testing-loggers.c
 src/transport/transport-testing-loggers2.c
-src/transport/transport-testing-main.c
 src/transport/transport-testing-main2.c
-src/transport/transport-testing-send.c
 src/transport/transport-testing-send2.c
-src/transport/transport-testing.c
 src/transport/transport-testing2.c
 src/transport/transport_api2_application.c
 src/transport/transport_api2_communication.c
 src/transport/transport_api2_core.c
 src/transport/transport_api2_monitor.c
-src/transport/transport_api_address_to_string.c
-src/transport/transport_api_blacklist.c
 src/transport/transport_api_cmd_backchannel_check.c
 src/transport/transport_api_cmd_connecting_peers.c
 src/transport/transport_api_cmd_send_simple.c
 src/transport/transport_api_cmd_send_simple_performance.c
 src/transport/transport_api_cmd_start_peer.c
 src/transport/transport_api_cmd_stop_peer.c
-src/transport/transport_api_core.c
-src/transport/transport_api_hello_get.c
-src/transport/transport_api_manipulation.c
-src/transport/transport_api_monitor_peers.c
-src/transport/transport_api_monitor_plugins.c
-src/transport/transport_api_offer_hello.c
 src/transport/transport_api_traits.c
 src/util/bandwidth.c
 src/util/benchmark.c
@@ -589,8 +532,13 @@ src/vpn/gnunet-vpn.c
 src/vpn/vpn_api.c
 src/zonemaster/gnunet-service-zonemaster.c
 src/fs/fs_api.h
+src/include/gnunet_ats_application_service.h
+src/include/gnunet_ats_service.h
+src/include/gnunet_ats_transport_service.h
 src/include/gnunet_json_lib.h
 src/include/gnunet_pq_lib.h
+src/include/gnunet_transport_hello_service.h
+src/include/gnunet_transport_service.h
 src/pq/pq.h
 src/testbed/testbed_api.h
 src/testbed/testbed_api_operations.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 8fb984d4b..b0064688a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
 # This Makefile.am is in the public domain
 
 TESTING = testing
-TESTBED = testbed-logger testbed
+#TESTBED = testbed-logger testbed
 
 if HAVE_EXPERIMENTAL
  EXP_DIR = \
@@ -44,21 +44,17 @@ SUBDIRS = \
   $(JSON_DIR) \
   $(CURL_DIR) \
   $(REST_DIR) \
-  peerinfo \
   $(SQLITE_DIR) \
   $(POSTGRES_DIR) \
   datacache \
   datastore \
   template \
   peerstore \
-  ats \
   nat \
   nat-auto \
   fragmentation \
   transport \
-  ats-tool \
   core \
-  $(TESTBED) \
   nse \
   dhtu \
   dht \
@@ -70,7 +66,6 @@ SUBDIRS = \
   gnsrecord \
   namecache \
   namestore \
-  peerinfo-tool \
   cadet \
   set \
   seti \
diff --git a/src/abd/Makefile.am b/src/abd/Makefile.am
index ae9248b43..69809291a 100644
--- a/src/abd/Makefile.am
+++ b/src/abd/Makefile.am
@@ -88,10 +88,10 @@ libgnunetabd_la_LDFLAGS = \
 
 
 check_SCRIPTS = \
-  test_abd_issue.sh \
-       test_abd_verify_simple.sh \
-       test_abd_verify.sh \
-       test_abd_verify_and.sh
+  test_abd_issue.sh 
+  # test_abd_verify_simple.sh \
+  # test_abd_verify.sh \
+  # test_abd_verify_and.sh
 
 if ENABLE_TEST_RUN
 if HAVE_SQLITE
diff --git a/src/abd/abd_api.c b/src/abd/abd_api.c
index 57f831e85..0b3b4f61f 100644
--- a/src/abd/abd_api.c
+++ b/src/abd/abd_api.c
@@ -26,7 +26,6 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_constants.h"
 #include "gnunet_arm_service.h"
-#include "gnunet_hello_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_signatures.h"
 #include "abd.h"
diff --git a/src/ats-tool/.gitignore b/src/ats-tool/.gitignore
deleted file mode 100644
index 2de03f0e8..000000000
--- a/src/ats-tool/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-gnunet-ats
diff --git a/src/ats-tool/Makefile.am b/src/ats-tool/Makefile.am
deleted file mode 100644
index 3bb99aa08..000000000
--- a/src/ats-tool/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-# This Makefile.am is in the public domain
-AM_CPPFLAGS = -I$(top_srcdir)/src/include
-
-if USE_COVERAGE
-  AM_CFLAGS = -fprofile-arcs -ftest-coverage
-endif
-
-bin_PROGRAMS = \
- gnunet-ats
-
-gnunet_ats_SOURCES = \
- gnunet-ats.c
-gnunet_ats_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
-  $(top_builddir)/src/nt/libgnunetnt.la \
-  $(top_builddir)/src/transport/libgnunettransport.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(GN_LIBINTL)
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c
deleted file mode 100644
index 169daa6f1..000000000
--- a/src/ats-tool/gnunet-ats.c
+++ /dev/null
@@ -1,992 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2009--2015 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats-tool/gnunet-ats.c
- * @brief ATS command line tool
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_ats_service.h"
-#include "gnunet_transport_service.h"
-
-/**
- * String to respresent unlimited
- */
-#define UNLIMITED_STRING "unlimited"
-
-
-/**
- * CLI Opt:
- */
-static int opt_resolve_addresses_numeric;
-
-/**
- * CLI Opt: Print verbose ATS information
- */
-static int opt_verbose;
-
-/**
- * CLI Option: List only addresses currently used (active)
- */
-static int opt_list_used;
-
-/**
- * CLI Option: List all addresses
- */
-static int opt_list_all;
-
-/**
- * CLI Option: set preference
- */
-static int opt_set_pref;
-
-/**
- * CLI Option: print quotas configured
- */
-static int opt_print_quotas;
-
-/**
- * CLI Option: Monitor addresses used
- */
-static int opt_monitor;
-
-/**
- * CLI Option: use specific peer
- */
-static char *opt_pid_str;
-
-/**
- * CLI Option: preference type to set
- */
-static char *opt_type_str;
-
-/**
- * CLI Option: preference value to set
- */
-static unsigned int opt_pref_value;
-
-/**
- * Final status code.
- */
-static int ret;
-
-/**
- * Number of results returned from service
- */
-static int stat_results;
-
-/**
- * State: all pending receive operations done?
- */
-static int stat_receive_done;
-
-/**
- * State: number of pending operations
- */
-static int stat_pending;
-
-/**
- * Which peer should we connect to?
- */
-static char *cpid_str;
-
-/**
- * ATS performance handle used
- */
-static struct GNUNET_ATS_PerformanceHandle *ph;
-
-/**
- * Our connectivity handle.
- */
-static struct GNUNET_ATS_ConnectivityHandle *ats_ch;
-
-/**
- * Handle for address suggestion request.
- */
-static struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh;
-
-/**
- * ATS address list handle used
- */
-static struct GNUNET_ATS_AddressListHandle *alh;
-
-/**
- * Configuration handle
- */
-static struct GNUNET_CONFIGURATION_Handle *cfg;
-
-/**
- * Shutdown task
- */
-static struct GNUNET_SCHEDULER_Task *shutdown_task;
-
-/**
- * Hashmap to store addresses
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *addresses;
-
-
-/**
- * Structure used to remember all pending address resolutions.
- * We keep address information in here while we talk to transport
- * to map the address to a string.
- */
-struct PendingResolutions
-{
-  /**
-   * Kept in a DLL.
-   */
-  struct PendingResolutions *next;
-
-  /**
-   * Kept in a DLL.
-   */
-  struct PendingResolutions *prev;
-
-  /**
-   * Copy of the address we are resolving.
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Handle to the transport request to convert the address
-   * to a string.
-   */
-  struct GNUNET_TRANSPORT_AddressToStringContext *tats_ctx;
-
-  /**
-   * Performance data.
-   */
-  struct GNUNET_ATS_Properties properties;
-
-  /**
-   * Amount of outbound bandwidth assigned by ATS.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
-
-  /**
-   * Amount of inbound bandwidth assigned by ATS.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
-
-  /**
-   * Is this an active address?
-   */
-  int active;
-};
-
-
-/**
- * Information we keep for an address.  Used to avoid
- * printing the same data multiple times.
- */
-struct ATSAddress
-{
-  /**
-   * Address information.
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Current outbound bandwidth.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
-
-  /**
-   * Current inbound bandwidth.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
-
-  /**
-   * Is this an active address?
-   */
-  int active;
-};
-
-
-/**
- * Head of list of pending resolution requests.
- */
-static struct PendingResolutions *head;
-
-/**
- * Tail of list of pending resolution requests.
- */
-static struct PendingResolutions *tail;
-
-
-/**
- * Free address corresponding to a given peer.
- *
- * @param cls NULL
- * @param key peer identity
- * @param value the `struct ATSAddress *` to be freed
- * @return #GNUNET_YES (always)
- */
-static int
-free_addr_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
-{
-  struct ATSAddress *a = value;
-
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multipeermap_remove (addresses, key, value));
-  GNUNET_HELLO_address_free (a->address);
-  GNUNET_free (a);
-  return GNUNET_OK;
-}
-
-
-/**
- * Task run on shutdown.
- *
- * @param cls NULL
- */
-static void
-end (void *cls)
-{
-  struct PendingResolutions *pr;
-  struct PendingResolutions *next;
-  unsigned int pending;
-
-  if (NULL != alh)
-  {
-    GNUNET_ATS_performance_list_addresses_cancel (alh);
-    alh = NULL;
-  }
-
-  if (NULL != ph)
-  {
-    GNUNET_ATS_performance_done (ph);
-    ph = NULL;
-  }
-
-  pending = 0;
-  next = head;
-  while (NULL != (pr = next))
-  {
-    next = pr->next;
-    GNUNET_CONTAINER_DLL_remove (head, tail, pr);
-    GNUNET_TRANSPORT_address_to_string_cancel (pr->tats_ctx);
-    GNUNET_free (pr->address);
-    GNUNET_free (pr);
-    pending++;
-  }
-  GNUNET_CONTAINER_multipeermap_iterate (addresses, &free_addr_it, NULL);
-  GNUNET_CONTAINER_multipeermap_destroy (addresses);
-  addresses = NULL;
-
-  if (0 < pending)
-    fprintf (stdout, _ ("%u address resolutions had a timeout\n"), pending);
-  if (opt_list_used || opt_list_all)
-    fprintf (stdout,
-             _ ("ATS returned stat_results for %u addresses\n"),
-             stat_results);
-
-  if (NULL != ats_sh)
-  {
-    GNUNET_ATS_connectivity_suggest_cancel (ats_sh);
-    ats_sh = NULL;
-  }
-  if (NULL != ats_ch)
-  {
-    GNUNET_ATS_connectivity_done (ats_ch);
-    ats_ch = NULL;
-  }
-  ret = 0;
-}
-
-
-/**
- * Function to call with a textual representation of an address.  This
- * function will be called several times with different possible
- * textual representations, and a last time with @a address being NULL
- * to signal the end of the iteration.  Note that @a address NULL
- * always is the last call, regardless of the value in @a res.
- *
- * @param cls closure, a `struct PendingResolutions *`
- * @param address NULL on end of iteration,
- *        otherwise 0-terminated printable UTF-8 string,
- *        in particular an empty string if @a res is #GNUNET_NO
- * @param res result of the address to string conversion:
- *        if #GNUNET_OK: conversion successful
- *        if #GNUNET_NO: address was invalid (or not supported)
- *        if #GNUNET_SYSERR: communication error (IPC error)
- */
-static void
-transport_addr_to_str_cb (void *cls, const char *address, int res)
-{
-  struct PendingResolutions *pr = cls;
-
-  if (NULL == address)
-  {
-    /* We're done */
-    GNUNET_CONTAINER_DLL_remove (head, tail, pr);
-    GNUNET_free (pr->address);
-    GNUNET_free (pr);
-    stat_pending--;
-
-    if ((GNUNET_YES == stat_receive_done) && (0 == stat_pending))
-    {
-      /* All messages received and no resolutions pending*/
-      if (shutdown_task != NULL)
-        GNUNET_SCHEDULER_cancel (shutdown_task);
-      shutdown_task = GNUNET_SCHEDULER_add_now (&end, NULL);
-    }
-    return;
-  }
-  switch (res)
-  {
-  case GNUNET_SYSERR:
-    fprintf (
-      stderr,
-      "Failed to convert address for peer `%s' plugin `%s' length %u to string 
(communication error)\n",
-      GNUNET_i2s (&pr->address->peer),
-      pr->address->transport_name,
-      (unsigned int) pr->address->address_length);
-    return;
-
-  case GNUNET_NO:
-    fprintf (
-      stderr,
-      "Failed to convert address for peer `%s' plugin `%s' length %u to string 
(address invalid or not supported)\n",
-      GNUNET_i2s (&pr->address->peer),
-      pr->address->transport_name,
-      (unsigned int) pr->address->address_length);
-    return;
-
-  case GNUNET_OK:
-    /* continues below */
-    break;
-
-  default:
-    GNUNET_break (0);
-    return;
-  }
-
-  fprintf (
-    stdout,
-    _ (
-      "Peer `%s' plugin `%s', address `%s', `%s' bw out: %u Bytes/s, bw in %u 
Bytes/s, %s\n"),
-    GNUNET_i2s (&pr->address->peer),
-    pr->address->transport_name,
-    address,
-    GNUNET_NT_to_string (pr->properties.scope),
-    ntohl (pr->bandwidth_out.value__),
-    ntohl (pr->bandwidth_in.value__),
-    pr->active ? _ ("active ") : _ ("inactive "));
-}
-
-
-/**
- * Closure for #find_address_it().
- */
-struct AddressFindCtx
-{
-  /**
-   * Address we are looking for.
-   */
-  const struct GNUNET_HELLO_Address *src;
-
-  /**
-   * Where to write the `struct ATSAddress` if we found one that matches.
-   */
-  struct ATSAddress *res;
-};
-
-
-/**
- * Find address corresponding to a given peer.
- *
- * @param cls the `struct AddressFindCtx *`
- * @param key peer identity
- * @param value the `struct ATSAddress *` for an existing address
- * @return #GNUNET_NO if we found a match, #GNUNET_YES if not
- */
-static int
-find_address_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
-{
-  struct AddressFindCtx *actx = cls;
-  struct ATSAddress *exist = value;
-
-  if (0 == GNUNET_HELLO_address_cmp (actx->src, exist->address))
-  {
-    actx->res = exist;
-    return GNUNET_NO;
-  }
-  return GNUNET_YES;
-}
-
-
-/**
- * Signature of a function that is called with QoS information about an 
address.
- *
- * @param cls closure (NULL)
- * @param address the address, NULL if ATS service was disconnected
- * @param active #GNUNET_YES if this address is actively used
- *        to maintain a connection to a peer;
- *        #GNUNET_NO if the address is not actively used;
- *        #GNUNET_SYSERR if this address is no longer available for ATS
- * @param bandwidth_out assigned outbound bandwidth for the connection
- * @param bandwidth_in assigned inbound bandwidth for the connection
- * @param prop performance data for the address (as far as known)
- */
-static void
-ats_perf_mon_cb (void *cls,
-                 const struct GNUNET_HELLO_Address *address,
-                 int active,
-                 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-                 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                 const struct GNUNET_ATS_Properties *prop)
-{
-  struct PendingResolutions *pr;
-  struct PendingResolutions *cur;
-  struct PendingResolutions *next;
-
-  if (NULL == address)
-  {
-    /* ATS service temporarily disconnected, remove current state */
-    next = head;
-    for (cur = next; NULL != cur; cur = next)
-    {
-      next = cur->next;
-      GNUNET_CONTAINER_DLL_remove (head, tail, cur);
-      GNUNET_TRANSPORT_address_to_string_cancel (cur->tats_ctx);
-      GNUNET_HELLO_address_free (cur->address);
-      GNUNET_free (cur);
-    }
-    GNUNET_CONTAINER_multipeermap_iterate (addresses, &free_addr_it, NULL);
-    return;
-  }
-  if (GNUNET_SYSERR == active)
-  {
-    /* remove address */
-    struct AddressFindCtx actx;
-
-    actx.src = address;
-    actx.res = NULL;
-    GNUNET_CONTAINER_multipeermap_get_multiple (addresses,
-                                                &address->peer,
-                                                &find_address_it,
-                                                &actx);
-    if (NULL == actx.res)
-    {
-      GNUNET_break (0);
-      return;
-    }
-    GNUNET_break (GNUNET_OK ==
-                  GNUNET_CONTAINER_multipeermap_remove (addresses,
-                                                        &address->peer,
-                                                        actx.res));
-    fprintf (stdout,
-             _ ("Removed address of peer `%s' with plugin `%s'\n"),
-             GNUNET_i2s (&address->peer),
-             actx.res->address->transport_name);
-    GNUNET_HELLO_address_free (actx.res);
-    return;
-  }
-
-  if (GNUNET_NO == opt_verbose)
-  {
-    struct AddressFindCtx actx;
-    struct ATSAddress *a;
-
-    actx.src = address;
-    actx.res = NULL;
-    GNUNET_CONTAINER_multipeermap_get_multiple (addresses,
-                                                &address->peer,
-                                                &find_address_it,
-                                                &actx);
-    if ((NULL != actx.res))
-    {
-      if ((bandwidth_in.value__ == actx.res->bandwidth_in.value__) &&
-          (bandwidth_out.value__ == actx.res->bandwidth_out.value__) &&
-          (active == actx.res->active))
-      {
-        return;       /* Nothing to do here */
-      }
-      else
-      {
-        actx.res->bandwidth_in = bandwidth_in;
-        actx.res->bandwidth_out = bandwidth_out;
-      }
-    }
-    else
-    {
-      a = GNUNET_new (struct ATSAddress);
-
-      a->address = GNUNET_HELLO_address_copy (address);
-      a->bandwidth_in = bandwidth_in;
-      a->bandwidth_out = bandwidth_out;
-      a->active = active;
-      GNUNET_CONTAINER_multipeermap_put (
-        addresses,
-        &address->peer,
-        a,
-        GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-    }
-  }
-
-  pr = GNUNET_new (struct PendingResolutions);
-  pr->properties = *prop;
-  pr->address = GNUNET_HELLO_address_copy (address);
-  pr->bandwidth_in = bandwidth_in;
-  pr->bandwidth_out = bandwidth_out;
-  pr->active = active;
-  pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (
-    cfg,
-    address,
-    opt_resolve_addresses_numeric,
-    GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
-    &transport_addr_to_str_cb,
-    pr);
-  GNUNET_CONTAINER_DLL_insert (head, tail, pr);
-  stat_results++;
-  stat_pending++;
-}
-
-
-/**
- * Signature of a function that is called with QoS information about an 
address.
- *
- * @param cls closure (NULL)
- * @param address the address, NULL if ATS service was disconnected
- * @param active is this address actively used to maintain a connection
-          to a peer
- * @param bandwidth_out assigned outbound bandwidth for the connection
- * @param bandwidth_in assigned inbound bandwidth for the connection
- * @param prop performance data for the address (as far as known)
- */
-static void
-ats_perf_cb (void *cls,
-             const struct GNUNET_HELLO_Address *address,
-             int active,
-             struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-             struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-             const struct GNUNET_ATS_Properties *prop)
-{
-  struct PendingResolutions *pr;
-
-  if (NULL == address)
-  {
-    /* All messages received */
-    stat_receive_done = GNUNET_YES;
-    alh = NULL;
-    if (0 == stat_pending)
-    {
-      /* All messages received and no resolutions pending*/
-      if (shutdown_task != NULL)
-        GNUNET_SCHEDULER_cancel (shutdown_task);
-      shutdown_task = GNUNET_SCHEDULER_add_now (&end, NULL);
-    }
-    return;
-  }
-
-  pr = GNUNET_new (struct PendingResolutions);
-  pr->properties = *prop;
-  pr->address = GNUNET_HELLO_address_copy (address);
-  pr->bandwidth_in = bandwidth_in;
-  pr->bandwidth_out = bandwidth_out;
-  pr->active = active;
-  pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (
-    cfg,
-    address,
-    opt_resolve_addresses_numeric,
-    GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
-    &transport_addr_to_str_cb,
-    pr);
-  GNUNET_CONTAINER_DLL_insert (head, tail, pr);
-  stat_results++;
-  stat_pending++;
-}
-
-
-/**
- * Print information about the quotas configured for the various
- * network scopes.
- *
- * @param cfg configuration to obtain quota information from
- * @return total number of ATS network types known
- */
-static unsigned int
-print_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *entry_in = NULL;
-  char *entry_out = NULL;
-  char *quota_out_str;
-  char *quota_in_str;
-  unsigned long long int quota_out;
-  unsigned long long int quota_in;
-  int c;
-
-  for (c = 0; (c < GNUNET_NT_COUNT); c++)
-  {
-    GNUNET_asprintf (&entry_out, "%s_QUOTA_OUT", GNUNET_NT_to_string (c));
-    GNUNET_asprintf (&entry_in, "%s_QUOTA_IN", GNUNET_NT_to_string (c));
-
-    /* quota out */
-    if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                            "ats",
-                                                            entry_out,
-                                                            &quota_out_str))
-    {
-      if ((0 == strcmp (quota_out_str, UNLIMITED_STRING)) ||
-          (GNUNET_SYSERR ==
-           GNUNET_STRINGS_fancy_size_to_bytes (quota_out_str, &quota_out)))
-        quota_out = UINT32_MAX;
-
-      GNUNET_free (quota_out_str);
-      GNUNET_asprintf (&quota_out_str, "%llu", quota_out);
-    }
-    else
-    {
-      fprintf (stderr,
-               "Outbound quota for network `%11s' not configured!\n",
-               GNUNET_NT_to_string (c));
-      GNUNET_asprintf (&quota_out_str, "-");
-    }
-    GNUNET_free (entry_out);
-
-    /* quota in */
-    if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                            "ats",
-                                                            entry_in,
-                                                            &quota_in_str))
-    {
-      if ((0 == strcmp (quota_in_str, UNLIMITED_STRING)) ||
-          (GNUNET_SYSERR ==
-           GNUNET_STRINGS_fancy_size_to_bytes (quota_in_str, &quota_in)))
-        quota_in = UINT32_MAX;
-      GNUNET_free (quota_in_str);
-      GNUNET_asprintf (&quota_in_str, "%llu", quota_in);
-    }
-    else
-    {
-      fprintf (stderr,
-               "Inbound quota for network `%11s' not configured!\n",
-               GNUNET_NT_to_string (c));
-      GNUNET_asprintf (&quota_in_str, "-");
-    }
-    GNUNET_free (entry_in);
-
-    fprintf (stdout,
-             _ ("Quota for network `%11s' (in/out): %10s / %10s\n"),
-             GNUNET_NT_to_string (c),
-             quota_in_str,
-             quota_out_str);
-    GNUNET_free (quota_out_str);
-    GNUNET_free (quota_in_str);
-  }
-  return GNUNET_NT_COUNT;
-}
-
-
-/**
- * Main function that will be run by the scheduler.
- *
- * @param cls closure
- * @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be 
NULL!)
- * @param my_cfg configuration
- */
-static void
-run (void *cls,
-     char *const *args,
-     const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *my_cfg)
-{
-  struct GNUNET_PeerIdentity pid;
-  struct GNUNET_PeerIdentity cpid;
-  unsigned int c;
-  unsigned int type;
-
-  cfg = (struct GNUNET_CONFIGURATION_Handle *) my_cfg;
-  addresses = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
-  stat_results = 0;
-
-  c = 0;
-  if (NULL != opt_pid_str)
-  {
-    if (GNUNET_OK !=
-        GNUNET_CRYPTO_eddsa_public_key_from_string (opt_pid_str,
-                                                    strlen (opt_pid_str),
-                                                    &pid.public_key))
-    {
-      fprintf (stderr, _ ("Failed to parse peer identity `%s'\n"), 
opt_pid_str);
-      return;
-    }
-  }
-  if (NULL != cpid_str)
-  {
-    if (GNUNET_OK !=
-        GNUNET_CRYPTO_eddsa_public_key_from_string (cpid_str,
-                                                    strlen (cpid_str),
-                                                    &cpid.public_key))
-    {
-      fprintf (stderr, _ ("Failed to parse peer identity `%s'\n"), cpid_str);
-      return;
-    }
-    c++;
-  }
-
-  c += opt_list_all + opt_list_used + opt_monitor + opt_set_pref;
-
-  if (1 < c)
-  {
-    fprintf (stderr,
-             _ ("Please select one operation: %s or %s or %s or %s or %s\n"),
-             "--used",
-             "--all",
-             "--monitor",
-             "--preference",
-             "--quotas");
-    return;
-  }
-  if (0 == c)
-    opt_list_used = GNUNET_YES; /* set default */
-  if (opt_print_quotas)
-  {
-    ret = print_quotas (cfg);
-    return;
-  }
-  if (opt_list_all)
-  {
-    ph = GNUNET_ATS_performance_init (cfg, NULL, NULL);
-    if (NULL == ph)
-    {
-      fprintf (stderr, "%s", _ ("Cannot connect to ATS service, 
exiting...\n"));
-      return;
-    }
-    alh = GNUNET_ATS_performance_list_addresses (ph,
-                                                 (NULL == opt_pid_str) ? NULL
-                                                 : &pid,
-                                                 GNUNET_YES,
-                                                 &ats_perf_cb,
-                                                 NULL);
-    if (NULL == alh)
-    {
-      fprintf (stderr,
-               "%s",
-               _ ("Cannot issue request to ATS service, exiting...\n"));
-      shutdown_task = GNUNET_SCHEDULER_add_now (&end, NULL);
-      return;
-    }
-    shutdown_task = GNUNET_SCHEDULER_add_shutdown (&end, NULL);
-    return;
-  }
-  if (opt_list_used)
-  {
-    ph = GNUNET_ATS_performance_init (cfg, NULL, NULL);
-    if (NULL == ph)
-      fprintf (stderr, "%s", _ ("Cannot connect to ATS service, 
exiting...\n"));
-
-    alh = GNUNET_ATS_performance_list_addresses (ph,
-                                                 (NULL == opt_pid_str) ? NULL
-                                                 : &pid,
-                                                 GNUNET_NO,
-                                                 &ats_perf_cb,
-                                                 NULL);
-    if (NULL == alh)
-    {
-      fprintf (stderr,
-               "%s",
-               _ ("Cannot issue request to ATS service, exiting...\n"));
-      shutdown_task = GNUNET_SCHEDULER_add_now (&end, NULL);
-      return;
-    }
-    shutdown_task = GNUNET_SCHEDULER_add_shutdown (&end, NULL);
-    return;
-  }
-  if (opt_monitor)
-  {
-    ph = GNUNET_ATS_performance_init (cfg, &ats_perf_mon_cb, NULL);
-    shutdown_task = GNUNET_SCHEDULER_add_shutdown (&end, NULL);
-    if (NULL == ph)
-    {
-      fprintf (stderr, "%s", _ ("Cannot connect to ATS service, 
exiting...\n"));
-      GNUNET_SCHEDULER_shutdown ();
-    }
-    return;
-  }
-  if (opt_set_pref)
-  {
-    if (NULL == opt_type_str)
-    {
-      fprintf (stderr, "%s", _ ("No preference type given!\n"));
-      return;
-    }
-    if (NULL == opt_pid_str)
-    {
-      fprintf (stderr, "%s", _ ("No peer given!\n"));
-      return;
-    }
-
-    for (c = 0; c < strlen (opt_type_str); c++)
-    {
-      if (isupper ((unsigned char) opt_type_str[c]))
-        opt_type_str[c] = tolower ((unsigned char) opt_type_str[c]);
-    }
-
-    if (0 == strcasecmp ("latency", opt_type_str))
-      type = GNUNET_ATS_PREFERENCE_LATENCY;
-    else if (0 == strcasecmp ("bandwidth", opt_type_str))
-      type = GNUNET_ATS_PREFERENCE_BANDWIDTH;
-    else
-    {
-      fprintf (stderr, "%s", _ ("Valid type required\n"));
-      return;
-    }
-
-    /* set */
-    ph = GNUNET_ATS_performance_init (cfg, NULL, NULL);
-    if (NULL == ph)
-      fprintf (stderr, "%s", _ ("Cannot connect to ATS service, 
exiting...\n"));
-
-    GNUNET_ATS_performance_change_preference (ph,
-                                              &pid,
-                                              type,
-                                              (double) opt_pref_value,
-                                              GNUNET_ATS_PREFERENCE_END);
-
-    shutdown_task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &end, NULL);
-    return;
-  }
-  if (NULL != cpid_str)
-  {
-    ats_ch = GNUNET_ATS_connectivity_init (cfg);
-    ats_sh = GNUNET_ATS_connectivity_suggest (ats_ch, &cpid, 1000);
-    shutdown_task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &end, NULL);
-    return;
-  }
-  ret = 1;
-}
-
-
-/**
- * The main function.
- *
- * @param argc number of arguments from the command line
- * @param argv command line arguments
- * @return 0 ok, 1 on error
- */
-int
-main (int argc, char *const *argv)
-{
-  int res;
-
-  opt_resolve_addresses_numeric = GNUNET_NO;
-  opt_monitor = GNUNET_NO;
-  opt_list_all = GNUNET_NO;
-  opt_list_used = GNUNET_NO;
-  opt_set_pref = GNUNET_NO;
-  stat_pending = 0;
-  stat_receive_done = GNUNET_NO;
-  opt_type_str = NULL;
-
-  struct GNUNET_GETOPT_CommandLineOption options[] =
-  { GNUNET_GETOPT_option_flag ('u',
-                               "used",
-                               gettext_noop (
-                                 "get list of active addresses currently 
used"),
-                               &opt_list_used),
-    GNUNET_GETOPT_option_flag ('a',
-                               "all",
-                               gettext_noop (
-                                 "get list of all active addresses"),
-                               &opt_list_all),
-
-    GNUNET_GETOPT_option_string ('C',
-                                 "connect",
-                                 NULL,
-                                 gettext_noop ("connect to PEER"),
-                                 &cpid_str),
-    GNUNET_GETOPT_option_flag ('n',
-                               "numeric",
-                               gettext_noop (
-                                 "do not resolve IP addresses to hostnames"),
-                               &opt_resolve_addresses_numeric),
-
-    GNUNET_GETOPT_option_flag ('m',
-                               "monitor",
-                               gettext_noop ("monitor mode"),
-                               &opt_monitor),
-
-    GNUNET_GETOPT_option_flag ('p',
-                               "preference",
-                               gettext_noop (
-                                 "set preference for the given peer"),
-                               &opt_set_pref),
-
-    GNUNET_GETOPT_option_flag ('q',
-                               "quotas",
-                               gettext_noop ("print all configured quotas"),
-                               &opt_print_quotas),
-    GNUNET_GETOPT_option_string ('i',
-                                 "id",
-                                 "TYPE",
-                                 gettext_noop ("peer id"),
-                                 &opt_pid_str),
-
-    GNUNET_GETOPT_option_string ('t',
-                                 "type",
-                                 "TYPE",
-                                 gettext_noop (
-                                   "preference type to set: latency | 
bandwidth"),
-                                 &opt_type_str),
-
-    GNUNET_GETOPT_option_uint ('k',
-                               "value",
-                               "VALUE",
-                               gettext_noop ("preference value"),
-                               &opt_pref_value),
-
-    GNUNET_GETOPT_option_flag (
-      'V',
-      "verbose",
-      gettext_noop ("verbose output (include ATS address properties)"),
-      &opt_verbose),
-    GNUNET_GETOPT_OPTION_END };
-
-  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
-    return 2;
-
-  res = GNUNET_PROGRAM_run (argc,
-                            argv,
-                            "gnunet-ats",
-                            gettext_noop ("Print information about ATS state"),
-                            options,
-                            &run,
-                            NULL);
-  GNUNET_free (opt_pid_str);
-  GNUNET_free (opt_type_str);
-  GNUNET_free_nz ((void *) argv);
-
-  if (GNUNET_OK == res)
-    return ret;
-  else
-    return 1;
-}
-
-
-/* end of gnunet-ats.c */
diff --git a/src/ats-tool/meson.build b/src/ats-tool/meson.build
deleted file mode 100644
index 6b6df7b3d..000000000
--- a/src/ats-tool/meson.build
+++ /dev/null
@@ -1,15 +0,0 @@
-if get_option('monolith')
-  subdir_done()
-endif
-
-executable ('gnunet-ats',
-            ['gnunet-ats.c'],
-            dependencies: [libgnunetats_dep, libgnunetutil_dep,
-                           libgnunettransport_dep,
-                           libgnunetnt_dep,
-                           libgnunethello_dep
-                          ],
-            include_directories: [incdir, configuration_inc],
-            install: true,
-            install_dir: get_option('bindir'))
-
diff --git a/src/ats/.gitignore b/src/ats/.gitignore
deleted file mode 100644
index fa72eb136..000000000
--- a/src/ats/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-gnunet-service-ats
-test_ats_api_proportional
-test_ats_reservation_api_proportional
-test_ats_api_mlp
-test_ats_api_ril
-gnunet-service-ats-new
diff --git a/src/ats/Makefile.am b/src/ats/Makefile.am
deleted file mode 100644
index 85a2bb555..000000000
--- a/src/ats/Makefile.am
+++ /dev/null
@@ -1,102 +0,0 @@
-# This Makefile.am is in the public domain
-AM_CPPFLAGS = -I$(top_srcdir)/src/include
-
-plugindir = $(libdir)/gnunet
-
-pkgcfgdir= $(pkgdatadir)/config.d/
-
-libexecdir= $(pkglibdir)/libexec/
-
-pkgcfg_DATA = \
-  ats.conf
-
-if USE_COVERAGE
-  AM_CFLAGS = -fprofile-arcs -ftest-coverage
-endif
-
-lib_LTLIBRARIES = \
-  libgnunetats.la
-
-plugin_LTLIBRARIES = \
-  libgnunet_plugin_ats_proportional.la
-
-libgnunetats_la_SOURCES = \
-  ats_api_connectivity.c \
-  ats_api_scheduling.c \
-  ats_api_scanner.c \
-  ats_api_performance.c
-libgnunetats_la_LIBADD = \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(LTLIBINTL)
-libgnunetats_la_LDFLAGS = \
-  $(GN_LIB_LDFLAGS)   \
-  -version-info 4:0:0
-
-libgnunet_plugin_ats_proportional_la_SOURCES = \
-  plugin_ats_proportional.c
-libgnunet_plugin_ats_proportional_la_LIBADD = \
-  libgnunetats.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/nt/libgnunetnt.la \
-  $(LTLIBINTL)
-libgnunet_plugin_ats_proportional_la_LDFLAGS = \
-  $(GN_PLUGIN_LDFLAGS)
-
-
-libexec_PROGRAMS = \
- gnunet-service-ats
-
-gnunet_service_ats_SOURCES = \
- gnunet-service-ats.c gnunet-service-ats.h \
- gnunet-service-ats_addresses.c gnunet-service-ats_addresses.h \
- gnunet-service-ats_connectivity.c gnunet-service-ats_connectivity.h \
- gnunet-service-ats_normalization.c gnunet-service-ats_normalization.h \
- gnunet-service-ats_performance.c gnunet-service-ats_performance.h \
- gnunet-service-ats_plugins.c gnunet-service-ats_plugins.h \
- gnunet-service-ats_preferences.c gnunet-service-ats_preferences.h \
- gnunet-service-ats_scheduling.c gnunet-service-ats_scheduling.h \
- gnunet-service-ats_reservations.c gnunet-service-ats_reservations.h
-gnunet_service_ats_LDADD = \
-  $(top_builddir)/src/nt/libgnunetnt.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  libgnunetats.la \
-  $(GN_LIBINTL)
-
-TESTING_TESTS = \
- test_ats_api_proportional \
- test_ats_reservation_api_proportional
-
-check_PROGRAMS = \
- $(TESTING_TESTS)
-
-if ENABLE_TEST_RUN
-AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
-TESTS = $(check_PROGRAMS)
-endif
-
-test_ats_api_proportional_SOURCES = \
- test_ats_api.c \
- test_ats_lib.c test_ats_lib.h
-test_ats_api_proportional_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/testing/libgnunettesting.la \
-  libgnunetats.la
-
-test_ats_reservation_api_proportional_SOURCES = \
- test_ats_reservation_api.c \
- test_ats_lib.c test_ats_lib.h
-test_ats_reservation_api_proportional_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/testing/libgnunettesting.la \
-  libgnunetats.la
-
-EXTRA_DIST = \
-  ats.h \
-  test_delay \
-  test_ats_api.conf \
-  test_ats_api_proportional.conf
diff --git a/src/ats/ats.conf.in b/src/ats/ats.conf.in
deleted file mode 100644
index 2c65869dd..000000000
--- a/src/ats/ats.conf.in
+++ /dev/null
@@ -1,44 +0,0 @@
-[ats]
-START_ON_DEMAND = @START_ON_DEMAND@
-@UNIXONLY@ PORT = 2098
-HOSTNAME = localhost
-BINARY = gnunet-service-ats
-ACCEPT_FROM = 127.0.0.1;
-ACCEPT_FROM6 = ::1;
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-ats.sock
-UNIX_MATCH_UID = NO
-UNIX_MATCH_GID = YES
-# PREFIX = valgrind
-# Designated assignment mode: PROPORTIONAL / MLP / RIL
-MODE = proportional
-
-# IMPORTANT: Do not lower those quotas below 10 MiB
-# Or your peer may not bootstrap correctly.
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = 10 MiB
-WAN_QUOTA_OUT = 10 MiB
-# WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = 10 MiB
-BLUETOOTH_QUOTA_OUT = 10 MiB
-# ATS options
-
-# Proportional specific settings
-# How proportional to preferences is bandwidth distribution in a network
-# 1.0: Fair with respect to addresses without preferences
-# > 1.0: The bigger, the more respect is paid to preferences
-PROP_PROPORTIONALITY_FACTOR = 10.00
-# Should we stick to existing connections or prefer to switch?
-# [1.0...2.0], lower value prefers to switch, bigger value is more tolerant
-PROP_STABILITY_FACTOR = 1.25
diff --git a/src/ats/ats.h b/src/ats/ats.h
deleted file mode 100644
index 711c1c103..000000000
--- a/src/ats/ats.h
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/ats.h
- * @brief automatic transport selection messages
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#ifndef ATS_H
-#define ATS_H
-
-#include "gnunet_util_lib.h"
-#include "gnunet_ats_service.h"
-
-
-/**
- * Flag used to indicate which type of client is connecting
- * to the ATS service.
- */
-enum StartFlag
-{
-  /**
-   * This is a scheduling client (aka transport service)
-   */
-  START_FLAG_SCHEDULING = 0,
-
-  /**
-   * Performance monitoring client that wants to learn about
-   * changes in performance characteristics.
-   */
-  START_FLAG_PERFORMANCE_WITH_PIC = 1,
-
-  /**
-   * Performance monitoring client that does NOT want to learn
-   * about changes in performance characteristics.
-   */
-  START_FLAG_PERFORMANCE_NO_PIC = 2,
-
-  /**
-   * Connection suggestion handle.
-   */
-  START_FLAG_CONNECTION_SUGGESTION = 3
-};
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * First message any client sends to ATS, used to self-identify
- * (what type of client this is).
- */
-struct ClientStartMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_ATS_START.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * NBO value of an `enum StartFlag`.
-   */
-  uint32_t start_flag GNUNET_PACKED;
-};
-
-
-/**
- * Connectivity client to ATS service: we would like to have
- * address suggestions for this peer.
- */
-struct RequestAddressMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS or
-   * #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL to stop
-   * suggestions.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * How "strong" is our need for an address for this peer?
-   */
-  uint32_t strength GNUNET_PACKED;
-
-  /**
-   * Peer to get address suggestions for.
-   */
-  struct GNUNET_PeerIdentity peer;
-};
-
-
-/**
- * Scheduling client to ATS service: here is another address you can use.
- */
-struct AddressAddMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Number of bytes in the address that follows this struct.
-   */
-  uint16_t address_length GNUNET_PACKED;
-
-  /**
-   * Number of bytes in the plugin name that follows this struct.
-   */
-  uint16_t plugin_name_length GNUNET_PACKED;
-
-  /**
-   * Identity of the peer that this address is for.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Internal number this client will henceforth use to
-   * refer to this address.
-   */
-  uint32_t session_id GNUNET_PACKED;
-
-  /**
-   * Local-only information of the address, see
-   * `enum GNUNET_HELLO_AddressInfo`.
-   */
-  uint32_t address_local_info GNUNET_PACKED;
-
-  /**
-   * Performance properties of the address.
-   */
-  struct GNUNET_ATS_PropertiesNBO properties;
-
-  /* followed by:
-   * - char address[address_length]
-   * - char plugin_name[plugin_name_length] (including '\0'-termination).
-   */
-};
-
-
-/**
- * Message used to notify ATS that the performance
- * characteristics for an address have changed.
- */
-struct AddressUpdateMessage
-{
-  /**
-   * Message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Internal number this client uses to refer to this address.
-   */
-  uint32_t session_id GNUNET_PACKED;
-
-  /**
-   * Which peer is this about? (Technically redundant, as the
-   * @e session_id should be sufficient, but enables ATS service
-   * to find the session faster).
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Performance properties of the address.
-   */
-  struct GNUNET_ATS_PropertiesNBO properties;
-};
-
-
-/**
- * Message sent by ATS client to ATS service when an address
- * was destroyed and must thus henceforth no longer be considered
- * for scheduling.
- */
-struct AddressDestroyedMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Internal number this client uses to refer to this address.
-   */
-  uint32_t session_id GNUNET_PACKED;
-
-  /**
-   * Which peer is this about? (Technically redundant, as the
-   * @e session_id should be sufficient, but enables ATS service
-   * to find the session faster).
-   */
-  struct GNUNET_PeerIdentity peer;
-};
-
-
-/**
- * Message sent by ATS service to client to confirm that it is done
- * using the given session ID.
- */
-struct GNUNET_ATS_SessionReleaseMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Number the client used to identify the session.
-   */
-  uint32_t session_id GNUNET_PACKED;
-
-  /**
-   * Which peer is this about? (Technically redundant, as the
-   * @e session_id should be sufficient, but may enable client
-   * to find the session faster).
-   */
-  struct GNUNET_PeerIdentity peer;
-};
-
-
-/**
- * ATS Service suggests to the transport service to use the address
- * identified by the given @e session_id for the given @e peer with
- * the given @e bandwidth_in and @e bandwidth_out limits from now on.
- */
-struct AddressSuggestionMessage
-{
-  /**
-   * A message of type #GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Internal number this client uses to refer to the address this
-   * suggestion is about.
-   */
-  uint32_t session_id GNUNET_PACKED;
-
-  /**
-   * Which peer is this about? (Technically redundant, as the
-   * @e session_id should be sufficient, but may enable client
-   * to find the session faster and/or check consistency).
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * How much bandwidth we are allowed for sending.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
-
-  /**
-   * How much bandwidth we are allowed for receiving.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
-};
-
-
-/**
- *
- */
-struct PeerInformationMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_ATS_PEER_INFORMATION
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   *
-   */
-  uint16_t address_length GNUNET_PACKED;
-
-  /**
-   *
-   */
-  uint16_t plugin_name_length GNUNET_PACKED;
-
-  /**
-   *
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   *
-   */
-  uint32_t address_active GNUNET_PACKED;
-
-  /**
-   *
-   */
-  uint32_t id GNUNET_PACKED;
-
-  /**
-   *
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
-
-  /**
-   *
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
-
-  /**
-   * Performance properties of the address.
-   */
-  struct GNUNET_ATS_PropertiesNBO properties;
-
-  /**
-   * Local-only information of the address, see
-   * `enum GNUNET_HELLO_AddressInfo`.
-   */
-  uint32_t address_local_info GNUNET_PACKED;
-
-  /* followed by:
-   * - char address[address_length]
-   * - char plugin_name[plugin_name_length] (including '\0'-termination).
-   */
-};
-
-
-/**
- * Client to service: please give us an overview of the addresses.
- */
-struct AddressListRequestMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * ID used to match replies to this request.
-   */
-  uint32_t id GNUNET_PACKED;
-
-  /**
-   * Which peer do we care about? All zeros for all.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * #GNUNET_YES to get information about all addresses,
-   * #GNUNET_NO to only return addresses that are in use.
-   */
-  int32_t all GNUNET_PACKED;
-};
-
-
-/**
- *
- */
-struct ReservationRequestMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   *
-   */
-  int32_t amount GNUNET_PACKED;
-
-  /**
-   *
-   */
-  struct GNUNET_PeerIdentity peer;
-};
-
-
-/**
- *
- */
-struct ReservationResultMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   *
-   */
-  int32_t amount GNUNET_PACKED;
-
-  /**
-   *
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   *
-   */
-  struct GNUNET_TIME_RelativeNBO res_delay;
-};
-
-
-/**
- * Variable-size entry in a `struct ChangePreferenceMessage` or
- * `struct FeedbackPreferenceMessage`.
- */
-struct PreferenceInformation
-{
-  /**
-   * An `enum GNUNET_ATS_PreferenceKind` in NBO.
-   */
-  uint32_t preference_kind GNUNET_PACKED;
-
-  /**
-   * Degree of preference (or appreciation) for this @e
-   * preference_kind being expressed.
-   */
-  float preference_value GNUNET_PACKED;
-};
-
-
-/**
- * Client to ATS: I have a performance preference for a peer.
- */
-struct ChangePreferenceMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * How many `struct PreferenceInformation` entries follow
-   * this struct?
-   */
-  uint32_t num_preferences GNUNET_PACKED;
-
-  /**
-   * Which peer is the preference being expressed for?
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /* followed by 'num_preferences'
-   * struct PreferenceInformation values */
-};
-
-
-/**
- * Message containing application feedback for a peer
- */
-struct FeedbackPreferenceMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Number of feedback values included
-   */
-  uint32_t num_feedback GNUNET_PACKED;
-
-  /**
-   * Relative time describing for which time interval this feedback is
-   */
-  struct GNUNET_TIME_RelativeNBO scope;
-
-  /**
-   * Peer this feedback is for
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /* followed by 'num_feedback'
-   * struct PreferenceInformation values */
-};
-
-GNUNET_NETWORK_STRUCT_END
-
-
-#endif
diff --git a/src/ats/ats_api_connectivity.c b/src/ats/ats_api_connectivity.c
deleted file mode 100644
index f62d89772..000000000
--- a/src/ats/ats_api_connectivity.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/ats_api_connectivity.c
- * @brief enable clients to ask ATS about establishing connections to peers
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_ats_service.h"
-#include "ats.h"
-
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "ats-connectivity-api", \
-                                        __VA_ARGS__)
-
-
-/**
- * Handle for ATS address suggestion requests.
- */
-struct GNUNET_ATS_ConnectivitySuggestHandle
-{
-  /**
-   * ID of the peer for which address suggestion was requested.
-   */
-  struct GNUNET_PeerIdentity id;
-
-  /**
-   * Connecitivity handle this suggestion handle belongs to.
-   */
-  struct GNUNET_ATS_ConnectivityHandle *ch;
-
-  /**
-   * How urgent is the request.
-   */
-  uint32_t strength;
-};
-
-
-/**
- * Handle to the ATS subsystem for connectivity management.
- */
-struct GNUNET_ATS_ConnectivityHandle
-{
-  /**
-   * Our configuration.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Map with the identities of all the peers for which we would
-   * like to have address suggestions.  The key is the PID, the
-   * value is currently the `struct GNUNET_ATS_ConnectivitySuggestHandle`
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *sug_requests;
-
-  /**
-   * Message queue for sending requests to the ATS service.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Task to trigger reconnect.
-   */
-  struct GNUNET_SCHEDULER_Task *task;
-
-  /**
-   * Reconnect backoff delay.
-   */
-  struct GNUNET_TIME_Relative backoff;
-};
-
-
-/**
- * Re-establish the connection to the ATS service.
- *
- * @param ch handle to use to re-connect.
- */
-static void
-reconnect (struct GNUNET_ATS_ConnectivityHandle *ch);
-
-
-/**
- * Re-establish the connection to the ATS service.
- *
- * @param cls handle to use to re-connect.
- */
-static void
-reconnect_task (void *cls)
-{
-  struct GNUNET_ATS_ConnectivityHandle *ch = cls;
-
-  ch->task = NULL;
-  reconnect (ch);
-}
-
-
-/**
- * Disconnect from ATS and then reconnect.
- *
- * @param ch our handle
- */
-static void
-force_reconnect (struct GNUNET_ATS_ConnectivityHandle *ch)
-{
-  if (NULL != ch->mq)
-  {
-    GNUNET_MQ_destroy (ch->mq);
-    ch->mq = NULL;
-  }
-  ch->backoff = GNUNET_TIME_STD_BACKOFF (ch->backoff);
-  ch->task = GNUNET_SCHEDULER_add_delayed (ch->backoff,
-                                           &reconnect_task,
-                                           ch);
-}
-
-
-/**
- * We encountered an error handling the MQ to the
- * ATS service.  Reconnect.
- *
- * @param cls the `struct GNUNET_ATS_ConnectivityHandle`
- * @param error details about the error
- */
-static void
-error_handler (void *cls,
-               enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_ATS_ConnectivityHandle *ch = cls;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "ATS connection died (code %d), reconnecting\n",
-       (int) error);
-  force_reconnect (ch);
-}
-
-
-/**
- * Transmit request for an address suggestion.
- *
- * @param cls the `struct GNUNET_ATS_ConnectivityHandle`
- * @param peer peer to ask for an address suggestion for
- * @param value the `struct GNUNET_ATS_SuggestHandle`
- * @return #GNUNET_OK (continue to iterate), #GNUNET_SYSERR on
- *         failure (message queue no longer exists)
- */
-static int
-transmit_suggestion (void *cls,
-                     const struct GNUNET_PeerIdentity *peer,
-                     void *value)
-{
-  struct GNUNET_ATS_ConnectivityHandle *ch = cls;
-  struct GNUNET_ATS_ConnectivitySuggestHandle *sh = value;
-  struct GNUNET_MQ_Envelope *ev;
-  struct RequestAddressMessage *m;
-
-  if (NULL == ch->mq)
-    return GNUNET_SYSERR;
-  ev = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS);
-  m->strength = htonl (sh->strength);
-  m->peer = *peer;
-  GNUNET_MQ_send (ch->mq, ev);
-  return GNUNET_OK;
-}
-
-
-/**
- * Re-establish the connection to the ATS service.
- *
- * @param ch handle to use to re-connect.
- */
-static void
-reconnect (struct GNUNET_ATS_ConnectivityHandle *ch)
-{
-  static const struct GNUNET_MQ_MessageHandler handlers[] =
-  { { NULL, 0, 0 } };
-  struct GNUNET_MQ_Envelope *ev;
-  struct ClientStartMessage *init;
-
-  GNUNET_assert (NULL == ch->mq);
-  ch->mq = GNUNET_CLIENT_connect (ch->cfg,
-                                  "ats",
-                                  handlers,
-                                  &error_handler,
-                                  ch);
-  if (NULL == ch->mq)
-  {
-    force_reconnect (ch);
-    return;
-  }
-  ev = GNUNET_MQ_msg (init,
-                      GNUNET_MESSAGE_TYPE_ATS_START);
-  init->start_flag = htonl (START_FLAG_CONNECTION_SUGGESTION);
-  GNUNET_MQ_send (ch->mq, ev);
-  if (NULL == ch->mq)
-    return;
-  GNUNET_CONTAINER_multipeermap_iterate (ch->sug_requests,
-                                         &transmit_suggestion,
-                                         ch);
-}
-
-
-/**
- * Initialize the ATS connectivity suggestion client handle.
- *
- * @param cfg configuration to use
- * @return ats connectivity handle, NULL on error
- */
-struct GNUNET_ATS_ConnectivityHandle *
-GNUNET_ATS_connectivity_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  struct GNUNET_ATS_ConnectivityHandle *ch;
-
-  ch = GNUNET_new (struct GNUNET_ATS_ConnectivityHandle);
-  ch->cfg = cfg;
-  ch->sug_requests = GNUNET_CONTAINER_multipeermap_create (32,
-                                                           GNUNET_YES);
-  reconnect (ch);
-  return ch;
-}
-
-
-/**
- * Function called to free all `struct GNUNET_ATS_ConnectivitySuggestHandle`s
- * in the map.
- *
- * @param cls NULL
- * @param key the key
- * @param value the value to free
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-free_sug_handle (void *cls,
-                 const struct GNUNET_PeerIdentity *key,
-                 void *value)
-{
-  struct GNUNET_ATS_ConnectivitySuggestHandle *cur = value;
-
-  GNUNET_free (cur);
-  return GNUNET_OK;
-}
-
-
-/**
- * Client is done with ATS connectivity management, release resources.
- *
- * @param ch handle to release
- */
-void
-GNUNET_ATS_connectivity_done (struct GNUNET_ATS_ConnectivityHandle *ch)
-{
-  if (NULL != ch->mq)
-  {
-    GNUNET_MQ_destroy (ch->mq);
-    ch->mq = NULL;
-  }
-  if (NULL != ch->task)
-  {
-    GNUNET_SCHEDULER_cancel (ch->task);
-    ch->task = NULL;
-  }
-  GNUNET_CONTAINER_multipeermap_iterate (ch->sug_requests,
-                                         &free_sug_handle,
-                                         NULL);
-  GNUNET_CONTAINER_multipeermap_destroy (ch->sug_requests);
-  GNUNET_free (ch);
-}
-
-
-/**
- * We would like to receive address suggestions for a peer. ATS will
- * respond with a call to the continuation immediately containing an address or
- * no address if none is available. ATS can suggest more addresses until we 
call
- * #GNUNET_ATS_connectivity_suggest_cancel().
- *
- * @param ch handle
- * @param peer identity of the peer we need an address for
- * @param strength how urgent is the need for such a suggestion
- * @return suggest handle, NULL if a request is already pending
- */
-struct GNUNET_ATS_ConnectivitySuggestHandle *
-GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch,
-                                 const struct GNUNET_PeerIdentity *peer,
-                                 uint32_t strength)
-{
-  struct GNUNET_ATS_ConnectivitySuggestHandle *s;
-
-  s = GNUNET_new (struct GNUNET_ATS_ConnectivitySuggestHandle);
-  s->ch = ch;
-  s->id = *peer;
-  s->strength = strength;
-  if (GNUNET_OK !=
-      GNUNET_CONTAINER_multipeermap_put (ch->sug_requests,
-                                         &s->id,
-                                         s,
-                                         
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Not requesting ATS to suggest address for `%s', request already 
pending\n",
-         GNUNET_i2s (peer));
-    GNUNET_free (s);
-    return NULL;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Requesting ATS to suggest address for `%s'\n",
-       GNUNET_i2s (peer));
-  if (NULL == ch->mq)
-    return s;
-  (void) transmit_suggestion (ch,
-                              &s->id,
-                              s);
-  return s;
-}
-
-
-void
-GNUNET_ATS_connectivity_suggest_cancel (struct
-                                        GNUNET_ATS_ConnectivitySuggestHandle 
*sh)
-{
-  struct GNUNET_ATS_ConnectivityHandle *ch = sh->ch;
-  struct GNUNET_MQ_Envelope *ev;
-  struct RequestAddressMessage *m;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Telling ATS we no longer care for an address for `%s'\n",
-       GNUNET_i2s (&sh->id));
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multipeermap_remove (ch->sug_requests,
-                                                       &sh->id,
-                                                       sh));
-  if (NULL == ch->mq)
-  {
-    GNUNET_free (sh);
-    return;
-  }
-  ev = GNUNET_MQ_msg (m,
-                      GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL);
-  m->strength = htonl (0);
-  m->peer = sh->id;
-  GNUNET_MQ_send (ch->mq, ev);
-  GNUNET_free (sh);
-}
-
-
-/* end of ats_api_connectivity.c */
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c
deleted file mode 100644
index 242589851..000000000
--- a/src/ats/ats_api_performance.c
+++ /dev/null
@@ -1,946 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010, 2011, 2016 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/ats_api_performance.c
- * @brief automatic transport selection and outbound bandwidth determination
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_ats_service.h"
-#include "ats.h"
-
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "ats-performance-api", \
-                                        __VA_ARGS__)
-
-
-/**
- * Linked list of pending reservations.
- */
-struct GNUNET_ATS_ReservationContext
-{
-  /**
-   * Kept in a DLL.
-   */
-  struct GNUNET_ATS_ReservationContext *next;
-
-  /**
-   * Kept in a DLL.
-   */
-  struct GNUNET_ATS_ReservationContext *prev;
-
-  /**
-   * Target peer.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Desired reservation
-   */
-  int32_t size;
-
-  /**
-   * Function to call on result.
-   */
-  GNUNET_ATS_ReservationCallback rcb;
-
-  /**
-   * Closure for @e rcb
-   */
-  void *rcb_cls;
-
-  /**
-   * Do we need to undo this reservation if it succeeded?  Set to
-   * #GNUNET_YES if a reservation is cancelled.  (at that point, 'info'
-   * is also set to NULL; however, info will ALSO be NULL for the
-   * reservation context that is created to undo the original request,
-   * so 'info' being NULL cannot be used to check if undo is
-   * required).
-   */
-  int undo;
-};
-
-
-/**
- * Linked list of pending reservations.
- */
-struct GNUNET_ATS_AddressListHandle
-{
-  /**
-   * Kept in a DLL.
-   */
-  struct GNUNET_ATS_AddressListHandle *next;
-
-  /**
-   * Kept in a DLL.
-   */
-  struct GNUNET_ATS_AddressListHandle *prev;
-
-  /**
-   * Performance handle
-   */
-  struct GNUNET_ATS_PerformanceHandle *ph;
-
-  /**
-   * Callback
-   */
-  GNUNET_ATS_AddressInformationCallback cb;
-
-  /**
-   * Callback closure for @e cb
-   */
-  void *cb_cls;
-
-  /**
-   * Target peer.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Return all or specific peer only
-   */
-  int all_peers;
-
-  /**
-   * Return all or used address only
-   */
-  int all_addresses;
-
-  /**
-   * Request multiplexing
-   */
-  uint32_t id;
-};
-
-
-/**
- * ATS Handle to obtain and/or modify performance information.
- */
-struct GNUNET_ATS_PerformanceHandle
-{
-  /**
-   * Our configuration.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Callback to invoke when an address has performance changes.
-   */
-  GNUNET_ATS_AddressInformationCallback addr_info_cb;
-
-  /**
-   * Closure for @e addr_info_cb.
-   */
-  void *addr_info_cb_cls;
-
-  /**
-   * Connection to ATS service.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Head of linked list of pending reservation requests.
-   */
-  struct GNUNET_ATS_ReservationContext *reservation_head;
-
-  /**
-   * Tail of linked list of pending reservation requests.
-   */
-  struct GNUNET_ATS_ReservationContext *reservation_tail;
-
-  /**
-   * Head of linked list of pending address list requests.
-   */
-  struct GNUNET_ATS_AddressListHandle *addresslist_head;
-
-  /**
-   * Tail of linked list of pending address list requests.
-   */
-  struct GNUNET_ATS_AddressListHandle *addresslist_tail;
-
-  /**
-   * Current request for transmission to ATS.
-   */
-  struct GNUNET_CLIENT_TransmitHandle *th;
-
-  /**
-   * Task to trigger reconnect.
-   */
-  struct GNUNET_SCHEDULER_Task *task;
-
-  /**
-   * Reconnect backoff delay.
-   */
-  struct GNUNET_TIME_Relative backoff;
-
-  /**
-   * Monitor request multiplexing
-   */
-  uint32_t monitor_id;
-
-  /**
-   * Request multiplexing
-   */
-  uint32_t id;
-
-  /**
-   * Is the receive loop active?
-   */
-  int in_receive;
-};
-
-/**
- * Re-establish the connection to the ATS service.
- *
- * @param ph handle to use to re-connect.
- */
-static void
-reconnect (struct GNUNET_ATS_PerformanceHandle *ph);
-
-
-/**
- * Re-establish the connection to the ATS service.
- *
- * @param cls handle to use to re-connect.
- */
-static void
-reconnect_task (void *cls)
-{
-  struct GNUNET_ATS_PerformanceHandle *ph = cls;
-
-  ph->task = NULL;
-  reconnect (ph);
-}
-
-
-/**
- * Reconnect to the ATS service, something went wrong.
- *
- * @param ph handle to reconnect
- */
-static void
-do_reconnect (struct GNUNET_ATS_PerformanceHandle *ph)
-{
-  struct GNUNET_ATS_ReservationContext *rc;
-  struct GNUNET_ATS_AddressListHandle *alh;
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_zero;
-
-  if (NULL != ph->mq)
-  {
-    GNUNET_MQ_destroy (ph->mq);
-    ph->mq = NULL;
-  }
-  while (NULL != (rc = ph->reservation_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (ph->reservation_head,
-                                 ph->reservation_tail,
-                                 rc);
-    if (NULL != rc->rcb)
-      rc->rcb (rc->rcb_cls,
-               NULL,
-               0,
-               GNUNET_TIME_UNIT_FOREVER_REL);
-    GNUNET_free (rc);
-  }
-  bandwidth_zero.value__ = htonl (0);
-  while (NULL != (alh = ph->addresslist_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (ph->addresslist_head,
-                                 ph->addresslist_tail,
-                                 alh);
-    if (NULL != alh->cb)
-      alh->cb (alh->cb_cls,
-               NULL,
-               GNUNET_NO,
-               bandwidth_zero,
-               bandwidth_zero,
-               NULL);
-    GNUNET_free (alh);
-  }
-  if (NULL != ph->addr_info_cb)
-  {
-    /* Indicate reconnect */
-    ph->addr_info_cb (ph->addr_info_cb_cls,
-                      NULL,
-                      GNUNET_NO,
-                      bandwidth_zero,
-                      bandwidth_zero,
-                      NULL);
-  }
-  ph->backoff = GNUNET_TIME_STD_BACKOFF (ph->backoff);
-  ph->task = GNUNET_SCHEDULER_add_delayed (ph->backoff,
-                                           &reconnect_task,
-                                           ph);
-}
-
-
-/**
- * We received a peer information message.  Validate and process it.
- *
- * @param cls our context with the callback
- * @param pi the message
- * @return #GNUNET_OK if the message was well-formed
- */
-static int
-check_peer_information (void *cls,
-                        const struct PeerInformationMessage *pi)
-{
-  const char *plugin_address;
-  const char *plugin_name;
-  uint16_t plugin_address_length;
-  uint16_t plugin_name_length;
-
-  plugin_address_length = ntohs (pi->address_length);
-  plugin_name_length = ntohs (pi->plugin_name_length);
-  plugin_address = (const char *) &pi[1];
-  plugin_name = &plugin_address[plugin_address_length];
-  if ((plugin_address_length + plugin_name_length
-       + sizeof(struct PeerInformationMessage) != ntohs (pi->header.size)) ||
-      (plugin_name[plugin_name_length - 1] != '\0'))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * We received a peer information message.  Validate and process it.
- *
- * @param cls our context with the callback
- * @param pi the message
- * @return #GNUNET_OK if the message was well-formed
- */
-static void
-handle_peer_information (void *cls,
-                         const struct PeerInformationMessage *pi)
-{
-  struct GNUNET_ATS_PerformanceHandle *ph = cls;
-  const char *plugin_address;
-  const char *plugin_name;
-  struct GNUNET_HELLO_Address address;
-  uint16_t plugin_address_length;
-  int addr_active;
-  struct GNUNET_ATS_Properties prop;
-
-  if (NULL == ph->addr_info_cb)
-    return;
-  plugin_address_length = ntohs (pi->address_length);
-  addr_active = (int) ntohl (pi->address_active);
-  plugin_address = (const char *) &pi[1];
-  plugin_name = &plugin_address[plugin_address_length];
-
-  GNUNET_ATS_properties_ntoh (&prop,
-                              &pi->properties);
-  address.peer = pi->peer;
-  address.local_info = (enum GNUNET_HELLO_AddressInfo) ntohl (
-    pi->address_local_info);
-  address.address = plugin_address;
-  address.address_length = plugin_address_length;
-  address.transport_name = plugin_name;
-  ph->addr_info_cb (ph->addr_info_cb_cls,
-                    &address,
-                    addr_active,
-                    pi->bandwidth_out,
-                    pi->bandwidth_in,
-                    &prop);
-}
-
-
-/**
- * We received a reservation result message.  Validate and process it.
- *
- * @param cls our context with the callback
- * @param rr the message
- */
-static void
-handle_reservation_result (void *cls,
-                           const struct ReservationResultMessage *rr)
-{
-  struct GNUNET_ATS_PerformanceHandle *ph = cls;
-  struct GNUNET_ATS_ReservationContext *rc;
-  int32_t amount;
-
-  amount = ntohl (rr->amount);
-  rc = ph->reservation_head;
-  if (0 != GNUNET_memcmp (&rr->peer,
-                          &rc->peer))
-  {
-    GNUNET_break (0);
-    reconnect (ph);
-    return;
-  }
-  GNUNET_CONTAINER_DLL_remove (ph->reservation_head,
-                               ph->reservation_tail,
-                               rc);
-  if ((0 == amount) ||
-      (NULL != rc->rcb))
-  {
-    /* tell client if not cancelled */
-    if (NULL != rc->rcb)
-      rc->rcb (rc->rcb_cls,
-               &rr->peer,
-               amount,
-               GNUNET_TIME_relative_ntoh (rr->res_delay));
-    GNUNET_free (rc);
-    return;
-  }
-  /* amount non-zero, but client cancelled, consider undo! */
-  if (GNUNET_YES != rc->undo)
-  {
-    GNUNET_free (rc);
-    return;   /* do not try to undo failed undos or negative amounts */
-  }
-  GNUNET_free (rc);
-  (void) GNUNET_ATS_reserve_bandwidth (ph,
-                                       &rr->peer,
-                                       -amount,
-                                       NULL, NULL);
-}
-
-
-/**
- * We received a PeerInformationMessage.  Validate it.
- *
- * @param cls our context with the callback
- * @param pi the message
- * @return #GNUNET_OK if the message was well-formed
- */
-static int
-check_address_list (void *cls,
-                    const struct PeerInformationMessage *pi)
-{
-  const char *plugin_address;
-  const char *plugin_name;
-  uint16_t plugin_address_length;
-  uint16_t plugin_name_length;
-
-  plugin_address_length = ntohs (pi->address_length);
-  plugin_name_length = ntohs (pi->plugin_name_length);
-  plugin_address = (const char *) &pi[1];
-  plugin_name = &plugin_address[plugin_address_length];
-  if ((plugin_address_length + plugin_name_length
-       + sizeof(struct PeerInformationMessage) != ntohs (pi->header.size)) ||
-      (plugin_name[plugin_name_length - 1] != '\0'))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * We received a #GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE.
- * Process it.
- *
- * @param cls our context with the callback
- * @param pi the message
- */
-static void
-handle_address_list (void *cls,
-                     const struct PeerInformationMessage *pi)
-{
-  struct GNUNET_ATS_PerformanceHandle *ph = cls;
-  struct GNUNET_ATS_AddressListHandle *alh;
-  struct GNUNET_ATS_AddressListHandle *next;
-  const char *plugin_address;
-  const char *plugin_name;
-  struct GNUNET_HELLO_Address address;
-  struct GNUNET_PeerIdentity allzeros;
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_zero;
-  struct GNUNET_ATS_Properties prop;
-  uint16_t plugin_address_length;
-  uint16_t plugin_name_length;
-  uint32_t active;
-  uint32_t id;
-
-  id = ntohl (pi->id);
-  active = ntohl (pi->address_active);
-  plugin_address_length = ntohs (pi->address_length);
-  plugin_name_length = ntohs (pi->plugin_name_length);
-  plugin_address = (const char *) &pi[1];
-  plugin_name = &plugin_address[plugin_address_length];
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Received ATS_ADDRESSLIST_RESPONSE message for peer %s and plugin %s\n",
-       GNUNET_i2s (&pi->peer),
-       plugin_name);
-
-  next = ph->addresslist_head;
-  while (NULL != (alh = next))
-  {
-    next = alh->next;
-    if (alh->id == id)
-      break;
-  }
-  if (NULL == alh)
-    return; /* was canceled */
-
-  memset (&allzeros, '\0', sizeof(allzeros));
-  if ((GNUNET_YES == GNUNET_is_zero (&pi->peer)) &&
-      (0 == plugin_name_length) &&
-      (0 == plugin_address_length))
-  {
-    /* Done */
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Received last message for ATS_ADDRESSLIST_RESPONSE\n");
-    bandwidth_zero.value__ = htonl (0);
-    GNUNET_CONTAINER_DLL_remove (ph->addresslist_head,
-                                 ph->addresslist_tail,
-                                 alh);
-    if (NULL != alh->cb)
-      alh->cb (alh->cb_cls,
-               NULL,
-               GNUNET_NO,
-               bandwidth_zero,
-               bandwidth_zero,
-               NULL);
-    GNUNET_free (alh);
-    return;
-  }
-
-  address.peer = pi->peer;
-  address.address = plugin_address;
-  address.address_length = plugin_address_length;
-  address.transport_name = plugin_name;
-  if (((GNUNET_YES == alh->all_addresses) ||
-       (GNUNET_YES == active)) &&
-      (NULL != alh->cb))
-  {
-    GNUNET_ATS_properties_ntoh (&prop,
-                                &pi->properties);
-    alh->cb (alh->cb_cls,
-             &address,
-             active,
-             pi->bandwidth_out,
-             pi->bandwidth_in,
-             &prop);
-  }
-}
-
-
-/**
- * Generic error handler, called with the appropriate error code and
- * the same closure specified at the creation of the message queue.
- * Not every message queue implementation supports an error handler.
- *
- * @param cls closure with the `struct GNUNET_ATS_PerformanceHandle *`
- * @param error error code
- */
-static void
-mq_error_handler (void *cls,
-                  enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_ATS_PerformanceHandle *ph = cls;
-
-  do_reconnect (ph);
-}
-
-
-/**
- * Re-establish the connection to the ATS service.
- *
- * @param ph handle to use to re-connect.
- */
-static void
-reconnect (struct GNUNET_ATS_PerformanceHandle *ph)
-{
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_var_size (peer_information,
-                           GNUNET_MESSAGE_TYPE_ATS_PEER_INFORMATION,
-                           struct PeerInformationMessage,
-                           ph),
-    GNUNET_MQ_hd_fixed_size (reservation_result,
-                             GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT,
-                             struct ReservationResultMessage,
-                             ph),
-    GNUNET_MQ_hd_var_size (address_list,
-                           GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE,
-                           struct PeerInformationMessage,
-                           ph),
-    GNUNET_MQ_handler_end ()
-  };
-  struct GNUNET_MQ_Envelope *env;
-  struct ClientStartMessage *init;
-
-  GNUNET_assert (NULL == ph->mq);
-  ph->mq = GNUNET_CLIENT_connect (ph->cfg,
-                                  "ats",
-                                  handlers,
-                                  &mq_error_handler,
-                                  ph);
-  if (NULL == ph->mq)
-    return;
-  env = GNUNET_MQ_msg (init,
-                       GNUNET_MESSAGE_TYPE_ATS_START);
-  init->start_flag = htonl ((NULL == ph->addr_info_cb)
-                            ? START_FLAG_PERFORMANCE_NO_PIC
-                            : START_FLAG_PERFORMANCE_WITH_PIC);
-  GNUNET_MQ_send (ph->mq,
-                  env);
-}
-
-
-/**
- * Get handle to access performance API of the ATS subsystem.
- *
- * @param cfg configuration to use
- * @param addr_info_cb callback called when performance characteristics for
- *      an address change
- * @param addr_info_cb_cls closure for @a addr_info_cb
- * @return ats performance context
- */
-struct GNUNET_ATS_PerformanceHandle *
-GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                             GNUNET_ATS_AddressInformationCallback 
addr_info_cb,
-                             void *addr_info_cb_cls)
-{
-  struct GNUNET_ATS_PerformanceHandle *ph;
-
-  ph = GNUNET_new (struct GNUNET_ATS_PerformanceHandle);
-  ph->cfg = cfg;
-  ph->addr_info_cb = addr_info_cb;
-  ph->addr_info_cb_cls = addr_info_cb_cls;
-  reconnect (ph);
-  if (NULL == ph->mq)
-  {
-    GNUNET_free (ph);
-    return NULL;
-  }
-  return ph;
-}
-
-
-/**
- * Client is done using the ATS performance subsystem, release resources.
- *
- * @param ph handle
- */
-void
-GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph)
-{
-  struct GNUNET_ATS_ReservationContext *rc;
-  struct GNUNET_ATS_AddressListHandle *alh;
-
-  while (NULL != (alh = ph->addresslist_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (ph->addresslist_head,
-                                 ph->addresslist_tail,
-                                 alh);
-    GNUNET_free (alh);
-  }
-  while (NULL != (rc = ph->reservation_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (ph->reservation_head,
-                                 ph->reservation_tail,
-                                 rc);
-    GNUNET_break (NULL == rc->rcb);
-    GNUNET_free (rc);
-  }
-  if (NULL != ph->task)
-  {
-    GNUNET_SCHEDULER_cancel (ph->task);
-    ph->task = NULL;
-  }
-  if (NULL != ph->mq)
-  {
-    GNUNET_MQ_destroy (ph->mq);
-    ph->mq = NULL;
-  }
-  GNUNET_free (ph);
-}
-
-
-struct GNUNET_ATS_ReservationContext *
-GNUNET_ATS_reserve_bandwidth (struct GNUNET_ATS_PerformanceHandle *ph,
-                              const struct GNUNET_PeerIdentity *peer,
-                              int32_t amount,
-                              GNUNET_ATS_ReservationCallback rcb,
-                              void *rcb_cls)
-{
-  struct GNUNET_ATS_ReservationContext *rc;
-  struct GNUNET_MQ_Envelope *env;
-  struct ReservationRequestMessage *m;
-
-  if (NULL == ph->mq)
-    return NULL;
-  rc = GNUNET_new (struct GNUNET_ATS_ReservationContext);
-  rc->size = amount;
-  rc->peer = *peer;
-  rc->rcb = rcb;
-  rc->rcb_cls = rcb_cls;
-  if ((NULL != rcb) &&
-      (amount > 0))
-    rc->undo = GNUNET_YES;
-  GNUNET_CONTAINER_DLL_insert_tail (ph->reservation_head,
-                                    ph->reservation_tail,
-                                    rc);
-  env = GNUNET_MQ_msg (m,
-                       GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST);
-  m->amount = htonl (amount);
-  m->peer = *peer;
-  GNUNET_MQ_send (ph->mq,
-                  env);
-  return rc;
-}
-
-
-void
-GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc)
-{
-  rc->rcb = NULL;
-}
-
-
-struct GNUNET_ATS_AddressListHandle*
-GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *ph,
-                                       const struct GNUNET_PeerIdentity *peer,
-                                       int all,
-                                       GNUNET_ATS_AddressInformationCallback
-                                       infocb,
-                                       void *infocb_cls)
-{
-  struct GNUNET_ATS_AddressListHandle *alh;
-  struct GNUNET_MQ_Envelope *env;
-  struct AddressListRequestMessage *m;
-
-  if (NULL == ph->mq)
-    return NULL;
-  if (NULL == infocb)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  alh = GNUNET_new (struct GNUNET_ATS_AddressListHandle);
-  alh->id = ph->id++;
-  alh->cb = infocb;
-  alh->cb_cls = infocb_cls;
-  alh->ph = ph;
-  alh->all_addresses = all;
-  if (NULL == peer)
-  {
-    alh->all_peers = GNUNET_YES;
-  }
-  else
-  {
-    alh->all_peers = GNUNET_NO;
-    alh->peer = *peer;
-  }
-  GNUNET_CONTAINER_DLL_insert (ph->addresslist_head,
-                               ph->addresslist_tail,
-                               alh);
-  env = GNUNET_MQ_msg (m,
-                       GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST);
-  m->all = htonl (all);
-  m->id = htonl (alh->id);
-  if (NULL != peer)
-    m->peer = *peer;
-  GNUNET_MQ_send (ph->mq,
-                  env);
-  return alh;
-}
-
-
-void
-GNUNET_ATS_performance_list_addresses_cancel (struct
-                                              GNUNET_ATS_AddressListHandle 
*alh)
-{
-  struct GNUNET_ATS_PerformanceHandle *ph = alh->ph;
-
-  GNUNET_CONTAINER_DLL_remove (ph->addresslist_head,
-                               ph->addresslist_tail,
-                               alh);
-  GNUNET_free (alh);
-}
-
-
-const char *
-GNUNET_ATS_print_preference_type (enum GNUNET_ATS_PreferenceKind type)
-{
-  const char *prefs[] = GNUNET_ATS_PreferenceTypeString;
-
-  if (type < GNUNET_ATS_PREFERENCE_END)
-    return prefs[type];
-  return NULL;
-}
-
-
-void
-GNUNET_ATS_performance_change_preference (struct
-                                          GNUNET_ATS_PerformanceHandle *ph,
-                                          const struct
-                                          GNUNET_PeerIdentity *peer,
-                                          ...)
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct ChangePreferenceMessage *m;
-  uint32_t count;
-  struct PreferenceInformation *pi;
-  va_list ap;
-  enum GNUNET_ATS_PreferenceKind kind;
-
-  if (NULL == ph->mq)
-    return;
-  count = 0;
-  va_start (ap, peer);
-  while (GNUNET_ATS_PREFERENCE_END !=
-         (kind = GNUNET_VA_ARG_ENUM (ap, GNUNET_ATS_PreferenceKind)))
-  {
-    switch (kind)
-    {
-    case GNUNET_ATS_PREFERENCE_BANDWIDTH:
-      count++;
-      (void) va_arg (ap, double);
-      break;
-
-    case GNUNET_ATS_PREFERENCE_LATENCY:
-      count++;
-      (void) va_arg (ap, double);
-      break;
-
-    default:
-      GNUNET_assert (0);
-    }
-  }
-  va_end (ap);
-  env = GNUNET_MQ_msg_extra (m,
-                             count * sizeof(struct PreferenceInformation),
-                             GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE);
-  m->num_preferences = htonl (count);
-  m->peer = *peer;
-  pi = (struct PreferenceInformation *) &m[1];
-  count = 0;
-  va_start (ap, peer);
-  while (GNUNET_ATS_PREFERENCE_END != (kind =
-                                         GNUNET_VA_ARG_ENUM (ap,
-                                                             
GNUNET_ATS_PreferenceKind)))
-  {
-    pi[count].preference_kind = htonl (kind);
-    switch (kind)
-    {
-    case GNUNET_ATS_PREFERENCE_BANDWIDTH:
-      pi[count].preference_value = (float) va_arg (ap, double);
-
-      count++;
-      break;
-
-    case GNUNET_ATS_PREFERENCE_LATENCY:
-      pi[count].preference_value = (float) va_arg (ap, double);
-
-      count++;
-      break;
-
-    default:
-      GNUNET_assert (0);
-    }
-  }
-  va_end (ap);
-  GNUNET_MQ_send (ph->mq,
-                  env);
-}
-
-
-/**
- * Send feedback to ATS on how good a the requirements for a peer and a
- * preference is satisfied by ATS
- *
- * @param ph performance handle
- * @param scope the time interval this valid for: [now - scope .. now]
- * @param peer identifies the peer
- * @param ... #GNUNET_ATS_PREFERENCE_END-terminated specification of the 
desired changes
- */
-void
-GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph,
-                                      const struct GNUNET_PeerIdentity *peer,
-                                      const struct GNUNET_TIME_Relative scope,
-                                      ...)
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct FeedbackPreferenceMessage *m;
-  uint32_t count;
-  struct PreferenceInformation *pi;
-  va_list ap;
-  enum GNUNET_ATS_PreferenceKind kind;
-
-  if (NULL == ph->mq)
-    return;
-  count = 0;
-  va_start (ap, scope);
-  while (GNUNET_ATS_PREFERENCE_END !=
-         (kind = GNUNET_VA_ARG_ENUM (ap, GNUNET_ATS_PreferenceKind)))
-  {
-    switch (kind)
-    {
-    case GNUNET_ATS_PREFERENCE_BANDWIDTH:
-      count++;
-      (void) va_arg (ap, double);
-      break;
-
-    case GNUNET_ATS_PREFERENCE_LATENCY:
-      count++;
-      (void) va_arg (ap, double);
-      break;
-
-    default:
-      GNUNET_assert (0);
-    }
-  }
-  va_end (ap);
-  env = GNUNET_MQ_msg_extra (m,
-                             count * sizeof(struct PreferenceInformation),
-                             GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK);
-  m->scope = GNUNET_TIME_relative_hton (scope);
-  m->num_feedback = htonl (count);
-  m->peer = *peer;
-  pi = (struct PreferenceInformation *) &m[1];
-  count = 0;
-  va_start (ap, scope);
-  while (GNUNET_ATS_PREFERENCE_END != (kind =
-                                         GNUNET_VA_ARG_ENUM (ap,
-                                                             
GNUNET_ATS_PreferenceKind)))
-  {
-    pi[count].preference_kind = htonl (kind);
-    switch (kind)
-    {
-    case GNUNET_ATS_PREFERENCE_BANDWIDTH:
-      pi[count].preference_value = (float) va_arg (ap, double);
-
-      count++;
-      break;
-
-    case GNUNET_ATS_PREFERENCE_LATENCY:
-      pi[count].preference_value = (float) va_arg (ap, double);
-
-      count++;
-      break;
-
-    default:
-      GNUNET_assert (0);
-    }
-  }
-  va_end (ap);
-  GNUNET_MQ_send (ph->mq,
-                  env);
-}
-
-
-/* end of ats_api_performance.c */
diff --git a/src/ats/ats_api_scanner.c b/src/ats/ats_api_scanner.c
deleted file mode 100644
index 82114f888..000000000
--- a/src/ats/ats_api_scanner.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/ats_api_scanner.c
- * @brief LAN interface scanning to determine IPs in LAN
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_ats_service.h"
-
-/**
- * Convert ATS properties from host to network byte order.
- *
- * @param nbo[OUT] value written
- * @param hbo value read
- */
-void
-GNUNET_ATS_properties_hton (struct GNUNET_ATS_PropertiesNBO *nbo,
-                            const struct GNUNET_ATS_Properties *hbo)
-{
-  nbo->utilization_out = htonl (hbo->utilization_out);
-  nbo->utilization_in = htonl (hbo->utilization_in);
-  nbo->scope = htonl ((uint32_t) hbo->scope);
-  nbo->distance = htonl (hbo->distance);
-  nbo->delay = GNUNET_TIME_relative_hton (hbo->delay);
-}
-
-
-/**
- * Convert ATS properties from network to host byte order.
- *
- * @param hbo[OUT] value written
- * @param nbo value read
- */
-void
-GNUNET_ATS_properties_ntoh (struct GNUNET_ATS_Properties *hbo,
-                            const struct GNUNET_ATS_PropertiesNBO *nbo)
-{
-  hbo->utilization_out = ntohl (nbo->utilization_out);
-  hbo->utilization_in = ntohl (nbo->utilization_in);
-  hbo->scope = ntohl ((uint32_t) nbo->scope);
-  hbo->distance = ntohl (nbo->distance);
-  hbo->delay = GNUNET_TIME_relative_ntoh (nbo->delay);
-}
-
-
-/* end of ats_api_scanner.c */
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c
deleted file mode 100644
index 6fb61b2e8..000000000
--- a/src/ats/ats_api_scheduling.c
+++ /dev/null
@@ -1,781 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/ats_api_scheduling.c
- * @brief automatic transport selection and outbound bandwidth determination
- * @author Christian Grothoff
- * @author Matthias Wachs
- *
- * TODO:
- * - we could avoid a linear scan over the
- *   active addresses in some cases, so if
- *   there is need, we can still optimize here
- * - we might want to split off the logic to
- *   determine LAN vs. WAN, as it has nothing
- *   to do with accessing the ATS service.
- */
-#include "platform.h"
-#include "gnunet_ats_service.h"
-#include "ats.h"
-
-/**
- * How frequently do we scan the interfaces for changes to the addresses?
- */
-#define INTERFACE_PROCESSING_INTERVAL GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_MINUTES, 2)
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "ats-scheduling-api", 
__VA_ARGS__)
-
-/**
- * Session ID we use if there is no session / slot.
- */
-#define NOT_FOUND 0
-
-
-/**
- * Information we track per address, incoming or outgoing.  It also
- * doesn't matter if we have a session, any address that ATS is
- * allowed to suggest right now should be tracked.
- */
-struct GNUNET_ATS_AddressRecord
-{
-  /**
-   * Scheduling handle this address record belongs to.
-   */
-  struct GNUNET_ATS_SchedulingHandle *sh;
-
-  /**
-   * Address data.
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Session handle.  NULL if we have an address but no
-   * active session for this address.
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * Performance data about the address.
-   */
-  struct GNUNET_ATS_PropertiesNBO properties;
-
-  /**
-   * Which slot (index) in the session array does
-   * this record correspond to?
-   * FIXME: a linear search on this is really crappy!
-   * Maybe switch to a 64-bit global counter and be
-   * done with it?  Or does that then cause too much
-   * trouble on the ATS-service side?
-   */
-  uint32_t slot;
-
-  /**
-   * We're about to destroy this address record, just ATS does
-   * not know this yet.  Once ATS confirms its destruction,
-   * we can clean up.
-   */
-  int in_destroy;
-};
-
-
-/**
- * Handle to the ATS subsystem for bandwidth/transport scheduling information.
- */
-struct GNUNET_ATS_SchedulingHandle
-{
-  /**
-   * Our configuration.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Callback to invoke on suggestions.
-   */
-  GNUNET_ATS_AddressSuggestionCallback suggest_cb;
-
-  /**
-   * Closure for @e suggest_cb.
-   */
-  void *suggest_cb_cls;
-
-  /**
-   * Message queue for sending requests to the ATS service.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Array of session objects (we need to translate them to numbers and back
-   * for the protocol; the offset in the array is the session number on the
-   * network).  Index 0 is always NULL and reserved to represent the NULL 
pointer.
-   * Unused entries are also NULL.
-   */
-  struct GNUNET_ATS_AddressRecord **session_array;
-
-  /**
-   * Task to trigger reconnect.
-   */
-  struct GNUNET_SCHEDULER_Task *task;
-
-  /**
-   * Reconnect backoff delay.
-   */
-  struct GNUNET_TIME_Relative backoff;
-
-  /**
-   * Size of the @e session_array.
-   */
-  unsigned int session_array_size;
-};
-
-
-/**
- * Re-establish the connection to the ATS service.
- *
- * @param sh handle to use to re-connect.
- */
-static void
-reconnect (struct GNUNET_ATS_SchedulingHandle *sh);
-
-
-/**
- * Re-establish the connection to the ATS service.
- *
- * @param cls handle to use to re-connect.
- */
-static void
-reconnect_task (void *cls)
-{
-  struct GNUNET_ATS_SchedulingHandle *sh = cls;
-
-  sh->task = NULL;
-  reconnect (sh);
-}
-
-
-/**
- * Disconnect from ATS and then reconnect.
- *
- * @param sh our handle
- */
-static void
-force_reconnect (struct GNUNET_ATS_SchedulingHandle *sh)
-{
-  if (NULL != sh->mq)
-  {
-    GNUNET_MQ_destroy (sh->mq);
-    sh->mq = NULL;
-  }
-  sh->suggest_cb (sh->suggest_cb_cls,
-                  NULL, NULL, NULL,
-                  GNUNET_BANDWIDTH_ZERO,
-                  GNUNET_BANDWIDTH_ZERO);
-  sh->backoff = GNUNET_TIME_STD_BACKOFF (sh->backoff);
-  sh->task = GNUNET_SCHEDULER_add_delayed (sh->backoff,
-                                           &reconnect_task,
-                                           sh);
-}
-
-
-/**
- * Find the session object corresponding to the given session ID.
- *
- * @param sh our handle
- * @param session_id current session ID
- * @param peer peer the session belongs to
- * @return the session object (or NULL)
- */
-static struct GNUNET_ATS_AddressRecord *
-find_session (struct GNUNET_ATS_SchedulingHandle *sh,
-              uint32_t session_id,
-              const struct GNUNET_PeerIdentity *peer)
-{
-  struct GNUNET_ATS_AddressRecord *ar;
-
-  if (session_id >= sh->session_array_size)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  if (0 == session_id)
-    return NULL;
-  ar = sh->session_array[session_id];
-  if (NULL == ar)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  if (NULL == ar->address)
-  {
-    /* address was destroyed in the meantime, this can happen
-       as we communicate asynchronously with the ATS service. */
-    return NULL;
-  }
-  if (0 != GNUNET_memcmp (peer,
-                          &ar->address->peer))
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  return ar;
-}
-
-
-/**
- * Get an available session ID.
- *
- * @param sh our handle
- * @return an unused slot, but never NOT_FOUND (0)
- */
-static uint32_t
-find_empty_session_slot (struct GNUNET_ATS_SchedulingHandle *sh)
-{
-  static uint32_t off;
-  uint32_t i;
-
-  GNUNET_assert (0 != sh->session_array_size);
-  i = 0;
-  while (((NOT_FOUND == off) ||
-          (NULL != sh->session_array[off % sh->session_array_size])) &&
-         (i < sh->session_array_size))
-  {
-    off++;
-    i++;
-  }
-  if ((NOT_FOUND != off % sh->session_array_size) &&
-      (NULL == sh->session_array[off % sh->session_array_size]))
-    return off;
-  i = sh->session_array_size;
-  GNUNET_array_grow (sh->session_array,
-                     sh->session_array_size,
-                     sh->session_array_size * 2);
-  return i;
-}
-
-
-/**
- * Get the ID for the given session object.
- *
- * @param sh our handle
- * @param session session object
- * @param address the address we are looking for
- * @return the session id or NOT_FOUND for error
- */
-static uint32_t
-find_session_id (struct GNUNET_ATS_SchedulingHandle *sh,
-                 struct GNUNET_ATS_Session *session,
-                 const struct GNUNET_HELLO_Address *address)
-{
-  uint32_t i;
-
-  if (NULL == address)
-  {
-    GNUNET_break (0);
-    return NOT_FOUND;
-  }
-  for (i = 1; i < sh->session_array_size; i++)
-    if ((NULL != sh->session_array[i]) &&
-        (GNUNET_NO == sh->session_array[i]->in_destroy) &&
-        ((session == sh->session_array[i]->session) ||
-         (NULL == sh->session_array[i]->session)) &&
-        (0 == GNUNET_memcmp (&address->peer,
-                             &sh->session_array[i]->address->peer)) &&
-        (0 == GNUNET_HELLO_address_cmp (address,
-                                        sh->session_array[i]->address)))
-      return i;
-  return NOT_FOUND;
-}
-
-
-/**
- * Release the session slot from the session table (ATS service is
- * also done using it).
- *
- * @param sh our handle
- * @param session_id identifies session that is no longer valid
- */
-static void
-release_session (struct GNUNET_ATS_SchedulingHandle *sh,
-                 uint32_t session_id)
-{
-  struct GNUNET_ATS_AddressRecord *ar;
-
-  if (NOT_FOUND == session_id)
-    return;
-  if (session_id >= sh->session_array_size)
-  {
-    GNUNET_break (0);
-    force_reconnect (sh);
-    return;
-  }
-  /* this slot should have been removed from remove_session before */
-  ar = sh->session_array[session_id];
-  if (NULL != ar->session)
-  {
-    GNUNET_break (0);
-    force_reconnect (sh);
-    return;
-  }
-  GNUNET_HELLO_address_free (ar->address);
-  GNUNET_free (ar);
-  sh->session_array[session_id] = NULL;
-}
-
-
-/**
- * Type of a function to call when we receive a session release
- * message from the service.
- *
- * @param cls the `struct GNUNET_ATS_SchedulingHandle`
- * @param srm message received
- */
-static void
-handle_ats_session_release (void *cls,
-                            const struct GNUNET_ATS_SessionReleaseMessage *srm)
-{
-  struct GNUNET_ATS_SchedulingHandle *sh = cls;
-
-  /* Note: peer field in srm not necessary right now,
-     but might be good to have in the future */
-  release_session (sh,
-                   ntohl (srm->session_id));
-}
-
-
-/**
- * Type of a function to call when we receive a address suggestion
- * message from the service.
- *
- * @param cls the `struct GNUNET_ATS_SchedulingHandle`
- * @param m message received
- */
-static void
-handle_ats_address_suggestion (void *cls,
-                               const struct AddressSuggestionMessage *m)
-{
-  struct GNUNET_ATS_SchedulingHandle *sh = cls;
-  struct GNUNET_ATS_AddressRecord *ar;
-  uint32_t session_id;
-
-  session_id = ntohl (m->session_id);
-  if (0 == session_id)
-  {
-    GNUNET_break (0);
-    force_reconnect (sh);
-    return;
-  }
-  ar = find_session (sh,
-                     session_id,
-                     &m->peer);
-  if (NULL == ar)
-  {
-    GNUNET_break (0);
-    force_reconnect (sh);
-    return;
-  }
-  if (NULL == sh->suggest_cb)
-    return;
-  if (GNUNET_YES == ar->in_destroy)
-  {
-    /* ignore suggestion, as this address is dying, unless BW is 0,
-       in that case signal 'disconnect' via BW 0 */
-    if ((0 == ntohl (m->bandwidth_out.value__)) &&
-        (0 == ntohl (m->bandwidth_in.value__)))
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "ATS suggests disconnect from peer `%s' with BW %u/%u\n",
-           GNUNET_i2s (&ar->address->peer),
-           (unsigned int) ntohl (m->bandwidth_out.value__),
-           (unsigned int) ntohl (m->bandwidth_in.value__));
-      sh->suggest_cb (sh->suggest_cb_cls,
-                      &m->peer,
-                      NULL,
-                      NULL,
-                      m->bandwidth_out,
-                      m->bandwidth_in);
-    }
-    return;
-  }
-  if ((NULL == ar->session) &&
-      (GNUNET_HELLO_address_check_option (ar->address,
-                                          GNUNET_HELLO_ADDRESS_INFO_INBOUND)))
-  {
-    GNUNET_break (0);
-    return;
-  }
-  sh->backoff = GNUNET_TIME_UNIT_ZERO;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "ATS suggests address slot %u for peer `%s' using plugin %s\n",
-       ar->slot,
-       GNUNET_i2s (&ar->address->peer),
-       ar->address->transport_name);
-  sh->suggest_cb (sh->suggest_cb_cls,
-                  &m->peer,
-                  ar->address,
-                  ar->session,
-                  m->bandwidth_out,
-                  m->bandwidth_in);
-}
-
-
-/**
- * We encountered an error handling the MQ to the
- * ATS service.  Reconnect.
- *
- * @param cls the `struct GNUNET_ATS_SchedulingHandle`
- * @param error details about the error
- */
-static void
-error_handler (void *cls,
-               enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_ATS_SchedulingHandle *sh = cls;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "ATS connection died (code %d), reconnecting\n",
-       (int) error);
-  force_reconnect (sh);
-}
-
-
-/**
- * Generate and transmit the `struct AddressAddMessage` for the given
- * address record.
- *
- * @param sh the scheduling handle to use for transmission
- * @param ar the address to inform the ATS service about
- */
-static void
-send_add_address_message (struct GNUNET_ATS_SchedulingHandle *sh,
-                          const struct GNUNET_ATS_AddressRecord *ar)
-{
-  struct GNUNET_MQ_Envelope *ev;
-  struct AddressAddMessage *m;
-  char *pm;
-  size_t namelen;
-  size_t msize;
-
-  if (NULL == sh->mq)
-    return; /* disconnected, skip for now */
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != ar->properties.scope);
-  namelen = strlen (ar->address->transport_name) + 1;
-  msize = ar->address->address_length + namelen;
-  ev = GNUNET_MQ_msg_extra (m, msize, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD);
-  m->peer = ar->address->peer;
-  m->address_length = htons (ar->address->address_length);
-  m->address_local_info = htonl ((uint32_t) ar->address->local_info);
-  m->plugin_name_length = htons (namelen);
-  m->session_id = htonl (ar->slot);
-  m->properties = ar->properties;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Adding address for peer `%s', plugin `%s', session %p slot %u\n",
-       GNUNET_i2s (&ar->address->peer),
-       ar->address->transport_name,
-       ar->session,
-       ar->slot);
-  pm = (char *) &m[1];
-  GNUNET_memcpy (pm,
-                 ar->address->address,
-                 ar->address->address_length);
-  if (NULL != ar->address->transport_name)
-    GNUNET_memcpy (&pm[ar->address->address_length],
-                   ar->address->transport_name,
-                   namelen);
-  GNUNET_MQ_send (sh->mq, ev);
-}
-
-
-/**
- * Re-establish the connection to the ATS service.
- *
- * @param sh handle to use to re-connect.
- */
-static void
-reconnect (struct GNUNET_ATS_SchedulingHandle *sh)
-{
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_fixed_size (ats_session_release,
-                             GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE,
-                             struct GNUNET_ATS_SessionReleaseMessage,
-                             sh),
-    GNUNET_MQ_hd_fixed_size (ats_address_suggestion,
-                             GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION,
-                             struct AddressSuggestionMessage,
-                             sh),
-    GNUNET_MQ_handler_end ()
-  };
-  struct GNUNET_MQ_Envelope *ev;
-  struct ClientStartMessage *init;
-  unsigned int i;
-  struct GNUNET_ATS_AddressRecord *ar;
-
-  GNUNET_assert (NULL == sh->mq);
-  sh->mq = GNUNET_CLIENT_connect (sh->cfg,
-                                  "ats",
-                                  handlers,
-                                  &error_handler,
-                                  sh);
-  if (NULL == sh->mq)
-  {
-    GNUNET_break (0);
-    force_reconnect (sh);
-    return;
-  }
-  ev = GNUNET_MQ_msg (init,
-                      GNUNET_MESSAGE_TYPE_ATS_START);
-  init->start_flag = htonl (START_FLAG_SCHEDULING);
-  GNUNET_MQ_send (sh->mq, ev);
-  if (NULL == sh->mq)
-    return;
-  for (i = 0; i < sh->session_array_size; i++)
-  {
-    ar = sh->session_array[i];
-    if (NULL == ar)
-      continue;
-    send_add_address_message (sh, ar);
-    if (NULL == sh->mq)
-      return;
-  }
-}
-
-
-struct GNUNET_ATS_SchedulingHandle *
-GNUNET_ATS_scheduling_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                            GNUNET_ATS_AddressSuggestionCallback suggest_cb,
-                            void *suggest_cb_cls)
-{
-  struct GNUNET_ATS_SchedulingHandle *sh;
-
-  sh = GNUNET_new (struct GNUNET_ATS_SchedulingHandle);
-  sh->cfg = cfg;
-  sh->suggest_cb = suggest_cb;
-  sh->suggest_cb_cls = suggest_cb_cls;
-  GNUNET_array_grow (sh->session_array,
-                     sh->session_array_size,
-                     4);
-  reconnect (sh);
-  return sh;
-}
-
-
-/**
- * Client is done with ATS scheduling, release resources.
- *
- * @param sh handle to release
- */
-void
-GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh)
-{
-  struct GNUNET_ATS_AddressRecord *ar;
-  unsigned int i;
-
-  if (NULL != sh->mq)
-  {
-    GNUNET_MQ_destroy (sh->mq);
-    sh->mq = NULL;
-  }
-  if (NULL != sh->task)
-  {
-    GNUNET_SCHEDULER_cancel (sh->task);
-    sh->task = NULL;
-  }
-  for (i = 0; i < sh->session_array_size; i++)
-  {
-    if (NULL != (ar = sh->session_array[i]))
-    {
-      GNUNET_HELLO_address_free (ar->address);
-      GNUNET_free (ar);
-      sh->session_array[i] = NULL;
-    }
-  }
-  GNUNET_array_grow (sh->session_array,
-                     sh->session_array_size,
-                     0);
-  GNUNET_free (sh);
-}
-
-
-/**
- * We have a new address ATS should know. Addresses have to be added
- * with this function before they can be: updated, set in use and
- * destroyed.
- *
- * @param sh handle
- * @param address the address
- * @param session session handle, can be NULL
- * @param prop performance data for the address
- * @return handle to the address representation inside ATS, NULL
- *         on error (i.e. ATS knows this exact address already)
- */
-struct GNUNET_ATS_AddressRecord *
-GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
-                        const struct GNUNET_HELLO_Address *address,
-                        struct GNUNET_ATS_Session *session,
-                        const struct GNUNET_ATS_Properties *prop)
-{
-  struct GNUNET_ATS_AddressRecord *ar;
-  size_t namelen;
-  size_t msize;
-  uint32_t s;
-
-  if (NULL == address)
-  {
-    /* we need a valid address */
-    GNUNET_break (0);
-    return NULL;
-  }
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
-  namelen = strlen (address->transport_name) + 1;
-  msize = address->address_length + namelen;
-  if ((msize + sizeof(struct AddressUpdateMessage) >=
-       GNUNET_MAX_MESSAGE_SIZE) ||
-      (address->address_length >= GNUNET_MAX_MESSAGE_SIZE) ||
-      (namelen >= GNUNET_MAX_MESSAGE_SIZE))
-  {
-    /* address too large for us, this should not happen */
-    GNUNET_break (0);
-    return NULL;
-  }
-
-  if (NOT_FOUND !=
-      find_session_id (sh,
-                       session,
-                       address))
-  {
-    /* Already existing, nothing todo, but this should not happen */
-    GNUNET_break (0);
-    return NULL;
-  }
-  s = find_empty_session_slot (sh);
-  ar = GNUNET_new (struct GNUNET_ATS_AddressRecord);
-  ar->sh = sh;
-  ar->slot = s;
-  ar->session = session;
-  ar->address = GNUNET_HELLO_address_copy (address);
-  GNUNET_ATS_properties_hton (&ar->properties,
-                              prop);
-  sh->session_array[s] = ar;
-  send_add_address_message (sh, ar);
-  return ar;
-}
-
-
-/**
- * An address was used to initiate a session.
- *
- * @param ar address record to update information for
- * @param session session handle
- */
-void
-GNUNET_ATS_address_add_session (struct GNUNET_ATS_AddressRecord *ar,
-                                struct GNUNET_ATS_Session *session)
-{
-  GNUNET_break (NULL == ar->session);
-  ar->session = session;
-}
-
-
-int
-GNUNET_ATS_address_del_session (struct GNUNET_ATS_AddressRecord *ar,
-                                struct GNUNET_ATS_Session *session)
-{
-  GNUNET_assert (session == ar->session);
-  ar->session = NULL;
-  if (GNUNET_HELLO_address_check_option (ar->address,
-                                         GNUNET_HELLO_ADDRESS_INFO_INBOUND))
-  {
-    GNUNET_ATS_address_destroy (ar);
-    return GNUNET_YES;
-  }
-  return GNUNET_NO;
-}
-
-
-/**
- * We have updated performance statistics for a given address.  Note
- * that this function can be called for addresses that are currently
- * in use as well as addresses that are valid but not actively in use.
- * Furthermore, the peer may not even be connected to us right now (in
- * which case the call may be ignored or the information may be stored
- * for later use).  Update bandwidth assignments.
- *
- * @param ar address record to update information for
- * @param prop performance data for the address
- */
-void
-GNUNET_ATS_address_update (struct GNUNET_ATS_AddressRecord *ar,
-                           const struct GNUNET_ATS_Properties *prop)
-{
-  struct GNUNET_ATS_SchedulingHandle *sh = ar->sh;
-  struct GNUNET_MQ_Envelope *ev;
-  struct AddressUpdateMessage *m;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Updating address for peer `%s', plugin `%s', session %p slot %u\n",
-       GNUNET_i2s (&ar->address->peer),
-       ar->address->transport_name,
-       ar->session,
-       ar->slot);
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
-  GNUNET_ATS_properties_hton (&ar->properties,
-                              prop);
-  if (NULL == sh->mq)
-    return; /* disconnected, skip for now */
-  ev = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE);
-  m->session_id = htonl (ar->slot);
-  m->peer = ar->address->peer;
-  m->properties = ar->properties;
-  GNUNET_MQ_send (sh->mq,
-                  ev);
-}
-
-
-/**
- * An address got destroyed, stop using it as a valid address.
- *
- * @param ar address to destroy
- */
-void
-GNUNET_ATS_address_destroy (struct GNUNET_ATS_AddressRecord *ar)
-{
-  struct GNUNET_ATS_SchedulingHandle *sh = ar->sh;
-  struct GNUNET_MQ_Envelope *ev;
-  struct AddressDestroyedMessage *m;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Deleting address for peer `%s', plugin `%s', slot %u session %p\n",
-       GNUNET_i2s (&ar->address->peer),
-       ar->address->transport_name,
-       ar->slot,
-       ar->session);
-  GNUNET_break (NULL == ar->session);
-  ar->session = NULL;
-  ar->in_destroy = GNUNET_YES;
-  if (NULL == sh->mq)
-    return;
-  ev = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED);
-  m->session_id = htonl (ar->slot);
-  m->peer = ar->address->peer;
-  GNUNET_MQ_send (sh->mq, ev);
-}
-
-
-/* end of ats_api_scheduling.c */
diff --git a/src/ats/experiments/example.exp b/src/ats/experiments/example.exp
deleted file mode 100644
index a490e5ec6..000000000
--- a/src/ats/experiments/example.exp
+++ /dev/null
@@ -1,104 +0,0 @@
-[experiment]
-name = test
-max_duration = 15 s
-log_freq = 1000 ms
-cfg_file = experiments/gnunet_ats_sim_default.conf
-log_output_dir = data/
-log_append_time_stamp = no
-  
-[episode-0]
-# Setup addresses
-
-# operations = address_add, address_del, start_set_property, 
stop_set_property, 
-# start_set_preference, stop_preference, start_request, stop_request
-duration = 0
-op-0-operation = address_add
-op-0-address-id = 0
-op-0-peer-id = 0
-op-0-address-session = 0
-op-0-address-network = 0
-op-0-address = 0_0_test
-op-0-plugin = test
-
-op-1-operation = address_add
-op-1-address-id = 1
-op-1-peer-id = 1
-op-1-address-session = 0
-op-1-address-network = 0
-op-1-address = 1_1_test
-op-1-plugin = test
-
-op-2-operation = start_request
-op-2-peer-id = 0
-
-op-3-operation = start_request
-op-3-peer-id = 1
-
-[episode-1]
-# Set delay
-duration = 5 s
-
-op-0-operation = start_set_property
-op-0-address-id = 0
-op-0-peer-id = 0
-# constant, linear, sinus, random
-op-0-gen-type = random
-op-0-base-rate= 10000
-op-0-max-rate = 20000
-op-0-frequency = 1000 ms
-# bandwidth, latency
-# "TERMINATOR", "UTILIZATION_UP", "UTILIZATION_DOWN", 
"UTILIZATION_PAYLOAD_UP", "UTILIZATION_PAYLOAD_DOWN", "NETWORK_TYPE", "DELAY", 
"DISTANCE", "COST_WAN", "COST_LAN", "COST_WLAN"
-op-0-property = DELAY  
-
-op-1-operation = start_set_property
-op-1-address-id = 1
-op-1-peer-id = 1
-# constant, linear, sinus, random
-op-1-gen-type = constant
-op-1-base-rate= 1
-op-1-max-rate = 1
-op-1-frequency = 1000 ms
-# bandwidth, latency
-# "TERMINATOR", "UTILIZATION_UP", "UTILIZATION_DOWN", 
"UTILIZATION_PAYLOAD_UP", "UTILIZATION_PAYLOAD_DOWN", "NETWORK_TYPE", "DELAY", 
"DISTANCE", "COST_WAN", "COST_LAN", "COST_WLAN"
-op-1-property = DELAY  
-
-
-[episode-2]
-# Shutdown
-duration = 2 s
-op-0-operation = stop_set_property
-op-0-address-id = 0
-op-0-peer-id = 0
-op-0-property = DELAY
-
-op-1-operation = stop_set_property
-op-1-address-id = 1
-op-1-peer-id = 1
-op-1-property = DELAY
-
-[episode-3]
-# Shutdown
-duration = 2 s
-
-op-0-operation = stop_request
-op-0-peer-id = 0  
-
-op-1-operation = stop_request
-op-1-peer-id = 1
-
-op-2-operation = address_del
-op-2-address-id = 0
-op-2-peer-id = 0
-op-2-address-session = 0
-op-2-address-network = 0
-op-2-address = 0_0_test
-op-2-plugin = test
-
-op-2-operation = address_del
-op-2-address-id = 1
-op-2-peer-id = 1
-op-2-address-session = 0
-op-2-address-network = 0
-op-2-address = 1_1_test
-op-2-plugin = test
-
diff --git a/src/ats/experiments/gnunet_ats_sim_default.conf 
b/src/ats/experiments/gnunet_ats_sim_default.conf
deleted file mode 100644
index 14e0a2e0b..000000000
--- a/src/ats/experiments/gnunet_ats_sim_default.conf
+++ /dev/null
@@ -1,18 +0,0 @@
-[ats]
-UNSPECIFIED_QUOTA_IN = 64 KiB
-UNSPECIFIED_QUOTA_OUT = 64 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = 64 KiB
-LOOPBACK_QUOTA_OUT = 64 KiB
-# LAN
-LAN_QUOTA_IN = 64 KiB
-LAN_QUOTA_OUT = 64 KiB
-# WAN
-WAN_QUOTA_IN = 64 KiB
-WAN_QUOTA_OUT = 64 KiB
-# WLAN
-WLAN_QUOTA_IN = 64 KiB
-WLAN_QUOTA_OUT = 64 KiB
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = 64 KiB
-BLUETOOTH_QUOTA_OUT = 64 KiB
diff --git a/src/ats/experiments/set_preference.exp 
b/src/ats/experiments/set_preference.exp
deleted file mode 100644
index 34f9af296..000000000
--- a/src/ats/experiments/set_preference.exp
+++ /dev/null
@@ -1,95 +0,0 @@
-# Example setting up two peers 
-
-[experiment]
-name = test
-max_duration = 15 s
-log_freq = 1000 ms
-log_prefix = set_preference
-cfg_file = experiments/gnunet_ats_sim_default.conf
-  
-[episode-0]
-# Setup addresses
-
-# operations = address_add, address_del, start_set_property, 
stop_set_property, 
-# start_set_preference, stop_preference, start_request, stop_request
-duration = 1 s
-
-op-0-operation = address_add
-op-0-address-id = 0
-op-0-peer-id = 0
-op-0-address-session = 0
-op-0-address-network = lan
-op-0-address = 0_0_test
-op-0-plugin = test
-
-op-1-operation = address_add
-op-1-address-id = 1
-op-1-peer-id = 1
-op-1-address-session = 0
-op-1-address-network = lan
-op-1-address = 1_1_test
-op-1-plugin = test
-
-op-2-operation = start_request
-op-2-peer-id = 0
-
-op-3-operation = start_request
-op-3-peer-id = 1
-
-[episode-1]
-# Set delay
-duration = 20 s
-
-op-0-operation = start_set_preference
-op-0-address-id = 0
-op-0-peer-id = 0
-op-0-client-id = 1
-# constant, linear, sinus, random
-op-0-gen-type = linear
-op-0-base-rate= 1000
-op-0-max-rate = 10000
-op-0-period = 10 s
-op-0-frequency = 500 ms
-op-0-feedback_delay = 500 ms
-# BANDWIDTH, LATENCY
-op-0-pref = BANDWIDTH  
-
-
-op-1-operation = start_set_preference
-op-1-address-id = 1
-op-1-peer-id = 1
-op-1-client-id = 1
-# constant, linear, sinus, random
-op-1-gen-type = constant
-op-1-base-rate= 1000
-op-1-max-rate = 1000
-op-1-period = 10 s
-op-1-frequency = 500 ms
-# BANDWIDTH, LATENCY
-op-1-pref = BANDWIDTH  
-
-[episode-2]
-# Shutdown
-duration = 2 s
-
-op-0-operation = stop_request
-op-0-peer-id = 0  
-
-op-1-operation = stop_request
-op-1-peer-id = 1
-
-op-2-operation = address_del
-op-2-address-id = 0
-op-2-peer-id = 0
-op-2-address-session = 0
-op-2-address-network = 0
-op-2-address = 0_0_test
-op-2-plugin = test
-
-op-3-operation = address_del
-op-3-address-id = 1
-op-3-peer-id = 1
-op-3-address-session = 0
-op-3-address-network = 0
-op-3-address = 1_1_test
-op-3-plugin = test
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c
deleted file mode 100644
index ba7994686..000000000
--- a/src/ats/gnunet-ats-solver-eval.c
+++ /dev/null
@@ -1,3588 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010-2013 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats-tests/ats-testing-experiment.c
- * @brief ats benchmark: controlled experiment execution
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet-ats-solver-eval.h"
-#include "gnunet-service-ats_normalization.h"
-#include "gnunet-service-ats_preferences.c"
-
-#define BIG_M_STRING "unlimited"
-
-/**
- * Handle for statistics.
- */
-struct GNUNET_STATISTICS_Handle *GSA_stats;
-
-
-static struct Experiment *e;
-
-static struct LoggingHandle *l;
-
-static struct SolverHandle *sh;
-
-static struct TestPeer *peer_head;
-
-static struct TestPeer *peer_tail;
-
-static double default_properties[GNUNET_ATS_PropertyCount];
-static double default_preferences[GNUNET_ATS_PreferenceCount];
-
-/**
- * cmd option -e: experiment file
- */
-static char *opt_exp_file;
-
-static char *opt_solver;
-
-/**
- * cmd option -l: enable logging
- */
-static int opt_log;
-
-/**
- * cmd option -p: enable plots
- */
-static int opt_save;
-
-/**
- * cmd option -v: verbose logs
- */
-static int opt_verbose;
-
-/**
- * cmd option -p: print logs
- */
-static int opt_print;
-
-/**
- * cmd option -d: disable normalization
- */
-static int opt_disable_normalization;
-
-static int res;
-
-static void
-end_now ();
-
-
-static char *
-print_generator_type (enum GeneratorType g)
-{
-  switch (g)
-  {
-  case GNUNET_ATS_TEST_TG_CONSTANT:
-    return "CONSTANT";
-
-  case GNUNET_ATS_TEST_TG_LINEAR:
-    return "LINEAR";
-
-  case GNUNET_ATS_TEST_TG_RANDOM:
-    return "RANDOM";
-
-  case GNUNET_ATS_TEST_TG_SINUS:
-    return "SINUS";
-
-  default:
-    return "INVALID";
-    break;
-  }
-}
-
-
-static struct TestPeer *
-find_peer_by_id (int id)
-{
-  struct TestPeer *cur;
-
-  for (cur = peer_head; NULL != cur; cur = cur->next)
-    if (cur->id == id)
-      return cur;
-  return NULL;
-}
-
-
-static struct TestPeer *
-find_peer_by_pid (const struct GNUNET_PeerIdentity *pid)
-{
-  struct TestPeer *cur;
-
-  for (cur = peer_head; NULL != cur; cur = cur->next)
-    if (0 == GNUNET_memcmp (&cur->peer_id, pid))
-      return cur;
-  return NULL;
-}
-
-
-static struct TestAddress *
-find_address_by_id (struct TestPeer *peer, int aid)
-{
-  struct TestAddress *cur;
-
-  for (cur = peer->addr_head; NULL != cur; cur = cur->next)
-    if (cur->aid == aid)
-      return cur;
-  return NULL;
-}
-
-
-/**
- * Logging
- */
-void
-GNUNET_ATS_solver_logging_now (struct LoggingHandle *l)
-{
-  struct LoggingTimeStep *lts;
-  struct TestPeer *cur;
-  struct TestAddress *cur_addr;
-  struct LoggingPeer *log_p;
-  struct LoggingAddress *log_a;
-  int c;
-
-  lts = GNUNET_new (struct LoggingTimeStep);
-  GNUNET_CONTAINER_DLL_insert_tail (l->head, l->tail, lts);
-  lts->timestamp = GNUNET_TIME_absolute_get ();
-  if (NULL == lts->prev)
-    lts->delta = GNUNET_TIME_UNIT_ZERO;
-  else
-    lts->delta = GNUNET_TIME_absolute_get_duration (lts->prev->timestamp);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Logging %llu, delta %llu\n",
-              lts->timestamp.abs_value_us, lts->delta.rel_value_us);
-
-
-  /* Store logging data here */
-  for (cur = peer_head; NULL != cur; cur = cur->next)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Logging peer id %llu\n", cur->id);
-
-    log_p = GNUNET_new (struct LoggingPeer);
-    log_p->id = cur->id;
-    log_p->peer_id = cur->peer_id;
-    log_p->is_requested = cur->is_requested;
-    for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
-    {
-      log_p->pref_abs[c] = cur->pref_abs[c];
-      log_p->pref_norm[c] = cur->pref_norm[c];
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "\t %s = %.2f %.2f [abs/rel]\n",
-                  GNUNET_ATS_print_preference_type (c),
-                  log_p->pref_abs[c], log_p->pref_norm[c]);
-    }
-    GNUNET_CONTAINER_DLL_insert_tail (lts->head, lts->tail, log_p);
-
-    for (cur_addr = cur->addr_head; NULL != cur_addr; cur_addr = 
cur_addr->next)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Logging peer id %llu address %llu\n",
-                  cur->id, cur_addr->aid);
-      log_a = GNUNET_new (struct LoggingAddress);
-      log_a->aid = cur_addr->aid;
-      log_a->active = cur_addr->ats_addr->active;
-      log_a->network = cur_addr->network;
-      log_a->assigned_bw_in = cur_addr->ats_addr->assigned_bw_in;
-      log_a->assigned_bw_out = cur_addr->ats_addr->assigned_bw_out;
-      for (c = 0; c < GNUNET_ATS_PropertyCount; c++)
-      {
-        log_a->prop_abs[c] = cur_addr->prop_abs[c];
-        log_a->prop_norm[c] = cur_addr->prop_norm[c];
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "\t %s = %.2f %.2f [abs/rel]\n",
-                    GNUNET_ATS_print_property_type (c),
-                    log_a->prop_abs[c],
-                    log_a->prop_norm[c]);
-      }
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t Active = %i\n", log_a->active);
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t BW in = %llu\n",
-                  log_a->assigned_bw_in);
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\t BW out = %llu\n",
-                  log_a->assigned_bw_out);
-
-      GNUNET_CONTAINER_DLL_insert_tail (log_p->addr_head, log_p->addr_tail,
-                                        log_a);
-    }
-  }
-}
-
-
-static void
-logging_task (void *cls)
-{
-  struct LoggingHandle *l = cls;
-
-  l->logging_task = NULL;
-  GNUNET_ATS_solver_logging_now (l);
-  l->logging_task = GNUNET_SCHEDULER_add_delayed (l->log_freq,
-                                                  &logging_task,
-                                                  l);
-}
-
-
-struct LoggingHandle *
-GNUNET_ATS_solver_logging_start (struct GNUNET_TIME_Relative freq)
-{
-  struct LoggingHandle *l;
-
-  l = GNUNET_new (struct LoggingHandle);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start logging every  %s\n",
-              GNUNET_STRINGS_relative_time_to_string (freq, GNUNET_NO));
-  l->log_freq = freq;
-  l->logging_task = GNUNET_SCHEDULER_add_now (&logging_task, l);
-  return l;
-}
-
-
-void
-GNUNET_ATS_solver_logging_stop (struct LoggingHandle *l)
-{
-  if (NULL != l->logging_task)
-    GNUNET_SCHEDULER_cancel (l->logging_task);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stop logging\n");
-
-  l->logging_task = NULL;
-}
-
-
-static struct LoggingFileHandle *
-find_logging_file_handle (struct LoggingFileHandle *lf_head,
-                          struct LoggingFileHandle *lf_tail,
-                          int peer_id, int address_id)
-{
-  struct LoggingFileHandle *res;
-
-  for (res = lf_head; NULL != res; res = res->next)
-    if ((res->pid == peer_id) && (res->aid == address_id))
-      return res;
-  return NULL;
-}
-
-
-void
-GNUNET_ATS_solver_logging_write_to_disk (struct LoggingHandle *l, int
-                                         add_time_stamp,
-                                         char *output_dir)
-{
-  struct LoggingTimeStep *lts;
-  struct LoggingPeer *log_p;
-  struct LoggingAddress *log_a;
-  struct LoggingFileHandle *lf_head;
-  struct LoggingFileHandle *lf_tail;
-  struct LoggingFileHandle *cur;
-  struct LoggingFileHandle *next;
-  char *filename;
-  char *datastring;
-  char *propstring;
-  char *propstring_tmp;
-  char *prefstring;
-  char *prefstring_tmp;
-  int c;
-  int use_dir;
-
-  use_dir = GNUNET_NO;
-  if (NULL != output_dir)
-  {
-    if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (output_dir))
-    {
-      fprintf (stderr, "Failed to create directory `%s'\n", output_dir);
-      return;
-    }
-    else
-    {
-      fprintf (stderr, "Created directory `%s'\n", output_dir);
-      use_dir = GNUNET_YES;
-    }
-  }
-
-  lf_head = NULL;
-  lf_tail = NULL;
-
-  for (lts = l->head; NULL != lts; lts = lts->next)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Writing log step %llu\n",
-                (long long unsigned int) lts->timestamp.abs_value_us);
-
-    for (log_p = lts->head; NULL != log_p; log_p = log_p->next)
-    {
-      for (log_a = log_p->addr_head; NULL != log_a; log_a = log_a->next)
-      {
-        cur = find_logging_file_handle (lf_head, lf_tail, log_p->id,
-                                        log_a->aid);
-        if (NULL == cur)
-        {
-          cur = GNUNET_new (struct LoggingFileHandle);
-          cur->aid = log_a->aid;
-          cur->pid = log_p->id;
-
-          if (GNUNET_YES == add_time_stamp)
-            GNUNET_asprintf (&filename, "%s%s%s_%s_p%u_a%u_%llu.log",
-                             (GNUNET_YES == use_dir) ? output_dir : "",
-                             (GNUNET_YES == use_dir) ? DIR_SEPARATOR_STR : "",
-                             e->log_prefix,
-                             opt_solver,
-                             cur->pid,
-                             cur->aid,
-                             l->head->timestamp.abs_value_us);
-          else
-            GNUNET_asprintf (&filename, "%s%s%s_%s_p%u_a%u.log",
-                             (GNUNET_YES == use_dir) ? output_dir : "",
-                             (GNUNET_YES == use_dir) ? DIR_SEPARATOR_STR : "",
-                             e->log_prefix,
-                             opt_solver,
-                             cur->pid,
-                             cur->aid);
-
-          fprintf (stderr,
-                   "Add writing log data for peer %llu address %llu to file 
`%s'\n",
-                   cur->pid, cur->aid, filename);
-
-
-          cur->f_hd = GNUNET_DISK_file_open (filename,
-                                             GNUNET_DISK_OPEN_READWRITE
-                                             | GNUNET_DISK_OPEN_CREATE
-                                             | GNUNET_DISK_OPEN_TRUNCATE,
-                                             GNUNET_DISK_PERM_USER_READ
-                                             | GNUNET_DISK_PERM_USER_WRITE
-                                             | GNUNET_DISK_PERM_GROUP_READ
-                                             | GNUNET_DISK_PERM_OTHER_READ);
-          if (NULL == cur->f_hd)
-          {
-            fprintf (stderr, "Cannot open `%s' to write log data!\n", 
filename);
-            GNUNET_free (filename);
-            GNUNET_free (cur);
-            goto cleanup;
-          }
-          GNUNET_free (filename);
-          GNUNET_CONTAINER_DLL_insert (lf_head, lf_tail, cur);
-
-          GNUNET_asprintf (&datastring,
-                           "#time delta;log duration;peer_requested;addr net; 
addr_active; bw in; bw out; " \
-                           "UTILIZATION_UP [abs/rel]; UTILIZATION_UP; 
UTILIZATION_DOWN; UTILIZATION_DOWN; " \
-                           "UTILIZATION_PAYLOAD_UP; UTILIZATION_PAYLOAD_UP; 
UTILIZATION_PAYLOAD_DOWN; UTILIZATION_PAYLOAD_DOWN;" \
-                           "DELAY; DELAY; " \
-                           "DISTANCE ;DISTANCE ; COST_WAN; COST_WAN; COST_LAN; 
COST_LAN; " \
-                           "COST_WLAN; COST_WLAN;COST_BT; COST_BT; PREF BW 
abs; PREF BW rel; PREF LATENCY abs; PREF LATENCY rel;\n");
-          GNUNET_DISK_file_write (cur->f_hd, datastring, strlen (datastring));
-          GNUNET_free (datastring);
-        }
-
-        prefstring = GNUNET_strdup ("");
-        for (c = 1; c < GNUNET_ATS_PreferenceCount; c++)
-        {
-          /*
-             fprintf(stderr,"\t %s = %.2f %.2f [abs/rel]\n",
-              GNUNET_ATS_print_preference_type(c),
-              log_p->pref_abs[c], log_p->pref_norm[c]);
-           */GNUNET_asprintf (&prefstring_tmp, "%s;%.3f;%.3f",
-                           prefstring, log_p->pref_abs[c], 
log_p->pref_norm[c]);
-
-
-          GNUNET_free (prefstring);
-          prefstring = GNUNET_strdup (prefstring_tmp);
-          GNUNET_free (prefstring_tmp);
-        }
-
-
-        propstring = GNUNET_strdup ("");
-        for (c = 1; c < GNUNET_ATS_PropertyCount; c++)
-        {
-          if (GNUNET_ATS_NETWORK_TYPE == c)
-            continue;
-          /*
-             fprintf(stderr, "\t %s = %.2f %.2f [abs/rel]\n",
-              GNUNET_ATS_print_property_type(c),
-              log_a->prop_abs[c], log_a->prop_norm[c]);*/
-          GNUNET_asprintf (&propstring_tmp, "%s%.3f;%.3f;",
-                           propstring,
-                           log_a->prop_abs[c],
-                           log_a->prop_norm[c]);
-          GNUNET_free (propstring);
-          propstring = GNUNET_strdup (propstring_tmp);
-          GNUNET_free (propstring_tmp);
-        }
-        GNUNET_asprintf (&datastring, "%llu;%llu;%u;%u;%i;%u;%u;%s;%s\n",
-                         GNUNET_TIME_absolute_get_difference (
-                           l->head->timestamp,
-                           lts->timestamp).
-                         rel_value_us / 1000, lts->delta,
-                         log_p->is_requested, log_a->network, log_a->active,
-                         log_a->assigned_bw_in, log_a->assigned_bw_out,
-                         propstring,
-                         prefstring);
-
-        GNUNET_DISK_file_write (cur->f_hd, datastring, strlen (datastring));
-        GNUNET_free (datastring);
-        GNUNET_free (prefstring);
-        GNUNET_free (propstring);
-      }
-    }
-  }
-
-  cleanup:
-  next = lf_head;
-  for (cur = next; NULL != cur; cur = next)
-  {
-    next = cur->next;
-    GNUNET_CONTAINER_DLL_remove (lf_head, lf_tail, cur);
-    if (NULL != cur->f_hd)
-      GNUNET_DISK_file_close (cur->f_hd);
-    GNUNET_free (cur);
-  }
-}
-
-
-void
-GNUNET_ATS_solver_logging_eval (struct LoggingHandle *l)
-{
-  struct LoggingTimeStep *lts;
-  struct LoggingPeer *log_p;
-  struct LoggingAddress *log_a;
-  int c;
-
-  for (lts = l->head; NULL != lts; lts = lts->next)
-  {
-    fprintf (stderr, "Log step %llu %llu: \n",
-             (long long unsigned int) lts->timestamp.abs_value_us,
-             (long long unsigned int) lts->delta.rel_value_us);
-
-    for (log_p = lts->head; NULL != log_p; log_p = log_p->next)
-    {
-      fprintf (stderr, "\tLogging peer pid %llu\n", log_p->id);
-      for (c = 1; c < GNUNET_ATS_PreferenceCount; c++)
-      {
-        fprintf (stderr, "\t %s = %.2f %.2f [abs/rel]\n",
-                 GNUNET_ATS_print_preference_type (c),
-                 log_p->pref_abs[c], log_p->pref_norm[c]);
-      }
-
-      for (log_a = log_p->addr_head; NULL != log_a; log_a = log_a->next)
-      {
-        fprintf (stderr, "\tPeer pid %llu address %llu: %u %u %u\n",
-                 log_p->id, log_a->aid, log_a->active,
-                 log_a->assigned_bw_in,
-                 log_a->assigned_bw_out);
-
-        for (c = 1; c < GNUNET_ATS_PropertyCount; c++)
-        {
-          if (GNUNET_ATS_NETWORK_TYPE == c)
-            continue;
-          fprintf (stderr, "\t %s = %.2f %.2f [abs/rel]\n",
-                   GNUNET_ATS_print_property_type (c),
-                   log_a->prop_abs[c], log_a->prop_norm[c]);
-        }
-      }
-    }
-  }
-}
-
-
-void
-GNUNET_ATS_solver_logging_free (struct LoggingHandle *l)
-{
-  struct LoggingTimeStep *lts_cur;
-  struct LoggingTimeStep *lts_next;
-  struct LoggingPeer *log_p_cur;
-  struct LoggingPeer *log_p_next;
-  struct LoggingAddress *log_a_cur;
-  struct LoggingAddress *log_a_next;
-
-  if (NULL != l->logging_task)
-    GNUNET_SCHEDULER_cancel (l->logging_task);
-  l->logging_task = NULL;
-
-  lts_next = l->head;
-  while (NULL != (lts_cur = lts_next))
-  {
-    lts_next = lts_cur->next;
-
-    log_p_next = lts_cur->head;
-    while (NULL != (log_p_cur = log_p_next))
-    {
-      log_p_next = log_p_cur->next;
-
-      log_a_next = log_p_cur->addr_head;
-      while (NULL != (log_a_cur = log_a_next))
-      {
-        log_a_next = log_a_cur->next;
-
-        GNUNET_CONTAINER_DLL_remove (log_p_cur->addr_head, 
log_p_cur->addr_tail,
-                                     log_a_cur);
-        GNUNET_free (log_a_cur);
-      }
-
-      GNUNET_CONTAINER_DLL_remove (lts_cur->head, lts_cur->tail, log_p_cur);
-      GNUNET_free (log_p_cur);
-    }
-
-    GNUNET_CONTAINER_DLL_remove (l->head, l->tail, lts_cur);
-    GNUNET_free (lts_cur);
-  }
-
-  GNUNET_free (l);
-}
-
-
-/**
- * Property Generators
- */
-static struct PropertyGenerator *prop_gen_head;
-static struct PropertyGenerator *prop_gen_tail;
-
-
-static double
-get_property (struct PropertyGenerator *pg)
-{
-  struct GNUNET_TIME_Relative time_delta;
-  double delta_value;
-  double pref_value;
-
-  /* Calculate the current preference value */
-  switch (pg->type)
-  {
-  case GNUNET_ATS_TEST_TG_CONSTANT:
-    pref_value = pg->base_value;
-    break;
-
-  case GNUNET_ATS_TEST_TG_LINEAR:
-    time_delta = GNUNET_TIME_absolute_get_duration (pg->time_start);
-    /* Calculate point of time in the current period */
-    time_delta.rel_value_us = time_delta.rel_value_us
-                              % pg->duration_period.rel_value_us;
-    delta_value = ((double) time_delta.rel_value_us
-                   / pg->duration_period.rel_value_us) * (pg->max_value
-                                                          - pg->base_value);
-    if ((pg->max_value < pg->base_value) &&
-        ((pg->max_value - pg->base_value) > pg->base_value))
-    {
-      /* This will cause an underflow */
-      GNUNET_break (0);
-    }
-    pref_value = pg->base_value + delta_value;
-    break;
-
-  case GNUNET_ATS_TEST_TG_RANDOM:
-    delta_value = (double) GNUNET_CRYPTO_random_u32 
(GNUNET_CRYPTO_QUALITY_WEAK,
-                                                     10000 * (pg->max_value
-                                                              - 
pg->base_value))
-                  / 10000;
-    pref_value = pg->base_value + delta_value;
-    break;
-
-  case GNUNET_ATS_TEST_TG_SINUS:
-    time_delta = GNUNET_TIME_absolute_get_duration (pg->time_start);
-    /* Calculate point of time in the current period */
-    time_delta.rel_value_us = time_delta.rel_value_us
-                              % pg->duration_period.rel_value_us;
-    if ((pg->max_value - pg->base_value) > pg->base_value)
-    {
-      /* This will cause an underflow for second half of sinus period,
-       * will be detected in general when experiments are loaded */
-      GNUNET_break (0);
-    }
-    delta_value = (pg->max_value - pg->base_value)
-                  * sin ((2 * M_PI)
-                         / ((double) pg->duration_period.rel_value_us)
-                         * time_delta.rel_value_us);
-    pref_value = pg->base_value + delta_value;
-    break;
-
-  default:
-    pref_value = 0.0;
-    break;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Current property value is %f\n",
-              pref_value);
-  return pref_value;
-}
-
-
-static void
-set_prop_task (void *cls)
-{
-  struct PropertyGenerator *pg = cls;
-  struct TestPeer *p;
-  struct TestAddress *a;
-  double prop_value;
-  struct GNUNET_ATS_Information atsi;
-
-  pg->set_task = NULL;
-
-  if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains_value (sh->addresses,
-                                                                 &pg->test_peer
-                                                                 ->peer_id,
-                                                                 pg->
-                                                                 test_address->
-                                                                 ats_addr))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Setting property generation for unknown address [%u:%u]\n",
-                pg->peer, pg->address_id);
-    return;
-  }
-  if (NULL == (p = find_peer_by_id (pg->peer)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Setting property generation for unknown peer %u\n",
-                pg->peer);
-    return;
-  }
-  if (NULL == (a = find_address_by_id (p, pg->address_id)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Setting property generation for unknown peer %u\n",
-                pg->peer);
-    return;
-  }
-
-  prop_value = get_property (pg);
-  a->prop_abs[pg->ats_property] = prop_value;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Setting property for peer [%u] address [%u] for %s to %f\n",
-              pg->peer, pg->address_id,
-              GNUNET_ATS_print_property_type (pg->ats_property), prop_value);
-
-  atsi.type = htonl (pg->ats_property);
-  atsi.value = htonl ((uint32_t) prop_value);
-
-  /* set performance here! */
-  sh->sf->s_bulk_start (sh->sf->cls);
-  if (GNUNET_YES == opt_disable_normalization)
-  {
-    a->prop_abs[pg->ats_property] = prop_value;
-    a->prop_norm[pg->ats_property] = prop_value;
-    sh->sf->s_address_update_property (sh->sf->cls, a->ats_addr,
-                                       pg->ats_property, prop_value,
-                                       prop_value);
-  }
-  else
-    GAS_normalization_update_property (pg->test_address->ats_addr, &atsi, 1);
-  sh->sf->s_bulk_stop (sh->sf->cls);
-
-  pg->set_task = GNUNET_SCHEDULER_add_delayed (pg->frequency,
-                                               &set_prop_task, pg);
-}
-
-
-/**
- * Set ats_property to 0 to find all pgs
- */
-static struct PropertyGenerator *
-find_prop_gen (unsigned int peer, unsigned int address,
-               uint32_t ats_property)
-{
-  struct PropertyGenerator *cur;
-
-  for (cur = prop_gen_head; NULL != cur; cur = cur->next)
-    if ((cur->peer == peer) && (cur->address_id == address))
-    {
-      if ((cur->ats_property == ats_property) || (0 == ats_property))
-        return cur;
-    }
-  return NULL;
-}
-
-
-void
-GNUNET_ATS_solver_generate_property_stop (struct PropertyGenerator *pg)
-{
-  GNUNET_CONTAINER_DLL_remove (prop_gen_head, prop_gen_tail, pg);
-
-  if (NULL != pg->set_task)
-  {
-    GNUNET_SCHEDULER_cancel (pg->set_task);
-    pg->set_task = NULL;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Removing old up preference generator peer [%u] address [%u] 
`%s'\n",
-              pg->peer, pg->address_id,
-              GNUNET_ATS_print_property_type (pg->ats_property));
-
-  GNUNET_free (pg);
-}
-
-
-/**
- * Generate between the source master and the partner and set property with a
- * value depending on the generator.
- *
- * @param peer source
- * @param address_id partner
- * @param test_peer the peer
- * @param test_address the address
- * @param type type of generator
- * @param base_value base value
- * @param value_rate maximum value
- * @param period duration of a period of generation (~ 1/frequency)
- * @param frequency how long to generate property
- * @param ats_property ATS property to generate
- * @return the property generator
- */
-struct PropertyGenerator *
-GNUNET_ATS_solver_generate_property_start (unsigned int peer,
-                                           unsigned int address_id,
-                                           struct TestPeer *test_peer,
-                                           struct TestAddress *test_address,
-                                           enum GeneratorType type,
-                                           long int base_value,
-                                           long int value_rate,
-                                           struct GNUNET_TIME_Relative period,
-                                           struct GNUNET_TIME_Relative
-                                           frequency,
-                                           uint32_t ats_property)
-{
-  struct PropertyGenerator *pg;
-
-  pg = GNUNET_new (struct PropertyGenerator);
-  GNUNET_CONTAINER_DLL_insert (prop_gen_head, prop_gen_tail, pg);
-  pg->type = type;
-  pg->peer = peer;
-  pg->test_address = test_address;
-  pg->test_peer = test_peer;
-  pg->address_id = address_id;
-  pg->ats_property = ats_property;
-  pg->base_value = base_value;
-  pg->max_value = value_rate;
-  pg->duration_period = period;
-  pg->frequency = frequency;
-  pg->time_start = GNUNET_TIME_absolute_get ();
-
-  switch (type)
-  {
-  case GNUNET_ATS_TEST_TG_CONSTANT:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Setting up %s property generator peer [%u] address [%u] `%s'" 
\
-                "max %u Bips\n",
-                print_generator_type (type), pg->peer, pg->address_id,
-                GNUNET_ATS_print_property_type (ats_property),
-                base_value);
-    break;
-
-  case GNUNET_ATS_TEST_TG_LINEAR:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Setting up %s property generator peer [%u] address [%u] `%s' 
" \
-                "min %u Bips max %u Bips\n",
-                print_generator_type (type), pg->peer, pg->address_id,
-                GNUNET_ATS_print_property_type (ats_property),
-                base_value, value_rate);
-    break;
-
-  case GNUNET_ATS_TEST_TG_SINUS:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Setting up %s property generator peer [%u] address [%u] `%s' 
" \
-                "baserate %u Bips, amplitude %u Bps\n",
-                print_generator_type (type), pg->peer, pg->address_id,
-                GNUNET_ATS_print_property_type (ats_property),
-                base_value, value_rate);
-    break;
-
-  case GNUNET_ATS_TEST_TG_RANDOM:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Setting up %s property generator peer [%u] address [%u] `%s' 
" \
-                "min %u Bips max %u Bps\n",
-                print_generator_type (type), pg->peer, pg->address_id,
-                GNUNET_ATS_print_property_type (ats_property),
-                base_value, value_rate);
-    break;
-
-  default:
-    break;
-  }
-
-  pg->set_task = GNUNET_SCHEDULER_add_now (&set_prop_task, pg);
-  return pg;
-}
-
-
-/**
- * Stop all preferences generators
- */
-void
-GNUNET_ATS_solver_generate_property_stop_all ()
-{
-  struct PropertyGenerator *cur;
-  struct PropertyGenerator *next;
-
-  next = prop_gen_head;
-  for (cur = next; NULL != cur; cur = next)
-  {
-    next = cur->next;
-    GNUNET_ATS_solver_generate_property_stop (cur);
-  }
-}
-
-
-/**
- * Preference Generators
- */
-static struct PreferenceGenerator *pref_gen_head;
-static struct PreferenceGenerator *pref_gen_tail;
-
-
-static double
-get_preference (struct PreferenceGenerator *pg)
-{
-  struct GNUNET_TIME_Relative time_delta;
-  double delta_value;
-  double pref_value;
-
-  /* Calculate the current preference value */
-  switch (pg->type)
-  {
-  case GNUNET_ATS_TEST_TG_CONSTANT:
-    pref_value = pg->base_value;
-    break;
-
-  case GNUNET_ATS_TEST_TG_LINEAR:
-    time_delta = GNUNET_TIME_absolute_get_duration (pg->time_start);
-    /* Calculate point of time in the current period */
-    time_delta.rel_value_us = time_delta.rel_value_us
-                              % pg->duration_period.rel_value_us;
-    delta_value = ((double) time_delta.rel_value_us
-                   / pg->duration_period.rel_value_us) * (pg->max_value
-                                                          - pg->base_value);
-    if ((pg->max_value < pg->base_value) &&
-        ((pg->max_value - pg->base_value) > pg->base_value))
-    {
-      /* This will cause an underflow */
-      GNUNET_break (0);
-    }
-    pref_value = pg->base_value + delta_value;
-    break;
-
-  case GNUNET_ATS_TEST_TG_RANDOM:
-    delta_value = (double) GNUNET_CRYPTO_random_u32 
(GNUNET_CRYPTO_QUALITY_WEAK,
-                                                     10000 * (pg->max_value
-                                                              - 
pg->base_value))
-                  / 10000;
-    pref_value = pg->base_value + delta_value;
-    break;
-
-  case GNUNET_ATS_TEST_TG_SINUS:
-    time_delta = GNUNET_TIME_absolute_get_duration (pg->time_start);
-    /* Calculate point of time in the current period */
-    time_delta.rel_value_us = time_delta.rel_value_us
-                              % pg->duration_period.rel_value_us;
-    if ((pg->max_value - pg->base_value) > pg->base_value)
-    {
-      /* This will cause an underflow for second half of sinus period,
-       * will be detected in general when experiments are loaded */
-      GNUNET_break (0);
-    }
-    delta_value = (pg->max_value - pg->base_value)
-                  * sin ((2 * M_PI)
-                         / ((double) pg->duration_period.rel_value_us)
-                         * time_delta.rel_value_us);
-    pref_value = pg->base_value + delta_value;
-    break;
-
-  default:
-    pref_value = 0.0;
-    break;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Current preference value is %f\n",
-              pref_value);
-  return pref_value;
-}
-
-
-static void
-set_feedback_task (void *cls)
-{
-  struct PreferenceGenerator *pg = cls;
-  struct TestPeer *p;
-  double feedback;
-  uint32_t bw_acc_out;
-  uint32_t bw_acc_in;
-  uint32_t delay_acc_in;
-  struct GNUNET_TIME_Relative dur;
-  double p_new;
-
-  pg->feedback_task = NULL;
-
-  if (NULL == (p = find_peer_by_id (pg->peer)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Setting feedback for unknown peer %u\n", pg->peer);
-    return;
-  }
-
-  switch (pg->kind)
-  {
-  case GNUNET_ATS_PREFERENCE_BANDWIDTH:
-    dur = GNUNET_TIME_absolute_get_duration (pg->feedback_last_bw_update);
-    bw_acc_in = dur.rel_value_us * pg->last_assigned_bw_in
-                + pg->feedback_bw_in_acc;
-    pg->feedback_bw_in_acc = 0;
-
-    bw_acc_out = dur.rel_value_us * pg->last_assigned_bw_out
-                 + pg->feedback_bw_out_acc;
-    p_new = get_preference (pg);
-    feedback = (p_new / pg->pref_bw_old) * (bw_acc_in + bw_acc_out)
-               / (2 * GNUNET_TIME_absolute_get_duration (
-                    pg->feedback_last).rel_value_us);
-
-    break;
-
-  case GNUNET_ATS_PREFERENCE_LATENCY:
-    dur = GNUNET_TIME_absolute_get_duration (pg->feedback_last_delay_update);
-    delay_acc_in = dur.rel_value_us * pg->last_delay_value
-                   + pg->feedback_delay_acc;
-    pg->feedback_delay_acc = 0;
-
-    p_new = get_preference (pg);
-    feedback = (p_new / pg->pref_latency_old) * (delay_acc_in)
-               / (GNUNET_TIME_absolute_get_duration (
-                    pg->feedback_last).rel_value_us);
-
-    break;
-
-  default:
-    GNUNET_break (0);
-    feedback = 0.0;
-    break;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Giving feedback for peer [%u] for client %p pref %s of %.3f\n",
-              pg->peer, NULL + (pg->client_id),
-              GNUNET_ATS_print_preference_type (pg->kind),
-              feedback);
-
-  sh->sf->s_feedback (sh->sf->cls, NULL + (pg->client_id), &p->peer_id,
-                      pg->feedback_frequency, pg->kind, feedback);
-  pg->feedback_last = GNUNET_TIME_absolute_get ();
-
-
-  pg->feedback_bw_out_acc = 0;
-  pg->feedback_bw_in_acc = 0;
-  pg->feedback_last_bw_update = GNUNET_TIME_absolute_get ();
-
-  pg->feedback_delay_acc = 0;
-  pg->feedback_last_delay_update = GNUNET_TIME_absolute_get ();
-
-
-  pg->feedback_task = GNUNET_SCHEDULER_add_delayed (pg->feedback_frequency,
-                                                    &set_feedback_task, pg);
-}
-
-
-static void
-set_pref_task (void *cls)
-{
-  struct PreferenceGenerator *pg = cls;
-  struct TestPeer *p;
-  double pref_value;
-
-  pg->set_task = NULL;
-
-  if (NULL == (p = find_peer_by_id (pg->peer)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Setting preference for unknown peer %u\n", pg->peer);
-    return;
-  }
-
-  pref_value = get_preference (pg);
-  switch (pg->kind)
-  {
-  case GNUNET_ATS_PREFERENCE_BANDWIDTH:
-    pg->pref_bw_old = pref_value;
-    break;
-
-  case GNUNET_ATS_PREFERENCE_LATENCY:
-    pg->pref_latency_old = pref_value;
-    break;
-
-  default:
-    break;
-  }
-
-  p->pref_abs[pg->kind] = pref_value;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Setting preference for peer [%u] for client %p pref %s to %f\n",
-              pg->peer, NULL + (pg->client_id),
-              GNUNET_ATS_print_preference_type (pg->kind), pref_value);
-
-  if (GNUNET_YES == opt_disable_normalization)
-  {
-    p->pref_abs[pg->kind] = pref_value;
-    p->pref_norm[pg->kind] = pref_value;
-    sh->sf->s_pref (sh->sf->cls, &p->peer_id, pg->kind, pref_value);
-  }
-  else
-    update_preference (NULL + (pg->client_id),
-                       &p->peer_id,
-                       pg->kind,
-                       pref_value);
-
-  pg->set_task = GNUNET_SCHEDULER_add_delayed (pg->frequency,
-                                               &set_pref_task,
-                                               pg);
-}
-
-
-static struct PreferenceGenerator *
-find_pref_gen (unsigned int peer, enum GNUNET_ATS_PreferenceKind kind)
-{
-  struct PreferenceGenerator *cur;
-
-  for (cur = pref_gen_head; NULL != cur; cur = cur->next)
-    if (cur->peer == peer)
-    {
-      if ((cur->kind == kind) || (GNUNET_ATS_PREFERENCE_END == kind))
-        return cur;
-    }
-  return NULL;
-}
-
-
-void
-GNUNET_ATS_solver_generate_preferences_stop (struct PreferenceGenerator *pg)
-{
-  GNUNET_CONTAINER_DLL_remove (pref_gen_head, pref_gen_tail, pg);
-
-  if (NULL != pg->feedback_task)
-  {
-    GNUNET_SCHEDULER_cancel (pg->feedback_task);
-    pg->feedback_task = NULL;
-  }
-
-  if (NULL != pg->set_task)
-  {
-    GNUNET_SCHEDULER_cancel (pg->set_task);
-    pg->set_task = NULL;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Removing old up preference generator peer [%u] `%s'\n",
-              pg->peer, GNUNET_ATS_print_preference_type (pg->kind));
-
-  GNUNET_free (pg);
-}
-
-
-static struct TestAddress*
-find_active_address (struct TestPeer *p)
-{
-  struct TestAddress *cur;
-
-  for (cur = p->addr_head; NULL != cur; cur = cur->next)
-    if (GNUNET_YES == cur->ats_addr->active)
-      return cur;
-  return NULL;
-}
-
-
-/**
- * Generate between the source master and the partner and set property with a
- * value depending on the generator.
- *
- * @param peer source
- * @param address_id partner
- * @param client_id the client
- * @param type type of generator
- * @param base_value base value
- * @param value_rate maximum value
- * @param period duration of a period of generation (~ 1/frequency)
- * @param frequency how long to generate property
- * @param kind ATS preference to generate
- * @param feedback_frequency how often to give feedback
- * @return the preference generator
- */
-struct PreferenceGenerator *
-GNUNET_ATS_solver_generate_preferences_start (unsigned int peer,
-                                              unsigned int address_id,
-                                              unsigned int client_id,
-                                              enum GeneratorType type,
-                                              long int base_value,
-                                              long int value_rate,
-                                              struct GNUNET_TIME_Relative
-                                              period,
-                                              struct GNUNET_TIME_Relative
-                                              frequency,
-                                              enum GNUNET_ATS_PreferenceKind
-                                              kind,
-                                              struct GNUNET_TIME_Relative
-                                              feedback_frequency)
-{
-  struct PreferenceGenerator *pg;
-  struct TestPeer *p;
-
-  if (NULL == (p = find_peer_by_id (peer)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Starting preference for unknown peer %u\n", peer);
-    return NULL;
-  }
-
-  pg = GNUNET_new (struct PreferenceGenerator);
-  GNUNET_CONTAINER_DLL_insert (pref_gen_head, pref_gen_tail, pg);
-  pg->type = type;
-  pg->peer = peer;
-  pg->client_id = client_id;
-  pg->kind = kind;
-  pg->base_value = base_value;
-  pg->max_value = value_rate;
-  pg->duration_period = period;
-  pg->frequency = frequency;
-  pg->time_start = GNUNET_TIME_absolute_get ();
-  pg->feedback_frequency = feedback_frequency;
-
-  switch (type)
-  {
-  case GNUNET_ATS_TEST_TG_CONSTANT:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Setting up %s preference generator peer [%u] `%s' max %u 
Bips\n",
-                print_generator_type (type), pg->peer,
-                GNUNET_ATS_print_preference_type (kind),
-                base_value);
-    break;
-
-  case GNUNET_ATS_TEST_TG_LINEAR:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Setting up %s preference generator peer [%u] `%s' min %u Bips 
max %u Bips\n",
-                print_generator_type (type), pg->peer,
-                GNUNET_ATS_print_preference_type (kind),
-                base_value, value_rate);
-    break;
-
-  case GNUNET_ATS_TEST_TG_SINUS:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Setting up %s preference generator peer [%u] `%s' baserate %u 
Bips, amplitude %u Bps\n",
-                print_generator_type (type), pg->peer,
-                GNUNET_ATS_print_preference_type (kind),
-                base_value, value_rate);
-    break;
-
-  case GNUNET_ATS_TEST_TG_RANDOM:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Setting up %s preference generator peer [%u] `%s' min %u Bips 
max %u Bps\n",
-                print_generator_type (type), pg->peer,
-                GNUNET_ATS_print_preference_type (kind),
-                base_value, value_rate);
-    break;
-
-  default:
-    break;
-  }
-
-  pg->set_task = GNUNET_SCHEDULER_add_now (&set_pref_task, pg);
-  if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us !=
-      feedback_frequency.rel_value_us)
-  {
-    struct TestAddress *addr = find_active_address (p);
-
-    pg->last_assigned_bw_in = p->assigned_bw_in;
-    pg->last_assigned_bw_out = p->assigned_bw_out;
-    pg->feedback_bw_in_acc = 0;
-    pg->feedback_bw_out_acc = 0;
-    pg->last_delay_value = addr->prop_norm[GNUNET_ATS_QUALITY_NET_DELAY];
-    pg->feedback_delay_acc = 0;
-
-    pg->feedback_last_bw_update = GNUNET_TIME_absolute_get ();
-    pg->feedback_last_delay_update = GNUNET_TIME_absolute_get ();
-    pg->feedback_last = GNUNET_TIME_absolute_get ();
-    pg->feedback_task = GNUNET_SCHEDULER_add_delayed (feedback_frequency,
-                                                      &set_feedback_task, pg);
-  }
-
-  return pg;
-}
-
-
-/**
- * Stop all preferences generators
- */
-void
-GNUNET_ATS_solver_generate_preferences_stop_all ()
-{
-  struct PreferenceGenerator *cur;
-  struct PreferenceGenerator *next;
-
-  next = pref_gen_head;
-  for (cur = next; NULL != cur; cur = next)
-  {
-    next = cur->next;
-    GNUNET_ATS_solver_generate_preferences_stop (cur);
-  }
-}
-
-
-/**
- * Experiments
- */
-static const char *
-print_op (enum OperationType op)
-{
-  switch (op)
-  {
-  case SOLVER_OP_ADD_ADDRESS:
-    return "ADD_ADDRESS";
-
-  case SOLVER_OP_DEL_ADDRESS:
-    return "DEL_ADDRESS";
-
-  case SOLVER_OP_START_SET_PREFERENCE:
-    return "START_SET_PREFERENCE";
-
-  case SOLVER_OP_STOP_SET_PREFERENCE:
-    return "STOP_STOP_PREFERENCE";
-
-  case SOLVER_OP_START_SET_PROPERTY:
-    return "START_SET_PROPERTY";
-
-  case SOLVER_OP_STOP_SET_PROPERTY:
-    return "STOP_SET_PROPERTY";
-
-  case SOLVER_OP_START_REQUEST:
-    return "START_REQUEST";
-
-  case SOLVER_OP_STOP_REQUEST:
-    return "STOP_REQUEST";
-
-  default:
-    break;
-  }
-  return "";
-}
-
-
-static struct Experiment *
-create_experiment ()
-{
-  struct Experiment *e;
-
-  e = GNUNET_new (struct Experiment);
-  e->name = NULL;
-  e->start = NULL;
-  e->total_duration = GNUNET_TIME_UNIT_ZERO;
-  return e;
-}
-
-
-static void
-free_experiment (struct Experiment *e)
-{
-  struct Episode *cur;
-  struct Episode *next;
-  struct GNUNET_ATS_TEST_Operation *cur_o;
-  struct GNUNET_ATS_TEST_Operation *next_o;
-
-  next = e->start;
-  for (cur = next; NULL != cur; cur = next)
-  {
-    next = cur->next;
-
-    next_o = cur->head;
-    for (cur_o = next_o; NULL != cur_o; cur_o = next_o)
-    {
-      next_o = cur_o->next;
-      GNUNET_free (cur_o->address);
-      GNUNET_free (cur_o->plugin);
-      GNUNET_free (cur_o);
-    }
-    GNUNET_free (cur);
-  }
-
-  GNUNET_free (e->name);
-  GNUNET_free (e->log_prefix);
-  GNUNET_free (e->log_output_dir);
-  GNUNET_free (e->cfg_file);
-  GNUNET_free (e);
-}
-
-
-static int
-load_op_add_address (struct GNUNET_ATS_TEST_Operation *o,
-                     struct Episode *e,
-                     int op_counter,
-                     char *sec_name,
-                     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *op_name;
-  char *op_network;
-
-  /* peer pid */
-  GNUNET_asprintf (&op_name, "op-%u-peer-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->peer_id))
-  {
-    fprintf (stderr, "Missing peer-id in operation %u `%s' in episode `%s'\n",
-             op_counter, "ADD_ADDRESS", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* address pid */
-  GNUNET_asprintf (&op_name, "op-%u-address-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->address_id))
-  {
-    fprintf (stderr,
-             "Missing address-id in operation %u `%s' in episode `%s'\n",
-             op_counter, "ADD_ADDRESS", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* plugin */
-  GNUNET_asprintf (&op_name, "op-%u-plugin", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->plugin))
-  {
-    fprintf (stderr, "Missing plugin in operation %u `%s' in episode `%s'\n",
-             op_counter, "ADD_ADDRESS", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* address  */
-  GNUNET_asprintf (&op_name, "op-%u-address", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->address))
-  {
-    fprintf (stderr, "Missing address in operation %u `%s' in episode `%s'\n",
-             op_counter, "ADD_ADDRESS", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* session */
-  GNUNET_asprintf (&op_name, "op-%u-address-session", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->
-                                                              address_session))
-  {
-    fprintf (stderr,
-             "Missing address-session in operation %u `%s' in episode `%s'\n",
-             op_counter, "ADD_ADDRESS", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* network */
-  GNUNET_asprintf (&op_name, "op-%u-address-network", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                              sec_name, 
op_name,
-                                                              &op_network))
-  {
-    fprintf (stderr,
-             "Missing address-network in operation %u `%s' in episode `%s'\n",
-             op_counter, "ADD_ADDRESS", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  else
-  {
-    GNUNET_break (GNUNET_OK == GNUNET_STRINGS_utf8_toupper (op_network,
-                                                            op_network));
-    if (0 == strcmp (op_network, "UNSPECIFIED"))
-    {
-      o->address_network = GNUNET_NT_UNSPECIFIED;
-    }
-    else if (0 == strcmp (op_network, "LOOPBACK"))
-    {
-      o->address_network = GNUNET_NT_LOOPBACK;
-    }
-    else if (0 == strcmp (op_network, "LAN"))
-    {
-      o->address_network = GNUNET_NT_LAN;
-    }
-    else if (0 == strcmp (op_network, "WAN"))
-    {
-      o->address_network = GNUNET_NT_WAN;
-    }
-    else if (0 == strcmp (op_network, "WLAN"))
-    {
-      o->address_network = GNUNET_NT_WLAN;
-    }
-    else if (0 == strcmp (op_network, "BT"))
-    {
-      o->address_network = GNUNET_NT_BT;
-    }
-    else
-    {
-      fprintf (stderr,
-               "Invalid address-network in operation %u `%s' in episode `%s': 
`%s'\n",
-               op_counter, "ADD_ADDRESS", op_name, op_network);
-      GNUNET_free (op_network);
-      GNUNET_free (op_name);
-      return GNUNET_SYSERR;
-    }
-  }
-  GNUNET_free (op_network);
-  GNUNET_free (op_name);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Found operation %s: [%llu:%llu] address `%s' plugin `%s' \n",
-              "ADD_ADDRESS", o->peer_id, o->address_id, o->address, o->plugin);
-
-  return GNUNET_OK;
-}
-
-
-static int
-load_op_del_address (struct GNUNET_ATS_TEST_Operation *o,
-                     struct Episode *e,
-                     int op_counter,
-                     char *sec_name,
-                     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *op_name;
-
-  // char *op_network;
-
-  /* peer pid */
-  GNUNET_asprintf (&op_name, "op-%u-peer-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->peer_id))
-  {
-    fprintf (stderr, "Missing peer-id in operation %u `%s' in episode `%s'\n",
-             op_counter, "DEL_ADDRESS", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* address pid */
-  GNUNET_asprintf (&op_name, "op-%u-address-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->address_id))
-  {
-    fprintf (stderr,
-             "Missing address-id in operation %u `%s' in episode `%s'\n",
-             op_counter, "DEL_ADDRESS", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-#if 0
-  /* plugin */
-  GNUNET_asprintf (&op_name, "op-%u-plugin", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->plugin))
-  {
-    fprintf (stderr, "Missing plugin in operation %u `%s' in episode `%s'\n",
-             op_counter, "DEL_ADDRESS", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* address  */
-  GNUNET_asprintf (&op_name, "op-%u-address", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->address))
-  {
-    fprintf (stderr, "Missing address in operation %u `%s' in episode `%s'\n",
-             op_counter, "DEL_ADDRESS", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* session */
-  GNUNET_asprintf (&op_name, "op-%u-address-session", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->
-                                                              address_session))
-  {
-    fprintf (stderr,
-             "Missing address-session in operation %u `%s' in episode `%s'\n",
-             op_counter, "DEL_ADDRESS", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-#endif
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Found operation %s: [%llu:%llu] address `%s' plugin `%s' \n",
-              "DEL_ADDRESS", o->peer_id, o->address_id, o->address, o->plugin);
-
-  return GNUNET_OK;
-}
-
-
-static enum GNUNET_ATS_Property
-parse_preference_string (const char *str)
-{
-  int c = 0;
-  char *props[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceTypeString;
-
-  for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
-    if (0 == strcmp (str, props[c]))
-      return c;
-  return 0;
-}
-
-
-static int
-load_op_start_set_preference (struct GNUNET_ATS_TEST_Operation *o,
-                              struct Episode *e,
-                              int op_counter,
-                              char *sec_name,
-                              const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *op_name;
-  char *type;
-  char *pref;
-
-  /* peer pid */
-  GNUNET_asprintf (&op_name, "op-%u-peer-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->peer_id))
-  {
-    fprintf (stderr, "Missing peer-id in operation %u  `%s' in episode `%s'\n",
-             op_counter, "START_SET_PREFERENCE", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* address pid */
-  GNUNET_asprintf (&op_name, "op-%u-client-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->client_id))
-  {
-    fprintf (stderr, "Missing client-id in operation %u `%s' in episode 
`%s'\n",
-             op_counter, "START_SET_PREFERENCE", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* generator */
-  GNUNET_asprintf (&op_name, "op-%u-gen-type", op_counter);
-  if ((GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                               sec_name,
-                                                               op_name, 
&type)))
-  {
-    fprintf (stderr, "Missing type in operation %u `%s' in episode `%s'\n",
-             op_counter, "START_SET_PREFERENCE", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-
-  /* Load arguments for set_rate, start_send, set_preference */
-  if (0 == strcmp (type, "constant"))
-  {
-    o->gen_type = GNUNET_ATS_TEST_TG_CONSTANT;
-  }
-  else if (0 == strcmp (type, "linear"))
-  {
-    o->gen_type = GNUNET_ATS_TEST_TG_LINEAR;
-  }
-  else if (0 == strcmp (type, "sinus"))
-  {
-    o->gen_type = GNUNET_ATS_TEST_TG_SINUS;
-  }
-  else if (0 == strcmp (type, "random"))
-  {
-    o->gen_type = GNUNET_ATS_TEST_TG_RANDOM;
-  }
-  else
-  {
-    fprintf (stderr, "Invalid generator type %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (type);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (type);
-  GNUNET_free (op_name);
-
-
-  /* Get base rate */
-  GNUNET_asprintf (&op_name, "op-%u-base-rate", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->base_rate))
-  {
-    fprintf (stderr, "Missing base rate in operation %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-
-  /* Get max rate */
-  GNUNET_asprintf (&op_name, "op-%u-max-rate", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->max_rate))
-  {
-    if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) ||
-        (GNUNET_ATS_TEST_TG_RANDOM == o->gen_type) ||
-        (GNUNET_ATS_TEST_TG_SINUS == o->gen_type))
-    {
-      fprintf (stderr, "Missing max rate in operation %u `%s' in episode %u\n",
-               op_counter, op_name, e->id);
-      GNUNET_free (op_name);
-      return GNUNET_SYSERR;
-    }
-  }
-  GNUNET_free (op_name);
-
-  /* Get period */
-  GNUNET_asprintf (&op_name, "op-%u-period", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
-                                                            sec_name, op_name,
-                                                            &o->period))
-  {
-    o->period = e->duration;
-  }
-  GNUNET_free (op_name);
-
-  /* Get frequency */
-  GNUNET_asprintf (&op_name, "op-%u-frequency", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
-                                                            sec_name, op_name,
-                                                            &o->frequency))
-  {
-    fprintf (stderr, "Missing frequency in operation %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* Get preference */
-  GNUNET_asprintf (&op_name, "op-%u-pref", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                              sec_name, 
op_name,
-                                                              &pref))
-  {
-    fprintf (stderr, "Missing preference in operation %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-
-  if (0 == (o->pref_type = parse_preference_string (pref)))
-  {
-    fprintf (stderr, "Invalid preference in operation %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (op_name);
-    GNUNET_free (pref);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (pref);
-  GNUNET_free (op_name);
-
-  /* Get feedback delay */
-  GNUNET_asprintf (&op_name, "op-%u-feedback_delay", op_counter);
-  if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_time (cfg,
-                                                        sec_name, op_name,
-                                                        &o->feedback_delay))
-  {
-    fprintf (stderr,
-             "Using feedback delay %llu in operation %u `%s' in episode %u\n",
-             (long long unsigned int) o->feedback_delay.rel_value_us,
-             op_counter, op_name, e->id);
-  }
-  else
-    o->feedback_delay = GNUNET_TIME_UNIT_FOREVER_REL;
-  GNUNET_free (op_name);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Found operation %s: [%llu:%llu]: %s = %llu\n",
-              "START_SET_PREFERENCE", o->peer_id, o->address_id,
-              GNUNET_ATS_print_preference_type (o->pref_type), o->base_rate);
-
-  return GNUNET_OK;
-}
-
-
-static int
-load_op_stop_set_preference (struct GNUNET_ATS_TEST_Operation *o,
-                             struct Episode *e,
-                             int op_counter,
-                             char *sec_name,
-                             const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *op_name;
-  char *pref;
-
-  /* peer pid */
-  GNUNET_asprintf (&op_name, "op-%u-peer-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->peer_id))
-  {
-    fprintf (stderr, "Missing peer-id in operation %u  `%s' in episode `%s'\n",
-             op_counter, "STOP_SET_PREFERENCE", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* address pid */
-  GNUNET_asprintf (&op_name, "op-%u-address-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->address_id))
-  {
-    fprintf (stderr,
-             "Missing address-id in operation %u `%s' in episode `%s'\n",
-             op_counter, "STOP_SET_PREFERENCE", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* Get preference */
-  GNUNET_asprintf (&op_name, "op-%u-pref", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                              sec_name, 
op_name,
-                                                              &pref))
-  {
-    fprintf (stderr,
-             "Missing preference in operation %u `%s' in episode `%s'\n",
-             op_counter, "STOP_SET_PREFERENCE", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-
-  if (0 == (o->pref_type = parse_preference_string (pref)))
-  {
-    fprintf (stderr, "Invalid preference in operation %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (op_name);
-    GNUNET_free (pref);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (pref);
-  GNUNET_free (op_name);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Found operation %s: [%llu:%llu]: %s\n",
-              "STOP_SET_PREFERENCE", o->peer_id, o->address_id,
-              GNUNET_ATS_print_preference_type (o->pref_type));
-  return GNUNET_OK;
-}
-
-
-static enum GNUNET_ATS_Property
-parse_property_string (const char *str)
-{
-  enum GNUNET_ATS_Property c;
-
-  for (c = 0; c < GNUNET_ATS_PropertyCount; c++)
-    if (0 == strcmp (str,
-                     GNUNET_ATS_print_property_type (c)))
-      return c;
-  return 0;
-}
-
-
-static int
-load_op_start_set_property (struct GNUNET_ATS_TEST_Operation *o,
-                            struct Episode *e,
-                            int op_counter,
-                            char *sec_name,
-                            const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *op_name;
-  char *type;
-  char *prop;
-
-  /* peer pid */
-  GNUNET_asprintf (&op_name, "op-%u-peer-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->peer_id))
-  {
-    fprintf (stderr, "Missing peer-id in operation %u  `%s' in episode `%s'\n",
-             op_counter, "START_SET_PROPERTY", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* address pid */
-  GNUNET_asprintf (&op_name, "op-%u-address-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->address_id))
-  {
-    fprintf (stderr,
-             "Missing address-id in operation %u `%s' in episode `%s'\n",
-             op_counter, "START_SET_PROPERTY", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* generator */
-  GNUNET_asprintf (&op_name, "op-%u-gen-type", op_counter);
-  if ((GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                               sec_name,
-                                                               op_name, 
&type)))
-  {
-    fprintf (stderr, "Missing type in operation %u `%s' in episode `%s'\n",
-             op_counter, "START_SET_PROPERTY", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-
-  /* Load arguments for set_rate, start_send, set_preference */
-  if (0 == strcmp (type, "constant"))
-  {
-    o->gen_type = GNUNET_ATS_TEST_TG_CONSTANT;
-  }
-  else if (0 == strcmp (type, "linear"))
-  {
-    o->gen_type = GNUNET_ATS_TEST_TG_LINEAR;
-  }
-  else if (0 == strcmp (type, "sinus"))
-  {
-    o->gen_type = GNUNET_ATS_TEST_TG_SINUS;
-  }
-  else if (0 == strcmp (type, "random"))
-  {
-    o->gen_type = GNUNET_ATS_TEST_TG_RANDOM;
-  }
-  else
-  {
-    fprintf (stderr, "Invalid generator type %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (type);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (type);
-  GNUNET_free (op_name);
-
-
-  /* Get base rate */
-  GNUNET_asprintf (&op_name, "op-%u-base-rate", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->base_rate))
-  {
-    fprintf (stderr, "Missing base rate in operation %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-
-  /* Get max rate */
-  GNUNET_asprintf (&op_name, "op-%u-max-rate", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->max_rate))
-  {
-    if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) ||
-        (GNUNET_ATS_TEST_TG_RANDOM == o->gen_type) ||
-        (GNUNET_ATS_TEST_TG_SINUS == o->gen_type))
-    {
-      fprintf (stderr, "Missing max rate in operation %u `%s' in episode %u\n",
-               op_counter, op_name, e->id);
-      GNUNET_free (op_name);
-      return GNUNET_SYSERR;
-    }
-  }
-  GNUNET_free (op_name);
-
-  /* Get period */
-  GNUNET_asprintf (&op_name, "op-%u-period", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
-                                                            sec_name, op_name,
-                                                            &o->period))
-  {
-    o->period = e->duration;
-  }
-  GNUNET_free (op_name);
-
-  /* Get frequency */
-  GNUNET_asprintf (&op_name, "op-%u-frequency", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
-                                                            sec_name, op_name,
-                                                            &o->frequency))
-  {
-    fprintf (stderr, "Missing frequency in operation %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* Get preference */
-  GNUNET_asprintf (&op_name, "op-%u-property", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                              sec_name, 
op_name,
-                                                              &prop))
-  {
-    fprintf (stderr, "Missing property in operation %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (op_name);
-    GNUNET_free (prop);
-    return GNUNET_SYSERR;
-  }
-
-  if (0 == (o->prop_type = parse_property_string (prop)))
-  {
-    fprintf (stderr, "Invalid property in operation %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (op_name);
-    GNUNET_free (prop);
-    return GNUNET_SYSERR;
-  }
-
-  GNUNET_free (prop);
-  GNUNET_free (op_name);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Found operation %s: [%llu:%llu] %s = %llu\n",
-              "START_SET_PROPERTY", o->peer_id, o->address_id,
-              GNUNET_ATS_print_property_type (o->prop_type), o->base_rate);
-
-  return GNUNET_OK;
-}
-
-
-static int
-load_op_stop_set_property (struct GNUNET_ATS_TEST_Operation *o,
-                           struct Episode *e,
-                           int op_counter,
-                           char *sec_name,
-                           const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *op_name;
-  char *pref;
-
-  /* peer pid */
-  GNUNET_asprintf (&op_name, "op-%u-peer-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->peer_id))
-  {
-    fprintf (stderr, "Missing peer-id in operation %u  `%s' in episode `%s'\n",
-             op_counter, "STOP_SET_PROPERTY", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* address pid */
-  GNUNET_asprintf (&op_name, "op-%u-address-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->address_id))
-  {
-    fprintf (stderr,
-             "Missing address-id in operation %u `%s' in episode `%s'\n",
-             op_counter, "STOP_SET_PROPERTY", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-
-  /* Get property */
-  GNUNET_asprintf (&op_name, "op-%u-property", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                              sec_name, 
op_name,
-                                                              &pref))
-  {
-    fprintf (stderr, "Missing property in operation %u `%s' in episode `%s'\n",
-             op_counter, "STOP_SET_PROPERTY", op_name);
-    GNUNET_free (op_name);
-    GNUNET_free (pref);
-    return GNUNET_SYSERR;
-  }
-
-  if (0 == (o->prop_type = parse_property_string (pref)))
-  {
-    fprintf (stderr, "Invalid property in operation %u `%s' in episode %u\n",
-             op_counter, op_name, e->id);
-    GNUNET_free (op_name);
-    GNUNET_free (pref);
-    return GNUNET_SYSERR;
-  }
-
-  GNUNET_free (pref);
-  GNUNET_free (op_name);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Found operation %s: [%llu:%llu] %s\n",
-              "STOP_SET_PROPERTY", o->peer_id, o->address_id,
-              GNUNET_ATS_print_property_type (o->prop_type));
-
-  return GNUNET_OK;
-}
-
-
-static int
-load_op_start_request (struct GNUNET_ATS_TEST_Operation *o,
-                       struct Episode *e,
-                       int op_counter,
-                       char *sec_name,
-                       const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *op_name;
-
-  /* peer pid */
-  GNUNET_asprintf (&op_name, "op-%u-peer-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->peer_id))
-  {
-    fprintf (stderr, "Missing peer-id in operation %u  `%s' in episode `%s'\n",
-             op_counter, "START_REQUEST", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-  return GNUNET_OK;
-}
-
-
-static int
-load_op_stop_request (struct GNUNET_ATS_TEST_Operation *o,
-                      struct Episode *e,
-                      int op_counter,
-                      char *sec_name,
-                      const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *op_name;
-
-  /* peer pid */
-  GNUNET_asprintf (&op_name, "op-%u-peer-id", op_counter);
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                              sec_name, 
op_name,
-                                                              &o->peer_id))
-  {
-    fprintf (stderr, "Missing peer-id in operation %u  `%s' in episode `%s'\n",
-             op_counter, "STOP_REQUEST", op_name);
-    GNUNET_free (op_name);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (op_name);
-  return GNUNET_OK;
-}
-
-
-static int
-load_episode (struct Experiment *e, struct Episode *cur,
-              struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  struct GNUNET_ATS_TEST_Operation *o;
-  char *sec_name;
-  char *op_name;
-  char *op;
-  int op_counter = 0;
-  int res;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "=== Parsing episode %u\n", cur->id);
-  GNUNET_asprintf (&sec_name, "episode-%u", cur->id);
-
-  while (1)
-  {
-    /* Load operation */
-    GNUNET_asprintf (&op_name, "op-%u-operation", op_counter);
-    if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                                sec_name,
-                                                                op_name, &op))
-    {
-      GNUNET_free (op_name);
-      break;
-    }
-    o = GNUNET_new (struct GNUNET_ATS_TEST_Operation);
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "==== Parsing operation %u: `%s'\n",
-                cur->id, op_name);
-
-    /* operations = set_rate, start_send, stop_send, set_preference */
-    if (0 == strcmp (op, "address_add"))
-    {
-      o->type = SOLVER_OP_ADD_ADDRESS;
-      res = load_op_add_address (o, cur,
-                                 op_counter, sec_name, cfg);
-    }
-    else if (0 == strcmp (op, "address_del"))
-    {
-      o->type = SOLVER_OP_DEL_ADDRESS;
-      res = load_op_del_address (o, cur,
-                                 op_counter, sec_name, cfg);
-    }
-    else if (0 == strcmp (op, "start_set_property"))
-    {
-      o->type = SOLVER_OP_START_SET_PROPERTY;
-      res = load_op_start_set_property (o, cur,
-                                        op_counter, sec_name, cfg);
-    }
-    else if (0 == strcmp (op, "stop_set_property"))
-    {
-      o->type = SOLVER_OP_STOP_SET_PROPERTY;
-      res = load_op_stop_set_property (o, cur,
-                                       op_counter, sec_name, cfg);
-    }
-    else if (0 == strcmp (op, "start_set_preference"))
-    {
-      o->type = SOLVER_OP_START_SET_PREFERENCE;
-      res = load_op_start_set_preference (o, cur,
-                                          op_counter, sec_name, cfg);
-    }
-    else if (0 == strcmp (op, "stop_set_preference"))
-    {
-      o->type = SOLVER_OP_STOP_SET_PREFERENCE;
-      res = load_op_stop_set_preference (o, cur,
-                                         op_counter, sec_name, cfg);
-    }
-    else if (0 == strcmp (op, "start_request"))
-    {
-      o->type = SOLVER_OP_START_REQUEST;
-      res = load_op_start_request (o, cur,
-                                   op_counter, sec_name, cfg);
-    }
-    else if (0 == strcmp (op, "stop_request"))
-    {
-      o->type = SOLVER_OP_STOP_REQUEST;
-      res = load_op_stop_request (o, cur,
-                                  op_counter, sec_name, cfg);
-    }
-    else
-    {
-      fprintf (stderr, "Invalid operation %u `%s' in episode %u\n",
-               op_counter, op, cur->id);
-      res = GNUNET_SYSERR;
-    }
-
-    GNUNET_free (op);
-    GNUNET_free (op_name);
-
-    if (GNUNET_SYSERR == res)
-    {
-      GNUNET_free (o);
-      GNUNET_free (sec_name);
-      return GNUNET_SYSERR;
-    }
-
-    GNUNET_CONTAINER_DLL_insert_tail (cur->head, cur->tail, o);
-    op_counter++;
-  }
-  GNUNET_free (sec_name);
-  return GNUNET_OK;
-}
-
-
-static int
-load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  int e_counter = 0;
-  char *sec_name;
-  struct GNUNET_TIME_Relative e_duration;
-  struct Episode *cur;
-  struct Episode *last;
-
-  e_counter = 0;
-  last = NULL;
-  while (1)
-  {
-    GNUNET_asprintf (&sec_name, "episode-%u", e_counter);
-    if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
-                                                              sec_name,
-                                                              "duration",
-                                                              &e_duration))
-    {
-      GNUNET_free (sec_name);
-      break;
-    }
-
-    cur = GNUNET_new (struct Episode);
-    cur->duration = e_duration;
-    cur->id = e_counter;
-
-    if (GNUNET_OK != load_episode (e, cur, cfg))
-    {
-      GNUNET_free (sec_name);
-      GNUNET_free (cur);
-      return GNUNET_SYSERR;
-    }
-
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Found episode %u with duration %s \n",
-                e_counter,
-                GNUNET_STRINGS_relative_time_to_string (cur->duration,
-                                                        GNUNET_YES));
-
-    /* Update experiment */
-    e->num_episodes++;
-    e->total_duration = GNUNET_TIME_relative_add (e->total_duration,
-                                                  cur->duration);
-    /* Put in linked list */
-    if (NULL == last)
-      e->start = cur;
-    else
-      last->next = cur;
-
-    GNUNET_free (sec_name);
-    e_counter++;
-    last = cur;
-  }
-  return e_counter;
-}
-
-
-static void
-timeout_experiment (void *cls)
-{
-  struct Experiment *e = cls;
-
-  e->experiment_timeout_task = NULL;
-  fprintf (stderr, "Experiment timeout!\n");
-
-  if (NULL != e->episode_timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (e->episode_timeout_task);
-    e->episode_timeout_task = NULL;
-  }
-
-  e->e_done_cb (e, GNUNET_TIME_absolute_get_duration (e->start_time),
-                GNUNET_SYSERR);
-}
-
-
-struct ATS_Address *
-create_ats_address (const struct GNUNET_PeerIdentity *peer,
-                    const char *plugin_name,
-                    const void *plugin_addr,
-                    size_t plugin_addr_len,
-                    uint32_t session_id,
-                    uint32_t network)
-{
-  struct ATS_Address *aa = NULL;
-
-  aa = GNUNET_malloc (sizeof(struct ATS_Address) + plugin_addr_len + strlen (
-                        plugin_name) + 1);
-  aa->atsi = GNUNET_new (struct GNUNET_ATS_Information);
-  aa->atsi[0].type = htonl (GNUNET_ATS_NETWORK_TYPE);
-  aa->atsi[0].value = htonl (network);
-  aa->atsi_count = 1;
-
-  aa->peer = *peer;
-  aa->addr_len = plugin_addr_len;
-  aa->addr = &aa[1];
-  aa->plugin = (char *) &aa[1] + plugin_addr_len;
-  GNUNET_memcpy (&aa[1], plugin_addr, plugin_addr_len);
-  GNUNET_memcpy (aa->plugin, plugin_name, strlen (plugin_name) + 1);
-  aa->session_id = session_id;
-
-  return aa;
-}
-
-
-static void
-enforce_add_address (struct GNUNET_ATS_TEST_Operation *op)
-{
-  struct TestPeer *p;
-  struct TestAddress *a;
-  int c;
-
-  if (NULL == (p = find_peer_by_id (op->peer_id)))
-  {
-    p = GNUNET_new (struct TestPeer);
-    p->id = op->peer_id;
-    p->assigned_bw_in = 0;
-    p->assigned_bw_out = 0;
-    memset (&p->peer_id, op->peer_id, sizeof(p->peer_id));
-    for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
-    {
-      p->pref_abs[c] = DEFAULT_ABS_PREFERENCE;
-      p->pref_norm[c] = DEFAULT_REL_PREFERENCE;
-    }
-
-    GNUNET_CONTAINER_DLL_insert (peer_head, peer_tail, p);
-  }
-
-  if (NULL != (find_address_by_id (p, op->address_id)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Duplicate address %u for peer %u\n",
-                op->address_id, op->peer_id);
-    return;
-  }
-
-  a = GNUNET_new (struct TestAddress);
-  a->aid = op->address_id;
-  a->network = op->address_network;
-  a->ats_addr = create_ats_address (&p->peer_id, op->plugin, op->address,
-                                    strlen (op->address) + 1,
-                                    op->address_session, op->address_network);
-  memset (&p->peer_id, op->peer_id, sizeof(p->peer_id));
-  GNUNET_CONTAINER_DLL_insert_tail (p->addr_head, p->addr_tail, a);
-
-  for (c = 0; c < GNUNET_ATS_PropertyCount; c++)
-    a->prop_norm[c] = DEFAULT_REL_QUALITY;
-
-  GNUNET_CONTAINER_multipeermap_put (sh->addresses, &p->peer_id, a->ats_addr,
-                                     
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Adding address %u for peer %u in network `%s'\n",
-              op->address_id, op->peer_id, GNUNET_NT_to_string (a->network));
-
-  sh->sf->s_add (sh->sf->cls, a->ats_addr, op->address_network);
-}
-
-
-static void
-enforce_del_address (struct GNUNET_ATS_TEST_Operation *op)
-{
-  struct TestPeer *p;
-  struct TestAddress *a;
-  struct PropertyGenerator *pg;
-
-  if (NULL == (p = find_peer_by_id (op->peer_id)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Deleting address for unknown peer %u\n", op->peer_id);
-    return;
-  }
-
-  if (NULL == (a = find_address_by_id (p, op->address_id)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Deleting address for unknown peer %u\n", op->peer_id);
-    return;
-  }
-
-  while (NULL != (pg = find_prop_gen (p->id, a->aid, 0)))
-  {
-    GNUNET_ATS_solver_generate_property_stop (pg);
-  }
-
-  GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CONTAINER_multipeermap_remove (sh->addresses,
-                                                       &p->peer_id,
-                                                       a->ats_addr));
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Removing address %u for peer %u\n",
-              op->address_id,
-              op->peer_id);
-
-  sh->sf->s_del (sh->sf->cls, a->ats_addr);
-
-  if (NULL != l)
-  {
-    GNUNET_ATS_solver_logging_now (l);
-  }
-  GNUNET_CONTAINER_DLL_remove (p->addr_head, p->addr_tail, a);
-
-  GNUNET_free (a->ats_addr->atsi);
-  GNUNET_free (a->ats_addr);
-  GNUNET_free (a);
-}
-
-
-static void
-enforce_start_property (struct GNUNET_ATS_TEST_Operation *op)
-{
-  struct PropertyGenerator *pg;
-  struct TestPeer *p;
-  struct TestAddress *a;
-
-  if (NULL != (pg = find_prop_gen (op->peer_id, op->address_id, 
op->prop_type)))
-  {
-    GNUNET_ATS_solver_generate_property_stop (pg);
-    GNUNET_free (pg);
-  }
-
-  if (NULL == (p = find_peer_by_id (op->peer_id)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Starting property generation for unknown peer %u\n",
-                op->peer_id);
-    return;
-  }
-
-  if (NULL == (a = find_address_by_id (p, op->address_id)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Setting property for unknown address %u\n", op->peer_id);
-    return;
-  }
-
-  GNUNET_ATS_solver_generate_property_start (op->peer_id,
-                                             op->address_id,
-                                             p, a,
-                                             op->gen_type,
-                                             op->base_rate,
-                                             op->max_rate,
-                                             op->period,
-                                             op->frequency,
-                                             op->prop_type);
-}
-
-
-static void
-enforce_stop_property (struct GNUNET_ATS_TEST_Operation *op)
-{
-  struct PropertyGenerator *pg = find_prop_gen (op->peer_id, op->address_id,
-                                                op->prop_type);
-
-  if (NULL != pg)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Stopping preference generation for peer %u address %u\n",
-                op->peer_id,
-                op->address_id);
-    GNUNET_ATS_solver_generate_property_stop (pg);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Cannot find preference generator for peer %u address %u\n",
-                op->peer_id, op->address_id);
-    GNUNET_break (0);
-  }
-}
-
-
-static void
-enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op)
-{
-  struct PreferenceGenerator *pg;
-
-  if (NULL != (pg = find_pref_gen (op->peer_id, op->pref_type)))
-  {
-    GNUNET_ATS_solver_generate_preferences_stop (pg);
-    GNUNET_free (pg);
-  }
-
-  if (NULL == (find_peer_by_id (op->peer_id)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Starting preference generation for unknown peer %u\n",
-                op->peer_id);
-    return;
-  }
-
-  GNUNET_ATS_solver_generate_preferences_start (op->peer_id,
-                                                op->address_id,
-                                                op->client_id,
-                                                op->gen_type,
-                                                op->base_rate,
-                                                op->max_rate,
-                                                op->period,
-                                                op->frequency,
-                                                op->pref_type,
-                                                op->frequency);
-}
-
-
-static void
-enforce_stop_preference (struct GNUNET_ATS_TEST_Operation *op)
-{
-  struct PreferenceGenerator *pg = find_pref_gen (op->peer_id,
-                                                  op->pref_type);
-
-  if (NULL != pg)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Stopping property generation for peer %u address %u\n",
-                op->peer_id,
-                op->address_id);
-    GNUNET_ATS_solver_generate_preferences_stop (pg);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Cannot find preference generator for peer %u address %u\n",
-                op->peer_id, op->address_id);
-    GNUNET_break (0);
-  }
-}
-
-
-static void
-enforce_start_request (struct GNUNET_ATS_TEST_Operation *op)
-{
-  struct TestPeer *p;
-
-  if (NULL == (p = find_peer_by_id (op->peer_id)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Requesting address for unknown peer %u\n", op->peer_id);
-    return;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Requesting address for peer %u\n",
-              op->peer_id);
-  p->is_requested = GNUNET_YES;
-
-  sh->sf->s_get (sh->sf->cls, &p->peer_id);
-}
-
-
-static void
-enforce_stop_request (struct GNUNET_ATS_TEST_Operation *op)
-{
-  struct TestPeer *p;
-
-  if (NULL == (p = find_peer_by_id (op->peer_id)))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Requesting address for unknown peer %u\n", op->peer_id);
-    return;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Stop requesting address for peer %u\n",
-              op->peer_id);
-  p->is_requested = GNUNET_NO;
-  p->assigned_bw_in = 0;
-  p->assigned_bw_out = 0;
-  sh->sf->s_get_stop (sh->sf->cls, &p->peer_id);
-
-  if (NULL != l)
-  {
-    GNUNET_ATS_solver_logging_now (l);
-  }
-}
-
-
-static void
-enforce_episode (struct Episode *ep)
-{
-  struct GNUNET_ATS_TEST_Operation *cur;
-
-  for (cur = ep->head; NULL != cur; cur = cur->next)
-  {
-    switch (cur->type)
-    {
-    case SOLVER_OP_ADD_ADDRESS:
-      fprintf (stderr, "Enforcing operation: %s [%llu:%llu]\n",
-               print_op (cur->type), cur->peer_id, cur->address_id);
-      enforce_add_address (cur);
-      break;
-
-    case SOLVER_OP_DEL_ADDRESS:
-      fprintf (stderr, "Enforcing operation: %s [%llu:%llu]\n",
-               print_op (cur->type), cur->peer_id, cur->address_id);
-      enforce_del_address (cur);
-      break;
-
-    case SOLVER_OP_START_SET_PROPERTY:
-      fprintf (stderr, "Enforcing operation: %s [%llu:%llu] == %llu\n",
-               print_op (cur->type), cur->peer_id, cur->address_id,
-               cur->base_rate);
-      enforce_start_property (cur);
-      break;
-
-    case SOLVER_OP_STOP_SET_PROPERTY:
-      fprintf (stderr, "Enforcing operation: %s [%llu:%llu] == %llu\n",
-               print_op (cur->type), cur->peer_id, cur->address_id,
-               cur->base_rate);
-      enforce_stop_property (cur);
-      break;
-
-    case SOLVER_OP_START_SET_PREFERENCE:
-      fprintf (stderr, "Enforcing operation: %s [%llu:%llu] == %llu\n",
-               print_op (cur->type), cur->peer_id, cur->address_id,
-               cur->base_rate);
-      enforce_start_preference (cur);
-      break;
-
-    case SOLVER_OP_STOP_SET_PREFERENCE:
-      fprintf (stderr, "Enforcing operation: %s [%llu:%llu] == %llu\n",
-               print_op (cur->type), cur->peer_id, cur->address_id,
-               cur->base_rate);
-      enforce_stop_preference (cur);
-      break;
-
-    case SOLVER_OP_START_REQUEST:
-      fprintf (stderr, "Enforcing operation: %s [%llu]\n",
-               print_op (cur->type), cur->peer_id);
-      enforce_start_request (cur);
-      break;
-
-    case SOLVER_OP_STOP_REQUEST:
-      fprintf (stderr, "Enforcing operation: %s [%llu]\n",
-               print_op (cur->type), cur->peer_id);
-      enforce_stop_request (cur);
-      break;
-
-    default:
-      break;
-    }
-  }
-}
-
-
-static void
-timeout_episode (void *cls)
-{
-  struct Experiment *e = cls;
-
-  e->episode_timeout_task = NULL;
-  if (NULL != e->ep_done_cb)
-    e->ep_done_cb (e->cur);
-
-  /* Scheduling next */
-  e->cur = e->cur->next;
-  if (NULL == e->cur)
-  {
-    /* done */
-    fprintf (stderr, "Last episode done!\n");
-    if (NULL != e->experiment_timeout_task)
-    {
-      GNUNET_SCHEDULER_cancel (e->experiment_timeout_task);
-      e->experiment_timeout_task = NULL;
-    }
-    e->e_done_cb (e, GNUNET_TIME_absolute_get_duration (e->start_time),
-                  GNUNET_OK);
-    return;
-  }
-
-  fprintf (stderr, "Running episode %u with timeout %s\n",
-           e->cur->id,
-           GNUNET_STRINGS_relative_time_to_string (e->cur->duration,
-                                                   GNUNET_YES));
-  e->episode_timeout_task = GNUNET_SCHEDULER_add_delayed (e->cur->duration,
-                                                          &timeout_episode, e);
-  enforce_episode (e->cur);
-}
-
-
-void
-GNUNET_ATS_solvers_experimentation_run (struct Experiment *e,
-                                        GNUNET_ATS_TESTING_EpisodeDoneCallback
-                                        ep_done_cb,
-                                        
GNUNET_ATS_TESTING_ExperimentDoneCallback
-                                        e_done_cb)
-{
-  fprintf (stderr, "Running experiment `%s'  with timeout %s\n", e->name,
-           GNUNET_STRINGS_relative_time_to_string (e->max_duration,
-                                                   GNUNET_YES));
-  e->e_done_cb = e_done_cb;
-  e->ep_done_cb = ep_done_cb;
-  e->start_time = GNUNET_TIME_absolute_get ();
-
-  /* Start total time out */
-  e->experiment_timeout_task = GNUNET_SCHEDULER_add_delayed (e->max_duration,
-                                                             
&timeout_experiment,
-                                                             e);
-
-  /* Start */
-  if (NULL == e->start)
-  {
-    GNUNET_break (0);
-    return;
-  }
-
-  e->cur = e->start;
-  fprintf (stderr, "Running episode %u with timeout %s\n",
-           e->cur->id,
-           GNUNET_STRINGS_relative_time_to_string (e->cur->duration,
-                                                   GNUNET_YES));
-  e->episode_timeout_task = GNUNET_SCHEDULER_add_delayed (e->cur->duration,
-                                                          &timeout_episode, e);
-  enforce_episode (e->cur);
-}
-
-
-void
-GNUNET_ATS_solvers_experimentation_stop (struct Experiment *e)
-{
-  if (NULL != e->experiment_timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (e->experiment_timeout_task);
-    e->experiment_timeout_task = NULL;
-  }
-  if (NULL != e->episode_timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (e->episode_timeout_task);
-    e->episode_timeout_task = NULL;
-  }
-  if (NULL != e->cfg)
-  {
-    GNUNET_CONFIGURATION_destroy (e->cfg);
-    e->cfg = NULL;
-  }
-  free_experiment (e);
-}
-
-
-struct Experiment *
-GNUNET_ATS_solvers_experimentation_load (char *filename)
-{
-  struct Experiment *e;
-  struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  e = NULL;
-
-  cfg = GNUNET_CONFIGURATION_create ();
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, filename))
-  {
-    fprintf (stderr, "Failed to load `%s'\n", filename);
-    GNUNET_CONFIGURATION_destroy (cfg);
-    return NULL;
-  }
-
-  e = create_experiment ();
-
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, 
"experiment",
-                                                              "name", 
&e->name))
-  {
-    fprintf (stderr, "Invalid %s \n", "name");
-    free_experiment (e);
-    return NULL;
-  }
-  else
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment name: `%s'\n", e->name);
-
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, 
"experiment",
-                                                              "log_prefix",
-                                                              &e->log_prefix))
-  {
-    fprintf (stderr, "Invalid %s \n", "log_prefix");
-    free_experiment (e);
-    return NULL;
-  }
-  else
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment logging prefix: `%s'\n",
-                e->log_prefix);
-
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_filename (cfg,
-                                                                "experiment",
-                                                                
"log_output_dir",
-                                                                &e->
-                                                                
log_output_dir))
-  {
-    e->log_output_dir = NULL;
-  }
-  else
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Experiment logging output directory: `%s'\n",
-                e->log_output_dir);
-
-
-  if (GNUNET_SYSERR == (e->log_append_time_stamp =
-                          GNUNET_CONFIGURATION_get_value_yesno (cfg,
-                                                                "experiment",
-                                                                
"log_append_time_stamp")))
-    e->log_append_time_stamp = GNUNET_YES;
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Experiment logging append timestamp: `%s'\n",
-              (GNUNET_YES == e->log_append_time_stamp) ? "yes" : "no");
-
-
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_filename (cfg,
-                                                                "experiment",
-                                                                "cfg_file",
-                                                                &e->cfg_file))
-  {
-    fprintf (stderr, "Invalid %s \n", "cfg_file");
-    free_experiment (e);
-    return NULL;
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment configuration: `%s'\n",
-                e->cfg_file);
-    e->cfg = GNUNET_CONFIGURATION_create ();
-    if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (e->cfg, e->cfg_file))
-    {
-      fprintf (stderr, "Invalid configuration %s \n", "cfg_file");
-      free_experiment (e);
-      return NULL;
-    }
-  }
-
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, "experiment",
-                                                            "log_freq",
-                                                            &e->log_freq))
-  {
-    fprintf (stderr, "Invalid %s \n", "log_freq");
-    free_experiment (e);
-    return NULL;
-  }
-  else
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment logging frequency: `%s'\n",
-                GNUNET_STRINGS_relative_time_to_string (e->log_freq,
-                                                        GNUNET_YES));
-
-  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, "experiment",
-                                                            "max_duration",
-                                                            &e->max_duration))
-  {
-    fprintf (stderr, "Invalid %s", "max_duration");
-    free_experiment (e);
-    return NULL;
-  }
-  else
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment duration: `%s'\n",
-                GNUNET_STRINGS_relative_time_to_string (e->max_duration,
-                                                        GNUNET_YES));
-
-  if (GNUNET_SYSERR == load_episodes (e, cfg))
-  {
-    GNUNET_ATS_solvers_experimentation_stop (e);
-    GNUNET_CONFIGURATION_destroy (cfg);
-    e = NULL;
-    fprintf (stderr, "Failed to load experiment\n");
-    return NULL;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Loaded %u episodes with total duration %s\n",
-              e->num_episodes,
-              GNUNET_STRINGS_relative_time_to_string (e->total_duration,
-                                                      GNUNET_YES));
-
-  GNUNET_CONFIGURATION_destroy (cfg);
-  return e;
-}
-
-
-/**
- * Solver
- */
-
-static int
-free_all_it (void *cls,
-             const struct GNUNET_PeerIdentity *key,
-             void *value)
-{
-  struct ATS_Address *address = value;
-
-  GNUNET_break (GNUNET_OK == GNUNET_CONTAINER_multipeermap_remove (
-                  sh->env.addresses,
-                  key, value));
-  GNUNET_free (address);
-
-  return GNUNET_OK;
-}
-
-
-void
-GNUNET_ATS_solvers_solver_stop (struct SolverHandle *sh)
-{
-  GNUNET_STATISTICS_destroy ((struct GNUNET_STATISTICS_Handle *) sh->env.stats,
-                             GNUNET_NO);
-  GNUNET_PLUGIN_unload (sh->plugin, sh->sf);
-  sh->sf = NULL;
-  GAS_normalization_stop ();
-
-  GNUNET_CONTAINER_multipeermap_iterate (sh->addresses,
-                                         &free_all_it,
-                                         NULL);
-  GNUNET_CONTAINER_multipeermap_destroy (sh->addresses);
-  GNUNET_free (sh->plugin);
-  GNUNET_free (sh);
-}
-
-
-/**
- * Load quotas for networks from configuration
- *
- * @param cfg configuration handle
- * @param out_dest where to write outbound quotas
- * @param in_dest where to write inbound quotas
- * @param dest_length length of inbound and outbound arrays
- * @return number of networks loaded
- */
-unsigned int
-GNUNET_ATS_solvers_load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                                unsigned long long *out_dest,
-                                unsigned long long *in_dest,
-                                int dest_length)
-{
-  char *entry_in = NULL;
-  char *entry_out = NULL;
-  char *quota_out_str;
-  char *quota_in_str;
-  int c;
-  int res;
-
-  for (c = 0; (c < GNUNET_NT_COUNT) && (c < dest_length); c++)
-  {
-    in_dest[c] = 0;
-    out_dest[c] = 0;
-    GNUNET_asprintf (&entry_out,
-                     "%s_QUOTA_OUT",
-                     GNUNET_NT_to_string (c));
-    GNUNET_asprintf (&entry_in,
-                     "%s_QUOTA_IN",
-                     GNUNET_NT_to_string (c));
-
-    /* quota out */
-    if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, "ats",
-                                                            entry_out,
-                                                            &quota_out_str))
-    {
-      res = GNUNET_NO;
-      if (0 == strcmp (quota_out_str, BIG_M_STRING))
-      {
-        out_dest[c] = GNUNET_ATS_MaxBandwidth;
-        res = GNUNET_YES;
-      }
-      if ((GNUNET_NO == res) && (GNUNET_OK ==
-                                 GNUNET_STRINGS_fancy_size_to_bytes (
-                                   quota_out_str, &out_dest[c])))
-        res = GNUNET_YES;
-      if ((GNUNET_NO == res) && (GNUNET_OK ==
-                                 GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                                        "ats",
-                                                                        
entry_out,
-                                                                        &
-                                                                        
out_dest
-                                                                        [c])))
-        res = GNUNET_YES;
-
-      if (GNUNET_NO == res)
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                    _ (
-                      "Could not load quota for network `%s':  `%s', assigning 
default bandwidth %llu\n"),
-                    GNUNET_NT_to_string (c),
-                    quota_out_str,
-                    GNUNET_ATS_DefaultBandwidth);
-        out_dest[c] = GNUNET_ATS_DefaultBandwidth;
-      }
-      else
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Outbound quota configure for network `%s' is %llu\n",
-                    GNUNET_NT_to_string (c),
-                    out_dest[c]);
-      }
-      GNUNET_free (quota_out_str);
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                  _ (
-                    "No outbound quota configured for network `%s', assigning 
default bandwidth %llu\n"),
-                  GNUNET_NT_to_string (c),
-                  GNUNET_ATS_DefaultBandwidth);
-      out_dest[c] = GNUNET_ATS_DefaultBandwidth;
-    }
-
-    /* quota in */
-    if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, "ats",
-                                                            entry_in,
-                                                            &quota_in_str))
-    {
-      res = GNUNET_NO;
-      if (0 == strcmp (quota_in_str, BIG_M_STRING))
-      {
-        in_dest[c] = GNUNET_ATS_MaxBandwidth;
-        res = GNUNET_YES;
-      }
-      if ((GNUNET_NO == res) && (GNUNET_OK ==
-                                 GNUNET_STRINGS_fancy_size_to_bytes (
-                                   quota_in_str, &in_dest[c])))
-        res = GNUNET_YES;
-      if ((GNUNET_NO == res) && (GNUNET_OK ==
-                                 GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                                        "ats",
-                                                                        
entry_in,
-                                                                        
&in_dest
-                                                                        [c])))
-        res = GNUNET_YES;
-
-      if (GNUNET_NO == res)
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                    _ (
-                      "Could not load quota for network `%s':  `%s', assigning 
default bandwidth %llu\n"),
-                    GNUNET_NT_to_string (c),
-                    quota_in_str,
-                    GNUNET_ATS_DefaultBandwidth);
-        in_dest[c] = GNUNET_ATS_DefaultBandwidth;
-      }
-      else
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Inbound quota configured for network `%s' is %llu\n",
-                    GNUNET_NT_to_string (c),
-                    in_dest[c]);
-      }
-      GNUNET_free (quota_in_str);
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                  _ (
-                    "No outbound quota configure for network `%s', assigning 
default bandwidth %llu\n"),
-                  GNUNET_NT_to_string (c),
-                  GNUNET_ATS_DefaultBandwidth);
-      out_dest[c] = GNUNET_ATS_DefaultBandwidth;
-    }
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Loaded quota for network `%s' (in/out): %llu %llu\n",
-                GNUNET_NT_to_string (c),
-                in_dest[c],
-                out_dest[c]);
-    GNUNET_free (entry_out);
-    GNUNET_free (entry_in);
-  }
-  return GNUNET_NT_COUNT;
-}
-
-
-/**
- * Information callback for the solver
- *
- * @param cls the closure
- * @param op the solver operation
- * @param stat status of the solver operation
- * @param add additional solver information
- */
-static void
-solver_info_cb (void *cls,
-                enum GAS_Solver_Operation op,
-                enum GAS_Solver_Status stat,
-                enum GAS_Solver_Additional_Information add)
-{
-  char *add_info;
-
-  switch (add)
-  {
-  case GAS_INFO_NONE:
-    add_info = "GAS_INFO_NONE";
-    break;
-
-  case GAS_INFO_FULL:
-    add_info = "GAS_INFO_MLP_FULL";
-    break;
-
-  case GAS_INFO_UPDATED:
-    add_info = "GAS_INFO_MLP_UPDATED";
-    break;
-
-  case GAS_INFO_PROP_ALL:
-    add_info = "GAS_INFO_PROP_ALL";
-    break;
-
-  case GAS_INFO_PROP_SINGLE:
-    add_info = "GAS_INFO_PROP_SINGLE";
-    break;
-
-  default:
-    add_info = "INVALID";
-    break;
-  }
-
-  switch (op)
-  {
-  case GAS_OP_SOLVE_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s' `%s'\n",
-                "GAS_OP_SOLVE_START",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL", add_info);
-    return;
-
-  case GAS_OP_SOLVE_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n", "GAS_OP_SOLVE_STOP",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL", add_info);
-    return;
-
-  case GAS_OP_SOLVE_SETUP_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_SETUP_START",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_SETUP_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_SETUP_STOP",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_MLP_LP_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_LP_START",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_MLP_LP_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_LP_STOP",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_MLP_MLP_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_MLP_START",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_MLP_MLP_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_MLP_STOP",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_UPDATE_NOTIFICATION_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_UPDATE_NOTIFICATION_START",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    return;
-
-  default:
-    break;
-  }
-}
-
-
-static void
-solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address)
-{
-  struct GNUNET_TIME_Relative duration;
-  struct TestPeer *p;
-  static struct PreferenceGenerator *pg;
-  uint32_t delta;
-
-  if ((0 == address->assigned_bw_out) && (0 == address->assigned_bw_in))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Solver notified to disconnect peer `%s'\n",
-                GNUNET_i2s (&address->peer));
-  }
-  p = find_peer_by_pid (&address->peer);
-  if (NULL == p)
-    return;
-  p->assigned_bw_out = address->assigned_bw_out;
-  p->assigned_bw_in = address->assigned_bw_in;
-
-  for (pg = pref_gen_head; NULL != pg; pg = pg->next)
-  {
-    if (pg->peer == p->id)
-    {
-      duration = GNUNET_TIME_absolute_get_duration (
-        pg->feedback_last_bw_update);
-      delta = duration.rel_value_us * pg->last_assigned_bw_out;
-      pg->feedback_bw_out_acc += delta;
-
-      delta = duration.rel_value_us * pg->last_assigned_bw_in;
-      pg->feedback_bw_in_acc += delta;
-
-      pg->last_assigned_bw_in = address->assigned_bw_in;
-      pg->last_assigned_bw_out = address->assigned_bw_out;
-      pg->feedback_last_bw_update = GNUNET_TIME_absolute_get ();
-    }
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n",
-              GNUNET_i2s (&address->peer),
-              address,
-              address->assigned_bw_out,
-              address->assigned_bw_in);
-
-  if (NULL != l)
-    GNUNET_ATS_solver_logging_now (l);
-
-  return;
-}
-
-
-const double *
-get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id)
-{
-  struct TestPeer *p;
-
-  if (GNUNET_YES == opt_disable_normalization)
-  {
-    if (NULL == (p = find_peer_by_pid (id)))
-      return NULL;
-    return p->pref_abs;
-  }
-  else
-    return GAS_preference_get_by_peer (NULL,
-                                       id);
-}
-
-
-struct SolverHandle *
-GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type)
-{
-  struct SolverHandle *sh;
-  char *solver_str;
-
-  switch (type)
-  {
-  case GNUNET_ATS_SOLVER_PROPORTIONAL:
-    solver_str = "proportional";
-    break;
-
-  case GNUNET_ATS_SOLVER_MLP:
-    solver_str = "mlp";
-    break;
-
-  case GNUNET_ATS_SOLVER_RIL:
-    solver_str = "ril";
-    break;
-
-  default:
-    GNUNET_break (0);
-    return NULL;
-    break;
-  }
-
-  sh = GNUNET_new (struct SolverHandle);
-  GNUNET_asprintf (&sh->plugin,
-                   "libgnunet_plugin_ats_%s",
-                   solver_str);
-  sh->addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
-
-  /* setup environment */
-  sh->env.cfg = e->cfg;
-  sh->env.stats = GNUNET_STATISTICS_create ("ats", e->cfg);
-  sh->env.addresses = sh->addresses;
-  sh->env.bandwidth_changed_cb = &solver_bandwidth_changed_cb;
-  sh->env.get_preferences = &get_preferences_cb;
-  sh->env.network_count = GNUNET_NT_COUNT;
-  sh->env.info_cb = &solver_info_cb;
-  sh->env.network_count = GNUNET_NT_COUNT;
-
-  /* start normalization */
-  GAS_normalization_start ();
-
-  /* load quotas */
-  if (GNUNET_NT_COUNT != GNUNET_ATS_solvers_load_quotas (e->cfg,
-                                                         sh->env.out_quota,
-                                                         sh->env.in_quota,
-                                                         GNUNET_NT_COUNT))
-  {
-    GNUNET_break (0);
-    GNUNET_free (sh->plugin);
-    GNUNET_free (sh);
-    end_now ();
-    return NULL;
-  }
-
-  sh->sf = GNUNET_PLUGIN_load (sh->plugin, &sh->env);
-  if (NULL == sh->sf)
-  {
-    fprintf (stderr, "Failed to load solver `%s'\n", sh->plugin);
-    GNUNET_break (0);
-    GNUNET_free (sh->plugin);
-    GNUNET_free (sh);
-    end_now ();
-    return NULL;
-  }
-  return sh;
-}
-
-
-static void
-done ()
-{
-  struct TestPeer *cur;
-  struct TestPeer *next;
-
-  struct TestAddress *cur_a;
-  struct TestAddress *next_a;
-
-  /* Stop logging */
-  GNUNET_ATS_solver_logging_stop (l);
-
-  /* Stop all preference generation */
-  GNUNET_ATS_solver_generate_preferences_stop_all ();
-
-  /* Stop all property generation */
-  GNUNET_ATS_solver_generate_property_stop_all ();
-
-  if (opt_print)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "== Printing log information \n");
-    GNUNET_ATS_solver_logging_eval (l);
-  }
-  if (opt_save)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "== Saving log information \n");
-    GNUNET_ATS_solver_logging_write_to_disk (l, e->log_append_time_stamp,
-                                             e->log_output_dir);
-  }
-
-  if (NULL != l)
-  {
-    GNUNET_ATS_solver_logging_free (l);
-    l = NULL;
-  }
-
-  /* Clean up experiment */
-  if (NULL != e)
-  {
-    GNUNET_ATS_solvers_experimentation_stop (e);
-    e = NULL;
-  }
-
-  next = peer_head;
-  while (NULL != (cur = next))
-  {
-    next = cur->next;
-    GNUNET_CONTAINER_DLL_remove (peer_head, peer_tail, cur);
-    next_a = cur->addr_head;
-    while (NULL != (cur_a = next_a))
-    {
-      next_a = cur_a->next;
-      GNUNET_CONTAINER_DLL_remove (cur->addr_head, cur->addr_tail, cur_a);
-      GNUNET_free (cur_a);
-    }
-    GNUNET_free (cur);
-  }
-  if (NULL != sh)
-  {
-    GNUNET_ATS_solvers_solver_stop (sh);
-    sh = NULL;
-  }
-
-  /* Shutdown */
-  end_now ();
-}
-
-
-static void
-experiment_done_cb (struct Experiment *e, struct GNUNET_TIME_Relative duration,
-                    int success)
-{
-  if (GNUNET_OK == success)
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment done successful in %s\n",
-                GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES));
-  else
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment failed \n");
-
-  GNUNET_SCHEDULER_add_now (&done, NULL);
-}
-
-
-static void
-episode_done_cb (struct Episode *ep)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Episode %u done\n", ep->id);
-}
-
-
-/**
- * Do shutdown
- */
-static void
-end_now ()
-{
-  if (NULL != e)
-  {
-    GNUNET_ATS_solvers_experimentation_stop (e);
-    e = NULL;
-  }
-  if (NULL != sh)
-  {
-    GNUNET_ATS_solvers_solver_stop (sh);
-    sh = NULL;
-  }
-}
-
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  enum GNUNET_ATS_Solvers solver;
-  int c;
-
-  if (NULL == opt_exp_file)
-  {
-    fprintf (stderr, "No experiment given ...\n");
-    res = 1;
-    end_now ();
-    return;
-  }
-
-  if (NULL == opt_solver)
-  {
-    fprintf (stderr, "No solver given ...\n");
-    res = 1;
-    end_now ();
-    return;
-  }
-
-  if (0 == strcmp (opt_solver, "mlp"))
-  {
-    solver = GNUNET_ATS_SOLVER_MLP;
-  }
-  else if (0 == strcmp (opt_solver, "proportional"))
-  {
-    solver = GNUNET_ATS_SOLVER_PROPORTIONAL;
-  }
-  else if (0 == strcmp (opt_solver, "ril"))
-  {
-    solver = GNUNET_ATS_SOLVER_RIL;
-  }
-  else
-  {
-    fprintf (stderr, "No solver given ...");
-    res = 1;
-    end_now ();
-    return;
-  }
-
-  for (c = 0; c < GNUNET_ATS_PropertyCount; c++)
-    default_properties[c] = DEFAULT_REL_QUALITY;
-
-  for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
-    default_preferences[c] = DEFAULT_REL_PREFERENCE;
-
-  /* load experiment */
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "=== Loading experiment\n");
-  e = GNUNET_ATS_solvers_experimentation_load (opt_exp_file);
-  if (NULL == e)
-  {
-    fprintf (stderr, "Failed to load experiment ...\n");
-    res = 1;
-    end_now ();
-    return;
-  }
-
-  /* load solver */
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "=== Loading solver\n");
-  sh = GNUNET_ATS_solvers_solver_start (solver);
-  if (NULL == sh)
-  {
-    fprintf (stderr, "Failed to start solver ...\n");
-    end_now ();
-    res = 1;
-    return;
-  }
-
-  /* start logging */
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "=== Start logging \n");
-  l = GNUNET_ATS_solver_logging_start (e->log_freq);
-
-  /* run experiment */
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "=== Running experiment \n");
-  GNUNET_ATS_solvers_experimentation_run (e, episode_done_cb,
-                                          experiment_done_cb);
-
-  /* WAIT */
-}
-
-
-/**
- * Main function of the benchmark
- *
- * @param argc argument count
- * @param argv argument values
- */
-int
-main (int argc, char *argv[])
-{
-  opt_exp_file = NULL;
-  opt_solver = NULL;
-  opt_log = GNUNET_NO;
-  opt_save = GNUNET_NO;
-
-  res = 0;
-
-  static struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_option_string ('s',
-                                 "solver",
-                                 gettext_noop ("solver to use"),
-                                 &opt_solver),
-
-    GNUNET_GETOPT_option_string ('e',
-                                 "experiment"
-                                 gettext_noop ("experiment to use"),
-                                 &opt_exp_file),
-
-    GNUNET_GETOPT_option_verbose (&opt_verbose),
-
-    GNUNET_GETOPT_option_flag ('p',
-                               "print",
-                               gettext_noop ("print logging"),
-                               &opt_print),
-
-    GNUNET_GETOPT_option_flag ('f',
-                               "file",
-                               gettext_noop ("save logging to disk"),
-                               &opt_save),
-
-    GNUNET_GETOPT_option_flag ('d',
-                               "dn",
-                               gettext_noop ("disable normalization"),
-                               &opt_disable_normalization),
-
-    GNUNET_GETOPT_OPTION_END
-  };
-
-  GNUNET_PROGRAM_run (argc, argv, "gnunet-ats-solver-eval",
-                      NULL, options, &run, argv[0]);
-
-  return res;
-}
-
-
-/* end of file ats-testing-experiment.c*/
diff --git a/src/ats/gnunet-ats-solver-eval.h b/src/ats/gnunet-ats-solver-eval.h
deleted file mode 100644
index 7d14bf761..000000000
--- a/src/ats/gnunet-ats-solver-eval.h
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010-2013 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats-tests/ats-testing-experiment.c
- * @brief ats benchmark: controlled experiment execution
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#ifndef GNUNET_ATS_SOLVER_EVAL_H
-#define GNUNET_ATS_SOLVER_EVAL_H
-
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_ats_plugin.h"
-#include "gnunet_ats_service.h"
-#include "gnunet-service-ats_addresses.h"
-#include "gnunet-service-ats_normalization.h"
-#include "test_ats_api_common.h"
-
-enum GeneratorType
-{
-  GNUNET_ATS_TEST_TG_LINEAR,
-  GNUNET_ATS_TEST_TG_CONSTANT,
-  GNUNET_ATS_TEST_TG_RANDOM,
-  GNUNET_ATS_TEST_TG_SINUS
-};
-
-
-enum OperationType
-{
-  SOLVER_OP_ADD_ADDRESS,
-  SOLVER_OP_DEL_ADDRESS,
-  SOLVER_OP_START_SET_PROPERTY,
-  SOLVER_OP_STOP_SET_PROPERTY,
-  SOLVER_OP_START_SET_PREFERENCE,
-  SOLVER_OP_STOP_SET_PREFERENCE,
-  SOLVER_OP_START_REQUEST,
-  SOLVER_OP_STOP_REQUEST,
-};
-
-struct SolverHandle
-{
-  /**
-   * Solver plugin name
-   */
-  char *plugin;
-
-  /**
-   * Solver environment
-   */
-  struct GNUNET_ATS_PluginEnvironment env;
-
-  /**
-   * Solver handle
-   */
-  struct GNUNET_ATS_SolverFunctions *sf;
-
-  /**
-   * Address hashmap
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *addresses;
-};
-
-enum GNUNET_ATS_Solvers
-{
-  GNUNET_ATS_SOLVER_PROPORTIONAL,
-  GNUNET_ATS_SOLVER_MLP,
-  GNUNET_ATS_SOLVER_RIL,
-};
-
-struct LoggingFileHandle
-{
-  /* DLL list for logging time steps */
-  struct LoggingFileHandle *next;
-  struct LoggingFileHandle *prev;
-
-  /* peer id */
-  long long unsigned int pid;
-
-  /* address id */
-  long long unsigned int aid;
-
-  struct GNUNET_DISK_FileHandle *f_hd;
-};
-
-struct LoggingTimeStep
-{
-  struct LoggingTimeStep *prev;
-  struct LoggingTimeStep *next;
-
-  struct LoggingPeer *head;
-  struct LoggingPeer *tail;
-
-  struct GNUNET_TIME_Absolute timestamp;
-  struct GNUNET_TIME_Relative delta;
-};
-
-struct LoggingPeer
-{
-  struct LoggingPeer *prev;
-  struct LoggingPeer *next;
-
-  long long unsigned int id;
-  struct GNUNET_PeerIdentity peer_id;
-  double pref_abs[GNUNET_ATS_PREFERENCE_END];
-  double pref_norm[GNUNET_ATS_PREFERENCE_END];
-  int is_requested;
-
-  struct LoggingAddress *addr_head;
-  struct LoggingAddress *addr_tail;
-};
-
-struct LoggingAddress
-{
-  struct LoggingAddress *next;
-  struct LoggingAddress *prev;
-
-  long long unsigned int aid;
-  int active;
-  uint32_t network;
-  uint32_t assigned_bw_in;
-  uint32_t assigned_bw_out;
-
-  double prop_abs[GNUNET_ATS_PropertyCount];
-  double prop_norm[GNUNET_ATS_PropertyCount];
-};
-
-
-struct TestPeer
-{
-  struct TestPeer *prev;
-  struct TestPeer *next;
-
-
-  long long unsigned int id;
-  int is_requested;
-  struct GNUNET_PeerIdentity peer_id;
-
-  double pref_abs[GNUNET_ATS_PreferenceCount];
-  double pref_norm[GNUNET_ATS_PreferenceCount];
-
-  uint32_t assigned_bw_in;
-  uint32_t assigned_bw_out;
-
-  struct TestAddress *addr_head;
-  struct TestAddress *addr_tail;
-};
-
-
-struct TestAddress
-{
-  struct TestAddress *next;
-  struct TestAddress *prev;
-
-  long long unsigned int aid;
-  struct ATS_Address *ats_addr;
-  uint32_t network;
-
-  double prop_abs[GNUNET_ATS_PropertyCount];
-  double prop_norm[GNUNET_ATS_PropertyCount];
-};
-
-struct Episode;
-
-struct Experiment;
-
-typedef void (*GNUNET_ATS_TESTING_EpisodeDoneCallback) (
-  struct Episode *e);
-
-typedef void (*GNUNET_ATS_TESTING_ExperimentDoneCallback) (struct Experiment 
*e,
-                                                           struct
-                                                           GNUNET_TIME_Relative
-                                                           duration, int
-                                                           success);
-
-/**
- * An operation in an experiment
- */
-struct GNUNET_ATS_TEST_Operation
-{
-  struct GNUNET_ATS_TEST_Operation *next;
-  struct GNUNET_ATS_TEST_Operation *prev;
-
-  long long unsigned int address_id;
-  long long unsigned int peer_id;
-  long long unsigned int client_id;
-
-  long long unsigned int address_session;
-  unsigned int address_network;
-  char*address;
-  char*plugin;
-
-
-  long long unsigned int base_rate;
-  long long unsigned int max_rate;
-  struct GNUNET_TIME_Relative period;
-  struct GNUNET_TIME_Relative frequency;
-  struct GNUNET_TIME_Relative feedback_delay;
-
-  enum OperationType type;
-  enum GeneratorType gen_type;
-  enum GNUNET_ATS_PreferenceKind pref_type;
-  // enum GNUNET_ATS_Property prop_type;
-};
-
-struct Episode
-{
-  int id;
-  struct Episode *next;
-  struct GNUNET_TIME_Relative duration;
-
-  struct GNUNET_ATS_TEST_Operation *head;
-  struct GNUNET_ATS_TEST_Operation *tail;
-};
-
-struct LoggingHandle
-{
-  struct GNUNET_SCHEDULER_Task *logging_task;
-  struct GNUNET_TIME_Relative log_freq;
-
-  /* DLL list for logging time steps */
-  struct LoggingTimeStep *head;
-  struct LoggingTimeStep *tail;
-};
-
-struct Experiment
-{
-  char *name;
-  char *log_prefix;
-  char *cfg_file;
-  char *log_output_dir;
-  int log_append_time_stamp;
-
-  struct GNUNET_TIME_Relative log_freq;
-  struct GNUNET_TIME_Relative max_duration;
-  struct GNUNET_TIME_Relative total_duration;
-  struct GNUNET_TIME_Absolute start_time;
-  unsigned int num_episodes;
-  struct Episode *start;
-
-  struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  struct GNUNET_SCHEDULER_Task *experiment_timeout_task;
-  struct GNUNET_SCHEDULER_Task *episode_timeout_task;
-  struct Episode *cur;
-
-  GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb;
-  GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb;
-};
-
-struct PreferenceGenerator
-{
-  struct PreferenceGenerator *prev;
-  struct PreferenceGenerator *next;
-
-  enum GeneratorType type;
-
-  long long unsigned int peer;
-  unsigned int client_id;
-
-  enum GNUNET_ATS_PreferenceKind kind;
-
-  long int base_value;
-  long int max_value;
-  struct GNUNET_TIME_Relative duration_period;
-  struct GNUNET_TIME_Relative frequency;
-  struct GNUNET_TIME_Relative feedback_frequency;
-
-  struct GNUNET_SCHEDULER_Task *set_task;
-  struct GNUNET_SCHEDULER_Task *feedback_task;
-  struct GNUNET_TIME_Absolute next_ping_transmission;
-  struct GNUNET_TIME_Absolute time_start;
-
-
-  /* Feedback */
-  uint32_t feedback_bw_out_acc;
-  uint32_t feedback_bw_in_acc;
-  uint32_t feedback_delay_acc;
-
-  double pref_bw_old;
-  double pref_latency_old;
-
-  struct GNUNET_TIME_Absolute feedback_last;
-
-  struct GNUNET_TIME_Absolute feedback_last_bw_update;
-  struct GNUNET_TIME_Absolute feedback_last_delay_update;
-  uint32_t last_assigned_bw_in;
-  uint32_t last_assigned_bw_out;
-  double last_delay_value;
-};
-
-
-struct PropertyGenerator
-{
-  struct PropertyGenerator *prev;
-  struct PropertyGenerator *next;
-
-  enum GeneratorType type;
-
-  long long unsigned int peer;
-  long long unsigned int address_id;
-
-  struct TestPeer *test_peer;
-  struct TestAddress *test_address;
-  uint32_t ats_property;
-
-  long int base_value;
-  long int max_value;
-  struct GNUNET_TIME_Relative duration_period;
-  struct GNUNET_TIME_Relative frequency;
-
-  struct GNUNET_SCHEDULER_Task *set_task;
-  struct GNUNET_TIME_Absolute next_ping_transmission;
-  struct GNUNET_TIME_Absolute time_start;
-};
-
-#endif /* #ifndef GNUNET_ATS_SOLVER_EVAL_H */
-/* end of file ats-testing.h */
diff --git a/src/ats/gnunet-service-ats.c b/src/ats/gnunet-service-ats.c
deleted file mode 100644
index 5e27ecbd0..000000000
--- a/src/ats/gnunet-service-ats.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/gnunet-service-ats.c
- * @brief ats service
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet-service-ats.h"
-#include "gnunet-service-ats_addresses.h"
-#include "gnunet-service-ats_connectivity.h"
-#include "gnunet-service-ats_normalization.h"
-#include "gnunet-service-ats_performance.h"
-#include "gnunet-service-ats_preferences.h"
-#include "gnunet-service-ats_scheduling.h"
-#include "gnunet-service-ats_reservations.h"
-#include "gnunet-service-ats_plugins.h"
-#include "ats.h"
-
-/**
- * Handle for statistics.
- */
-struct GNUNET_STATISTICS_Handle *GSA_stats;
-
-
-/**
- * We have received a `struct ClientStartMessage` from a client.  Find
- * out which type of client it is and notify the respective subsystem.
- *
- * @param cls handle to the client
- * @param msg the start message
- */
-static void
-handle_ats_start (void *cls,
-                  const struct ClientStartMessage *msg)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-  enum StartFlag flag;
-
-  flag = ntohl (msg->start_flag);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received ATS_START (%d) message\n",
-              (int) flag);
-  switch (flag)
-  {
-  case START_FLAG_SCHEDULING:
-    if (GNUNET_OK !=
-        GAS_scheduling_add_client (client))
-    {
-      GNUNET_SERVICE_client_drop (client);
-      return;
-    }
-    break;
-
-  case START_FLAG_PERFORMANCE_WITH_PIC:
-    GAS_performance_add_client (client,
-                                flag);
-    break;
-
-  case START_FLAG_PERFORMANCE_NO_PIC:
-    GAS_performance_add_client (client,
-                                flag);
-    break;
-
-  case START_FLAG_CONNECTION_SUGGESTION:
-    /* This client won't receive messages from us, no need to 'add' */
-    break;
-
-  default:
-    GNUNET_break (0);
-    GNUNET_SERVICE_client_drop (client);
-    return;
-  }
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Handle 'reservation request' messages from clients.
- *
- * @param cls client that sent the request
- * @param message the request message
- */
-static void
-handle_reservation_request (void *cls,
-                            const struct ReservationRequestMessage *message)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-
-  GAS_handle_reservation_request (client,
-                                  message);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Check 'preference feedback' message is well-formed
- *
- * @param cls client that sent the request
- * @param message the request message
- * @return #GNUNET_OK if @a message is well-formed
- */
-static int
-check_feedback (void *cls,
-                const struct FeedbackPreferenceMessage *message)
-{
-  uint16_t msize;
-  uint32_t nump;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received PREFERENCE_FEEDBACK message\n");
-  msize = ntohs (message->header.size);
-  nump = ntohl (message->num_feedback);
-  if (msize !=
-      sizeof(struct FeedbackPreferenceMessage)
-      + nump * sizeof(struct PreferenceInformation))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Handle 'preference feedback' messages from clients.
- *
- * @param cls client that sent the request
- * @param msg the request message
- */
-static void
-handle_feedback (void *cls,
-                 const struct FeedbackPreferenceMessage *msg)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-  const struct PreferenceInformation *pi;
-  uint32_t nump;
-
-  nump = ntohl (msg->num_feedback);
-  if (GNUNET_NO ==
-      GNUNET_CONTAINER_multipeermap_contains (GSA_addresses,
-                                              &msg->peer))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Received PREFERENCE FEEDBACK for unknown peer `%s'\n",
-                GNUNET_i2s (&msg->peer));
-    GNUNET_SERVICE_client_continue (client);
-    return;
-  }
-
-  GNUNET_STATISTICS_update (GSA_stats,
-                            "# preference feedbacks requests processed",
-                            1,
-                            GNUNET_NO);
-  pi = (const struct PreferenceInformation *) &msg[1];
-  for (uint32_t i = 0; i < nump; i++)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Received PREFERENCE FEEDBACK for peer `%s'\n",
-                GNUNET_i2s (&msg->peer));
-    GAS_plugin_notify_feedback (client,
-                                &msg->peer,
-                                GNUNET_TIME_relative_ntoh (msg->scope),
-                                (enum GNUNET_ATS_PreferenceKind) ntohl (
-                                  pi[i].preference_kind),
-                                pi[i].preference_value);
-  }
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Handle 'request address list' messages from clients.
- *
- * @param cls client that sent the request
- * @param message the request message
- */
-static void
-handle_request_address_list (void *cls,
-                             const struct AddressListRequestMessage *message)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-
-  GAS_handle_request_address_list (client,
-                                   message);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Handle 'request address' messages from clients.
- *
- * @param cls client that sent the request
- * @param message the request message
- */
-static void
-handle_request_address (void *cls,
-                        const struct RequestAddressMessage *message)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-
-  GAS_handle_request_address (client,
-                              message);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Cancel 'request address' messages from clients.
- *
- * @param cls client that sent the request
- * @param message the request message
- */
-static void
-handle_request_address_cancel (void *cls,
-                               const struct RequestAddressMessage *message)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-
-  GAS_handle_request_address_cancel (client,
-                                     message);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Handle 'address add' messages from clients.
- *
- * @param cls client that sent the request
- * @param m the request message
- */
-static int
-check_address_add (void *cls,
-                   const struct AddressAddMessage *m)
-{
-  const char *address;
-  const char *plugin_name;
-  uint16_t address_length;
-  uint16_t plugin_name_length;
-  uint16_t size;
-
-  size = ntohs (m->header.size);
-  address_length = ntohs (m->address_length);
-  plugin_name_length = ntohs (m->plugin_name_length);
-  address = (const char *) &m[1];
-  if (plugin_name_length != 0)
-    plugin_name = &address[address_length];
-  else
-    plugin_name = "";
-
-  if ((address_length + plugin_name_length
-       + sizeof(struct AddressAddMessage) != size) ||
-      ((plugin_name_length > 0) &&
-       (plugin_name[plugin_name_length - 1] != '\0')))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Handle 'address add' messages from clients.
- *
- * @param cls client that sent the request
- * @param message the request message
- */
-static void
-handle_address_add (void *cls,
-                    const struct AddressAddMessage *message)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-
-  GAS_handle_address_add (message);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Handle 'address update' messages from clients.
- *
- * @param cls client that sent the request
- * @param message the request message
- */
-static void
-handle_address_update (void *cls,
-                       const struct AddressUpdateMessage *message)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-
-  GAS_handle_address_update (message);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Handle 'address destroyed' messages from clients.
- *
- * @param cls client that sent the request
- * @param message the request message
- */
-static void
-handle_address_destroyed (void *cls,
-                          const struct AddressDestroyedMessage *message)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-
-  GAS_handle_address_destroyed (message);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Check that 'change preference' message is well-formed.
- *
- * @param cls client that sent the request
- * @param message the request message
- * @return #GNUNET_OK if @a message is well-formed
- */
-static int
-check_preference_change (void *cls,
-                         const struct ChangePreferenceMessage *message)
-{
-  uint16_t msize;
-  uint32_t nump;
-
-  msize = ntohs (message->header.size);
-  nump = ntohl (message->num_preferences);
-  if ((msize !=
-       sizeof(struct ChangePreferenceMessage)
-       + nump * sizeof(struct PreferenceInformation)) ||
-      (UINT16_MAX / sizeof(struct PreferenceInformation) < nump))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Handle 'change preference' messages from clients.
- *
- * @param cls client that sent the request
- * @param message the request message
- */
-static void
-handle_preference_change (void *cls,
-                          const struct ChangePreferenceMessage *message)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-
-  GAS_handle_preference_change (client,
-                                message);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * A client connected to us. Setup the local client
- * record.
- *
- * @param cls unused
- * @param client handle of the client
- * @param mq message queue to talk to @a client
- * @return @a client
- */
-static void *
-client_connect_cb (void *cls,
-                   struct GNUNET_SERVICE_Client *client,
-                   struct GNUNET_MQ_Handle *mq)
-{
-  return client;
-}
-
-
-/**
- * A client disconnected from us.  Tear down the local client
- * record.
- *
- * @param cls unused
- * @param client handle of the client
- * @param app_ctx
- */
-static void
-client_disconnect_cb (void *cls,
-                      struct GNUNET_SERVICE_Client *client,
-                      void *app_ctx)
-{
-  if (NULL == client)
-    return;
-  GAS_scheduling_remove_client (client);
-  GAS_connectivity_remove_client (client);
-  GAS_preference_client_disconnect (client);
-}
-
-
-/**
- * Task run during shutdown.
- *
- * @param cls unused
- */
-static void
-cleanup_task (void *cls)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "ATS shutdown initiated\n");
-  GAS_connectivity_done ();
-  GAS_addresses_done ();
-  GAS_plugin_done ();
-  GAS_normalization_stop ();
-  GAS_performance_done ();
-  GAS_preference_done ();
-  GAS_reservations_done ();
-  if (NULL != GSA_stats)
-  {
-    GNUNET_STATISTICS_destroy (GSA_stats, GNUNET_NO);
-    GSA_stats = NULL;
-  }
-}
-
-
-/**
- * Process template requests.
- *
- * @param cls closure
- * @param cfg configuration to use
- * @param service the initialized service
- */
-static void
-run (void *cls,
-     const struct GNUNET_CONFIGURATION_Handle *cfg,
-     struct GNUNET_SERVICE_Handle *service)
-{
-  GSA_stats = GNUNET_STATISTICS_create ("ats",
-                                        cfg);
-  GAS_reservations_init ();
-  GAS_connectivity_init ();
-  GAS_preference_init ();
-  GAS_normalization_start ();
-  GAS_addresses_init ();
-  if (GNUNET_OK !=
-      GAS_plugin_init (cfg))
-  {
-    GNUNET_break (0);
-    GAS_addresses_done ();
-    GAS_normalization_stop ();
-    GAS_reservations_done ();
-    GAS_connectivity_done ();
-    GAS_preference_done ();
-    if (NULL != GSA_stats)
-    {
-      GNUNET_STATISTICS_destroy (GSA_stats,
-                                 GNUNET_NO);
-      GSA_stats = NULL;
-    }
-    return;
-  }
-  GAS_performance_init ();
-  GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
-                                 NULL);
-}
-
-
-/**
- * Define "main" method using service macro.
- */
-GNUNET_SERVICE_MAIN
-  ("ats",
-  GNUNET_SERVICE_OPTION_NONE,
-  &run,
-  &client_connect_cb,
-  &client_disconnect_cb,
-  NULL,
-  GNUNET_MQ_hd_fixed_size (ats_start,
-                           GNUNET_MESSAGE_TYPE_ATS_START,
-                           struct ClientStartMessage,
-                           NULL),
-  GNUNET_MQ_hd_fixed_size (request_address,
-                           GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS,
-                           struct RequestAddressMessage,
-                           NULL),
-  GNUNET_MQ_hd_fixed_size (request_address_cancel,
-                           GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL,
-                           struct RequestAddressMessage,
-                           NULL),
-  GNUNET_MQ_hd_fixed_size (request_address_list,
-                           GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST,
-                           struct AddressListRequestMessage,
-                           NULL),
-  GNUNET_MQ_hd_var_size (address_add,
-                         GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD,
-                         struct AddressAddMessage,
-                         NULL),
-  GNUNET_MQ_hd_fixed_size (address_update,
-                           GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE,
-                           struct AddressUpdateMessage,
-                           NULL),
-  GNUNET_MQ_hd_fixed_size (address_destroyed,
-                           GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED,
-                           struct AddressDestroyedMessage,
-                           NULL),
-  GNUNET_MQ_hd_fixed_size (reservation_request,
-                           GNUNET_MESSAGE_TYPE_ATS_RESERVATION_REQUEST,
-                           struct ReservationRequestMessage,
-                           NULL),
-  GNUNET_MQ_hd_var_size (preference_change,
-                         GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_CHANGE,
-                         struct ChangePreferenceMessage,
-                         NULL),
-  GNUNET_MQ_hd_var_size (feedback,
-                         GNUNET_MESSAGE_TYPE_ATS_PREFERENCE_FEEDBACK,
-                         struct FeedbackPreferenceMessage,
-                         NULL),
-  GNUNET_MQ_handler_end ());
-
-
-/* end of gnunet-service-ats.c */
diff --git a/src/ats/gnunet-service-ats.h b/src/ats/gnunet-service-ats.h
deleted file mode 100644
index 85d522b9f..000000000
--- a/src/ats/gnunet-service-ats.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats.h
- * @brief ats service
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_ATS_H
-#define GNUNET_SERVICE_ATS_H
-
-#include "gnunet_statistics_service.h"
-
-#define GAS_normalization_queue_length 3
-
-#define BANDWIDTH_ZERO GNUNET_BANDWIDTH_value_init (0)
-
-/**
- * Handle for statistics.
- */
-extern struct GNUNET_STATISTICS_Handle *GSA_stats;
-
-
-#endif
diff --git a/src/ats/gnunet-service-ats_addresses.c 
b/src/ats/gnunet-service-ats_addresses.c
deleted file mode 100644
index 9c9856094..000000000
--- a/src/ats/gnunet-service-ats_addresses.c
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2011-2015 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats_addresses.c
- * @brief ats service address management
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet-service-ats_addresses.h"
-#include "gnunet-service-ats_performance.h"
-#include "gnunet-service-ats_normalization.h"
-#include "gnunet-service-ats_plugins.h"
-
-
-/**
- * A multihashmap to store all addresses
- */
-struct GNUNET_CONTAINER_MultiPeerMap *GSA_addresses;
-
-
-/**
- * Update statistic on number of addresses.
- */
-static void
-update_addresses_stat ()
-{
-  GNUNET_STATISTICS_set (GSA_stats,
-                         "# addresses",
-                         GNUNET_CONTAINER_multipeermap_size (GSA_addresses),
-                         GNUNET_NO);
-}
-
-
-/**
- * Free the given address
- *
- * @param addr address to destroy
- */
-static void
-free_address (struct ATS_Address *addr)
-{
-  GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CONTAINER_multipeermap_remove (GSA_addresses,
-                                                       &addr->peer,
-                                                       addr));
-  update_addresses_stat ();
-  GAS_plugin_delete_address (addr);
-  GAS_performance_notify_all_clients (&addr->peer,
-                                      addr->plugin,
-                                      addr->addr,
-                                      addr->addr_len,
-                                      GNUNET_NO,
-                                      NULL,
-                                      addr->local_address_info,
-                                      GNUNET_BANDWIDTH_ZERO,
-                                      GNUNET_BANDWIDTH_ZERO);
-  GNUNET_free (addr->plugin);
-  GNUNET_free (addr);
-}
-
-
-/**
- * Initialize @a norm.  Sets all historic values to undefined.
- *
- * @param norm normalization data to initialize
- */
-static void
-init_norm (struct GAS_NormalizationInfo *norm)
-{
-  unsigned int c;
-
-  for (c = 0; c < GAS_normalization_queue_length; c++)
-    norm->atsi_abs[c] = UINT64_MAX;
-}
-
-
-/**
- * Create a ATS_address with the given information
- *
- * @param peer peer
- * @param plugin_name plugin
- * @param plugin_addr address
- * @param plugin_addr_len address length
- * @param local_address_info additional local info for the address
- * @param session_id session identifier, can never be 0
- * @return the ATS_Address
- */
-static struct ATS_Address *
-create_address (const struct GNUNET_PeerIdentity *peer,
-                const char *plugin_name,
-                const void *plugin_addr,
-                size_t plugin_addr_len,
-                uint32_t local_address_info,
-                uint32_t session_id)
-{
-  struct ATS_Address *aa;
-
-  aa = GNUNET_malloc (sizeof(struct ATS_Address) + plugin_addr_len);
-  aa->peer = *peer;
-  aa->addr_len = plugin_addr_len;
-  aa->addr = &aa[1];
-  GNUNET_memcpy (&aa[1],
-                 plugin_addr,
-                 plugin_addr_len);
-  aa->plugin = GNUNET_strdup (plugin_name);
-  aa->session_id = session_id;
-  aa->local_address_info = local_address_info;
-  init_norm (&aa->norm_delay);
-  init_norm (&aa->norm_distance);
-  init_norm (&aa->norm_utilization_in);
-  init_norm (&aa->norm_utilization_out);
-  return aa;
-}
-
-
-/**
- * Closure for #find_address_cb()
- */
-struct FindAddressContext
-{
-  /**
-   * Session Id to look for.
-   */
-  uint32_t session_id;
-
-  /**
-   * Where to store matching address result.
-   */
-  struct ATS_Address *exact_address;
-};
-
-
-/**
- * Find session matching given session ID.
- *
- * @param cls a `struct FindAddressContext`
- * @param key peer id
- * @param value the address to compare with
- * @return #GNUNET_YES to continue, #GNUNET_NO if address is found
- */
-static int
-find_address_cb (void *cls,
-                 const struct GNUNET_PeerIdentity *key,
-                 void *value)
-{
-  struct FindAddressContext *fac = cls;
-  struct ATS_Address *aa = value;
-
-  if (aa->session_id == fac->session_id)
-  {
-    fac->exact_address = aa;
-    return GNUNET_NO;
-  }
-  return GNUNET_YES;
-}
-
-
-/**
- * Find the exact address
- *
- * @param peer peer
- * @param session_id session id, can never be 0
- * @return an ATS_address or NULL
- */
-static struct ATS_Address *
-find_exact_address (const struct GNUNET_PeerIdentity *peer,
-                    uint32_t session_id)
-{
-  struct FindAddressContext fac;
-
-  fac.exact_address = NULL;
-  fac.session_id = session_id;
-  GNUNET_CONTAINER_multipeermap_get_multiple (GSA_addresses,
-                                              peer,
-                                              &find_address_cb, &fac);
-  return fac.exact_address;
-}
-
-
-void
-GAS_addresses_add (const struct GNUNET_PeerIdentity *peer,
-                   const char *plugin_name,
-                   const void *plugin_addr,
-                   size_t plugin_addr_len,
-                   uint32_t local_address_info,
-                   uint32_t session_id,
-                   const struct GNUNET_ATS_Properties *prop)
-{
-  struct ATS_Address *new_address;
-
-  if (NULL != find_exact_address (peer,
-                                  session_id))
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
-  new_address = create_address (peer,
-                                plugin_name,
-                                plugin_addr,
-                                plugin_addr_len,
-                                local_address_info,
-                                session_id);
-  /* Add a new address */
-  new_address->properties = *prop;
-  new_address->t_added = GNUNET_TIME_absolute_get ();
-  new_address->t_last_activity = GNUNET_TIME_absolute_get ();
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multipeermap_put (GSA_addresses,
-                                                    peer,
-                                                    new_address,
-                                                    
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
-  update_addresses_stat ();
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Adding new address for peer `%s' slot %u\n",
-              GNUNET_i2s (peer),
-              session_id);
-  /* Tell solver about new address */
-  GAS_plugin_solver_lock ();
-  GAS_plugin_new_address (new_address);
-  GAS_normalization_update_property (new_address);  // FIXME: needed?
-  GAS_plugin_solver_unlock ();
-  /* Notify performance clients about new address */
-  GAS_performance_notify_all_clients (&new_address->peer,
-                                      new_address->plugin,
-                                      new_address->addr,
-                                      new_address->addr_len,
-                                      new_address->active,
-                                      &new_address->properties,
-                                      new_address->local_address_info,
-                                      GNUNET_BANDWIDTH_value_init (
-                                        new_address->assigned_bw_out),
-                                      GNUNET_BANDWIDTH_value_init (
-                                        new_address->assigned_bw_in));
-}
-
-
-void
-GAS_addresses_update (const struct GNUNET_PeerIdentity *peer,
-                      uint32_t session_id,
-                      const struct GNUNET_ATS_Properties *prop)
-{
-  struct ATS_Address *aa;
-
-  /* Get existing address */
-  aa = find_exact_address (peer,
-                           session_id);
-  if (NULL == aa)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if (NULL == aa->solver_information)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received ADDRESS_UPDATE for peer `%s' slot %u\n",
-              GNUNET_i2s (peer),
-              (unsigned int) session_id);
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
-  /* Update address */
-  aa->t_last_activity = GNUNET_TIME_absolute_get ();
-  aa->properties = *prop;
-  /* Notify performance clients about updated address */
-  GAS_performance_notify_all_clients (&aa->peer,
-                                      aa->plugin,
-                                      aa->addr,
-                                      aa->addr_len,
-                                      aa->active,
-                                      prop,
-                                      aa->local_address_info,
-                                      GNUNET_BANDWIDTH_value_init (
-                                        aa->assigned_bw_out),
-                                      GNUNET_BANDWIDTH_value_init (
-                                        aa->assigned_bw_in));
-
-  GAS_normalization_update_property (aa);
-}
-
-
-/**
- * Remove an address for a peer.
- *
- * @param peer peer
- * @param session_id session id, can never be 0
- */
-void
-GAS_addresses_destroy (const struct GNUNET_PeerIdentity *peer,
-                       uint32_t session_id)
-{
-  struct ATS_Address *ea;
-
-  /* Get existing address */
-  ea = find_exact_address (peer,
-                           session_id);
-  if (NULL == ea)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received ADDRESS_DESTROYED for peer `%s' session %u\n",
-              GNUNET_i2s (peer),
-              session_id);
-  free_address (ea);
-}
-
-
-/**
- * Initialize address subsystem. The addresses subsystem manages the addresses
- * known and current performance information. It has a solver component
- * responsible for the resource allocation. It tells the solver about changes
- * and receives updates when the solver changes the resource allocation.
- */
-void
-GAS_addresses_init ()
-{
-  GSA_addresses
-    = GNUNET_CONTAINER_multipeermap_create (128,
-                                            GNUNET_NO);
-  update_addresses_stat ();
-}
-
-
-/**
- * Destroy all addresses iterator
- *
- * @param cls NULL
- * @param key peer identity (unused)
- * @param value the 'struct ATS_Address' to free
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-destroy_all_address_it (void *cls,
-                        const struct GNUNET_PeerIdentity *key,
-                        void *value)
-{
-  struct ATS_Address *aa = value;
-
-  free_address (aa);
-  return GNUNET_OK;
-}
-
-
-/**
- * Remove all addresses
- */
-void
-GAS_addresses_destroy_all ()
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Destroying all addresses\n");
-  if (NULL == GSA_addresses)
-    return;
-  if (0 ==
-      GNUNET_CONTAINER_multipeermap_size (GSA_addresses))
-    return;
-  GAS_plugin_solver_lock ();
-  GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses,
-                                         &destroy_all_address_it,
-                                         NULL);
-  GAS_plugin_solver_unlock ();
-}
-
-
-/**
- * Shutdown address subsystem.
- */
-void
-GAS_addresses_done ()
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Shutting down addresses\n");
-  GAS_plugin_solver_lock ();
-  GAS_addresses_destroy_all ();
-  GAS_plugin_solver_unlock ();
-  GNUNET_CONTAINER_multipeermap_destroy (GSA_addresses);
-  GSA_addresses = NULL;
-}
-
-
-/**
- * Closure for #peerinfo_it().
- */
-struct PeerInfoIteratorContext
-{
-  /**
-   * Function to call for each address.
-   */
-  GNUNET_ATS_PeerInfo_Iterator it;
-
-  /**
-   * Closure for @e it.
-   */
-  void *it_cls;
-};
-
-
-/**
- * Iterator to iterate over a peer's addresses
- *
- * @param cls a `struct PeerInfoIteratorContext`
- * @param key the peer id
- * @param value the `struct ATS_address`
- * @return #GNUNET_OK to continue
- */
-static int
-peerinfo_it (void *cls,
-             const struct GNUNET_PeerIdentity *key,
-             void *value)
-{
-  struct PeerInfoIteratorContext *pi_ctx = cls;
-  struct ATS_Address *addr = value;
-
-  pi_ctx->it (pi_ctx->it_cls,
-              &addr->peer,
-              addr->plugin,
-              addr->addr,
-              addr->addr_len,
-              addr->active,
-              &addr->properties,
-              addr->local_address_info,
-              GNUNET_BANDWIDTH_value_init (addr->assigned_bw_out),
-              GNUNET_BANDWIDTH_value_init (addr->assigned_bw_in));
-  return GNUNET_OK;
-}
-
-
-void
-GAS_addresses_get_peer_info (const struct GNUNET_PeerIdentity *peer,
-                             GNUNET_ATS_PeerInfo_Iterator pi_it,
-                             void *pi_it_cls)
-{
-  struct PeerInfoIteratorContext pi_ctx;
-
-  if (NULL == pi_it)
-  {
-    /* does not make sense without callback */
-    GNUNET_break (0);
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Returning information for %s from a total of %u known 
addresses\n",
-              (NULL == peer)
-              ? "all peers"
-              : GNUNET_i2s (peer),
-              (unsigned int) GNUNET_CONTAINER_multipeermap_size (
-                GSA_addresses));
-  pi_ctx.it = pi_it;
-  pi_ctx.it_cls = pi_it_cls;
-  if (NULL == peer)
-    GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses,
-                                           &peerinfo_it,
-                                           &pi_ctx);
-  else
-    GNUNET_CONTAINER_multipeermap_get_multiple (GSA_addresses,
-                                                peer,
-                                                &peerinfo_it, &pi_ctx);
-  pi_it (pi_it_cls,
-         NULL, NULL, NULL, 0,
-         GNUNET_NO,
-         NULL,
-         GNUNET_HELLO_ADDRESS_INFO_NONE,
-         GNUNET_BANDWIDTH_ZERO,
-         GNUNET_BANDWIDTH_ZERO);
-}
-
-
-/**
- * Information we need for the callbacks to return a list of addresses
- * back to the client.
- */
-struct AddressIteration
-{
-  /**
-   * Actual handle to the client.
-   */
-  struct GNUNET_SERVICE_Client *client;
-
-  /**
-   * Are we sending all addresses, or only those that are active?
-   */
-  int all;
-
-  /**
-   * Which ID should be included in the response?
-   */
-  uint32_t id;
-};
-
-
-/**
- * Send a #GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE with the
- * given address details to the client identified in @a ai.
- *
- * @param ai our address information context (identifies the client)
- * @param id the peer id this address is for
- * @param plugin_name name of the plugin that supports this address
- * @param plugin_addr address
- * @param plugin_addr_len length of @a plugin_addr
- * @param active #GNUNET_YES if this address is actively used
- * @param prop performance information
- * @param local_address_info flags for the address
- * @param bandwidth_out current outbound bandwidth assigned to address
- * @param bandwidth_in current inbound bandwidth assigned to address
- */
-static void
-transmit_req_addr (struct AddressIteration *ai,
-                   const struct GNUNET_PeerIdentity *id,
-                   const char *plugin_name,
-                   const void *plugin_addr,
-                   size_t plugin_addr_len,
-                   int active,
-                   const struct GNUNET_ATS_Properties *prop,
-                   enum GNUNET_HELLO_AddressInfo local_address_info,
-                   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-                   struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
-
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct PeerInformationMessage *msg;
-  char *addrp;
-  size_t plugin_name_length;
-  size_t msize;
-
-  if (NULL != plugin_name)
-    plugin_name_length = strlen (plugin_name) + 1;
-  else
-    plugin_name_length = 0;
-  msize = plugin_addr_len + plugin_name_length;
-
-  GNUNET_assert (sizeof(struct PeerInformationMessage) + msize
-                 < GNUNET_MAX_MESSAGE_SIZE);
-  env = GNUNET_MQ_msg_extra (msg,
-                             msize,
-                             GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE);
-  msg->id = htonl (ai->id);
-  if (NULL != id)
-    msg->peer = *id;
-  msg->address_length = htons (plugin_addr_len);
-  msg->address_active = ntohl (active);
-  msg->plugin_name_length = htons (plugin_name_length);
-  msg->bandwidth_out = bandwidth_out;
-  msg->bandwidth_in = bandwidth_in;
-  if (NULL != prop)
-    GNUNET_ATS_properties_hton (&msg->properties,
-                                prop);
-  msg->address_local_info = htonl ((uint32_t) local_address_info);
-  addrp = (char *) &msg[1];
-  GNUNET_memcpy (addrp,
-                 plugin_addr,
-                 plugin_addr_len);
-  if (NULL != plugin_name)
-    strcpy (&addrp[plugin_addr_len],
-            plugin_name);
-  GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (ai->client),
-                  env);
-}
-
-
-/**
- * Iterator for #GAS_addresses_get_peer_info(), called with peer-specific
- * information to be passed back to the client.
- *
- * @param cls closure with our `struct AddressIteration *`
- * @param id the peer id
- * @param plugin_name plugin name
- * @param plugin_addr address
- * @param plugin_addr_len length of @a plugin_addr
- * @param active is address actively used
- * @param prop performance information
- * @param local_address_info additional local info for the address
- * @param bandwidth_out current outbound bandwidth assigned to address
- * @param bandwidth_in current inbound bandwidth assigned to address
- */
-static void
-req_addr_peerinfo_it (void *cls,
-                      const struct GNUNET_PeerIdentity *id,
-                      const char *plugin_name,
-                      const void *plugin_addr,
-                      size_t plugin_addr_len,
-                      int active,
-                      const struct GNUNET_ATS_Properties *prop,
-                      enum GNUNET_HELLO_AddressInfo local_address_info,
-                      struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-                      struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
-{
-  struct AddressIteration *ai = cls;
-
-  if ((NULL == id) &&
-      (NULL == plugin_name) &&
-      (NULL == plugin_addr))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Address iteration done for one peer\n");
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Callback for %s peer `%s' plugin `%s' BW out %u, BW in %u\n",
-              (active == GNUNET_YES) ? "ACTIVE" : "INACTIVE",
-              GNUNET_i2s (id),
-              plugin_name,
-              (unsigned int) ntohl (bandwidth_out.value__),
-              (unsigned int) ntohl (bandwidth_in.value__));
-  /* Transmit result (either if address is active, or if
-     client wanted all addresses) */
-  if ((GNUNET_YES != ai->all) &&
-      (GNUNET_YES != active))
-    return;
-  transmit_req_addr (ai,
-                     id,
-                     plugin_name,
-                     plugin_addr, plugin_addr_len,
-                     active,
-                     prop,
-                     local_address_info,
-                     bandwidth_out,
-                     bandwidth_in);
-}
-
-
-void
-GAS_handle_request_address_list (struct GNUNET_SERVICE_Client *client,
-                                 const struct AddressListRequestMessage *alrm)
-{
-  struct AddressIteration ai;
-  struct GNUNET_PeerIdentity allzeros;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received ADDRESSLIST_REQUEST message\n");
-  ai.all = ntohl (alrm->all);
-  ai.id = ntohl (alrm->id);
-  ai.client = client;
-
-  memset (&allzeros,
-          '\0',
-          sizeof(struct GNUNET_PeerIdentity));
-  if (GNUNET_YES == GNUNET_is_zero (&alrm->peer))
-  {
-    /* Return addresses for all peers */
-    GAS_addresses_get_peer_info (NULL,
-                                 &req_addr_peerinfo_it,
-                                 &ai);
-  }
-  else
-  {
-    /* Return addresses for a specific peer */
-    GAS_addresses_get_peer_info (&alrm->peer,
-                                 &req_addr_peerinfo_it,
-                                 &ai);
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Finished handling `%s' message\n",
-              "ADDRESSLIST_REQUEST");
-  transmit_req_addr (&ai,
-                     NULL, NULL, NULL,
-                     0, GNUNET_NO,
-                     NULL,
-                     GNUNET_HELLO_ADDRESS_INFO_NONE,
-                     GNUNET_BANDWIDTH_ZERO,
-                     GNUNET_BANDWIDTH_ZERO);
-}
-
-
-/* end of gnunet-service-ats_addresses.c */
diff --git a/src/ats/gnunet-service-ats_addresses.h 
b/src/ats/gnunet-service-ats_addresses.h
deleted file mode 100644
index 8e6f40f38..000000000
--- a/src/ats/gnunet-service-ats_addresses.h
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2011-2014 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats_addresses.h
- * @brief ats service address management
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_ATS_ADDRESSES_H
-#define GNUNET_SERVICE_ATS_ADDRESSES_H
-
-#include "gnunet_util_lib.h"
-#include "gnunet_ats_service.h"
-#include "gnunet-service-ats.h"
-#include "ats.h"
-
-/**
- * NOTE: Do not change this documentation. This documentation is based on
- * gnunet.org:/vcs/fsnsg/ats-paper.git/tech-doku/ats-tech-guide.tex
- * use build_txt.sh to generate plaintext output
- *
- *   1 ATS addresses : ATS address management
- *
- *    This ATS addresses ("addresses") component manages the addresses known to
- *    ATS service and suggests addresses to transport service when it is
- *    interested in address suggestion for a peer. ATS addresses also
- *    instantiates the bandwidth assignment mechanism (solver), notifies it
- *    about changes to addresses and forwards changes to bandwidth assignments
- *    to transport, depending if transport is interested in this change.
- *
- *     1.1 Input data
- *
- *       1.1.1 Addresses
- *
- *    Addresses are added by specifying peer ID, plugin, address, address 
length
- *    and session, if available. ATS information can be specified if available.
- *
- *       1.1.2 Networks
- *
- *    ATS specifies a fix set of networks an address can belong to. For each
- *    network an inbound and outbound quota will be specified. The available
- *    networks and additional helper variables are defined in
- *    gnunet_ats_service.h. At the moment 5 networks are defined:
- *      * GNUNET_NT_UNSPECIFIED
- *      * GNUNET_NT_LOOPBACK
- *      * GNUNET_NT_LAN
- *      * GNUNET_NT_WAN
- *      * GNUNET_NT_WLAN
- *
- *    The total number of networks defined is stored in
- *    GNUNET_NT_COUNT GNUNET_ATS_NetworkType can be used array
- *    initializer for an int array, while GNUNET_ATS_NetworkType is an
- *    initializer for a char array containing a string description of all
- *    networks
- *
- *       1.1.3 Quotas
- *
- *    An inbound and outbound quota for each of the networks mentioned in 1.1.2
- *    is loaded from ats configuration during initialization. This quota 
defines
- *    to total amount of inbound and outbound traffic allowed for a specific
- *    network. The configuration values used are in section ats:
- *      * "NETWORK"_QUOTA_IN = <value>
- *      * "NETWORK"_QUOTA_IN = <value>
- *
- *    You can specify quotas by setting the <value> to a:
- *      * unrestricted: unlimited
- *      * number of bytes: e.g. 10240
- *      * fancy value: e.g. 64 Kib
- *
- *    unlimited is defined as GNUNET_ATS_MaxBandwidthString and equivalent to
- *    the value GNUNET_ATS_MaxBandwidth Important predefined values for quotas
- *    are:
- *      * GNUNET_ATS_DefaultBandwidth: 65536
- *      * GNUNET_ATS_MaxBandwidth: UINT32_MAX
- *      * GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT: 1024
- *
- *    Details of loading quotas and default values will be described on
- *
- *       1.1.4 Preference values
- *
- *     1.2 Data structures used
- *
- *    Addresse uses struct ATS_Address for each address. The structs are stored
- *    in a linked list and provides a pointer void *solver_information for the
- *    solver to store address specific information. It provides the int values
- *    active which is set to GNUNET_YES if the address is select for transport
- *    use and used, representing that transport service is actively using this
- *    address. Address information are stored in peer, addr, addr_len, plugin.
- *
- *     1.3 Initialization
- *
- *    During initialization a hashmap to store addresses is created. The quotas
- *    for all networks defined for ATS are loaded from configuration. For each
- *    network first the logic will check if the string
- *    GNUNET_ATS_MaxBandwidthString is configured, if not it will try to 
convert
- *    the configured value as a fancy size and if this fails it will try to use
- *    it as a value_number. If no configuration value is found it will assign
- *    GNUNET_ATS_DefaultBandwidth. The most important step is to load the
- *    configured solver using configuration "[ats]:MODE". Current solvers are
- *    MODE_PROPORTIONAL, MODE_MLP. Interaction is done using a solver API
- *
- *     1.4 Solver API
- *
- *    Solver functions:
- *      * s_init: init the solver with required information
- *      * s_add: add a new address
- *      * s_update: update ATS values or session for an address
- *      * s_get: get preferred address for a peer
- *      * s_del: delete an address
- *      * s_pref: change preference value for a peer
- *      * s_done: shutdown solver
- *
- *    Callbacks: addresses provides a bandwidth_changed_cb callback to the
- *    solver which is called when bandwidth assigned to peer has changed
- *
- *     1.5 Shutdown
- *
- *    During shutdown all addresses are freed and the solver told to shutdown
- *
- *     1.6 Addresses and sessions
- *
- *    Addresses consist of the address itself and a numerical session. When a
- *    new address without a session is added it has no session, so it gets
- *    session 0 assigned. When an address with a session is added and an 
address
- *    object with session 0 is found, this object is updated with the session
- *    otherwise a new address object with this session assigned is created.
- *
- *       1.6.1 Terminology
- *
- *    Addresses a1,a2 with session s1, s2 are "exact" if:
- *    (a1 == a2)&&(s1 == s2)
- *    Addresses a1,a2 with session s1, s2 are "equivalent" if:
- *    (a1 == a2)&&((s1 == s2)||(s1 == 0)||(s2 == 0)
- *
- *     1.7 Address management
- *
- *    Transport service notifies ATS about changes to the addresses known to
- *    it.
- *
- *       1.7.1 Adding an address
- *
- *    When transport learns a new address it tells ATS and ATS is telling
- *    addresses about it using GAS_address_add. If not known to addresses it
- *    creates a new address object and calls solver's s_add. ATS information 
are
- *    deserialized and solver is notified about the session and ATS information
- *    using s_update.
- *
- *       1.7.2 Updating an address
- *
- *    Addresses does an lookup up for the existing address with the given
- *    session. If disassembles included ATS information and notifies the solver
- *    using s_update about the update.
- *
- *       1.7.3 Deleting an address
- *
- *    Addresses does an lookup for the exact address and session and if removes
- *    this address. If session != 0 the session is set to 0 and the address is
- *    kept. If session == 0, the addresses is removed.
- *
- *       1.7.4 Requesting an address suggestion
- *
- *    The address client issues a request address message to be notified about
- *    address suggestions for a specific peer. Addresses asks the solver with
- *    s_get. If no address is available, it will not send a response, otherwise
- *    it will respond with the chosen address.
- *
- *       1.7.5 Address suggestions
- *
- *    Addresses will notify the client automatically on any 
bandwidth_changed_cb
- *    by the solver if a address suggestion request is pending. If no address 
is
- *    available it will not respond at all If the client is not interested
- *    anymore, it has to cancel the address suggestion request.
- *
- *       1.7.6 Suggestions blocks and reset
- *
- *    After suggesting an address it is blocked for ATS_BLOCKING_DELTA sec. to
- *    prevent the client from being thrashed. If the client requires 
immediately
- *    it can reset this block using GAS_addresses_handle_backoff_reset.
- *
- *       1.7.7 Address lifecycle
- *
- *      * (add address)
- *      * (updated address)
- *      * (delete address)
- *
- *     1.8 Bandwidth assignment
- *
- *    The addresses are used to perform resource allocation operations. ATS
- *    addresses takes care of instantiating the solver configured and notifies
- *    the respective solver about address changes and receives changes to the
- *    bandwidth assignment from the solver. The current bandwidth assignment is
- *    sent to transport. The specific solvers will be described in the specific
- *    section.
- *
- *     1.9 Changing peer preferences
- *
- *    The bandwidth assigned to a peer can be influenced by setting a 
preference
- *    for a peer. The preference will be given to to the solver with s_pref 
which
- *    has to take care of the preference value
- */
-
-
-/*
- * How long will address suggestions blocked after a suggestion
- */
-#define ATS_BLOCKING_DELTA GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_MILLISECONDS, 100)
-
-/**
- * Information provided by ATS normalization
- */
-struct GAS_NormalizationInfo
-{
-  /**
-   * Next index to use in averaging queue
-   */
-  unsigned int avg_queue_index;
-
-  /**
-   * Averaging queue
-   */
-  uint64_t atsi_abs[GAS_normalization_queue_length];
-
-  /**
-   * Averaged ATSI values from queue
-   */
-  uint64_t avg;
-
-  /**
-   * Normalized values from queue to a range of values [1.0...2.0]
-   */
-  double norm;
-};
-
-
-/**
- * Address with additional information
- */
-struct ATS_Address
-{
-  /**
-   * Peer ID this address is for.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Address (in plugin-specific binary format).
-   */
-  const void *addr;
-
-  /**
-   * Plugin name
-   */
-  char *plugin;
-
-  /**
-   * Solver-specific information for this address
-   */
-  void *solver_information;
-
-  /**
-   * ATS performance information for this address
-   */
-  struct GNUNET_ATS_Properties properties;
-
-  /**
-   * Time when address had last activity (update, in uses)
-   */
-  struct GNUNET_TIME_Absolute t_last_activity;
-
-  /**
-   * Time when address was added
-   */
-  struct GNUNET_TIME_Absolute t_added;
-
-  /**
-   * Address length, number of bytes in @e addr.
-   */
-  size_t addr_len;
-
-  /**
-   * Session ID, can never be 0.
-   */
-  uint32_t session_id;
-
-  /**
-   * Field to store local flags.
-   */
-  enum GNUNET_HELLO_AddressInfo local_address_info;
-
-  /**
-   * ATS performance information for this address, size of the @e atsi array.
-   */
-  uint32_t atsi_count;
-
-  /**
-   * Inbound bandwidth assigned by solver
-   */
-  uint32_t assigned_bw_in;
-
-  /**
-   * Outbound bandwidth assigned by solver
-   */
-  uint32_t assigned_bw_out;
-
-  /**
-   * Inbound bandwidth assigned by solver in NBO
-   */
-  uint32_t last_notified_bw_in;
-
-  /**
-   * Outbound bandwidth assigned by solver in NBO
-   */
-  uint32_t last_notified_bw_out;
-
-  /**
-   * Is this the active address for this peer?
-   */
-  int active;
-
-  /**
-   * Normalized delay information for this address.
-   */
-  struct GAS_NormalizationInfo norm_delay;
-
-  /**
-   * Normalized distance information for this address.
-   */
-  struct GAS_NormalizationInfo norm_distance;
-
-  /**
-   * Normalized utilization inbound for this address.
-   */
-  struct GAS_NormalizationInfo norm_utilization_in;
-
-  /**
-   * Normalized utilization outbound for this address.
-   */
-  struct GAS_NormalizationInfo norm_utilization_out;
-};
-
-
-/**
- * A multipeermap mapping peer identities to `struct ATS_Address`.
- */
-extern struct GNUNET_CONTAINER_MultiPeerMap *GSA_addresses;
-
-
-/**
- * Initialize address subsystem. The addresses subsystem manages the addresses
- * known and current performance information.
- */
-void
-GAS_addresses_init (void);
-
-
-/**
- * Shutdown address subsystem.
- */
-void
-GAS_addresses_done (void);
-
-
-/**
- * Add a new address for a peer.
- *
- * @param peer peer
- * @param plugin_name transport plugin name
- * @param plugin_addr plugin address
- * @param plugin_addr_len length of the @a plugin_addr
- * @param local_address_info the local address for the address
- * @param session_id session id, can never be 0.
- * @param prop performance information for this address
- */
-void
-GAS_addresses_add (const struct GNUNET_PeerIdentity *peer,
-                   const char *plugin_name,
-                   const void *plugin_addr,
-                   size_t plugin_addr_len,
-                   uint32_t local_address_info,
-                   uint32_t session_id,
-                   const struct GNUNET_ATS_Properties *prop);
-
-
-/**
- * Update an address with new performance information for a peer.
- *
- * @param peer peer
- * @param session_id session id, can never be 0
- * @param prop performance information for this address
- */
-void
-GAS_addresses_update (const struct GNUNET_PeerIdentity *peer,
-                      uint32_t session_id,
-                      const struct GNUNET_ATS_Properties *prop);
-
-
-/**
- * Remove an address for a peer.
- *
- * @param peer peer
- * @param session_id session id, can never be 0
- */
-void
-GAS_addresses_destroy (const struct GNUNET_PeerIdentity *peer,
-                       uint32_t session_id);
-
-
-/**
- * Remove all addresses.
- */
-void
-GAS_addresses_destroy_all (void);
-
-
-/**
- * Iterator for #GAS_addresses_get_peer_info()
- *
- * @param cls closure
- * @param id the peer id
- * @param plugin_name plugin name
- * @param plugin_addr address
- * @param plugin_addr_len length of @a plugin_addr
- * @param address_active is address actively used
- * @param atsi ats performance information
- * @param local_address_info flags for the address
- * @param bandwidth_out current outbound bandwidth assigned to address
- * @param bandwidth_in current inbound bandwidth assigned to address
- */
-typedef void
-(*GNUNET_ATS_PeerInfo_Iterator) (void *cls,
-                                 const struct GNUNET_PeerIdentity *id,
-                                 const char *plugin_name,
-                                 const void *plugin_addr,
-                                 size_t plugin_addr_len,
-                                 const int address_active,
-                                 const struct GNUNET_ATS_Properties *prop,
-                                 enum GNUNET_HELLO_AddressInfo
-                                 local_address_info,
-                                 struct GNUNET_BANDWIDTH_Value32NBO
-                                 bandwidth_out,
-                                 struct GNUNET_BANDWIDTH_Value32NBO
-                                 bandwidth_in);
-
-
-/**
- * Return information all peers currently known to ATS
- *
- * @param peer the respective peer, NULL for 'all' peers
- * @param pi_it the iterator to call for every peer
- * @param pi_it_cls the closure for @a pi_it
- */
-void
-GAS_addresses_get_peer_info (const struct GNUNET_PeerIdentity *peer,
-                             GNUNET_ATS_PeerInfo_Iterator pi_it,
-                             void *pi_it_cls);
-
-
-/**
- * Handle 'address list request' messages from clients.
- *
- * @param client client that sent the request
- * @param alrm the request message
- */
-void
-GAS_handle_request_address_list (struct GNUNET_SERVICE_Client *client,
-                                 const struct AddressListRequestMessage *alrm);
-
-
-#endif
-
-/* end of gnunet-service-ats_addresses.h */
diff --git a/src/ats/gnunet-service-ats_connectivity.c 
b/src/ats/gnunet-service-ats_connectivity.c
deleted file mode 100644
index 702c5ba87..000000000
--- a/src/ats/gnunet-service-ats_connectivity.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats_connectivity.c
- * @brief ats service, interaction with 'connecivity' API
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet-service-ats.h"
-#include "gnunet-service-ats_addresses.h"
-#include "gnunet-service-ats_connectivity.h"
-#include "gnunet-service-ats_plugins.h"
-#include "ats.h"
-
-
-/**
- * Active connection requests.
- */
-struct ConnectionRequest
-{
-  /**
-   * Client that made the request.
-   */
-  struct GNUNET_SERVICE_Client *client;
-
-  /* TODO: allow client to express a 'strength' for this request */
-};
-
-
-/**
- * Address suggestion requests by peer.
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *connection_requests;
-
-
-/**
- * Is the given peer in the list of peers for which we
- * have an address request?
- *
- * @param cls unused, NULL
- * @param peer peer to query for
- * @return #GNUNET_YES if so, #GNUNET_NO if not
- */
-unsigned int
-GAS_connectivity_has_peer (void *cls,
-                           const struct GNUNET_PeerIdentity *peer)
-{
-  if (NULL == connection_requests)
-    return 0;
-  /* TODO: return sum of 'strength's of connectivity requests */
-  return GNUNET_CONTAINER_multipeermap_contains (connection_requests,
-                                                 peer);
-}
-
-
-/**
- * Handle #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS messages from clients.
- *
- * @param client client that sent the request
- * @param msg the request message
- */
-void
-GAS_handle_request_address (struct GNUNET_SERVICE_Client *client,
-                            const struct RequestAddressMessage *msg)
-{
-  struct ConnectionRequest *cr;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received `%s' message\n",
-              "GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS");
-  /* FIXME: should not ignore "msg->strength" */
-  cr = GNUNET_new (struct ConnectionRequest);
-  cr->client = client;
-  (void) GNUNET_CONTAINER_multipeermap_put (connection_requests,
-                                            &msg->peer,
-                                            cr,
-                                            
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  GAS_plugin_request_connect_start (&msg->peer);
-}
-
-
-/**
- * Free the connection request from the map if the
- * closure matches the client.
- *
- * @param cls the client to match
- * @param pid peer for which the request was made
- * @param value the `struct ConnectionRequest`
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-free_matching_requests (void *cls,
-                        const struct GNUNET_PeerIdentity *pid,
-                        void *value)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-  struct ConnectionRequest *cr = value;
-
-  if (cr->client == client)
-  {
-    GAS_plugin_request_connect_stop (pid);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Removed request pending for peer `%s\n",
-                GNUNET_i2s (pid));
-    GNUNET_assert (GNUNET_YES ==
-                   GNUNET_CONTAINER_multipeermap_remove (connection_requests,
-                                                         pid,
-                                                         cr));
-    GNUNET_free (cr);
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Handle #GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL messages
- * from clients.
- *
- * @param client the client that sent the request
- * @param msg the request message
- */
-void
-GAS_handle_request_address_cancel (struct GNUNET_SERVICE_Client *client,
-                                   const struct RequestAddressMessage *msg)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL message 
for peer %s\n",
-              GNUNET_i2s (&msg->peer));
-  GNUNET_break (0 == ntohl (msg->strength));
-  GNUNET_CONTAINER_multipeermap_get_multiple (connection_requests,
-                                              &msg->peer,
-                                              &free_matching_requests,
-                                              client);
-}
-
-
-/**
- * Unregister a client (which may have been a connectivity client,
- * but this is not assured).
- *
- * @param client handle of the (now dead) client
- */
-void
-GAS_connectivity_remove_client (struct GNUNET_SERVICE_Client *client)
-{
-  if (NULL != connection_requests)
-    GNUNET_CONTAINER_multipeermap_iterate (connection_requests,
-                                           &free_matching_requests,
-                                           client);
-}
-
-
-/**
- * Shutdown connectivity subsystem.
- */
-void
-GAS_connectivity_init ()
-{
-  connection_requests
-    = GNUNET_CONTAINER_multipeermap_create (32,
-                                            GNUNET_NO);
-}
-
-
-/**
- * Free the connection request from the map.
- *
- * @param cls NULL
- * @param pid peer for which the request was made
- * @param value the `struct ConnectionRequest`
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-free_request (void *cls,
-              const struct GNUNET_PeerIdentity *pid,
-              void *value)
-{
-  struct ConnectionRequest *cr = value;
-
-  free_matching_requests (cr->client,
-                          pid,
-                          cr);
-  return GNUNET_OK;
-}
-
-
-/**
- * Shutdown connectivity subsystem.
- */
-void
-GAS_connectivity_done ()
-{
-  GAS_plugin_solver_lock ();
-  GNUNET_CONTAINER_multipeermap_iterate (connection_requests,
-                                         &free_request,
-                                         NULL);
-  GAS_plugin_solver_unlock ();
-  GNUNET_CONTAINER_multipeermap_destroy (connection_requests);
-  connection_requests = NULL;
-}
-
-
-/* end of gnunet-service-ats_connectivity.c */
diff --git a/src/ats/gnunet-service-ats_connectivity.h 
b/src/ats/gnunet-service-ats_connectivity.h
deleted file mode 100644
index 39453dfc8..000000000
--- a/src/ats/gnunet-service-ats_connectivity.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/gnunet-service-ats_connectivity.h
- * @brief ats service, interaction with 'connecivity' API
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_ATS_CONNECTIVITY_H
-#define GNUNET_SERVICE_ATS_CONNECTIVITY_H
-
-#include "ats.h"
-
-
-/**
- * Is the given peer in the list of peers for which we
- * have an address request?
- *
- * @param cls unused, NULL
- * @param peer peer to query for
- * @return #GNUNET_YES if so, #GNUNET_NO if not
- */
-unsigned int
-GAS_connectivity_has_peer (void *cls,
-                           const struct GNUNET_PeerIdentity *peer);
-
-
-/**
- * Handle 'request address' messages from clients.
- *
- * @param client client that sent the request
- * @param msg the request message
- */
-void
-GAS_handle_request_address (struct GNUNET_SERVICE_Client *client,
-                            const struct RequestAddressMessage *msg);
-
-
-/**
- * Cancel 'request address' messages from clients.
- *
- * @param client client that sent the request
- * @param msg the request message
- */
-void
-GAS_handle_request_address_cancel (struct GNUNET_SERVICE_Client *client,
-                                   const struct RequestAddressMessage *msg);
-
-
-/**
- * Unregister a client (which may have been a connectivity client,
- * but this is not assured).
- *
- * @param client handle of the (now dead) client
- */
-void
-GAS_connectivity_remove_client (struct GNUNET_SERVICE_Client *client);
-
-
-/**
- * Initialize connectivity subsystem.
- */
-void
-GAS_connectivity_init (void);
-
-
-/**
- * Shutdown connectivity subsystem.
- */
-void
-GAS_connectivity_done (void);
-
-
-#endif
-/* end of gnunet-service-ats_connectivity.h */
diff --git a/src/ats/gnunet-service-ats_normalization.c 
b/src/ats/gnunet-service-ats_normalization.c
deleted file mode 100644
index 36584e944..000000000
--- a/src/ats/gnunet-service-ats_normalization.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2011-2015 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats_normalization.c
- * @brief ats service address: management of ATS properties and preferences 
normalization
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include <float.h>
-#include "gnunet_ats_service.h"
-#include "gnunet-service-ats_addresses.h"
-#include "gnunet-service-ats_normalization.h"
-#include "gnunet-service-ats_plugins.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "ats-normalization", __VA_ARGS__)
-
-
-/**
- * Range information for normalization of quality properties.
- */
-struct PropertyRange
-{
-  /**
-   * Minimum value we see for this property across all addresses.
-   */
-  struct GNUNET_ATS_Properties min;
-
-  /**
-   * Maximum value we see for this property across all addresses.
-   */
-  struct GNUNET_ATS_Properties max;
-};
-
-
-/**
- * Range information for all quality properties we see.
- */
-static struct PropertyRange property_range;
-
-
-/**
- * Add the value from @a atsi to the running average of the
- * given @a ni quality property.
- *
- * @param current_val the updated value
- * @param ni normalization information to update
- */
-static void
-update_avg (uint64_t current_val,
-            struct GAS_NormalizationInfo *ni)
-{
-  double sum;
-  uint32_t count;
-  unsigned int c1;
-
-  ni->atsi_abs[ni->avg_queue_index++] = current_val;
-  if (GAS_normalization_queue_length == ni->avg_queue_index)
-    ni->avg_queue_index = 0;
-  count = 0;
-  sum = 0.0;
-  for (c1 = 0; c1 < GAS_normalization_queue_length; c1++)
-  {
-    if (UINT64_MAX != ni->atsi_abs[c1])
-    {
-      count++;
-      sum += (double) ni->atsi_abs[c1];
-    }
-  }
-  if (0 == count)
-    ni->avg = current_val; /* must be UINT64_MAX */
-  else
-    ni->avg = sum / count;
-}
-
-
-/**
- * Function called for all addresses and peers to find the minimum and
- * maximum (averaged) values for a given quality property.  Given
- * those, we can then calculate the normalized score.
- *
- * @param cls the `struct PropertyRange`
- * @param h which peer are we looking at (ignored)
- * @param k the address for that peer
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-find_min_max_it (void *cls,
-                 const struct GNUNET_PeerIdentity *h,
-                 void *k)
-{
-  struct PropertyRange *pr = cls;
-  const struct ATS_Address *a = k;
-
-  pr->max.utilization_out = GNUNET_MAX (pr->max.utilization_out,
-                                        a->properties.utilization_out);
-  pr->max.utilization_in = GNUNET_MAX (pr->max.utilization_in,
-                                       a->properties.utilization_in);
-  pr->max.distance = GNUNET_MAX (pr->max.distance,
-                                 a->properties.distance);
-  pr->max.delay = GNUNET_TIME_relative_max (pr->max.delay,
-                                            a->properties.delay);
-  pr->min.utilization_out = GNUNET_MIN (pr->min.utilization_out,
-                                        a->properties.utilization_out);
-  pr->min.utilization_in = GNUNET_MIN (pr->min.utilization_in,
-                                       a->properties.utilization_in);
-  pr->min.distance = GNUNET_MIN (pr->min.distance,
-                                 a->properties.distance);
-  pr->min.delay = GNUNET_TIME_relative_min (pr->min.delay,
-                                            a->properties.delay);
-  return GNUNET_OK;
-}
-
-
-/**
- * Compute the normalized value from the given @a ni range
- * data and the average value.
- *
- * @param min minimum value
- * @param max maximum value
- * @param ni normalization information to update
- */
-static void
-update_norm (uint64_t min,
-             uint64_t max,
-             struct GAS_NormalizationInfo *ni)
-{
-  /* max - 2 * min + avg_value / (max - min) */
-  if (min < max)
-    ni->norm = DEFAULT_REL_QUALITY + (ni->avg - min) / (double) (max - min);
-  else
-    ni->norm = DEFAULT_REL_QUALITY;
-}
-
-
-/**
- * Normalize the property value for a given address based
- * on the range we know that property values have globally.
- *
- * @param cls NULL
- * @param key which peer are we looking at (ignored)
- * @param value the address for that peer, from where we get
- *            the original value and where we write the
- *            normalized value
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-normalize_address (void *cls,
-                   const struct GNUNET_PeerIdentity *key,
-                   void *value)
-{
-  struct ATS_Address *address = value;
-
-  update_norm (property_range.min.delay.rel_value_us,
-               property_range.max.delay.rel_value_us,
-               &address->norm_delay);
-  update_norm (property_range.min.distance,
-               property_range.max.distance,
-               &address->norm_distance);
-  update_norm (property_range.min.utilization_in,
-               property_range.max.utilization_in,
-               &address->norm_utilization_in);
-  update_norm (property_range.min.utilization_out,
-               property_range.max.utilization_out,
-               &address->norm_utilization_out);
-  return GNUNET_OK;
-}
-
-
-/**
- * Notify about change in normalized property.
- *
- * @param cls NULL
- * @param key which peer are we looking at (ignored)
- * @param value the address for that peer
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-notify_change (void *cls,
-               const struct GNUNET_PeerIdentity *key,
-               void *value)
-{
-  struct ATS_Address *address = value;
-
-  GAS_plugin_notify_property_changed (address);
-  return GNUNET_OK;
-}
-
-
-/**
- * Initialize property range to the values corresponding
- * to an empty set.
- *
- * @param pr range to initialize
- */
-static void
-init_range (struct PropertyRange *pr)
-{
-  memset (pr, 0, sizeof(struct PropertyRange));
-  pr->min.utilization_out = UINT32_MAX;
-  pr->min.utilization_in = UINT32_MAX;
-  pr->min.distance = UINT32_MAX;
-  pr->min.delay = GNUNET_TIME_UNIT_FOREVER_REL;
-}
-
-
-/**
- * Update and normalize atsi performance information
- *
- * @param address the address to update
- */
-void
-GAS_normalization_update_property (struct ATS_Address *address)
-{
-  const struct GNUNET_ATS_Properties *prop = &address->properties;
-  struct PropertyRange range;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Updating properties for peer `%s'\n",
-       GNUNET_i2s (&address->peer));
-  GAS_plugin_solver_lock ();
-  update_avg (prop->delay.rel_value_us,
-              &address->norm_delay);
-  update_avg (prop->distance,
-              &address->norm_distance);
-  update_avg (prop->utilization_in,
-              &address->norm_utilization_in);
-  update_avg (prop->utilization_in,
-              &address->norm_utilization_out);
-
-  init_range (&range);
-  GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses,
-                                         &find_min_max_it,
-                                         &range);
-  if (0 != GNUNET_memcmp (&range,
-                          &property_range))
-  {
-    /* limits changed, (re)normalize all addresses */
-    property_range = range;
-    GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses,
-                                           &normalize_address,
-                                           NULL);
-    GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses,
-                                           &notify_change,
-                                           NULL);
-  }
-  else
-  {
-    /* renormalize just this one address */
-    normalize_address (NULL,
-                       &address->peer,
-                       address);
-    notify_change (NULL,
-                   &address->peer,
-                   address);
-  }
-  GAS_plugin_solver_unlock ();
-}
-
-
-/**
- * Start the normalization component
- */
-void
-GAS_normalization_start ()
-{
-  init_range (&property_range);
-}
-
-
-/**
- * Stop the normalization component and free all items
- */
-void
-GAS_normalization_stop ()
-{
-  /* nothing to do */
-}
-
-
-/* end of gnunet-service-ats_normalization.c */
diff --git a/src/ats/gnunet-service-ats_normalization.h 
b/src/ats/gnunet-service-ats_normalization.h
deleted file mode 100644
index 9c02586c2..000000000
--- a/src/ats/gnunet-service-ats_normalization.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats_normalization.h
- * @brief ats service address: management of ATS properties and preferences 
normalization
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_ATS_NORMALIZATION_H
-#define GNUNET_SERVICE_ATS_NORMALIZATION_H
-#include "gnunet_ats_service.h"
-
-/**
- * Value we return for a normalized quality score if we have no data.
- */
-#define DEFAULT_REL_QUALITY 1.0
-
-
-/**
- * Update and normalize a @a prop performance information
- *
- * @param address the address to update
- */
-void
-GAS_normalization_update_property (struct ATS_Address *address);
-
-
-/**
- * Start the normalization component
- */
-void
-GAS_normalization_start (void);
-
-
-/**
- * Stop the normalization component and free all items
- */
-void
-GAS_normalization_stop (void);
-
-#endif
-/* end of gnunet-service-ats_normalization.h */
diff --git a/src/ats/gnunet-service-ats_performance.c 
b/src/ats/gnunet-service-ats_performance.c
deleted file mode 100644
index a4d7b36b6..000000000
--- a/src/ats/gnunet-service-ats_performance.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/gnunet-service-ats_performance.c
- * @brief ats service, interaction with 'performance' API
- * @author Matthias Wachs
- * @author Christian Grothoff
- *
- * TODO:
- * - simplify functions by passing a `struct GNUNET_HELLO_Address`
- */
-#include "platform.h"
-#include "gnunet-service-ats.h"
-#include "gnunet-service-ats_addresses.h"
-#include "gnunet-service-ats_performance.h"
-#include "ats.h"
-
-
-/**
- * Context for sending messages to performance clients without PIC.
- */
-static struct GNUNET_NotificationContext *nc_no_pic;
-
-/**
- * Context for sending messages to performance clients with PIC.
- */
-static struct GNUNET_NotificationContext *nc_pic;
-
-
-/**
- * Transmit the given performance information to all performance
- * clients.
- *
- * @param client client to send to, NULL for all
- * @param peer peer for which this is an address suggestion
- * @param plugin_name 0-termintated string specifying the transport plugin
- * @param plugin_addr binary address for the plugin to use
- * @param plugin_addr_len number of bytes in plugin_addr
- * @param active #GNUNET_YES if this address is actively used
- *        to maintain a connection to a peer;
- *        #GNUNET_NO if the address is not actively used;
- *        #GNUNET_SYSERR if this address is no longer available for ATS
- * @param prop performance data for the address
- * @param local_address_info information about the local flags for the address
- * @param bandwidth_out assigned outbound bandwidth
- * @param bandwidth_in assigned inbound bandwidth
- */
-static void
-notify_client (struct GNUNET_SERVICE_Client *client,
-               const struct GNUNET_PeerIdentity *peer,
-               const char *plugin_name,
-               const void *plugin_addr,
-               size_t plugin_addr_len,
-               int active,
-               const struct GNUNET_ATS_Properties *prop,
-               enum GNUNET_HELLO_AddressInfo local_address_info,
-               struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-               struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
-{
-  struct PeerInformationMessage *msg;
-  size_t plugin_name_length = strlen (plugin_name) + 1;
-  size_t msize =
-    sizeof(struct PeerInformationMessage)
-    + plugin_addr_len
-    + plugin_name_length;
-  char buf[msize] GNUNET_ALIGN;
-  char *addrp;
-
-  if (NULL != prop)
-    GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
-  GNUNET_assert (msize < GNUNET_MAX_MESSAGE_SIZE);
-  msg = (struct PeerInformationMessage *) buf;
-  msg->header.size = htons (msize);
-  msg->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_PEER_INFORMATION);
-  msg->id = htonl (0);
-  msg->peer = *peer;
-  msg->address_length = htons (plugin_addr_len);
-  msg->address_active = ntohl ((uint32_t) active);
-  msg->plugin_name_length = htons (plugin_name_length);
-  msg->bandwidth_out = bandwidth_out;
-  msg->bandwidth_in = bandwidth_in;
-  if (NULL != prop)
-    GNUNET_ATS_properties_hton (&msg->properties,
-                                prop);
-  else
-    memset (&msg->properties,
-            0,
-            sizeof(struct GNUNET_ATS_Properties));
-  msg->address_local_info = htonl (local_address_info);
-  addrp = (char *) &msg[1];
-  GNUNET_memcpy (addrp, plugin_addr, plugin_addr_len);
-  strcpy (&addrp[plugin_addr_len], plugin_name);
-  if (NULL == client)
-  {
-    GNUNET_notification_context_broadcast (nc_pic,
-                                           &msg->header,
-                                           GNUNET_YES);
-  }
-  else
-  {
-    struct GNUNET_MQ_Envelope *env;
-
-    env = GNUNET_MQ_msg_copy (&msg->header);
-    GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client),
-                    env);
-  }
-}
-
-
-/**
- * Transmit the given performance information to all performance
- * clients.
- *
- * @param peer peer for which this is an address suggestion
- * @param plugin_name 0-termintated string specifying the transport plugin
- * @param plugin_addr binary address for the plugin to use
- * @param plugin_addr_len number of bytes in @a plugin_addr
- * @param active #GNUNET_YES if this address is actively used
- *        to maintain a connection to a peer;
- *        #GNUNET_NO if the address is not actively used;
- *        #GNUNET_SYSERR if this address is no longer available for ATS
- * @param prop performance data for the address
- * @param local_address_info information about the local flags for the address
- * @param bandwidth_out assigned outbound bandwidth
- * @param bandwidth_in assigned inbound bandwidth
- */
-void
-GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
-                                    const char *plugin_name,
-                                    const void *plugin_addr,
-                                    size_t plugin_addr_len,
-                                    int active,
-                                    const struct GNUNET_ATS_Properties *prop,
-                                    enum GNUNET_HELLO_AddressInfo
-                                    local_address_info,
-                                    struct GNUNET_BANDWIDTH_Value32NBO
-                                    bandwidth_out,
-                                    struct GNUNET_BANDWIDTH_Value32NBO
-                                    bandwidth_in)
-{
-  GNUNET_break ((NULL == prop) ||
-                (GNUNET_NT_UNSPECIFIED != prop->scope));
-  notify_client (NULL,
-                 peer,
-                 plugin_name,
-                 plugin_addr,
-                 plugin_addr_len,
-                 active,
-                 prop,
-                 local_address_info,
-                 bandwidth_out,
-                 bandwidth_in);
-  GNUNET_STATISTICS_update (GSA_stats,
-                            "# performance updates given to clients",
-                            1,
-                            GNUNET_NO);
-}
-
-
-/**
- * Iterator for called from #GAS_addresses_get_peer_info()
- *
- * @param cls closure with the `struct GNUNET_SERVICE_Client *` to inform.
- * @param id the peer id
- * @param plugin_name plugin name
- * @param plugin_addr address
- * @param plugin_addr_len length of @a plugin_addr
- * @param active is address actively used
- * @param prop performance information
- * @param local_address_info information about the local flags for the address
- * @param bandwidth_out current outbound bandwidth assigned to address
- * @param bandwidth_in current inbound bandwidth assigned to address
- */
-static void
-peerinfo_it (void *cls,
-             const struct GNUNET_PeerIdentity *id,
-             const char *plugin_name,
-             const void *plugin_addr,
-             size_t plugin_addr_len,
-             int active,
-             const struct GNUNET_ATS_Properties *prop,
-             enum GNUNET_HELLO_AddressInfo local_address_info,
-             struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-             struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-
-  if (NULL == id)
-    return;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Callback for peer `%s' plugin `%s' BW out %u, BW in %u \n",
-              GNUNET_i2s (id),
-              plugin_name,
-              (unsigned int) ntohl (bandwidth_out.value__),
-              (unsigned int) ntohl (bandwidth_in.value__));
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
-  notify_client (client,
-                 id,
-                 plugin_name,
-                 plugin_addr,
-                 plugin_addr_len,
-                 active,
-                 prop,
-                 local_address_info,
-                 bandwidth_out,
-                 bandwidth_in);
-}
-
-
-/**
- * Register a new performance client.
- *
- * @param client handle of the new client
- * @param flag flag specifying the type of the client
- */
-void
-GAS_performance_add_client (struct GNUNET_SERVICE_Client *client,
-                            enum StartFlag flag)
-{
-  struct GNUNET_MQ_Handle *mq;
-
-  mq = GNUNET_SERVICE_client_get_mq (client);
-  if (START_FLAG_PERFORMANCE_WITH_PIC == flag)
-  {
-    GNUNET_notification_context_add (nc_pic,
-                                     mq);
-    GAS_addresses_get_peer_info (NULL,
-                                 &peerinfo_it,
-                                 client);
-  }
-  else
-  {
-    GNUNET_notification_context_add (nc_no_pic,
-                                     mq);
-  }
-}
-
-
-/**
- * Initialize performance subsystem.
- *
- * @param server handle to our server
- */
-void
-GAS_performance_init ()
-{
-  nc_no_pic = GNUNET_notification_context_create (32);
-  nc_pic = GNUNET_notification_context_create (32);
-}
-
-
-/**
- * Shutdown performance subsystem.
- */
-void
-GAS_performance_done ()
-{
-  GNUNET_notification_context_destroy (nc_no_pic);
-  nc_no_pic = NULL;
-  GNUNET_notification_context_destroy (nc_pic);
-  nc_pic = NULL;
-}
-
-
-/* end of gnunet-service-ats_performance.c */
diff --git a/src/ats/gnunet-service-ats_performance.h 
b/src/ats/gnunet-service-ats_performance.h
deleted file mode 100644
index 292c27c95..000000000
--- a/src/ats/gnunet-service-ats_performance.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats_performance.h
- * @brief ats service, interaction with 'performance' API
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_ATS_PERFORMANCE_H
-#define GNUNET_SERVICE_ATS_PERFORMANCE_H
-
-#include "gnunet_util_lib.h"
-#include "gnunet_ats_service.h"
-#include "ats.h"
-
-
-/**
- * Transmit the given performance information to all performance
- * clients.
- *
- * @param peer peer for which this is an address suggestion
- * @param plugin_name 0-termintated string specifying the transport plugin
- * @param plugin_addr binary address for the plugin to use
- * @param plugin_addr_len number of bytes in @a plugin_addr
- * @param active #GNUNET_YES if this address is actively used
- *        to maintain a connection to a peer;
- *        #GNUNET_NO if the address is not actively used;
- *        #GNUNET_SYSERR if this address is no longer available for ATS
- * @param prop performance data for the address
- * @param local_address_info information about the local flags for the address
- * @param bandwidth_out assigned outbound bandwidth
- * @param bandwidth_in assigned inbound bandwidth
- */
-void
-GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer,
-                                    const char *plugin_name,
-                                    const void *plugin_addr,
-                                    size_t plugin_addr_len,
-                                    int active,
-                                    const struct GNUNET_ATS_Properties *prop,
-                                    enum GNUNET_HELLO_AddressInfo
-                                    local_address_info,
-                                    struct GNUNET_BANDWIDTH_Value32NBO
-                                    bandwidth_out,
-                                    struct GNUNET_BANDWIDTH_Value32NBO
-                                    bandwidth_in);
-
-
-/**
- * Register a new performance client.
- *
- * @param client handle of the new client
- * @param flag flag specifying the type of the client
- */
-void
-GAS_performance_add_client (struct GNUNET_SERVICE_Client *client,
-                            enum StartFlag flag);
-
-
-/**
- * Initialize performance subsystem.
- *
- * @param server handle to our server
- * @param addresses the address handle to use
- */
-void
-GAS_performance_init (void);
-
-
-/**
- * Shutdown performance subsystem.
- */
-void
-GAS_performance_done (void);
-
-
-#endif
-/* end of gnunet-service-ats_performance.h */
diff --git a/src/ats/gnunet-service-ats_plugins.c 
b/src/ats/gnunet-service-ats_plugins.c
deleted file mode 100644
index d3db69caa..000000000
--- a/src/ats/gnunet-service-ats_plugins.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2011-2014 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats_plugins.c
- * @brief ats service plugin management
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_ats_plugin.h"
-#include "gnunet-service-ats_connectivity.h"
-#include "gnunet-service-ats_performance.h"
-#include "gnunet-service-ats_preferences.h"
-#include "gnunet-service-ats_plugins.h"
-#include "gnunet-service-ats_reservations.h"
-#include "gnunet-service-ats_scheduling.h"
-#include "gnunet-service-ats_normalization.h"
-
-
-/**
- * Solver handle.
- */
-static struct GNUNET_ATS_SolverFunctions *sf;
-
-/**
- * Solver environment.
- */
-static struct GNUNET_ATS_PluginEnvironment env;
-
-/**
- * Solver plugin name as string
- */
-static char *plugin;
-
-
-/**
- * The preference changed for a peer, update solver.
- *
- * @param peer the peer
- * @param kind the ATS kind
- * @param pref_rel the new relative preference value
- */
-void
-GAS_plugin_notify_preference_changed (const struct GNUNET_PeerIdentity *peer,
-                                      enum GNUNET_ATS_PreferenceKind kind,
-                                      double pref_rel)
-{
-  sf->s_pref (sf->cls,
-              peer,
-              kind,
-              pref_rel);
-}
-
-
-void
-GAS_plugin_notify_property_changed (struct ATS_Address *address)
-{
-  sf->s_address_update_property (sf->cls,
-                                 address);
-}
-
-
-/**
- * Solver information callback
- *
- * @param cls the closure
- * @param op the operation
- * @param status operation status
- * @param add additional information
- */
-static void
-solver_info_cb (void *cls,
-                enum GAS_Solver_Operation op,
-                enum GAS_Solver_Status status,
-                enum GAS_Solver_Additional_Information add)
-{
-  const char *add_info;
-
-  switch (add)
-  {
-  case GAS_INFO_NONE:
-    add_info = "GAS_INFO_NONE";
-    break;
-
-  case GAS_INFO_FULL:
-    add_info = "GAS_INFO_MLP_FULL";
-    break;
-
-  case GAS_INFO_UPDATED:
-    add_info = "GAS_INFO_MLP_UPDATED";
-    break;
-
-  case GAS_INFO_PROP_ALL:
-    add_info = "GAS_INFO_PROP_ALL";
-    break;
-
-  case GAS_INFO_PROP_SINGLE:
-    add_info = "GAS_INFO_PROP_SINGLE";
-    break;
-
-  default:
-    add_info = "INVALID";
-    break;
-  }
-  switch (op)
-  {
-  case GAS_OP_SOLVE_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s' `%s'\n",
-                "GAS_OP_SOLVE_START",
-                (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL",
-                add_info);
-    return;
-
-  case GAS_OP_SOLVE_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_STOP",
-                (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_SETUP_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_SETUP_START",
-                (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_SETUP_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_SETUP_STOP",
-                (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_MLP_LP_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_LP_START",
-                (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_MLP_LP_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_LP_STOP",
-                (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_MLP_MLP_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_MLP_START",
-                (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_MLP_MLP_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_MLP_STOP",
-                (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_UPDATE_NOTIFICATION_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_UPDATE_NOTIFICATION_START",
-                (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP",
-                (GAS_STAT_SUCCESS == status) ? "SUCCESS" : "FAIL");
-    return;
-
-  default:
-    GNUNET_break (0);
-    break;
-  }
-}
-
-
-/**
- * Callback for solver to notify about assignment changes
- *
- * @param cls NULL
- * @param address the address with changes
- */
-static void
-bandwidth_changed_cb (void *cls,
-                      struct ATS_Address *address)
-{
-  long long diff_out;
-  long long diff_in;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Bandwidth assignment changed for peer %s to %u/%u\n",
-              GNUNET_i2s (&address->peer),
-              (unsigned int) address->assigned_bw_in,
-              (unsigned int) address->assigned_bw_out);
-  GAS_reservations_set_bandwidth (&address->peer,
-                                  GNUNET_BANDWIDTH_value_init (
-                                    address->assigned_bw_in));
-  /* Notify performance clients about changes to address */
-  GAS_performance_notify_all_clients (&address->peer,
-                                      address->plugin,
-                                      address->addr,
-                                      address->addr_len,
-                                      address->active,
-                                      &address->properties,
-                                      address->local_address_info,
-                                      GNUNET_BANDWIDTH_value_init (
-                                        address->assigned_bw_out),
-                                      GNUNET_BANDWIDTH_value_init (
-                                        address->assigned_bw_in));
-
-  if ((0 == address->assigned_bw_in) &&
-      (0 == address->assigned_bw_out))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Telling transport to disconnect peer `%s'\n",
-                GNUNET_i2s (&address->peer));
-
-    /* Notify scheduling clients about suggestion */
-    GAS_scheduling_transmit_address_suggestion (&address->peer,
-                                                address->session_id,
-                                                GNUNET_BANDWIDTH_ZERO,
-                                                GNUNET_BANDWIDTH_ZERO);
-    return;
-  }
-
-  /* Do bandwidth stability check */
-  diff_out = llabs ((long long) address->assigned_bw_out
-                    - (long long) address->last_notified_bw_out);
-  diff_in = llabs ((long long) address->assigned_bw_in
-                   - (long long) address->last_notified_bw_in);
-  if ((diff_out < htonl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__)) &&
-      (diff_in < htonl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Bandwidth change too small, not notifying client\n");
-    return;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Sending bandwidth update for peer `%s': %u/%u\n",
-              GNUNET_i2s (&address->peer),
-              address->assigned_bw_out,
-              address->assigned_bw_out);
-
-  /* *Notify scheduling clients about suggestion */
-  GAS_scheduling_transmit_address_suggestion (&address->peer,
-                                              address->session_id,
-                                              GNUNET_BANDWIDTH_value_init (
-                                                address->assigned_bw_out),
-                                              GNUNET_BANDWIDTH_value_init (
-                                                address->assigned_bw_in));
-
-  address->last_notified_bw_out = address->assigned_bw_out;
-  address->last_notified_bw_in = address->assigned_bw_in;
-}
-
-
-/**
- * Convert quota from text to numeric value.
- *
- * @param quota_str the value found in the configuration
- * @param direction direction of the quota
- * @param network network the quota applies to
- * @return numeric quota value to use
- */
-static unsigned long long
-parse_quota (const char *quota_str,
-             const char *direction,
-             enum GNUNET_NetworkType network)
-{
-  int res;
-  unsigned long long ret;
-
-  res = GNUNET_NO;
-  if (0 == strcmp (quota_str, GNUNET_ATS_MaxBandwidthString))
-  {
-    ret = GNUNET_ATS_MaxBandwidth;
-    res = GNUNET_YES;
-  }
-  if ((GNUNET_NO == res) &&
-      (GNUNET_OK ==
-       GNUNET_STRINGS_fancy_size_to_bytes (quota_str,
-                                           &ret)))
-    res = GNUNET_YES;
-  if ((GNUNET_NO == res) &&
-      (1 ==
-       sscanf (quota_str,
-               "%llu",
-               &ret)))
-    res = GNUNET_YES;
-  if (GNUNET_NO == res)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ (
-                  "Could not load %s quota for network `%s':  `%s', assigning 
default bandwidth %llu\n"),
-                direction,
-                GNUNET_NT_to_string (network),
-                quota_str,
-                (unsigned long long) GNUNET_ATS_DefaultBandwidth);
-    ret = GNUNET_ATS_DefaultBandwidth;
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ ("%s quota configured for network `%s' is %llu\n"),
-                direction,
-                GNUNET_NT_to_string (network),
-                ret);
-  }
-  return ret;
-}
-
-
-/**
- * Load quota value from the configuration @a cfg for the
- * given network @a type and @a direction.
- *
- * @param cfg configuration to parse
- * @param type network type to parse for
- * @param direction traffic direction to parse for
- * @return quota to apply
- */
-static unsigned long long
-load_quota (const struct GNUNET_CONFIGURATION_Handle *cfg,
-            enum GNUNET_NetworkType type,
-            const char *direction)
-{
-  char *entry;
-  char *quota_str;
-  unsigned long long ret;
-
-  GNUNET_asprintf (&entry,
-                   "%s_QUOTA_%s",
-                   GNUNET_NT_to_string (type),
-                   direction);
-  if (GNUNET_OK ==
-      GNUNET_CONFIGURATION_get_value_string (cfg,
-                                             "ats",
-                                             entry,
-                                             &quota_str))
-  {
-    ret = parse_quota (quota_str,
-                       direction,
-                       type);
-    GNUNET_free (quota_str);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ (
-                  "No %s-quota configured for network `%s', assigning default 
bandwidth %llu\n"),
-                direction,
-                GNUNET_NT_to_string (type),
-                (unsigned long long) GNUNET_ATS_DefaultBandwidth);
-    ret = GNUNET_ATS_DefaultBandwidth;
-  }
-  GNUNET_free (entry);
-  return ret;
-}
-
-
-/**
- * Load quotas for networks from configuration
- *
- * @param cfg configuration handle
- * @param out_dest where to write outbound quotas
- * @param in_dest where to write inbound quotas
- * @param dest_length length of inbound and outbound arrays
- * @return number of networks loaded
- */
-static unsigned int
-load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg,
-             unsigned long long *out_dest,
-             unsigned long long *in_dest,
-             int dest_length)
-{
-  unsigned int c;
-
-  for (c = 0; (c < GNUNET_NT_COUNT) && (c < dest_length); c++)
-  {
-    in_dest[c] = load_quota (cfg,
-                             c,
-                             "out");
-    out_dest[c] = load_quota (cfg,
-                              c,
-                              "in");
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Loaded quota for network `%s' (in/out): %llu %llu\n",
-                GNUNET_NT_to_string (c),
-                in_dest[c],
-                out_dest[c]);
-  }
-  return c;
-}
-
-
-int
-GAS_plugin_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  char *mode_str;
-
-  /* Figure out configured solution method */
-  if (GNUNET_SYSERR ==
-      GNUNET_CONFIGURATION_get_value_string (cfg,
-                                             "ats",
-                                             "MODE",
-                                             &mode_str))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "No resource assignment method configured, using proportional 
approach\n");
-    mode_str = GNUNET_strdup ("proportional");
-  }
-  env.cls = NULL;
-  env.info_cb = &solver_info_cb;
-  env.bandwidth_changed_cb = &bandwidth_changed_cb;
-  env.get_preferences = &GAS_preference_get_by_peer;
-  env.get_connectivity = &GAS_connectivity_has_peer;
-  env.cfg = cfg;
-  env.stats = GSA_stats;
-  env.addresses = GSA_addresses;
-  env.network_count = GNUNET_NT_COUNT;
-  load_quotas (cfg,
-               env.out_quota,
-               env.in_quota,
-               GNUNET_NT_COUNT);
-  GNUNET_asprintf (&plugin,
-                   "libgnunet_plugin_ats_%s",
-                   mode_str);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Initializing solver `%s'\n",
-              mode_str);
-  GNUNET_free (mode_str);
-  if (NULL == (sf = GNUNET_PLUGIN_load (plugin, &env)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ ("Failed to initialize solver `%s'!\n"),
-                plugin);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Shutdown address subsystem.
- */
-void
-GAS_plugin_done ()
-{
-  GNUNET_PLUGIN_unload (plugin,
-                        sf);
-  sf = NULL;
-  GNUNET_free (plugin);
-  plugin = NULL;
-}
-
-
-void
-GAS_plugin_new_address (struct ATS_Address *new_address)
-{
-  sf->s_add (sf->cls,
-             new_address,
-             new_address->properties.scope); /* FIXME: remove 3rd arg here! */
-}
-
-
-/**
- * Tell the solver that the given address is no longer valid
- * can cannot be used any longer.
- *
- * @param address address that was deleted
- */
-void
-GAS_plugin_delete_address (struct ATS_Address *address)
-{
-  sf->s_del (sf->cls,
-             address);
-}
-
-
-/**
- * Tell the solver that the given client has expressed its
- * appreciation for the past performance of a given connection.
- *
- * @param application client providing the feedback
- * @param peer peer the feedback is about
- * @param scope timeframe the feedback applies to
- * @param kind performance property the feedback relates to
- * @param score_abs degree of the appreciation
- */
-void
-GAS_plugin_notify_feedback (struct GNUNET_SERVICE_Client *application,
-                            const struct GNUNET_PeerIdentity *peer,
-                            const struct GNUNET_TIME_Relative scope,
-                            enum GNUNET_ATS_PreferenceKind kind,
-                            float score_abs)
-{
-  sf->s_feedback (sf->cls,
-                  application,
-                  peer,
-                  scope,
-                  kind,
-                  score_abs);
-}
-
-
-/**
- * Stop instant solving, there are many state updates
- * happening in bulk right now.
- */
-void
-GAS_plugin_solver_lock ()
-{
-  sf->s_bulk_start (sf->cls);
-}
-
-
-/**
- * Resume instant solving, we are done with the bulk state updates.
- */
-void
-GAS_plugin_solver_unlock ()
-{
-  sf->s_bulk_stop (sf->cls);
-}
-
-
-/**
- * Notify the plugin that a request to connect to
- * a particular peer was given to us.
- *
- * @param pid identity of peer we now care about
- */
-void
-GAS_plugin_request_connect_start (const struct GNUNET_PeerIdentity *pid)
-{
-  sf->s_get (sf->cls,
-             pid);
-}
-
-
-/**
- * Notify the plugin that a request to connect to
- * a particular peer was dropped.
- *
- * @param pid identity of peer we care now less about
- */
-void
-GAS_plugin_request_connect_stop (const struct GNUNET_PeerIdentity *pid)
-{
-  sf->s_get_stop (sf->cls,
-                  pid);
-}
-
-
-/* end of gnunet-service-ats_plugins.c */
diff --git a/src/ats/gnunet-service-ats_plugins.h 
b/src/ats/gnunet-service-ats_plugins.h
deleted file mode 100644
index 1abdbbd80..000000000
--- a/src/ats/gnunet-service-ats_plugins.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2011-2014 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats_plugins.h
- * @brief ats service plugin management
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_ATS_PLUGINS_H
-#define GNUNET_SERVICE_ATS_PLUGINS_H
-
-#include "gnunet-service-ats_addresses.h"
-
-
-/**
- * Initialize address subsystem. The addresses subsystem manages the addresses
- * known and current performance information. It has a solver component
- * responsible for the resource allocation. It tells the solver about changes
- * and receives updates when the solver changes the resource allocation.
- *
- * @param cfg configuration to use
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error (failed to load
- *         solver plugin)
- */
-int
-GAS_plugin_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
-
-
-/**
- * Shutdown address subsystem.
- */
-void
-GAS_plugin_done (void);
-
-
-/**
- * The preference changed for a peer, update solver.
- *
- * @param peer the peer
- * @param kind the ATS kind
- * @param pref_rel the new relative preference value
- */
-void
-GAS_plugin_notify_preference_changed (const struct GNUNET_PeerIdentity *peer,
-                                      enum GNUNET_ATS_PreferenceKind kind,
-                                      double pref_rel);
-
-
-/**
- * The relative value for a property changed.
- *
- * @param address The peer for which a property changed.
- */
-void
-GAS_plugin_notify_property_changed (struct ATS_Address *address);
-
-
-/**
- * Tell the solver that the given address can now be used
- * for talking to the respective peer.
- *
- * @param new_address the new address
- */
-void
-GAS_plugin_new_address (struct ATS_Address *new_address);
-
-
-/**
- * Tell the solver that the given address is no longer valid
- * can cannot be used any longer.
- *
- * @param address address that was deleted
- */
-void
-GAS_plugin_delete_address (struct ATS_Address *address);
-
-
-/**
- * Tell the solver that the given client has expressed its
- * appreciation for the past performance of a given connection.
- *
- * @param application client providing the feedback
- * @param peer peer the feedback is about
- * @param scope timeframe the feedback applies to
- * @param kind performance property the feedback relates to
- * @param score_abs degree of the appreciation
- */
-void
-GAS_plugin_notify_feedback (struct GNUNET_SERVICE_Client *application,
-                            const struct GNUNET_PeerIdentity *peer,
-                            const struct GNUNET_TIME_Relative scope,
-                            enum GNUNET_ATS_PreferenceKind kind,
-                            float score_abs);
-
-
-/**
- * Stop instant solving, there are many state updates
- * happening in bulk right now.
- */
-void
-GAS_plugin_solver_lock (void);
-
-
-/**
- * Resume instant solving, we are done with the bulk state updates.
- */
-void
-GAS_plugin_solver_unlock (void);
-
-
-/**
- * Notify the plugin that a request to connect to
- * a particular peer was given to us.
- *
- * @param pid identity of peer we now care about
- */
-void
-GAS_plugin_request_connect_start (const struct GNUNET_PeerIdentity *pid);
-
-
-/**
- * Notify the plugin that a request to connect to
- * a particular peer was dropped.
- *
- * @param pid identity of peer we care now less about
- */
-void
-GAS_plugin_request_connect_stop (const struct GNUNET_PeerIdentity *pid);
-
-
-#endif
diff --git a/src/ats/gnunet-service-ats_preferences.c 
b/src/ats/gnunet-service-ats_preferences.c
deleted file mode 100644
index c2b2dc4c1..000000000
--- a/src/ats/gnunet-service-ats_preferences.c
+++ /dev/null
@@ -1,771 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/gnunet-service-ats_preferences.c
- * @brief manage preferences expressed by clients
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet-service-ats.h"
-#include "gnunet-service-ats_addresses.h"
-#include "gnunet-service-ats_performance.h"
-#include "gnunet-service-ats_plugins.h"
-#include "gnunet-service-ats_preferences.h"
-#include "gnunet-service-ats_reservations.h"
-#include "ats.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "ats-preferences", __VA_ARGS__)
-
-/**
- * How frequently do we age preference values?
- */
-#define PREF_AGING_INTERVAL GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 10)
-
-/**
- * By which factor do we age preferences expressed during
- * each #PREF_AGING_INTERVAL?
- */
-#define PREF_AGING_FACTOR 0.95
-
-/**
- * What is the lowest threshold up to which preference values
- * are aged, and below which we consider them zero and thus
- * no longer subject to aging?
- */
-#define PREF_EPSILON 0.01
-
-
-/**
- * Relative preferences for a peer.
- */
-struct PeerRelative
-{
-  /**
-   * Array of relative preference values, to be indexed by
-   * an `enum GNUNET_ATS_PreferenceKind`.
-   */
-  double f_rel[GNUNET_ATS_PREFERENCE_END];
-
-  /**
-   * Number of clients that are expressing a preference for
-   * this peer. When this counter reaches zero, this entry
-   * is freed.
-   */
-  unsigned int num_clients;
-};
-
-
-/**
- * Default values, returned as our preferences if we do not
- * have any preferences expressed for a peer.
- */
-static struct PeerRelative defvalues;
-
-
-/**
- * Preference information per peer and client.
- */
-struct PreferencePeer
-{
-  /**
-   * Next in DLL of preference entries for the same client.
-   */
-  struct PreferencePeer *next;
-
-  /**
-   * Previous in DLL of preference entries for the same client.
-   */
-  struct PreferencePeer *prev;
-
-  /**
-   * Absolute preference values for all preference types
-   * as expressed by this client for this peer.
-   */
-  double f_abs[GNUNET_ATS_PREFERENCE_END];
-
-  /**
-   * Relative preference values for all preference types,
-   * normalized in [0..1] based on how the respective
-   * client scored other peers.
-   */
-  double f_rel[GNUNET_ATS_PREFERENCE_END];
-};
-
-
-/**
- * Preference client, as in a client that expressed preferences
- * for peers.  This is the information we keep track of for each
- * such client.
- */
-struct PreferenceClient
-{
-  /**
-   * Next in client list
-   */
-  struct PreferenceClient *next;
-
-  /**
-   * Previous in client peer list
-   */
-  struct PreferenceClient *prev;
-
-  /**
-   * Client handle
-   */
-  struct GNUNET_SERVICE_Client *client;
-
-  /**
-   * Mapping peer identities to `struct PreferencePeer` entry
-   * for the respective peer.
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *peer2pref;
-
-  /**
-   * Array of sums of absolute preferences for all
-   * peers as expressed by this client.
-   */
-  double f_abs_sum[GNUNET_ATS_PREFERENCE_END];
-};
-
-
-/**
- * Hashmap to store peer information for preference normalization.
- * Maps the identity of a peer to a `struct PeerRelative` containing
- * the current relative preference values for that peer.
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *preference_peers;
-
-/**
- * Clients in DLL: head
- */
-static struct PreferenceClient *pc_head;
-
-/**
- * Clients in DLL: tail
- */
-static struct PreferenceClient *pc_tail;
-
-/**
- * Handle for task we run periodically to age preferences over time.
- */
-static struct GNUNET_SCHEDULER_Task *aging_task;
-
-
-/**
- * Closure for #sum_relative_preferences().
- */
-struct SumContext
-{
-  /**
-   * Where to accumulate the result.
-   */
-  double f_rel_total;
-
-  /**
-   * Which kind of preference value are we adding up?
-   */
-  enum GNUNET_ATS_PreferenceKind kind;
-};
-
-
-/**
- * Add the relative preference for the kind given to the
- * closure.
- *
- * @param cls the `struct SumContext` with the kind and place
- *                to store the result
- * @param peer ignored
- * @param value the `struct PreferencePeer` for getting the rel pref.
- * @return #GNUNET_OK
- */
-static int
-sum_relative_preferences (void *cls,
-                          const struct GNUNET_PeerIdentity *peer,
-                          void *value)
-{
-  struct SumContext *sum_ctx = cls;
-  struct PreferencePeer *p_cur = value;
-
-  sum_ctx->f_rel_total += p_cur->f_rel[sum_ctx->kind];
-  return GNUNET_OK;
-}
-
-
-/**
- * Update the total relative preference for a peer by summing
- * up the relative preferences all clients have for this peer.
- *
- * @param id peer id of the peer for which we should do the update
- * @param kind the kind of preference value to update
- * @return the new relative preference
- */
-static void
-update_relative_values_for_peer (const struct GNUNET_PeerIdentity *id,
-                                 enum GNUNET_ATS_PreferenceKind kind)
-{
-  struct PreferenceClient *c_cur;
-  struct SumContext sum_ctx;
-  struct PeerRelative *rp;
-
-  sum_ctx.f_rel_total = 0.0;
-  sum_ctx.kind = kind;
-  for (c_cur = pc_head; NULL != c_cur; c_cur = c_cur->next)
-    GNUNET_CONTAINER_multipeermap_get_multiple (c_cur->peer2pref,
-                                                id,
-                                                &sum_relative_preferences,
-                                                &sum_ctx);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Total relative preference for peer `%s' for `%s' is %.3f\n",
-       GNUNET_i2s (id),
-       GNUNET_ATS_print_preference_type (kind),
-       sum_ctx.f_rel_total);
-  rp = GNUNET_CONTAINER_multipeermap_get (preference_peers,
-                                          id);
-  GNUNET_assert (NULL != rp);
-  if (rp->f_rel[kind] != sum_ctx.f_rel_total)
-  {
-    rp->f_rel[kind] = sum_ctx.f_rel_total;
-    GAS_plugin_notify_preference_changed (id,
-                                          kind,
-                                          rp->f_rel[kind]);
-  }
-}
-
-
-/**
- * Free a peer's `struct PeerRelative`.
- *
- * @param cls unused
- * @param key the key
- * @param value the `struct PeerRelative` to free.
- * @return #GNUNET_OK to continue
- */
-static int
-free_peer (void *cls,
-           const struct GNUNET_PeerIdentity *key,
-           void *value)
-{
-  struct PeerRelative *rp = value;
-
-  GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CONTAINER_multipeermap_remove (preference_peers,
-                                                       key,
-                                                       value));
-  GNUNET_free (rp);
-  return GNUNET_OK;
-}
-
-
-/**
- * Free `struct PreferencePeer` entry in map.
- *
- * @param cls the `struct PreferenceClient` with the map
- * @param key the peer the entry is for
- * @param value the `struct PreferencePeer` entry to free
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-free_preference (void *cls,
-                 const struct GNUNET_PeerIdentity *key,
-                 void *value)
-{
-  struct PreferenceClient *pc = cls;
-  struct PreferencePeer *p = value;
-  struct PeerRelative *pr;
-
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multipeermap_remove (pc->peer2pref,
-                                                       key,
-                                                       p));
-  GNUNET_free (p);
-  pr = GNUNET_CONTAINER_multipeermap_get (preference_peers,
-                                          key);
-  GNUNET_assert (NULL != pr);
-  GNUNET_assert (pr->num_clients > 0);
-  pr->num_clients--;
-  if (0 == pr->num_clients)
-  {
-    free_peer (NULL,
-               key,
-               pr);
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Closure for #age_values().
- */
-struct AgeContext
-{
-  /**
-   * Counter of values remaining to update, incremented for each value
-   * changed (to a new non-zero value).
-   */
-  unsigned int values_to_update;
-
-  /**
-   * Client we are currently aging values for.
-   */
-  struct PreferenceClient *cur_client;
-};
-
-
-/**
- * Age preference values of the given peer.
- *
- * @param cls a `
- * @param peer peer being aged
- * @param value the `struct PreferencePeer` for the peer
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-age_values (void *cls,
-            const struct GNUNET_PeerIdentity *peer,
-            void *value)
-{
-  struct AgeContext *ac = cls;
-  struct PreferencePeer *p = value;
-  unsigned int i;
-  int dead;
-
-  dead = GNUNET_YES;
-  for (i = 0; i < GNUNET_ATS_PREFERENCE_END; i++)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Aging preference for peer `%s'\n",
-                GNUNET_i2s (peer));
-    if (p->f_abs[i] > DEFAULT_ABS_PREFERENCE)
-      p->f_abs[i] *= PREF_AGING_FACTOR;
-    if (p->f_abs[i] <= DEFAULT_ABS_PREFERENCE + PREF_EPSILON)
-    {
-      p->f_abs[i] = DEFAULT_ABS_PREFERENCE;
-      p->f_rel[i] = DEFAULT_REL_PREFERENCE;
-      update_relative_values_for_peer (peer,
-                                       i);
-    }
-    else
-    {
-      ac->values_to_update++;
-      dead = GNUNET_NO;
-    }
-  }
-  if (GNUNET_YES == dead)
-  {
-    /* all preferences are zero, remove this entry */
-    free_preference (ac->cur_client,
-                     peer,
-                     p);
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Reduce absolute preferences since they got old.
- *
- * @param cls unused
- */
-static void
-preference_aging (void *cls)
-{
-  struct AgeContext ac;
-
-  aging_task = NULL;
-  GAS_plugin_solver_lock ();
-  ac.values_to_update = 0;
-  for (ac.cur_client = pc_head; NULL != ac.cur_client; ac.cur_client =
-         ac.cur_client->next)
-    GNUNET_CONTAINER_multipeermap_iterate (ac.cur_client->peer2pref,
-                                           &age_values,
-                                           &ac);
-  GAS_plugin_solver_unlock ();
-  if (ac.values_to_update > 0)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Rescheduling aging task due to %u elements remaining to 
age\n",
-                ac.values_to_update);
-    if (NULL == aging_task)
-      aging_task = GNUNET_SCHEDULER_add_delayed (PREF_AGING_INTERVAL,
-                                                 &preference_aging,
-                                                 NULL);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "No values to age left, not rescheduling aging task\n");
-  }
-}
-
-
-/**
- * Closure for #update_rel_sum() and #update_abs_sum().
- */
-struct UpdateContext
-{
-  /**
-   * Preference client with the sum of all absolute scores.
-   */
-  struct PreferenceClient *pc;
-
-  /**
-   * Which kind are we updating?
-   */
-  enum GNUNET_ATS_PreferenceKind kind;
-};
-
-
-/**
- * Compute updated absolute score for the client based on the
- * current absolute scores for each peer.
- *
- * @param cls a `struct UpdateContext`
- * @param peer peer being updated
- * @param value the `struct PreferencePeer` for the peer
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-update_abs_sum (void *cls,
-                const struct GNUNET_PeerIdentity *peer,
-                void *value)
-{
-  struct UpdateContext *uc = cls;
-  struct PreferencePeer *p_cur = value;
-
-  uc->pc->f_abs_sum[uc->kind] += p_cur->f_abs[uc->kind];
-  return GNUNET_OK;
-}
-
-
-/**
- * Compute updated relative score for each peer based on the
- * current absolute score given by this client.
- *
- * @param cls a `struct UpdateContext`
- * @param peer peer being updated
- * @param value the `struct PreferencePeer` for the peer (updated)
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-update_rel_sum (void *cls,
-                const struct GNUNET_PeerIdentity *peer,
-                void *value)
-{
-  struct UpdateContext *uc = cls;
-  struct PreferencePeer *p_cur = value;
-
-  p_cur->f_rel[uc->kind] = p_cur->f_abs[uc->kind] / 
uc->pc->f_abs_sum[uc->kind];
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Client has relative preference for %s for peer `%s' of %.3f\n",
-       GNUNET_ATS_print_preference_type (uc->kind),
-       GNUNET_i2s (peer),
-       p_cur->f_rel[uc->kind]);
-  return GNUNET_OK;
-}
-
-
-/**
- * Recalculate preference for a specific ATS property
- *
- * @param c the preference client
- * @param kind the preference kind
- * @return the result
- */
-static void
-recalculate_relative_preferences (struct PreferenceClient *c,
-                                  enum GNUNET_ATS_PreferenceKind kind)
-{
-  struct UpdateContext uc;
-
-  /* For this client: sum of absolute preference values for this preference */
-  uc.kind = kind;
-  uc.pc = c;
-  c->f_abs_sum[kind] = 0.0;
-
-  /* For all peers: calculate sum of absolute preferences */
-  GNUNET_CONTAINER_multipeermap_iterate (c->peer2pref,
-                                         &update_abs_sum,
-                                         &uc);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Client has sum of total preferences for %s of %.3f\n",
-       GNUNET_ATS_print_preference_type (kind),
-       c->f_abs_sum[kind]);
-
-  /* For all peers: calculate relative preference */
-  GNUNET_CONTAINER_multipeermap_iterate (c->peer2pref,
-                                         &update_rel_sum,
-                                         &uc);
-}
-
-
-/**
- * The relative preferences of one of the clients have
- * changed, update the global preferences for the given
- * peer and notify the plugin.
- *
- * @param cls the kind of preference to calculate the
- *        new global relative preference values for
- * @param key the peer to update relative preference values for
- * @param value a `struct PeerRelative`, unused
- */
-static int
-update_iterator (void *cls,
-                 const struct GNUNET_PeerIdentity *key,
-                 void *value)
-{
-  enum GNUNET_ATS_PreferenceKind *kind = cls;
-
-  update_relative_values_for_peer (key,
-                                   *kind);
-  return GNUNET_OK;
-}
-
-
-/**
- * Update the absolute preference and calculate the
- * new relative preference value.
- *
- * @param client the client with this preference
- * @param peer the peer to change the preference for
- * @param kind the kind to change the preference
- * @param score_abs the normalized score
- */
-static void
-update_preference (struct GNUNET_SERVICE_Client *client,
-                   const struct GNUNET_PeerIdentity *peer,
-                   enum GNUNET_ATS_PreferenceKind kind,
-                   float score_abs)
-{
-  struct PreferenceClient *c_cur;
-  struct PreferencePeer *p_cur;
-  struct PeerRelative *r_cur;
-  unsigned int i;
-
-  if (kind >= GNUNET_ATS_PREFERENCE_END)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Client changes preference for peer `%s' for `%s' to %.2f\n",
-       GNUNET_i2s (peer),
-       GNUNET_ATS_print_preference_type (kind),
-       score_abs);
-
-  /* Find preference client */
-  for (c_cur = pc_head; NULL != c_cur; c_cur = c_cur->next)
-    if (client == c_cur->client)
-      break;
-  /* Not found: create new preference client */
-  if (NULL == c_cur)
-  {
-    c_cur = GNUNET_new (struct PreferenceClient);
-    c_cur->client = client;
-    c_cur->peer2pref = GNUNET_CONTAINER_multipeermap_create (16,
-                                                             GNUNET_NO);
-    for (i = 0; i < GNUNET_ATS_PREFERENCE_END; i++)
-      c_cur->f_abs_sum[i] = DEFAULT_ABS_PREFERENCE;
-    GNUNET_CONTAINER_DLL_insert (pc_head,
-                                 pc_tail,
-                                 c_cur);
-  }
-
-  /* check global peer entry exists */
-  if (NULL ==
-      (r_cur = GNUNET_CONTAINER_multipeermap_get (preference_peers,
-                                                  peer)))
-  {
-    /* Create struct for peer */
-    r_cur = GNUNET_new (struct PeerRelative);
-    for (i = 0; i < GNUNET_ATS_PREFERENCE_END; i++)
-      r_cur->f_rel[i] = DEFAULT_REL_PREFERENCE;
-    GNUNET_assert (GNUNET_OK ==
-                   GNUNET_CONTAINER_multipeermap_put (preference_peers,
-                                                      peer,
-                                                      r_cur,
-                                                      
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-  }
-
-  /* Find entry for peer */
-  p_cur = GNUNET_CONTAINER_multipeermap_get (c_cur->peer2pref,
-                                             peer);
-  if (NULL == p_cur)
-  {
-    /* Not found: create new peer entry */
-    p_cur = GNUNET_new (struct PreferencePeer);
-    for (i = 0; i < GNUNET_ATS_PREFERENCE_END; i++)
-    {
-      /* Default value per peer absolute preference for a preference*/
-      p_cur->f_abs[i] = DEFAULT_ABS_PREFERENCE;
-      /* Default value per peer relative preference for a quality */
-      p_cur->f_rel[i] = DEFAULT_REL_PREFERENCE;
-    }
-    GNUNET_assert (GNUNET_YES ==
-                   GNUNET_CONTAINER_multipeermap_put (c_cur->peer2pref,
-                                                      peer,
-                                                      p_cur,
-                                                      
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-    r_cur->num_clients++;
-  }
-
-  p_cur->f_abs[kind] += score_abs;
-  recalculate_relative_preferences (c_cur, kind);
-  GNUNET_CONTAINER_multipeermap_iterate (preference_peers,
-                                         &update_iterator,
-                                         &kind);
-
-  if (NULL == aging_task)
-    aging_task = GNUNET_SCHEDULER_add_delayed (PREF_AGING_INTERVAL,
-                                               &preference_aging,
-                                               NULL);
-}
-
-
-/**
- * Handle 'preference change' messages from clients.
- *
- * @param client the client that sent the request
- * @param msg the request message
- */
-void
-GAS_handle_preference_change (struct GNUNET_SERVICE_Client *client,
-                              const struct ChangePreferenceMessage *msg)
-{
-  const struct PreferenceInformation *pi;
-  uint32_t nump;
-
-  nump = ntohl (msg->num_preferences);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received PREFERENCE_CHANGE message for peer `%s'\n",
-              GNUNET_i2s (&msg->peer));
-  GNUNET_STATISTICS_update (GSA_stats,
-                            "# preference change requests processed",
-                            1,
-                            GNUNET_NO);
-  pi = (const struct PreferenceInformation *) &msg[1];
-  GAS_plugin_solver_lock ();
-  for (uint32_t i = 0; i < nump; i++)
-    update_preference (client,
-                       &msg->peer,
-                       (enum GNUNET_ATS_PreferenceKind) ntohl (
-                         pi[i].preference_kind),
-                       pi[i].preference_value);
-  GAS_plugin_solver_unlock ();
-}
-
-
-/**
- * Initialize preferences subsystem.
- */
-void
-GAS_preference_init ()
-{
-  unsigned int i;
-
-  preference_peers = GNUNET_CONTAINER_multipeermap_create (16,
-                                                           GNUNET_NO);
-  for (i = 0; i < GNUNET_ATS_PREFERENCE_END; i++)
-    defvalues.f_rel[i] = DEFAULT_REL_PREFERENCE;
-}
-
-
-/**
- * Shutdown preferences subsystem.
- */
-void
-GAS_preference_done ()
-{
-  struct PreferenceClient *pc;
-  struct PreferenceClient *next_pc;
-
-  if (NULL != aging_task)
-  {
-    GNUNET_SCHEDULER_cancel (aging_task);
-    aging_task = NULL;
-  }
-  next_pc = pc_head;
-  while (NULL != (pc = next_pc))
-  {
-    next_pc = pc->next;
-    GNUNET_CONTAINER_DLL_remove (pc_head,
-                                 pc_tail,
-                                 pc);
-    GNUNET_CONTAINER_multipeermap_iterate (pc->peer2pref,
-                                           &free_preference,
-                                           pc);
-    GNUNET_CONTAINER_multipeermap_destroy (pc->peer2pref);
-    GNUNET_free (pc);
-  }
-  GNUNET_CONTAINER_multipeermap_iterate (preference_peers,
-                                         &free_peer,
-                                         NULL);
-  GNUNET_CONTAINER_multipeermap_destroy (preference_peers);
-}
-
-
-/**
- * Get the normalized preference values for a specific peer or
- * the default values if
- *
- * @param cls ignored
- * @param id the peer
- * @return pointer to the values, can be indexed with 
GNUNET_ATS_PreferenceKind,
- * default preferences if peer does not exist
- */
-const double *
-GAS_preference_get_by_peer (void *cls,
-                            const struct GNUNET_PeerIdentity *id)
-{
-  struct PeerRelative *rp;
-
-  if (NULL ==
-      (rp = GNUNET_CONTAINER_multipeermap_get (preference_peers,
-                                               id)))
-  {
-    return defvalues.f_rel;
-  }
-  return rp->f_rel;
-}
-
-
-void
-GAS_preference_client_disconnect (struct GNUNET_SERVICE_Client *client)
-{
-  struct PreferenceClient *c_cur;
-
-  for (c_cur = pc_head; NULL != c_cur; c_cur = c_cur->next)
-    if (client == c_cur->client)
-      break;
-  if (NULL == c_cur)
-    return;
-  GNUNET_CONTAINER_DLL_remove (pc_head,
-                               pc_tail,
-                               c_cur);
-  GNUNET_CONTAINER_multipeermap_iterate (c_cur->peer2pref,
-                                         &free_preference,
-                                         c_cur);
-  GNUNET_CONTAINER_multipeermap_destroy (c_cur->peer2pref);
-  GNUNET_free (c_cur);
-}
-
-
-/* end of gnunet-service-ats_preferences.c */
diff --git a/src/ats/gnunet-service-ats_preferences.h 
b/src/ats/gnunet-service-ats_preferences.h
deleted file mode 100644
index 49bf2ddbd..000000000
--- a/src/ats/gnunet-service-ats_preferences.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2011-2014 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/gnunet-service-ats_preferences.h
- * @brief manage preferences expressed by clients
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_ATS_PREFERENCES_H
-#define GNUNET_SERVICE_ATS_PREFERENCES_H
-
-#include "gnunet_util_lib.h"
-#include "gnunet_ats_service.h"
-#include "gnunet-service-ats.h"
-#include "gnunet_statistics_service.h"
-#include "ats.h"
-
-/**
- * Default preference value we assume if we know nothing.
- */
-#define DEFAULT_ABS_PREFERENCE 0.0
-
-/**
- * Default relative preference value we assume if we know nothing.
- */
-#define DEFAULT_REL_PREFERENCE 0.0
-
-
-/**
- * Handle 'preference change' messages from clients.
- *
- * @param client the client that sent the request
- * @param msg the request message
- */
-void
-GAS_handle_preference_change (struct GNUNET_SERVICE_Client *client,
-                              const struct ChangePreferenceMessage *msg);
-
-
-/**
- * Initialize preferences subsystem.
- */
-void
-GAS_preference_init (void);
-
-
-/**
- * Shutdown preferences subsystem.
- */
-void
-GAS_preference_done (void);
-
-
-/**
- * Get the normalized preference values for a specific peer.
- *
- * @param cls ignored
- * @param id the peer
- * @return pointer to the values, can be indexed
- *  with `enum GNUNET_ATS_PreferenceKind`, never NULL
- */
-const double *
-GAS_preference_get_by_peer (void *cls,
-                            const struct GNUNET_PeerIdentity *id);
-
-
-/**
- * A performance client disconnected
- *
- * @param client the disconnecting client
- */
-void
-GAS_preference_client_disconnect (struct GNUNET_SERVICE_Client *client);
-
-
-#endif
diff --git a/src/ats/gnunet-service-ats_reservations.c 
b/src/ats/gnunet-service-ats_reservations.c
deleted file mode 100644
index 471a19859..000000000
--- a/src/ats/gnunet-service-ats_reservations.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/gnunet-service-ats_reservations.c
- * @brief ats service, inbound bandwidth reservation management
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet-service-ats_reservations.h"
-#include "gnunet-service-ats.h"
-#include "ats.h"
-
-/**
- * Number of seconds that available bandwidth carries over
- * (can accumulate).  Note that the
- * test_ats_reservation_api test depends on this value!
- */
-#define MAX_BANDWIDTH_CARRY_S 5
-
-
-/**
- * Map of peer identities to `struct GNUNET_BANDWIDTH_Tracker *`s
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *trackers;
-
-
-/**
- * Reserve the given amount of incoming bandwidth (in bytes) from the
- * given peer.  If a reservation is not possible right now, return how
- * long the client should wait before trying again.
- *
- * @param peer peer to reserve bandwidth from
- * @param amount number of bytes to reserve
- * @return 0 if the reservation was successful, FOREVER if the
- *         peer is not connected, otherwise the time to wait
- *         until the reservation might succeed
- */
-static struct GNUNET_TIME_Relative
-reservations_reserve (const struct GNUNET_PeerIdentity *peer,
-                      int32_t amount)
-{
-  struct GNUNET_BANDWIDTH_Tracker *tracker;
-  struct GNUNET_TIME_Relative ret;
-
-  tracker = GNUNET_CONTAINER_multipeermap_get (trackers,
-                                               peer);
-  if (NULL == tracker)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Not connected, allowing reservation of %d bytes\n",
-                (int) amount);
-    return GNUNET_TIME_UNIT_ZERO;       /* not connected, satisfy now */
-  }
-  if (amount >= 0)
-  {
-    ret = GNUNET_BANDWIDTH_tracker_get_delay (tracker, amount);
-    if (ret.rel_value_us > 0)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Delay to satisfy reservation for %d bytes is %s\n",
-                  (int) amount,
-                  GNUNET_STRINGS_relative_time_to_string (ret,
-                                                          GNUNET_YES));
-      return ret;
-    }
-  }
-  (void) GNUNET_BANDWIDTH_tracker_consume (tracker, amount);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Reserved %d bytes\n",
-              (int) amount);
-  return GNUNET_TIME_UNIT_ZERO;
-}
-
-
-/**
- * Set the amount of bandwidth the other peer could currently transmit
- * to us (as far as we know) to the given value.
- *
- * @param peer identity of the peer
- * @param bandwidth_in currently available bandwidth from that peer to
- *        this peer (estimate)
- */
-void
-GAS_reservations_set_bandwidth (const struct GNUNET_PeerIdentity *peer,
-                                struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_in)
-{
-  struct GNUNET_BANDWIDTH_Tracker *tracker;
-
-  tracker = GNUNET_CONTAINER_multipeermap_get (trackers, peer);
-  if (0 == ntohl (bandwidth_in.value__))
-  {
-    if (NULL == tracker)
-      return;
-    GNUNET_assert (GNUNET_YES ==
-                   GNUNET_CONTAINER_multipeermap_remove (trackers,
-                                                         peer,
-                                                         tracker));
-    GNUNET_free (tracker);
-    return;
-  }
-  if (NULL == tracker)
-  {
-    tracker = GNUNET_new (struct GNUNET_BANDWIDTH_Tracker);
-    GNUNET_BANDWIDTH_tracker_init (tracker,
-                                   NULL,
-                                   NULL,
-                                   bandwidth_in,
-                                   MAX_BANDWIDTH_CARRY_S);
-    GNUNET_assert (GNUNET_OK ==
-                   GNUNET_CONTAINER_multipeermap_put (trackers,
-                                                      peer,
-                                                      tracker,
-                                                      
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-    return;
-  }
-  GNUNET_BANDWIDTH_tracker_update_quota (tracker,
-                                         bandwidth_in);
-}
-
-
-void
-GAS_handle_reservation_request (struct GNUNET_SERVICE_Client *client,
-                                const struct ReservationRequestMessage *msg)
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct ReservationResultMessage *result;
-  int32_t amount;
-  struct GNUNET_TIME_Relative res_delay;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received RESERVATION_REQUEST message\n");
-  amount = (int32_t) ntohl (msg->amount);
-  res_delay = reservations_reserve (&msg->peer, amount);
-  if (res_delay.rel_value_us > 0)
-    amount = 0;
-  env = GNUNET_MQ_msg (result,
-                       GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT);
-  result->amount = htonl (amount);
-  result->peer = msg->peer;
-  result->res_delay = GNUNET_TIME_relative_hton (res_delay);
-  GNUNET_STATISTICS_update (GSA_stats,
-                            "# reservation requests processed",
-                            1,
-                            GNUNET_NO);
-  GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client),
-                  env);
-}
-
-
-/**
- * Initialize reservations subsystem.
- */
-void
-GAS_reservations_init ()
-{
-  trackers = GNUNET_CONTAINER_multipeermap_create (128,
-                                                   GNUNET_NO);
-}
-
-
-/**
- * Free memory of bandwidth tracker.
- *
- * @param cls NULL
- * @param key peer identity (unused)
- * @param value the `struct GNUNET_BANDWIDTH_Tracker` to free
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-free_tracker (void *cls,
-              const struct GNUNET_PeerIdentity *key,
-              void *value)
-{
-  struct GNUNET_BANDWIDTH_Tracker *tracker = value;
-
-  GNUNET_free (tracker);
-  return GNUNET_OK;
-}
-
-
-/**
- * Shutdown reservations subsystem.
- */
-void
-GAS_reservations_done ()
-{
-  GNUNET_CONTAINER_multipeermap_iterate (trackers,
-                                         &free_tracker,
-                                         NULL);
-  GNUNET_CONTAINER_multipeermap_destroy (trackers);
-}
-
-
-/* end of gnunet-service-ats_reservations.c */
diff --git a/src/ats/gnunet-service-ats_reservations.h 
b/src/ats/gnunet-service-ats_reservations.h
deleted file mode 100644
index 07edd69e0..000000000
--- a/src/ats/gnunet-service-ats_reservations.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats_reservations.h
- * @brief ats service, inbound bandwidth reservation management
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_ATS_RESERVATIONS_H
-#define GNUNET_SERVICE_ATS_RESERVATIONS_H
-
-#include "gnunet_util_lib.h"
-#include "ats.h"
-
-
-/**
- * Set the amount of bandwidth the other peer could currently transmit
- * to us (as far as we know) to the given value.
- *
- * @param peer identity of the peer
- * @param bandwidth_in currently available bandwidth from that peer to
- *        this peer (estimate)
- */
-void
-GAS_reservations_set_bandwidth (const struct GNUNET_PeerIdentity *peer,
-                                struct GNUNET_BANDWIDTH_Value32NBO
-                                bandwidth_in);
-
-
-/**
- * Handle 'reservation request' messages from clients.
- *
- * @param client client that sent the request
- * @param message the request message
- */
-void
-GAS_handle_reservation_request (struct GNUNET_SERVICE_Client *client,
-                                const struct
-                                ReservationRequestMessage *message);
-
-
-/**
- * Initialize reservations subsystem.
- */
-void
-GAS_reservations_init (void);
-
-
-/**
- * Shutdown reservations subsystem.
- */
-void
-GAS_reservations_done (void);
-
-#endif
diff --git a/src/ats/gnunet-service-ats_scheduling.c 
b/src/ats/gnunet-service-ats_scheduling.c
deleted file mode 100644
index 2dfb70343..000000000
--- a/src/ats/gnunet-service-ats_scheduling.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011-2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats_scheduling.c
- * @brief ats service, interaction with 'scheduling' API
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet-service-ats_addresses.h"
-#include "gnunet-service-ats_scheduling.h"
-#include "ats.h"
-
-/**
- * Actual handle to the client.
- */
-static struct GNUNET_SERVICE_Client *my_client;
-
-
-/**
- * Register a new scheduling client.
- *
- * @param client handle of the new client
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-int
-GAS_scheduling_add_client (struct GNUNET_SERVICE_Client *client)
-{
-  if (NULL != my_client)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "This ATS already has a scheduling client, refusing new 
scheduling client for now.\n");
-    return GNUNET_SYSERR;
-  }
-  my_client = client;
-  return GNUNET_OK;
-}
-
-
-/**
- * Unregister a client (which may have been a scheduling client,
- * but this is not assured).
- *
- * @param client handle of the (now dead) client
- */
-void
-GAS_scheduling_remove_client (struct GNUNET_SERVICE_Client *client)
-{
-  if (my_client != client)
-    return;
-  GAS_addresses_destroy_all ();
-  my_client = NULL;
-}
-
-
-void
-GAS_scheduling_transmit_address_suggestion (const struct
-                                            GNUNET_PeerIdentity *peer,
-                                            uint32_t session_id,
-                                            struct GNUNET_BANDWIDTH_Value32NBO
-                                            bandwidth_out,
-                                            struct GNUNET_BANDWIDTH_Value32NBO
-                                            bandwidth_in)
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct AddressSuggestionMessage *msg;
-
-  if (NULL == my_client)
-    return;
-  GNUNET_STATISTICS_update (GSA_stats,
-                            "# address suggestions made",
-                            1,
-                            GNUNET_NO);
-  env = GNUNET_MQ_msg (msg,
-                       GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION);
-  msg->peer = *peer;
-  msg->session_id = htonl (session_id);
-  msg->bandwidth_out = bandwidth_out;
-  msg->bandwidth_in = bandwidth_in;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "ATS sends quota for peer `%s': (in/out) %u/%u\n",
-              GNUNET_i2s (peer),
-              (unsigned int) ntohl (bandwidth_in.value__),
-              (unsigned int) ntohl (bandwidth_out.value__));
-  GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (my_client),
-                  env);
-}
-
-
-void
-GAS_handle_address_add (const struct AddressAddMessage *m)
-{
-  const char *address;
-  const char *plugin_name;
-  uint16_t address_length;
-  uint16_t plugin_name_length;
-  struct GNUNET_ATS_Properties prop;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received `%s' message\n",
-              "ADDRESS_ADD");
-  address_length = ntohs (m->address_length);
-  plugin_name_length = ntohs (m->plugin_name_length);
-  address = (const char *) &m[1];
-  if (plugin_name_length != 0)
-    plugin_name = &address[address_length];
-  else
-    plugin_name = "";
-  GNUNET_STATISTICS_update (GSA_stats,
-                            "# addresses created",
-                            1,
-                            GNUNET_NO);
-  GNUNET_ATS_properties_ntoh (&prop,
-                              &m->properties);
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != prop.scope);
-  GAS_addresses_add (&m->peer,
-                     plugin_name,
-                     address,
-                     address_length,
-                     ntohl (m->address_local_info),
-                     ntohl (m->session_id),
-                     &prop);
-}
-
-
-/**
- * Handle 'address update' messages from clients.
- *
- * @param m the request message
- */
-void
-GAS_handle_address_update (const struct AddressUpdateMessage *m)
-{
-  struct GNUNET_ATS_Properties prop;
-
-  GNUNET_STATISTICS_update (GSA_stats,
-                            "# address updates received",
-                            1,
-                            GNUNET_NO);
-  GNUNET_ATS_properties_ntoh (&prop,
-                              &m->properties);
-  GAS_addresses_update (&m->peer,
-                        ntohl (m->session_id),
-                        &prop);
-}
-
-
-/**
- * Handle 'address destroyed' messages from clients.
- *
- * @param m the request message
- */
-void
-GAS_handle_address_destroyed (const struct AddressDestroyedMessage *m)
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct GNUNET_ATS_SessionReleaseMessage *srm;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received `%s' message\n",
-              "ADDRESS_DESTROYED");
-  GNUNET_STATISTICS_update (GSA_stats,
-                            "# addresses destroyed",
-                            1,
-                            GNUNET_NO);
-  GAS_addresses_destroy (&m->peer,
-                         ntohl (m->session_id));
-  env = GNUNET_MQ_msg (srm,
-                       GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE);
-  srm->session_id = m->session_id;
-  srm->peer = m->peer;
-  GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (my_client),
-                  env);
-}
-
-
-/* end of gnunet-service-ats_scheduling.c */
diff --git a/src/ats/gnunet-service-ats_scheduling.h 
b/src/ats/gnunet-service-ats_scheduling.h
deleted file mode 100644
index ca6c1bd57..000000000
--- a/src/ats/gnunet-service-ats_scheduling.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file ats/gnunet-service-ats_scheduling.h
- * @brief ats service, interaction with 'scheduling' API
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_ATS_SCHEDULING_H
-#define GNUNET_SERVICE_ATS_SCHEDULING_H
-
-#include "gnunet_util_lib.h"
-
-
-/**
- * Register a new scheduling client.
- *
- * @param client handle of the new client
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-int
-GAS_scheduling_add_client (struct GNUNET_SERVICE_Client *client);
-
-
-/**
- * Unregister a client (which may have been a scheduling client,
- * but this is not assured).
- *
- * @param client handle of the (now dead) client
- */
-void
-GAS_scheduling_remove_client (struct GNUNET_SERVICE_Client *client);
-
-
-/**
- * Transmit the given address suggestion and bandwidth update to all scheduling
- * clients.
- *
- * @param peer peer for which this is an address suggestion
- * @param session_id session ID to use for the given client
- * @param bandwidth_out assigned outbound bandwidth
- * @param bandwidth_in assigned inbound bandwidth
- */
-void
-GAS_scheduling_transmit_address_suggestion (const struct
-                                            GNUNET_PeerIdentity *peer,
-                                            uint32_t session_id,
-                                            struct GNUNET_BANDWIDTH_Value32NBO
-                                            bandwidth_out,
-                                            struct GNUNET_BANDWIDTH_Value32NBO
-                                            bandwidth_in);
-
-
-/**
- * Handle 'address add' messages from clients.
- *
- * @param m the request message
- */
-void
-GAS_handle_address_add (const struct AddressAddMessage *m);
-
-
-/**
- * Handle 'address update' messages from clients.
- *
- * @param m the request message
- */
-void
-GAS_handle_address_update (const struct AddressUpdateMessage *m);
-
-
-/**
- * Handle 'address destroyed' messages from clients.
- *
- * @param m the request message
- */
-void
-GAS_handle_address_destroyed (const struct AddressDestroyedMessage *m);
-
-
-#endif
-/* end of gnunet-service-ats_scheduling.h */
diff --git a/src/ats/meson.build b/src/ats/meson.build
deleted file mode 100644
index 4aa4e6972..000000000
--- a/src/ats/meson.build
+++ /dev/null
@@ -1,58 +0,0 @@
-libgnunetats_src = ['ats_api_connectivity.c',
-                    'ats_api_scheduling.c',
-                    'ats_api_scanner.c',
-                    'ats_api_performance.c']
-
-gnunetserviceats_src = ['gnunet-service-ats.c',
-                        'gnunet-service-ats_addresses.c',
-                        'gnunet-service-ats_connectivity.c',
-                        'gnunet-service-ats_normalization.c',
-                        'gnunet-service-ats_performance.c',
-                        'gnunet-service-ats_plugins.c',
-                        'gnunet-service-ats_preferences.c',
-                        'gnunet-service-ats_scheduling.c',
-                        'gnunet-service-ats_reservations.c']
-
-configure_file(input : 'ats.conf.in',
-               output : 'ats.conf',
-               configuration : cdata,
-               install: true,
-               install_dir: pkgcfgdir)
-
-if get_option('monolith')
-  foreach p : libgnunetats_src + gnunetserviceats_src
-    gnunet_src += 'ats/' + p
-  endforeach
-  subdir_done()
-endif
-
-libgnunetats = library('gnunetats',
-        libgnunetats_src,
-        version: '4.0.0',
-        soversion: '4',
-        dependencies: [libgnunetutil_dep, libgnunethello_dep],
-        include_directories: [incdir, configuration_inc],
-        install: true,
-        install_dir: get_option('libdir'))
-pkg.generate(libgnunetats, url : 'https://www.gnunet.org',
-             description : 'Provides API for allocating bandwidth, expressing 
preferences for certain peers and accessing allocation information')
-libgnunetats_dep = declare_dependency(link_with : libgnunetats)
-
-shared_module('gnunet_plugin_ats_proportional',
-        ['plugin_ats_proportional.c'],
-        dependencies: [libgnunetutil_dep,
-                       libgnunetats_dep,
-                       libgnunetstatistics_dep,
-                       libgnunetnt_dep,
-                       libgnunetstatistics_dep],
-        include_directories: [incdir, configuration_inc],
-        install: true,
-        install_dir: get_option('libdir')/'gnunet')
-
-executable ('gnunet-service-ats',
-            gnunetserviceats_src,
-            dependencies: [libgnunetats_dep, libgnunetutil_dep,
-                           libgnunetnt_dep, libgnunetstatistics_dep],
-            include_directories: [incdir, configuration_inc],
-            install: true,
-            install_dir: get_option('libdir') / 'gnunet' / 'libexec')
diff --git a/src/ats/perf_ats_simplistic_bandwidth.conf 
b/src/ats/perf_ats_simplistic_bandwidth.conf
deleted file mode 100644
index cec5b36f5..000000000
--- a/src/ats/perf_ats_simplistic_bandwidth.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-[hostlist]
-SERVERS = 
-
-[transport-udp]
-BROADCAST = NO
-
-[peerinfo]
-USE_INCLUDED_HELLOS = NO
-
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = 128 KiB
-UNSPECIFIED_QUOTA_OUT = 128 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = 128 KiB
-LOOPBACK_QUOTA_OUT = 128 KiB
-# LAN
-LAN_QUOTA_IN = 128 KiB
-LAN_QUOTA_OUT = 128 KiB
-# WAN
-WAN_QUOTA_IN = 128 KiB
-WAN_QUOTA_OUT = 128 KiB
-# WLAN
-WLAN_QUOTA_IN = 128 KiB
-WLAN_QUOTA_OUT = 128 KiB
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = 128 KiB
-BLUETOOTH_QUOTA_OUT = 128 KiB
diff --git a/src/ats/perf_ats_simplistic_delay.conf 
b/src/ats/perf_ats_simplistic_delay.conf
deleted file mode 100644
index a5127d25f..000000000
--- a/src/ats/perf_ats_simplistic_delay.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-[hostlist]
-SERVERS = 
-
-[transport-udp]
-BROADCAST = NO
-
-[peerinfo]
-USE_INCLUDED_HELLOS = NO
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c
deleted file mode 100644
index 363d0cfc9..000000000
--- a/src/ats/perf_ats_solver.c
+++ /dev/null
@@ -1,1510 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010,2011 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/perf_ats_solver.c
- * @brief generic performance test for ATS solvers
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet-service-ats_addresses.h"
-#include "gnunet-service-ats_plugins.h"
-#include "gnunet-service-ats_normalization.h"
-#include "gnunet-service-ats_preferences.h"
-#include "gnunet_ats_service.h"
-#include "gnunet_ats_plugin.h"
-#include "test_ats_api_common.h"
-
-#define DEFAULT_UPDATE_PERCENTAGE       20
-#define DEFAULT_PEERS_START     10
-#define DEFAULT_PEERS_END       10
-#define DEFAULT_ADDRESSES       10
-#define DEFAULT_ATS_COUNT       2
-
-
-/**
- * Handle for statistics.
- */
-struct GNUNET_STATISTICS_Handle *GSA_stats;
-
-/**
- * Handle for ATS address component
- */
-struct PerfHandle
-{
-  /**
-   * Performance peers
-   */
-  struct PerfPeer *peers;
-
-  /**
-   *  Solver handle
-   */
-  struct GNUNET_ATS_SolverFunctions *sf;
-
-  /**
-   * Statistics stat;
-   */
-  struct GNUNET_STATISTICS_Handle *stat;
-
-  /**
-   * A multihashmap to store all addresses
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *addresses;
-
-  /**
-   * Solver functions
-   * */
-  struct GNUNET_ATS_PluginEnvironment env;
-
-  /**
-   * Array for results for each iteration with length iterations
-   */
-  struct Iteration *iterations_results;
-
-  /**
-   * The current result
-   */
-  struct Result *current_result;
-
-  /**
-   * Current number of peers benchmarked
-   */
-  int current_p;
-
-  /**
-   * Current number of addresses benchmarked
-   */
-  int current_a;
-
-  /**
-   * Solver description as string
-   */
-  char *ats_string;
-
-  /**
-   * Configured ATS solver
-   */
-  int ats_mode;
-
-  /**
-   * #peers to start benchmarking with
-   */
-  int N_peers_start;
-
-  /**
-   * #peers to end benchmarking with
-   */
-  int N_peers_end;
-
-  /**
-   * #addresses to benchmarking with
-   */
-  int N_address;
-
-  /**
-   * Percentage of peers to update
-   */
-  int opt_update_percent;
-
-  /**
-   * Create gnuplot file
-   */
-  int create_datafile;
-
-  /**
-   * Measure updates
-   */
-  int measure_updates;
-
-  /**
-   * Number of iterations
-   */
-  int total_iterations;
-
-  /**
-   * Current iteration
-   */
-  int current_iteration;
-
-  /**
-   * Is a bulk operation running?
-   */
-  int bulk_running;
-
-  /**
-   * Is a bulk operation running?
-   */
-  int expecting_solution;
-
-  /**
-   * Was the problem just updates?
-   */
-  int performed_update;
-};
-
-/**
- * Data structure to store results for a single iteration
- */
-struct Iteration
-{
-  struct Result **results_array;
-
-  struct Result **update_results_array;
-};
-
-
-/**
- * Result for a solver calculation
- */
-struct Result
-{
-  /**
-   * Previous element in the linked list
-   */
-  struct Result *prev;
-
-  /**
-   * Next element in the linked list
-   */
-  struct Result *next;
-
-  /**
-   * Number of peers this solution included
-   */
-  int peers;
-
-  /**
-   * Number of addresses per peer this solution included
-   */
-  int addresses;
-
-  /**
-   * Is this an update or a full solution
-   */
-  int update;
-
-  /**
-   * Was the solution valid or did the solver fail
-   */
-  int valid;
-
-  /**
-   * Result of the solver
-   */
-  enum GAS_Solver_Additional_Information info;
-
-  /**
-   * Duration of setting up the problem in the solver
-   */
-  struct GNUNET_TIME_Relative d_setup_full;
-
-  /**
-   * Duration of solving the LP problem in the solver
-   * MLP solver only
-   */
-  struct GNUNET_TIME_Relative d_lp_full;
-
-  /**
-   * Duration of solving the MLP problem in the solver
-   * MLP solver only
-   */
-  struct GNUNET_TIME_Relative d_mlp_full;
-
-  /**
-   * Duration of solving whole problem in the solver
-   */
-  struct GNUNET_TIME_Relative d_total_full;
-
-  /**
-   * Start time of setting up the problem in the solver
-   */
-  struct GNUNET_TIME_Absolute s_setup;
-
-  /**
-   * Start time of solving the LP problem in the solver
-   * MLP solver only
-   */
-  struct GNUNET_TIME_Absolute s_lp;
-
-  /**
-   * Start time of solving the MLP problem in the solver
-   * MLP solver only
-   */
-  struct GNUNET_TIME_Absolute s_mlp;
-
-  /**
-   * Start time of solving whole problem in the solver
-   */
-  struct GNUNET_TIME_Absolute s_total;
-
-  /**
-   * End time of setting up the problem in the solver
-   */
-  struct GNUNET_TIME_Absolute e_setup;
-
-  /**
-   * End time of solving the LP problem in the solver
-   * MLP solver only
-   */
-  struct GNUNET_TIME_Absolute e_lp;
-
-  /**
-   * End time of solving the MLP problem in the solver
-   * MLP solver only
-   */
-  struct GNUNET_TIME_Absolute e_mlp;
-
-  /**
-   * End time of solving whole problem in the solver
-   */
-  struct GNUNET_TIME_Absolute e_total;
-};
-
-/**
- * Peer used for the benchmarking
- */
-struct PerfPeer
-{
-  /**
-   * Peer identitity
-   */
-  struct GNUNET_PeerIdentity id;
-
-  /**
-   * Head of linked list of addresses used with this peer
-   */
-  struct ATS_Address *head;
-
-  /**
-   * Head of linked list of addresses used with this peer
-   */
-  struct ATS_Address *tail;
-};
-
-
-/**
- * ATS performance handle
- */
-static struct PerfHandle ph;
-
-/**
- * Return value
- */
-static int ret;
-
-
-/**
- * Do shutdown
- */
-static void
-end_now (int res)
-{
-  if (NULL != ph.stat)
-  {
-    GNUNET_STATISTICS_destroy (ph.stat, GNUNET_NO);
-    ph.stat = NULL;
-  }
-
-  GNUNET_free (ph.peers);
-  GNUNET_free (ph.iterations_results);
-
-  GAS_normalization_stop ();
-  GAS_preference_done ();
-  ret = res;
-}
-
-
-/**
- * Create a peer used for benchmarking
- *
- * @param cp the number of the peer
- */
-static void
-perf_create_peer (int cp)
-{
-  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
-                              &ph.peers[cp].id, sizeof(struct
-                                                       GNUNET_PeerIdentity));
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating peer #%u: %s \n", cp,
-              GNUNET_i2s (&ph.peers[cp].id));
-}
-
-
-/**
- * Perform an update for an address
- *
- * @param cur the address to update
- */
-static void
-perf_update_address (struct ATS_Address *cur)
-{
-  int r_type;
-  int abs_val;
-  double rel_val;
-
-  r_type = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2);
-  switch (r_type)
-  {
-  case 0:
-    abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
-    rel_val = (100 + (double) abs_val) / 100;
-
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Updating peer `%s' address %p type %s abs val %u rel val 
%.3f\n",
-                GNUNET_i2s (&cur->peer), cur,
-                "GNUNET_ATS_QUALITY_NET_DELAY",
-                abs_val, rel_val);
-    ph.sf->s_address_update_property (ph.sf->cls, cur,
-                                      GNUNET_ATS_QUALITY_NET_DELAY,
-                                      abs_val, rel_val);
-    break;
-
-  case 1:
-    abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 10);
-    rel_val = (100 + (double) abs_val) / 100;
-
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Updating peer `%s' address %p type %s abs val %u rel val 
%.3f\n",
-                GNUNET_i2s (&cur->peer), cur, 
"GNUNET_ATS_QUALITY_NET_DISTANCE",
-                abs_val, rel_val);
-    ph.sf->s_address_update_property (ph.sf->cls, cur,
-                                      GNUNET_ATS_QUALITY_NET_DISTANCE,
-                                      abs_val, rel_val);
-    break;
-
-  default:
-    break;
-  }
-}
-
-
-static void
-bandwidth_changed_cb (void *cls,
-                      struct ATS_Address *address)
-{
-  if ((0 == address->assigned_bw_out) && (0 == address->assigned_bw_in))
-    return;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Bandwidth changed addresses %s %p to %u Bps out / %u Bps in\n",
-              GNUNET_i2s (&address->peer),
-              address,
-              address->assigned_bw_out,
-              address->assigned_bw_in);
-  if (GNUNET_YES == ph.bulk_running)
-    GNUNET_break (0);
-  return;
-}
-
-
-static const double *
-get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id)
-{
-  return GAS_preference_get_by_peer (NULL, id);
-}
-
-
-static void
-perf_address_initial_update (void *dead,
-                             struct GNUNET_CONTAINER_MultiPeerMap *addresses,
-                             struct ATS_Address *address)
-{
-  double delay;
-  double distance;
-  uint32_t random = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
-
-  delay = (100 + (double) random) / 100;
-  ph.sf->s_address_update_property (ph.sf->cls,
-                                    address, GNUNET_ATS_QUALITY_NET_DELAY,
-                                    100, delay);
-
-  random = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
-  distance = (100 + (double) random) / 100;
-
-  ph.sf->s_address_update_property (ph.sf->cls, address,
-                                    GNUNET_ATS_QUALITY_NET_DISTANCE,
-                                    10, distance);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Initial update address %p : %.2f  %.2f\n",
-              address, delay, distance);
-}
-
-
-struct DUA_Ctx
-{
-  int r;
-  int c_cur_a;
-};
-
-
-static int
-do_update_address (void *cls,
-                   const struct GNUNET_PeerIdentity *pid,
-                   void *value)
-{
-  struct DUA_Ctx *ctx = cls;
-  struct ATS_Address *addr = value;
-
-  if (ctx->c_cur_a == ctx->r)
-    perf_update_address (addr);
-  ctx->c_cur_a++;
-  return GNUNET_OK;
-}
-
-
-/**
- * Update a certain percentage of peers
- *
- * @param cp the current number of peers
- * @param ca the current number of addresses
- * @param percentage_peers the percentage of peers to update
- */
-static void
-perf_update_all_addresses (unsigned int cp, unsigned int ca, unsigned int
-                           percentage_peers)
-{
-  int c_peer;
-  int c_select;
-  int c_cur_p;
-  int r;
-  int count;
-  unsigned int m[cp];
-  struct DUA_Ctx dua_ctx;
-
-  count = cp * ((double) percentage_peers / 100);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Updating %u of %u peers \n", count, cp);
-
-  for (c_peer = 0; c_peer < cp; c_peer++)
-    m[c_peer] = 0;
-
-  c_select = 0;
-
-  while (c_select < count)
-  {
-    r = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, cp);
-    if (0 == m[r])
-    {
-      m[r] = 1;
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Updating peer [%u] \n", r);
-      c_select++;
-    }
-  }
-  for (c_cur_p = 0; c_cur_p < cp; c_cur_p++)
-  {
-    if (1 == m[c_cur_p])
-    {
-      r = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, ca);
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Updating peer [%u] address [%u]\n", c_cur_p, r);
-
-      dua_ctx.c_cur_a = 0;
-      dua_ctx.r = r;
-      GNUNET_CONTAINER_multipeermap_get_multiple (ph.addresses,
-                                                  &ph.peers[c_cur_p].id,
-                                                  &do_update_address,
-                                                  &dua_ctx);
-    }
-  }
-}
-
-
-/**
- * Create an address for a peer
- *
- * @param cp index of the peer
- * @param ca index of the address
- * @return the address
- */
-static struct ATS_Address *
-perf_create_address (int cp, int ca)
-{
-  struct ATS_Address *a;
-
-  a = create_address (&ph.peers[cp].id,
-                      "Test 1", "test 1", strlen ("test 1") + 1, 0);
-  GNUNET_CONTAINER_multipeermap_put (ph.addresses, &ph.peers[cp].id, a,
-                                     
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  return a;
-}
-
-
-/**
- * Information callback for the solver
- *
- * @param op the solver operation
- * @param stat status of the solver operation
- * @param add additional solver information
- */
-static void
-solver_info_cb (void *cls,
-                enum GAS_Solver_Operation op,
-                enum GAS_Solver_Status stat,
-                enum GAS_Solver_Additional_Information add)
-{
-  char *add_info;
-
-  switch (add)
-  {
-  case GAS_INFO_NONE:
-    add_info = "GAS_INFO_NONE";
-    break;
-
-  case GAS_INFO_FULL:
-    add_info = "GAS_INFO_MLP_FULL";
-    break;
-
-  case GAS_INFO_UPDATED:
-    add_info = "GAS_INFO_MLP_UPDATED";
-    break;
-
-  case GAS_INFO_PROP_ALL:
-    add_info = "GAS_INFO_PROP_ALL";
-    break;
-
-  case GAS_INFO_PROP_SINGLE:
-    add_info = "GAS_INFO_PROP_SINGLE";
-    break;
-
-  default:
-    add_info = "INVALID";
-    break;
-  }
-
-  struct Result *tmp;
-  switch (op)
-  {
-  case GAS_OP_SOLVE_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Solver notifies `%s' with result `%s' `%s'\n",
-                "GAS_OP_SOLVE_START",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL", add_info);
-    if (GNUNET_NO == ph.expecting_solution)
-    {
-      /* We do not expect a solution at the moment */
-      GNUNET_break (0);
-      return;
-    }
-
-    if ((GAS_STAT_SUCCESS == stat) && (NULL == ph.current_result))
-    {
-      tmp = GNUNET_new (struct Result);
-      /* Create new result */
-      if ((add == GAS_INFO_UPDATED) || (GNUNET_YES == ph.performed_update))
-      {
-        ph.current_result = tmp;
-        // fprintf (stderr,"UPDATE %u %u\n",ph.current_iteration-1, 
ph.current_p);
-        ph.iterations_results[ph.current_iteration
-                              - 1].update_results_array[ph.current_p] = tmp;
-      }
-      else
-      {
-        ph.current_result = tmp;
-        // fprintf (stderr,"FULL %u %u\n",ph.current_iteration-1, 
ph.current_p);
-        ph.iterations_results[ph.current_iteration
-                              - 1].results_array[ph.current_p] = tmp;
-      }
-
-      ph.current_result->addresses = ph.current_a;
-      ph.current_result->peers = ph.current_p;
-      ph.current_result->s_total = GNUNET_TIME_absolute_get ();
-      ph.current_result->d_total_full = GNUNET_TIME_UNIT_FOREVER_REL;
-      ph.current_result->d_setup_full = GNUNET_TIME_UNIT_FOREVER_REL;
-      ph.current_result->d_lp_full = GNUNET_TIME_UNIT_FOREVER_REL;
-      ph.current_result->d_mlp_full = GNUNET_TIME_UNIT_FOREVER_REL;
-      ph.current_result->info = add;
-      if ((add == GAS_INFO_UPDATED) || (GNUNET_YES == ph.performed_update))
-      {
-        ph.current_result->update = GNUNET_YES;
-      }
-      else
-      {
-        ph.current_result->update = GNUNET_NO;
-      }
-    }
-    return;
-
-  case GAS_OP_SOLVE_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Solver notifies `%s' with result `%s', `%s'\n",
-                "GAS_OP_SOLVE_STOP",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL", add_info);
-    if ((GNUNET_NO == ph.expecting_solution) || (NULL == ph.current_result))
-    {
-      /* We do not expect a solution at the moment */
-      GNUNET_break (0);
-      return;
-    }
-
-    if (GAS_STAT_SUCCESS == stat)
-      ph.current_result->valid = GNUNET_YES;
-    else
-      ph.current_result->valid = GNUNET_NO;
-
-    if (NULL != ph.current_result)
-    {
-      /* Finalize result */
-      ph.current_result->e_total = GNUNET_TIME_absolute_get ();
-      ph.current_result->d_total_full = GNUNET_TIME_absolute_get_difference (
-        ph.current_result->s_total, ph.current_result->e_total);
-    }
-    ph.current_result = NULL;
-    return;
-
-  case GAS_OP_SOLVE_SETUP_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_SETUP_START",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    if ((GNUNET_NO == ph.expecting_solution) || (NULL == ph.current_result))
-    {
-      GNUNET_break (0);
-      return;
-    }
-
-    if (GAS_STAT_SUCCESS == stat)
-      ph.current_result->valid = GNUNET_YES;
-    else
-      ph.current_result->valid = GNUNET_NO;
-
-    ph.current_result->s_setup = GNUNET_TIME_absolute_get ();
-    return;
-
-  case GAS_OP_SOLVE_SETUP_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_SETUP_STOP",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    if ((GNUNET_NO == ph.expecting_solution) || (NULL == ph.current_result))
-    {
-      GNUNET_break (0);
-      return;
-    }
-
-    if (GAS_STAT_SUCCESS == stat)
-      ph.current_result->valid = GNUNET_YES;
-    else
-      ph.current_result->valid = GNUNET_NO;
-
-    ph.current_result->e_setup = GNUNET_TIME_absolute_get ();
-    ph.current_result->d_setup_full = GNUNET_TIME_absolute_get_difference (
-      ph.current_result->s_setup, ph.current_result->e_setup);
-    return;
-
-  case GAS_OP_SOLVE_MLP_LP_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_LP_START",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    if ((GNUNET_NO == ph.expecting_solution) || (NULL == ph.current_result))
-    {
-      GNUNET_break (0);
-      return;
-    }
-
-    if (GAS_STAT_SUCCESS == stat)
-      ph.current_result->valid = GNUNET_YES;
-    else
-      ph.current_result->valid = GNUNET_NO;
-
-    ph.current_result->s_lp = GNUNET_TIME_absolute_get ();
-    return;
-
-  case GAS_OP_SOLVE_MLP_LP_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_LP_STOP",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    if ((GNUNET_NO == ph.expecting_solution) || (NULL == ph.current_result))
-    {
-      GNUNET_break (0);
-      return;
-    }
-
-    if (GAS_STAT_SUCCESS == stat)
-      ph.current_result->valid = GNUNET_YES;
-    else
-      ph.current_result->valid = GNUNET_NO;
-
-    ph.current_result->e_lp = GNUNET_TIME_absolute_get ();
-    ph.current_result->d_lp_full = GNUNET_TIME_absolute_get_difference (
-      ph.current_result->s_lp, ph.current_result->e_lp);
-    return;
-
-  case GAS_OP_SOLVE_MLP_MLP_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_MLP_START",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    if ((GNUNET_NO == ph.expecting_solution) || (NULL == ph.current_result))
-    {
-      GNUNET_break (0);
-      return;
-    }
-
-    if (GAS_STAT_SUCCESS == stat)
-      ph.current_result->valid = GNUNET_YES;
-    else
-      ph.current_result->valid = GNUNET_NO;
-
-    ph.current_result->s_mlp = GNUNET_TIME_absolute_get ();
-    return;
-
-  case GAS_OP_SOLVE_MLP_MLP_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_MLP_STOP",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    if ((GNUNET_NO == ph.expecting_solution) || (NULL == ph.current_result))
-    {
-      GNUNET_break (0);
-      return;
-    }
-
-    if (GAS_STAT_SUCCESS == stat)
-      ph.current_result->valid = GNUNET_YES;
-    else
-      ph.current_result->valid = GNUNET_NO;
-
-    ph.current_result->e_mlp = GNUNET_TIME_absolute_get ();
-    ph.current_result->d_mlp_full = GNUNET_TIME_absolute_get_difference (
-      ph.current_result->s_mlp, ph.current_result->e_mlp);
-    return;
-
-  case GAS_OP_SOLVE_UPDATE_NOTIFICATION_START:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_UPDATE_NOTIFICATION_START",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    return;
-
-  case GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Solver notifies `%s' with result `%s'\n",
-                "GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP",
-                (GAS_STAT_SUCCESS == stat) ? "SUCCESS" : "FAIL");
-    if (GAS_STAT_SUCCESS != stat)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Solver `%s' failed to update problem with %u peers and %u 
address!\n",
-                  ph.ats_string, ph.current_p, ph.current_a);
-    }
-
-    return;
-
-  default:
-    break;
-  }
-}
-
-
-/**
- * Evaluate results for a specific iteration
- *
- * @param iteration the iteration to evaluate
- */
-static void
-evaluate (int iteration)
-{
-  struct Result *cur;
-  int cp;
-
-  for (cp = ph.N_peers_start; cp <= ph.N_peers_end; cp++)
-  {
-    cur = ph.iterations_results[ph.current_iteration - 1].results_array[cp];
-    if (0 == cp)
-      continue;
-    if (NULL == cur)
-    {
-      GNUNET_break (0);
-      fprintf (stderr,
-               "Missing result for %u peers\n", cp);
-      continue;
-    }
-
-
-    if (GNUNET_NO == cur->valid)
-    {
-      fprintf (stderr,
-               "Total time to solve %s for %u peers %u addresses: %s\n",
-               (GNUNET_YES == cur->update) ? "updated" : "full",
-               cur->peers, cur->addresses, "Failed to solve!");
-      continue;
-    }
-
-
-    if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us !=
-        cur->d_total_full.rel_value_us)
-    {
-      fprintf (stderr,
-               "Total time to solve %s for %u peers %u addresses: %llu us\n",
-               (GNUNET_YES == cur->update) ? "updated" : "full",
-               cur->peers, cur->addresses,
-               (unsigned long long) cur->d_total_full.rel_value_us);
-    }
-
-
-    if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us !=
-        cur->d_setup_full.rel_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Total time to setup %s %u peers %u addresses: %llu us\n",
-                  (GNUNET_YES == cur->update) ? "updated" : "full",
-                  cur->peers, cur->addresses,
-                  (unsigned long long) cur->d_setup_full.rel_value_us);
-    }
-
-    if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us !=
-        cur->d_lp_full.rel_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Total time to solve %s LP for %u peers %u addresses: %llu 
us\n",
-                  (GNUNET_YES == cur->update) ? "updated" : "full",
-                  cur->peers,
-                  cur->addresses,
-                  (unsigned long long ) cur->d_lp_full.rel_value_us);
-    }
-
-    if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us !=
-        cur->d_mlp_full.rel_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Total time to solve %s MLP for %u peers %u addresses: %llu 
us\n",
-                  (GNUNET_YES == cur->update) ? "updated" : "full",
-                  cur->peers, cur->addresses,
-                  (unsigned long long ) cur->d_mlp_full.rel_value_us);
-    }
-  }
-}
-
-
-static unsigned int
-get_connectivity_cb (void *cls,
-                     const struct GNUNET_PeerIdentity *peer)
-{
-  return GNUNET_CONTAINER_multipeermap_contains (ph.addresses,
-                                                 peer);
-}
-
-
-/**
- * Evaluate average results for all iterations
- */
-static void
-write_all_iterations (void)
-{
-  int c_iteration;
-  int c_peer;
-
-  struct GNUNET_DISK_FileHandle *f_full;
-  struct GNUNET_DISK_FileHandle *f_update;
-  char *data_fn_full;
-  char *data_fn_update;
-  char *data;
-
-  f_full = NULL;
-  f_update = NULL;
-
-  data_fn_full = NULL;
-
-  if (GNUNET_NO == ph.create_datafile)
-    return;
-
-  GNUNET_asprintf (&data_fn_full,
-                   "perf_%s_full_%u-%u_%u_%u.data",
-                   ph.ats_string,
-                   ph.total_iterations,
-                   ph.N_peers_start,
-                   ph.N_peers_end,
-                   ph.N_address);
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Using data file `%s'\n",
-              data_fn_full);
-
-  f_full = GNUNET_DISK_file_open (data_fn_full,
-                                  GNUNET_DISK_OPEN_WRITE
-                                  | GNUNET_DISK_OPEN_CREATE,
-                                  GNUNET_DISK_PERM_USER_EXEC
-                                  | GNUNET_DISK_PERM_USER_READ
-                                  | GNUNET_DISK_PERM_USER_WRITE);
-  if (NULL == f_full)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Cannot open data file `%s'\n",
-                data_fn_full);
-    GNUNET_free (data_fn_full);
-    return;
-  }
-
-  data =
-    "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time 
mlp in us;\n";
-  if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_full, data, strlen (data)))
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Cannot write data to log file `%s'\n",
-                data_fn_full);
-
-  data_fn_update = NULL;
-  if (GNUNET_YES == ph.measure_updates)
-  {
-    GNUNET_asprintf (&data_fn_update, "perf_%s_update_%u-%u_%u_%u.data",
-                     ph.ats_string,
-                     ph.total_iterations,
-                     ph.N_peers_start,
-                     ph.N_peers_end,
-                     ph.N_address);
-    f_update = GNUNET_DISK_file_open (data_fn_update,
-                                      GNUNET_DISK_OPEN_WRITE
-                                      | GNUNET_DISK_OPEN_CREATE,
-                                      GNUNET_DISK_PERM_USER_EXEC
-                                      | GNUNET_DISK_PERM_USER_READ
-                                      | GNUNET_DISK_PERM_USER_WRITE);
-    if (NULL == f_update)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Cannot open gnuplot file `%s'\n", data_fn_update);
-      GNUNET_free (data_fn_update);
-      if (NULL != f_full)
-        GNUNET_DISK_file_close (f_full);
-      GNUNET_free (data_fn_full);
-      return;
-    }
-
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Using update data file `%s'\n",
-                data_fn_update);
-
-    data =
-      "#peers;addresses;time total in us;#time setup in us;#time lp in 
us;#time mlp in us;\n";
-    if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data, strlen 
(data)))
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Cannot write data to log file `%s'\n",
-                  data_fn_update);
-  }
-
-  for (c_peer = ph.N_peers_start; c_peer <= ph.N_peers_end; c_peer++)
-  {
-    char *data_str;
-    char *data_tmp;
-    char *data_upd_str;
-    char *data_upd_tmp;
-    GNUNET_asprintf (&data_str, "%u;%u", c_peer, ph.N_address);
-    if (ph.measure_updates)
-      GNUNET_asprintf (&data_upd_str, "%u;%u", c_peer, ph.N_address);
-    for (c_iteration = 0; c_iteration < ph.total_iterations; c_iteration++)
-    {
-      struct Result *cur_full_res;
-      struct Result *cur_upd_res;
-
-
-      // fprintf (stderr, "P: %u I: %u  == %p \n", c_peer, c_iteration, 
cur_res);
-      cur_full_res = ph.iterations_results[c_iteration].results_array[c_peer];
-      if (c_peer == 0)
-        continue;
-      if (NULL == cur_full_res)
-        continue;
-
-      if (ph.measure_updates)
-      {
-        cur_upd_res =
-          ph.iterations_results[c_iteration].update_results_array[c_peer];
-        data_upd_tmp = GNUNET_strdup (data_upd_str);
-        GNUNET_free (data_upd_str);
-        if (GNUNET_YES == cur_full_res->valid)
-        {
-          GNUNET_asprintf (&data_upd_str, "%s;%llu", data_upd_tmp,
-                           (NULL == cur_upd_res) ? 0 :
-                           cur_upd_res->d_total_full.rel_value_us);
-        }
-        else
-        {
-          GNUNET_asprintf (&data_upd_str, "%s;", data_upd_tmp);
-        }
-        GNUNET_free (data_upd_tmp);
-      }
-
-      // fprintf (stderr, "P: %u I: %u: P %i  A %i\n", c_peer, c_iteration, 
cur_res->peers, cur_res->addresses);
-      // fprintf (stderr, "D total: %llu\n", (long long unsigned int) 
cur_res->d_total.rel_value_us);
-
-      data_tmp = GNUNET_strdup (data_str);
-      GNUNET_free (data_str);
-      if (GNUNET_YES == cur_full_res->valid)
-      {
-        GNUNET_asprintf (&data_str, "%s;%llu", data_tmp,
-                         cur_full_res->d_total_full.rel_value_us);
-      }
-      else
-      {
-        GNUNET_asprintf (&data_str, "%s;", data_tmp);
-      }
-
-      GNUNET_free (data_tmp);
-    }
-    data_tmp = GNUNET_strdup (data_str);
-    GNUNET_free (data_str);
-    GNUNET_asprintf (&data_str, "%s\n", data_tmp);
-    GNUNET_free (data_tmp);
-
-    fprintf (stderr, "Result full solution: %s\n", data_str);
-    if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_full, data_str, strlen (
-                                                   data_str)))
-      GNUNET_break (0);
-    GNUNET_free (data_str);
-
-    if (ph.measure_updates)
-    {
-      data_upd_tmp = GNUNET_strdup (data_upd_str);
-      GNUNET_free (data_upd_str);
-      GNUNET_asprintf (&data_upd_str, "%s\n", data_upd_tmp);
-      GNUNET_free (data_upd_tmp);
-
-      fprintf (stderr, "Result updated solution: `%s'\n", data_upd_str);
-      if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data_upd_str,
-                                                   strlen (data_upd_str)))
-        GNUNET_break (0);
-      GNUNET_free (data_upd_str);
-    }
-  }
-
-  if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full)))
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
-                data_fn_full);
-  GNUNET_free (data_fn_full);
-
-  if ((NULL != f_update) && (GNUNET_SYSERR == GNUNET_DISK_file_close (
-                               f_update)))
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
-                data_fn_update);
-  GNUNET_free (data_fn_update);
-}
-
-
-static int
-do_delete_address (void *cls,
-                   const struct GNUNET_PeerIdentity *pid,
-                   void *value)
-{
-  struct ATS_Address *cur = value;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Deleting addresses for peer %u\n",
-              pid);
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multipeermap_remove (ph.addresses,
-                                                       pid,
-                                                       cur));
-  ph.sf->s_del (ph.sf->cls, cur);
-  GNUNET_free (cur->atsi);
-  GNUNET_free (cur);
-  return GNUNET_OK;
-}
-
-
-/**
- * Run a performance iteration
- */
-static void
-perf_run_iteration (void)
-{
-  int cp;
-  int ca;
-  int count_p = ph.N_peers_end;
-  int count_a = ph.N_address;
-  struct ATS_Address *cur_addr;
-  uint32_t net;
-
-  ph.iterations_results[ph.current_iteration - 1].results_array =
-    GNUNET_malloc ((count_p + 1) * sizeof(struct Result *));
-  if (ph.measure_updates)
-    ph.iterations_results[ph.current_iteration - 1].update_results_array =
-      GNUNET_malloc ((count_p + 1) * sizeof(struct Result *));
-  ph.peers = GNUNET_malloc ((count_p) * sizeof(struct PerfPeer));
-  for (cp = 0; cp < count_p; cp++)
-    perf_create_peer (cp);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Iteration %u of %u, added %u peers\n", ph.current_iteration,
-              ph.total_iterations, cp);
-
-  for (cp = 0; cp < count_p; cp++)
-  {
-    fprintf (stderr, "%u..", cp);
-    if (GNUNET_NO == ph.bulk_running)
-    {
-      ph.bulk_running = GNUNET_YES;
-      ph.sf->s_bulk_start (ph.sf->cls);
-    }
-    ph.current_p = cp + 1;
-    for (ca = 0; ca < count_a; ca++)
-    {
-      cur_addr = perf_create_address (cp, ca);
-      /* Add address */
-
-      /* Random network selection */
-      // net = 1 + GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
GNUNET_NT_COUNT - 1);
-      /* Random equally distributed network selection */
-      net = 1 + (ca % (GNUNET_NT_COUNT - 1));
-      /* fprintf (stderr, "Network: %u `%s'\n",
-       * mod_net , GNUNET_NT_to_string(mod_net)); */
-
-      cur_addr->atsi = GNUNET_new (struct GNUNET_ATS_Information);
-      cur_addr->atsi_count = 1;
-      cur_addr->atsi[0].type = htonl (GNUNET_ATS_NETWORK_TYPE);
-      cur_addr->atsi[0].value = htonl (net);
-      ph.sf->s_add (ph.sf->cls, cur_addr, net);
-
-      ph.current_a = ca + 1;
-      perf_address_initial_update (NULL, ph.addresses, cur_addr);
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Adding address for peer %u address %u in network %s\n", cp,
-                  ca,
-                  GNUNET_NT_to_string (net));
-    }
-    /* Notify solver about request */
-    ph.sf->s_get (ph.sf->cls, &ph.peers[cp].id);
-
-    if (cp + 1 >= ph.N_peers_start)
-    {
-      /* Disable bulk to solve the problem */
-      if (GNUNET_YES == ph.bulk_running)
-      {
-        ph.expecting_solution = GNUNET_YES;
-        ph.bulk_running = GNUNET_NO;
-        ph.sf->s_bulk_stop (ph.sf->cls);
-      }
-      else
-        GNUNET_break (0);
-
-      /* Problem is solved by the solver here due to unlocking */
-      ph.expecting_solution = GNUNET_NO;
-
-      /* Update the problem */
-      if ((0 < ph.opt_update_percent) && (GNUNET_YES == ph.measure_updates))
-      {
-        /* Update */
-        GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                    "Updating problem with %u peers and %u addresses\n", cp + 
1,
-                    ca);
-
-        ph.expecting_solution = GNUNET_YES;
-        ph.performed_update = GNUNET_YES;
-        if (GNUNET_NO == ph.bulk_running)
-        {
-          ph.bulk_running = GNUNET_YES;
-          ph.sf->s_bulk_start (ph.sf->cls);
-        }
-        perf_update_all_addresses (cp + 1, ca, ph.opt_update_percent);
-        ph.bulk_running = GNUNET_NO;
-        ph.sf->s_bulk_stop (ph.sf->cls);
-        /* Problem is solved by the solver here due to unlocking */
-        ph.performed_update = GNUNET_NO;
-        ph.expecting_solution = GNUNET_NO;
-      }
-      GNUNET_assert (GNUNET_NO == ph.bulk_running);
-    }
-  }
-  fprintf (stderr, "\n");
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Done, cleaning up addresses\n");
-  if (GNUNET_NO == ph.bulk_running)
-  {
-    ph.sf->s_bulk_start (ph.sf->cls);
-    ph.bulk_running = GNUNET_YES;
-  }
-
-  for (cp = 0; cp < count_p; cp++)
-  {
-    GNUNET_CONTAINER_multipeermap_get_multiple (ph.addresses,
-                                                &ph.peers[cp].id,
-                                                &do_delete_address,
-                                                NULL);
-  }
-  if (GNUNET_NO == ph.bulk_running)
-  {
-    ph.sf->s_bulk_stop (ph.sf->cls);
-    ph.bulk_running = GNUNET_NO;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Iteration done\n");
-  GNUNET_free (ph.peers);
-}
-
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  GNUNET_log_setup ("perf-ats-solver", "WARNING", NULL);
-  char *sep;
-  char *src_filename = GNUNET_strdup (__FILE__);
-  char *test_filename = cls;
-  char *solver;
-  char *plugin;
-  struct GNUNET_CONFIGURATION_Handle *solver_cfg;
-  unsigned long long quotas_in[GNUNET_NT_COUNT];
-  unsigned long long quotas_out[GNUNET_NT_COUNT];
-  int c;
-  int c2;
-
-  /* Extract test name */
-  if (NULL == (sep = (strstr (src_filename, ".c"))))
-  {
-    GNUNET_free (src_filename);
-    GNUNET_break (0);
-    ret = 1;
-    return;
-  }
-  sep[0] = '\0';
-
-  if (NULL != (sep = strstr (test_filename, ".exe")))
-    sep[0] = '\0';
-
-  if (NULL == (solver = strstr (test_filename, src_filename)))
-  {
-    GNUNET_free (src_filename);
-    GNUNET_break (0);
-    ret = 1;
-    return;
-  }
-  solver += strlen (src_filename) + 1;
-
-  if (0 == strcmp (solver, "proportional"))
-  {
-    ph.ats_string = "proportional";
-  }
-  else if (0 == strcmp (solver, "mlp"))
-  {
-    ph.ats_string = "mlp";
-  }
-  else if ((0 == strcmp (solver, "ril")))
-  {
-    ph.ats_string = "ril";
-  }
-  else
-  {
-    GNUNET_free (src_filename);
-    GNUNET_break (0);
-    ret = 1;
-    return;
-  }
-  GNUNET_free (src_filename);
-
-  /* Calculate peers */
-  if ((0 == ph.N_peers_start) && (0 == ph.N_peers_end))
-  {
-    ph.N_peers_start = DEFAULT_PEERS_START;
-    ph.N_peers_end = DEFAULT_PEERS_END;
-  }
-  if (0 == ph.N_address)
-    ph.N_address = DEFAULT_ADDRESSES;
-
-
-  if (ph.N_peers_start != ph.N_peers_end)
-    fprintf (stderr,
-             "Benchmarking solver `%s' with %u to %u peers and %u addresses in 
%u iterations\n",
-             ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address,
-             ph.total_iterations);
-  else
-    fprintf (stderr,
-             "Benchmarking solver `%s' with %u peers and %u addresses in %u 
iterations\n",
-             ph.ats_string, ph.N_peers_end, ph.N_address, ph.total_iterations);
-
-  if (0 == ph.opt_update_percent)
-    ph.opt_update_percent = DEFAULT_UPDATE_PERCENTAGE;
-
-  /* Load quotas */
-  solver_cfg = GNUNET_CONFIGURATION_create ();
-  if ((NULL == solver_cfg) || (GNUNET_SYSERR == (GNUNET_CONFIGURATION_load (
-                                                   solver_cfg,
-                                                   "perf_ats_solver.conf"))))
-  {
-    GNUNET_break (0);
-    end_now (1);
-    return;
-  }
-  if (GNUNET_NT_COUNT != load_quotas (solver_cfg,
-                                      quotas_out, quotas_in, GNUNET_NT_COUNT))
-  {
-    GNUNET_break (0);
-    end_now (1);
-    return;
-  }
-
-  /* Create array of DLL to store results for iterations */
-  ph.iterations_results = GNUNET_malloc (sizeof(struct Iteration)
-                                         * ph.total_iterations);
-
-  /* Load solver */
-  ph.env.cfg = solver_cfg;
-  ph.stat = GNUNET_STATISTICS_create ("ats", cfg);
-  ph.env.stats = ph.stat;
-  ph.addresses = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
-  ph.env.addresses = ph.addresses;
-  ph.env.bandwidth_changed_cb = bandwidth_changed_cb;
-  ph.env.get_connectivity = &get_connectivity_cb;
-  ph.env.get_preferences = &get_preferences_cb;
-  ph.env.network_count = GNUNET_NT_COUNT;
-  ph.env.info_cb = &solver_info_cb;
-
-  for (c = 0; c < GNUNET_NT_COUNT; c++)
-  {
-    ph.env.out_quota[c] = quotas_out[c];
-    ph.env.in_quota[c] = quotas_in[c];
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Loading network quotas: `%s' %llu %llu \n",
-                GNUNET_NT_to_string (c),
-                ph.env.out_quota[c],
-                ph.env.in_quota[c]);
-  }
-  GAS_normalization_start ();
-  GAS_preference_init ();
-
-  GNUNET_asprintf (&plugin,
-                   "libgnunet_plugin_ats_%s",
-                   ph.ats_string);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              _ ("Initializing solver `%s'\n"),
-              ph.ats_string);
-  if (NULL == (ph.sf = GNUNET_PLUGIN_load (plugin, &ph.env)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ ("Failed to initialize solver `%s'!\n"),
-                plugin);
-    ret = 1;
-    return;
-  }
-
-  /* Do the benchmark */
-  for (ph.current_iteration = 1; ph.current_iteration <= ph.total_iterations;
-       ph.current_iteration++)
-  {
-    fprintf (stderr,
-             "Iteration %u of %u starting\n",
-             ph.current_iteration,
-             ph.total_iterations);
-    perf_run_iteration ();
-    evaluate (ph.current_iteration);
-    fprintf (stderr,
-             "Iteration %u of %u done\n",
-             ph.current_iteration,
-             ph.total_iterations);
-  }
-  if (ph.create_datafile)
-    write_all_iterations ();
-
-  /* Unload solver*/
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              _ ("Unloading solver `%s'\n"),
-              ph.ats_string);
-  GNUNET_PLUGIN_unload (plugin, ph.sf);
-  ph.sf = NULL;
-  GNUNET_free (plugin);
-  for (c = 0; c < ph.total_iterations; c++)
-  {
-    for (c2 = ph.N_peers_start; c2 < ph.N_peers_end; c2++)
-    {
-      if (0 == c2)
-        continue;
-      if (ph.measure_updates)
-        GNUNET_free (
-          ph.iterations_results[c].update_results_array[c2]);
-      GNUNET_free (ph.iterations_results[c].results_array[c2]);
-    }
-    if (ph.measure_updates)
-      GNUNET_free (ph.iterations_results[c].update_results_array);
-    GNUNET_free (ph.iterations_results[c].results_array);
-  }
-  GNUNET_free (ph.iterations_results);
-
-  GNUNET_CONFIGURATION_destroy (solver_cfg);
-  GNUNET_STATISTICS_destroy (ph.stat, GNUNET_NO);
-}
-
-
-/**
- * Main function of the benchmark
- *
- * @param argc argument count
- * @param argv argument values
- */
-int
-main (int argc, char *argv[])
-{
-  /* extract command line arguments */
-  ph.opt_update_percent = 0;
-  ph.N_peers_start = 0;
-  ph.N_peers_end = 0;
-  ph.N_address = 0;
-  ph.ats_string = NULL;
-  ph.create_datafile = GNUNET_NO;
-  ph.measure_updates = GNUNET_NO;
-  ph.total_iterations = 1;
-
-  static struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_option_uint ('a',
-                               "addresses",
-                               gettext_noop ("addresses to use"),
-                               &ph.N_address),
-
-    GNUNET_GETOPT_option_uint ('s',
-                               "start",
-                               gettext_noop ("start with peer"),
-                               &ph.N_peers_start),
-
-    GNUNET_GETOPT_option_uint ('e',
-                               "end",
-                               gettext_noop ("end with peer"),
-                               &ph.N_peers_end),
-
-    GNUNET_GETOPT_option_uint ('i',
-                               "iterations",
-                               gettext_noop (
-                                 "number of iterations used for averaging 
(default: 1)"),
-                               &ph.total_iterations),
-
-    GNUNET_GETOPT_option_uint ('p',
-                               "percentage",
-                               gettext_noop (
-                                 "update a fix percentage of addresses"),
-                               &ph.opt_update_percent),
-
-    GNUNET_GETOPT_option_flag ('d',
-                               "data",
-                               gettext_noop ("create data file"),
-                               &ph.create_datafile),
-
-    GNUNET_GETOPT_option_flag ('u',
-                               "update",
-                               gettext_noop ("measure updates"),
-                               &ph.measure_updates),
-
-    GNUNET_GETOPT_OPTION_END
-  };
-
-  GNUNET_PROGRAM_run (argc, argv, argv[0], NULL, options, &run, argv[0]);
-  return ret;
-}
-
-
-/* end of file perf_ats_solver.c */
diff --git a/src/ats/perf_ats_solver.conf b/src/ats/perf_ats_solver.conf
deleted file mode 100644
index a535891df..000000000
--- a/src/ats/perf_ats_solver.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-[ats]
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = 1000000
-UNSPECIFIED_QUOTA_OUT = 1000000
-# LOOPBACK
-LOOPBACK_QUOTA_IN = 10000000
-LOOPBACK_QUOTA_OUT = 10000000
-# LAN
-LAN_QUOTA_IN = 10000000
-LAN_QUOTA_OUT = 10000000
-# WAN
-WAN_QUOTA_IN = 10000000
-WAN_QUOTA_OUT = 10000000
-# WLAN
-WLAN_QUOTA_IN = 10000000
-WLAN_QUOTA_OUT = 10000000
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = 10000000
-BLUETOOTH_QUOTA_OUT = 10000000
-
-# Proportional specific settings
-# How proportional to preferences is bandwidth distribution in a network
-# 1: Fair with respect to addresses without preferences
-# > 10: The bigger, the more respect is paid to preferences
-PROP_PROPORTIONALITY_FACTOR = 2.00
-# Should we stick to existing connections are prefer to switch?
-# [10...200], lower value prefers to switch, bigger value is more tolerant
-PROP_STABILITY_FACTOR = 1.25
diff --git a/src/ats/perf_ats_solver_proportional.conf 
b/src/ats/perf_ats_solver_proportional.conf
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/ats/plugin_ats_proportional.c 
b/src/ats/plugin_ats_proportional.c
deleted file mode 100644
index d3062a5c0..000000000
--- a/src/ats/plugin_ats_proportional.c
+++ /dev/null
@@ -1,1243 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2011-2015 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/plugin_ats_proportional.c
- * @brief ATS proportional solver
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_ats_service.h"
-#include "gnunet_ats_plugin.h"
-#include "gnunet-service-ats_addresses.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "ats-proportional", __VA_ARGS__)
-
-/**
- * How much do we value stability over adaptation by default.  A low
- * value (close to 1.0) means we adapt as soon as possible, a larger
- * value means that we have to have the respective factor of an
- * advantage (or delay) before we adapt and sacrifice stability.
- */
-#define PROP_STABILITY_FACTOR 1.25
-
-
-/**
- * Default value to assume for the proportionality factor, if none is
- * given in the configuration.  This factor determines how strong the
- * bandwidth allocation will orient itself on the application
- * preferences.  A lower factor means a more balanced bandwidth
- * distribution while a larger number means a distribution more in
- * line with application (bandwidth) preferences.
- */
-#define PROPORTIONALITY_FACTOR 2.0
-
-
-/**
- * Address information stored for the proportional solver in the
- * `solver_information` member of `struct GNUNET_ATS_Address`.
- *
- * They are also stored in the respective `struct Network`'s linked
- * list.
- */
-struct AddressWrapper
-{
-  /**
-   * Next in DLL
-   */
-  struct AddressWrapper *next;
-
-  /**
-   * Previous in DLL
-   */
-  struct AddressWrapper *prev;
-
-  /**
-   * The address
-   */
-  struct ATS_Address *addr;
-
-  /**
-   * Network scope this address is in
-   */
-  struct Network *network;
-
-  /**
-   * Inbound quota
-   */
-  uint32_t calculated_quota_in;
-
-  /**
-   * Outbound quota
-   */
-  uint32_t calculated_quota_out;
-
-  /**
-   * When was this address activated
-   */
-  struct GNUNET_TIME_Absolute activated;
-};
-
-
-/**
- * Representation of a network
- */
-struct Network
-{
-  /**
-   * Network description
-   */
-  const char *desc;
-
-  /**
-   * String for statistics total addresses
-   */
-  char *stat_total;
-
-  /**
-   * String for statistics active addresses
-   */
-  char *stat_active;
-
-  /**
-   * Linked list of addresses in this network: head
-   */
-  struct AddressWrapper *head;
-
-  /**
-   * Linked list of addresses in this network: tail
-   */
-  struct AddressWrapper *tail;
-
-  /**
-   * Total inbound quota
-   */
-  unsigned long long total_quota_in;
-
-  /**
-   * Total outbound quota
-   */
-  unsigned long long total_quota_out;
-
-  /**
-   * ATS network type
-   */
-  enum GNUNET_NetworkType type;
-
-  /**
-   * Number of active addresses for this network
-   */
-  unsigned int active_addresses;
-
-  /**
-   * Number of total addresses for this network
-   */
-  unsigned int total_addresses;
-};
-
-
-/**
- * A handle for the proportional solver
- */
-struct GAS_PROPORTIONAL_Handle
-{
-  /**
-   * Our execution environment.
-   */
-  struct GNUNET_ATS_PluginEnvironment *env;
-
-  /**
-   * Networks array
-   */
-  struct Network *network_entries;
-
-  /**
-   * Proportionality factor
-   */
-  double prop_factor;
-
-  /**
-   * Stability factor
-   */
-  double stability_factor;
-
-  /**
-   * Bulk lock counter. If zero, we are not locked.
-   */
-  unsigned int bulk_lock;
-
-  /**
-   * Number of changes made while solver was locked.  We really only
-   * use 0/non-zero to check on unlock if we have to run the update.
-   */
-  unsigned int bulk_requests;
-
-  /**
-   * Number of active addresses for solver
-   */
-  unsigned int active_addresses;
-};
-
-
-/**
- * Test if bandwidth is available in this network to add an additional address.
- *
- * @param net the network type to check
- * @param extra for how many extra addresses do we check?
- * @return #GNUNET_YES or #GNUNET_NO
- */
-static int
-is_bandwidth_available_in_network (struct Network *net,
-                                   int extra)
-{
-  unsigned int na;
-  uint32_t min_bw = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__);
-
-  GNUNET_assert (((int) net->active_addresses) + extra >= 0);
-  na = net->active_addresses + extra;
-  if (0 == na)
-    return GNUNET_YES;
-  if (((net->total_quota_in / na) > min_bw) &&
-      ((net->total_quota_out / na) > min_bw))
-    return GNUNET_YES;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "No bandwidth available in network\n");
-  return GNUNET_NO;
-}
-
-
-/**
- * Test if all peers in this network require connectivity at level at
- * least @a con.
- *
- * @param s the solver handle
- * @param net the network type to check
- * @param con connection return value threshold to check
- * @return #GNUNET_YES or #GNUNET_NO
- */
-static int
-all_require_connectivity (struct GAS_PROPORTIONAL_Handle *s,
-                          struct Network *net,
-                          unsigned int con)
-{
-  struct AddressWrapper *aw;
-
-  for (aw = net->head; NULL != aw; aw = aw->next)
-    if (con >
-        s->env->get_connectivity (s->env->cls,
-                                  &aw->addr->peer))
-      return GNUNET_NO;
-  return GNUNET_YES;
-}
-
-
-/**
- * Update bandwidth assigned to peers in this network.  The basic idea
- * is to assign every peer in the network the minimum bandwidth, and
- * then distribute the remaining bandwidth proportional to application
- * preferences.
- *
- * @param s the solver handle
- * @param net the network type to update
- */
-static void
-distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s,
-                      struct Network *net)
-{
-  const uint32_t min_bw = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__);
-  struct AddressWrapper *aw;
-  unsigned long long remaining_quota_in;
-  unsigned long long quota_out_used;
-  unsigned long long remaining_quota_out;
-  unsigned long long quota_in_used;
-  unsigned int count_addresses;
-  double sum_relative_peer_prefences;
-  double peer_weight;
-  double total_weight;
-  const double *peer_relative_prefs;
-
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "Recalculate quota for network type `%s' for %u addresses (in/out): 
%llu/%llu \n",
-       net->desc,
-       net->active_addresses,
-       net->total_quota_in,
-       net->total_quota_in);
-
-  if (0 == net->active_addresses)
-    return; /* no addresses to update */
-
-  /* sanity checks */
-  if ((net->active_addresses * min_bw) > net->total_quota_in)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if ((net->active_addresses * min_bw) > net->total_quota_out)
-  {
-    GNUNET_break (0);
-    return;
-  }
-
-  /* Calculate sum of relative preference for active addresses in this
-     network */
-  sum_relative_peer_prefences = 0.0;
-  count_addresses = 0;
-  for (aw = net->head; NULL != aw; aw = aw->next)
-  {
-    if (GNUNET_YES != aw->addr->active)
-      continue;
-    peer_relative_prefs = s->env->get_preferences (s->env->cls,
-                                                   &aw->addr->peer);
-    sum_relative_peer_prefences
-      += peer_relative_prefs[GNUNET_ATS_PREFERENCE_BANDWIDTH];
-    count_addresses++;
-  }
-  if (count_addresses != net->active_addresses)
-  {
-    GNUNET_break (0);
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         "%s: Counted %u active addresses, expected %u active addresses\n",
-         net->desc,
-         count_addresses,
-         net->active_addresses);
-    /* try to fix... */
-    net->active_addresses = count_addresses;
-  }
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "Total relative preference %.3f for %u addresses in network %s\n",
-       sum_relative_peer_prefences,
-       net->active_addresses,
-       net->desc);
-
-  /* check how much we have to distribute */
-  remaining_quota_in = net->total_quota_in - (net->active_addresses * min_bw);
-  remaining_quota_out = net->total_quota_out - (net->active_addresses * 
min_bw);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Proportionally distributable bandwidth (in/out): %llu/%llu\n",
-       remaining_quota_in,
-       remaining_quota_out);
-
-  /* distribute remaining quota; we do not do it exactly proportional,
-     but balance "even" distribution ("net->active_addresses") with
-     the preference sum using the "prop_factor". */
-  total_weight = net->active_addresses
-                 + s->prop_factor * sum_relative_peer_prefences;
-  quota_out_used = 0;
-  quota_in_used = 0;
-  for (aw = net->head; NULL != aw; aw = aw->next)
-  {
-    if (GNUNET_YES != aw->addr->active)
-    {
-      /* set to 0, just to be sure */
-      aw->calculated_quota_in = 0;
-      aw->calculated_quota_out = 0;
-      continue;
-    }
-    peer_relative_prefs = s->env->get_preferences (s->env->cls,
-                                                   &aw->addr->peer);
-    peer_weight = 1.0
-                  + s->prop_factor
-                  * peer_relative_prefs[GNUNET_ATS_PREFERENCE_BANDWIDTH];
-
-    aw->calculated_quota_in = min_bw
-                              + (peer_weight / total_weight)
-                              * remaining_quota_in;
-    aw->calculated_quota_out = min_bw
-                               + (peer_weight / total_weight)
-                               * remaining_quota_out;
-
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         "New quotas for peer `%s' with weight (cur/total) %.3f/%.3f (in/out) 
are: %u/%u\n",
-         GNUNET_i2s (&aw->addr->peer),
-         peer_weight,
-         total_weight,
-         (unsigned int) aw->calculated_quota_in,
-         (unsigned int) aw->calculated_quota_out);
-    quota_in_used += aw->calculated_quota_in;
-    quota_out_used += aw->calculated_quota_out;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Total bandwidth assigned is (in/out): %llu /%llu\n",
-       quota_in_used,
-       quota_out_used);
-  /* +1 due to possible rounding errors */
-  GNUNET_break (quota_out_used <= net->total_quota_out + 1);
-  GNUNET_break (quota_in_used <= net->total_quota_in + 1);
-}
-
-
-/**
- * Notify ATS service of bandwidth changes to addresses.
- *
- * @param s solver handle
- * @param net the network to propagate changes in
- */
-static void
-propagate_bandwidth (struct GAS_PROPORTIONAL_Handle *s,
-                     struct Network *net)
-{
-  struct AddressWrapper *cur;
-
-  for (cur = net->head; NULL != cur; cur = cur->next)
-  {
-    if ((cur->addr->assigned_bw_in == cur->calculated_quota_in) &&
-        (cur->addr->assigned_bw_out == cur->calculated_quota_out))
-      continue;
-    cur->addr->assigned_bw_in = cur->calculated_quota_in;
-    cur->addr->assigned_bw_out = cur->calculated_quota_out;
-    if (GNUNET_YES == cur->addr->active)
-      s->env->bandwidth_changed_cb (s->env->cls,
-                                    cur->addr);
-  }
-}
-
-
-/**
- * Distribute bandwidth.  The addresses have already been selected,
- * this is merely distributed the bandwidth among the addresses.
- *
- * @param s the solver handle
- * @param n the network, can be NULL for all networks
- */
-static void
-distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s,
-                                 struct Network *n)
-{
-  unsigned int i;
-
-  if (0 != s->bulk_lock)
-  {
-    s->bulk_requests++;
-    return;
-  }
-  if (NULL != n)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Redistributing bandwidth in network %s with %u active and %u total 
addresses\n",
-         GNUNET_NT_to_string (n->type),
-         n->active_addresses,
-         n->total_addresses);
-    s->env->info_cb (s->env->cls,
-                     GAS_OP_SOLVE_START,
-                     GAS_STAT_SUCCESS,
-                     GAS_INFO_PROP_SINGLE);
-    distribute_bandwidth (s,
-                          n);
-    s->env->info_cb (s->env->cls,
-                     GAS_OP_SOLVE_STOP,
-                     GAS_STAT_SUCCESS,
-                     GAS_INFO_PROP_SINGLE);
-    s->env->info_cb (s->env->cls,
-                     GAS_OP_SOLVE_UPDATE_NOTIFICATION_START,
-                     GAS_STAT_SUCCESS,
-                     GAS_INFO_PROP_SINGLE);
-    propagate_bandwidth (s,
-                         n);
-
-    s->env->info_cb (s->env->cls,
-                     GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP,
-                     GAS_STAT_SUCCESS,
-                     GAS_INFO_PROP_SINGLE);
-  }
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Redistributing bandwidth in all %u networks\n",
-         s->env->network_count);
-    s->env->info_cb (s->env->cls,
-                     GAS_OP_SOLVE_START,
-                     GAS_STAT_SUCCESS,
-                     GAS_INFO_PROP_ALL);
-    for (i = 0; i < s->env->network_count; i++)
-      distribute_bandwidth (s,
-                            &s->network_entries[i]);
-    s->env->info_cb (s->env->cls,
-                     GAS_OP_SOLVE_STOP,
-                     GAS_STAT_SUCCESS,
-                     GAS_INFO_PROP_ALL);
-    s->env->info_cb (s->env->cls,
-                     GAS_OP_SOLVE_UPDATE_NOTIFICATION_START,
-                     GAS_STAT_SUCCESS,
-                     GAS_INFO_PROP_ALL);
-    for (i = 0; i < s->env->network_count; i++)
-      propagate_bandwidth (s,
-                           &s->network_entries[i]);
-    s->env->info_cb (s->env->cls,
-                     GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP,
-                     GAS_STAT_SUCCESS,
-                     GAS_INFO_PROP_ALL);
-  }
-}
-
-
-/**
- * Context for finding the best address* Linked list of addresses in this 
network: head
- */
-struct FindBestAddressCtx
-{
-  /**
-   * The solver handle
-   */
-  struct GAS_PROPORTIONAL_Handle *s;
-
-  /**
-   * The currently best address
-   */
-  struct ATS_Address *best;
-};
-
-
-/**
- * Find a "good" address to use for a peer by iterating over the
- * addresses for this peer.  If we already have an existing address,
- * we stick to it.  Otherwise, we pick by lowest distance and then by
- * lowest latency.
- *
- * @param cls the `struct FindBestAddressCtx *' where we store the result
- * @param key the peer we are trying to find the best address for
- * @param value another `struct ATS_Address*` to consider using
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-find_best_address_it (void *cls,
-                      const struct GNUNET_PeerIdentity *key,
-                      void *value)
-{
-  struct FindBestAddressCtx *ctx = cls;
-  struct ATS_Address *current = value;
-  struct AddressWrapper *asi = current->solver_information;
-  struct GNUNET_TIME_Relative active_time;
-  double best_delay;
-  double best_distance;
-  double cur_delay;
-  double cur_distance;
-  unsigned int con;
-  int bw_available;
-  int need;
-
-  /* we need +1 slot if 'current' is not yet active */
-  need = (GNUNET_YES == current->active) ? 0 : 1;
-  /* we save -1 slot if 'best' is active and belongs
-     to the same network (as we would replace it) */
-  if ((NULL != ctx->best) &&
-      (GNUNET_YES == ctx->best->active) &&
-      (((struct AddressWrapper *) ctx->best->solver_information)->network ==
-       asi->network))
-    need--;
-  /* we can gain -1 slot if this peers connectivity
-     requirement is higher than that of another peer
-     in that network scope */
-  con = ctx->s->env->get_connectivity (ctx->s->env->cls,
-                                       key);
-  if (GNUNET_YES !=
-      all_require_connectivity (ctx->s,
-                                asi->network,
-                                con))
-    need--;
-  /* test if minimum bandwidth for 'current' would be available */
-  bw_available
-    = is_bandwidth_available_in_network (asi->network,
-                                         need);
-  if (! bw_available)
-  {
-    /* Bandwidth for this address is unavailable, so we cannot use
-       it. */
-    return GNUNET_OK;
-  }
-  if (GNUNET_YES == current->active)
-  {
-    active_time = GNUNET_TIME_absolute_get_duration (asi->activated);
-    if (active_time.rel_value_us <=
-        ((double) GNUNET_TIME_UNIT_SECONDS.rel_value_us)
-        * ctx->s->stability_factor)
-    {
-      /* Keep active address for stability reasons */
-      ctx->best = current;
-      return GNUNET_NO;
-    }
-  }
-  if (NULL == ctx->best)
-  {
-    /* We so far have nothing else, so go with it! */
-    ctx->best = current;
-    return GNUNET_OK;
-  }
-
-  /* Now compare ATS information */
-  cur_distance = current->norm_distance.norm;
-  best_distance = ctx->best->norm_distance.norm;
-  cur_delay = current->norm_delay.norm;
-  best_delay = ctx->best->norm_delay.norm;
-
-  /* user shorter distance */
-  if (cur_distance < best_distance)
-  {
-    if (GNUNET_NO == ctx->best->active)
-    {
-      /* Activity doesn't influence the equation, use current */
-      ctx->best = current;
-    }
-    else if ((best_distance / cur_distance) > ctx->s->stability_factor)
-    {
-      /* Distance change is significant, switch active address! */
-      ctx->best = current;
-    }
-  }
-
-  /* User connection with less delay */
-  if (cur_delay < best_delay)
-  {
-    if (GNUNET_NO == ctx->best->active)
-    {
-      /* Activity doesn't influence the equation, use current */
-      ctx->best = current;
-    }
-    else if ((best_delay / cur_delay) > ctx->s->stability_factor)
-    {
-      /* Latency change is significant, switch active address! */
-      ctx->best = current;
-    }
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Find the currently best address for a peer from the set of
- * addresses available or return NULL of no address is available.
- *
- * @param s the proportional handle
- * @param addresses the address hashmap
- * @param id the peer id
- * @return the address or NULL
- */
-struct ATS_Address *
-get_best_address (struct GAS_PROPORTIONAL_Handle *s,
-                  struct GNUNET_CONTAINER_MultiPeerMap *addresses,
-                  const struct GNUNET_PeerIdentity *id)
-{
-  struct FindBestAddressCtx fba_ctx;
-
-  fba_ctx.best = NULL;
-  fba_ctx.s = s;
-  GNUNET_CONTAINER_multipeermap_get_multiple (addresses,
-                                              id,
-                                              &find_best_address_it,
-                                              &fba_ctx);
-  return fba_ctx.best;
-}
-
-
-/**
- * Decrease number of active addresses in network.
- *
- * @param s the solver handle
- * @param net the network type
- */
-static void
-address_decrement_active (struct GAS_PROPORTIONAL_Handle *s,
-                          struct Network *net)
-{
-  GNUNET_assert (net->active_addresses > 0);
-  net->active_addresses--;
-  GNUNET_STATISTICS_update (s->env->stats,
-                            net->stat_active,
-                            -1,
-                            GNUNET_NO);
-  GNUNET_assert (s->active_addresses > 0);
-  s->active_addresses--;
-  GNUNET_STATISTICS_update (s->env->stats,
-                            "# ATS addresses total",
-                            -1,
-                            GNUNET_NO);
-}
-
-
-/**
- * Address map iterator to find current active address for peer.
- * Asserts that only one address is active per peer.
- *
- * @param cls last active address
- * @param key peer's key
- * @param value address to check
- * @return #GNUNET_NO on double active address else #GNUNET_YES;
- */
-static int
-get_active_address_it (void *cls,
-                       const struct GNUNET_PeerIdentity *key,
-                       void *value)
-{
-  struct ATS_Address **dest = cls;
-  struct ATS_Address *aa = value;
-
-  if (GNUNET_YES != aa->active)
-    return GNUNET_OK;
-  GNUNET_assert (NULL == (*dest));
-  (*dest) = aa;
-  return GNUNET_OK;
-}
-
-
-/**
- * Find current active address for peer
- *
- * @param s the solver handle
- * @param peer the peer
- * @return active address or NULL
- */
-static struct ATS_Address *
-get_active_address (struct GAS_PROPORTIONAL_Handle *s,
-                    const struct GNUNET_PeerIdentity *peer)
-{
-  struct ATS_Address *dest;
-
-  dest = NULL;
-  GNUNET_CONTAINER_multipeermap_get_multiple (s->env->addresses,
-                                              peer,
-                                              &get_active_address_it,
-                                              &dest);
-  return dest;
-}
-
-
-/**
- * Update active address for a peer.  Check if active address exists
- * and what the best address is, if addresses are different switch.
- * Then reallocate bandwidth within the affected network scopes.
- *
- * @param s solver handle
- * @param current_address the address currently active for the peer,
- *        NULL for none
- * @param peer the peer to check
- */
-static void
-update_active_address (struct GAS_PROPORTIONAL_Handle *s,
-                       struct ATS_Address *current_address,
-                       const struct GNUNET_PeerIdentity *peer)
-{
-  struct ATS_Address *best_address;
-  struct AddressWrapper *asi_cur;
-  struct AddressWrapper *asi_best;
-  struct AddressWrapper *aw;
-  struct AddressWrapper *aw_min;
-  unsigned int a_con;
-  unsigned int con_min;
-
-  best_address = get_best_address (s,
-                                   s->env->addresses,
-                                   peer);
-  if (NULL != best_address)
-    asi_best = best_address->solver_information;
-  else
-    asi_best = NULL;
-  if (current_address == best_address)
-    return; /* no changes */
-  if (NULL != current_address)
-  {
-    /* We switch to a new address (or to none);
-       mark old address as inactive. */
-    asi_cur = current_address->solver_information;
-    GNUNET_assert (GNUNET_YES == current_address->active);
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         "Disabling previous active address for peer `%s'\n",
-         GNUNET_i2s (peer));
-    asi_cur->activated = GNUNET_TIME_UNIT_ZERO_ABS;
-    current_address->active = GNUNET_NO;
-    current_address->assigned_bw_in = 0;
-    current_address->assigned_bw_out = 0;
-    address_decrement_active (s,
-                              asi_cur->network);
-    if ((NULL == best_address) ||
-        (asi_best->network != asi_cur->network))
-      distribute_bandwidth_in_network (s,
-                                       asi_cur->network);
-    if (NULL == best_address)
-    {
-      /* We previously had an active address, but now we cannot
-       * suggest one.  Therefore we have to disconnect the peer.
-       * The above call to "distribute_bandwidth_in_network()
-       * does not see 'current_address' so we need to trigger
-       * the update here. */LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Disconnecting peer `%s'.\n",
-           GNUNET_i2s (peer));
-      s->env->bandwidth_changed_cb (s->env->cls,
-                                    current_address);
-      return;
-    }
-  }
-  if (NULL == best_address)
-  {
-    /* We do not have a new address, so we are done. */
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Cannot suggest address for peer `%s'\n",
-         GNUNET_i2s (peer));
-    return;
-  }
-  /* We do have a new address, activate it */
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Selecting new address %p for peer `%s'\n",
-       best_address,
-       GNUNET_i2s (peer));
-  /* Mark address as active */
-  best_address->active = GNUNET_YES;
-  asi_best->activated = GNUNET_TIME_absolute_get ();
-  asi_best->network->active_addresses++;
-  s->active_addresses++;
-  GNUNET_STATISTICS_update (s->env->stats,
-                            "# ATS active addresses total",
-                            1,
-                            GNUNET_NO);
-  GNUNET_STATISTICS_update (s->env->stats,
-                            asi_best->network->stat_active,
-                            1,
-                            GNUNET_NO);
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "Address %p for peer `%s' is now active\n",
-       best_address,
-       GNUNET_i2s (peer));
-
-  if (GNUNET_NO ==
-      is_bandwidth_available_in_network (asi_best->network,
-                                         0))
-  {
-    /* we went over the maximum number of addresses for
-       this scope; remove the address with the smallest
-       connectivity requirement */
-    con_min = UINT32_MAX;
-    aw_min = NULL;
-    for (aw = asi_best->network->head; NULL != aw; aw = aw->next)
-    {
-      if ((con_min >
-           (a_con = s->env->get_connectivity (s->env->cls,
-                                              &aw->addr->peer))) &&
-          (GNUNET_YES == aw->addr->active))
-      {
-        aw_min = aw;
-        con_min = a_con;
-        if (0 == con_min)
-          break;
-      }
-    }
-    update_active_address (s,
-                           aw_min->addr,
-                           &aw_min->addr->peer);
-  }
-  distribute_bandwidth_in_network (s,
-                                   asi_best->network);
-}
-
-
-/**
- * The preferences for a peer in the problem changed.
- *
- * @param solver the solver handle
- * @param peer the peer to change the preference for
- * @param kind the kind to change the preference
- * @param pref_rel the normalized preference value for this kind over all 
clients
- */
-static void
-GAS_proportional_change_preference (void *solver,
-                                    const struct GNUNET_PeerIdentity *peer,
-                                    enum GNUNET_ATS_PreferenceKind kind,
-                                    double pref_rel)
-{
-  struct GAS_PROPORTIONAL_Handle *s = solver;
-
-  if (GNUNET_ATS_PREFERENCE_BANDWIDTH != kind)
-    return; /* we do not care */
-  distribute_bandwidth_in_network (s,
-                                   NULL);
-}
-
-
-/**
- * Get application feedback for a peer
- *
- * @param solver the solver handle
- * @param application the application
- * @param peer the peer to change the preference for
- * @param scope the time interval for this feedback: [now - scope .. now]
- * @param kind the kind to change the preference
- * @param score the score
- */
-static void
-GAS_proportional_feedback (void *solver,
-                           struct GNUNET_SERVICE_Client *application,
-                           const struct GNUNET_PeerIdentity *peer,
-                           const struct GNUNET_TIME_Relative scope,
-                           enum GNUNET_ATS_PreferenceKind kind,
-                           double score)
-{
-  /* Proportional does not care about feedback */
-}
-
-
-/**
- * Get the preferred address for a specific peer
- *
- * @param solver the solver handle
- * @param peer the identity of the peer
- */
-static void
-GAS_proportional_start_get_address (void *solver,
-                                    const struct GNUNET_PeerIdentity *peer)
-{
-  struct GAS_PROPORTIONAL_Handle *s = solver;
-
-  update_active_address (s,
-                         get_active_address (s,
-                                             peer),
-                         peer);
-}
-
-
-/**
- * Stop notifying about address and bandwidth changes for this peer
- *
- * @param solver the solver handle
- * @param peer the peer
- */
-static void
-GAS_proportional_stop_get_address (void *solver,
-                                   const struct GNUNET_PeerIdentity *peer)
-{
-  struct GAS_PROPORTIONAL_Handle *s = solver;
-  struct ATS_Address *cur;
-  struct AddressWrapper *asi;
-
-  cur = get_active_address (s,
-                            peer);
-  if (NULL == cur)
-    return;
-  asi = cur->solver_information;
-  distribute_bandwidth_in_network (s,
-                                   asi->network);
-}
-
-
-/**
- * Start a bulk operation
- *
- * @param solver the solver
- */
-static void
-GAS_proportional_bulk_start (void *solver)
-{
-  struct GAS_PROPORTIONAL_Handle *s = solver;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Locking solver for bulk operation ...\n");
-  GNUNET_assert (NULL != solver);
-  s->bulk_lock++;
-}
-
-
-/**
- * Bulk operation done.
- *
- * @param solver our `struct GAS_PROPORTIONAL_Handle *`
- */
-static void
-GAS_proportional_bulk_stop (void *solver)
-{
-  struct GAS_PROPORTIONAL_Handle *s = solver;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Unlocking solver from bulk operation ...\n");
-  if (s->bulk_lock < 1)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  s->bulk_lock--;
-  if ((0 == s->bulk_lock) &&
-      (0 < s->bulk_requests))
-  {
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         "No lock pending, recalculating\n");
-    distribute_bandwidth_in_network (s,
-                                     NULL);
-    s->bulk_requests = 0;
-  }
-}
-
-
-/**
- * Transport properties for this address have changed
- *
- * @param solver solver handle
- * @param address the address
- */
-static void
-GAS_proportional_address_property_changed (void *solver,
-                                           struct ATS_Address *address)
-{
-  struct GAS_PROPORTIONAL_Handle *s = solver;
-  struct AddressWrapper *asi = address->solver_information;
-
-  distribute_bandwidth_in_network (s,
-                                   asi->network);
-}
-
-
-/**
- * Add a new single address to a network
- *
- * @param solver the solver Handle
- * @param address the address to add
- * @param network network type of this address
- */
-static void
-GAS_proportional_address_add (void *solver,
-                              struct ATS_Address *address,
-                              uint32_t network)
-{
-  struct GAS_PROPORTIONAL_Handle *s = solver;
-  struct Network *net;
-  struct AddressWrapper *aw;
-
-  GNUNET_assert (network < s->env->network_count);
-  net = &s->network_entries[network];
-  net->total_addresses++;
-
-  aw = GNUNET_new (struct AddressWrapper);
-  aw->addr = address;
-  aw->network = net;
-  address->solver_information = aw;
-  GNUNET_CONTAINER_DLL_insert (net->head,
-                               net->tail,
-                               aw);
-  GNUNET_STATISTICS_update (s->env->stats,
-                            "# ATS addresses total",
-                            1,
-                            GNUNET_NO);
-  GNUNET_STATISTICS_update (s->env->stats,
-                            net->stat_total,
-                            1,
-                            GNUNET_NO);
-  update_active_address (s,
-                         get_active_address (s,
-                                             &address->peer),
-                         &address->peer);
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "Added new address for `%s', now total %u and active %u addresses in 
network `%s'\n",
-       GNUNET_i2s (&address->peer),
-       net->total_addresses,
-       net->active_addresses,
-       net->desc);
-}
-
-
-/**
- * Remove an address from the solver. To do so, we:
- * - Removed it from specific network
- * - Decrease the number of total addresses
- * - If active:
- *   - decrease number of active addresses
- *   - update quotas
- *
- * @param solver the solver handle
- * @param address the address to remove
- */
-static void
-GAS_proportional_address_delete (void *solver,
-                                 struct ATS_Address *address)
-{
-  struct GAS_PROPORTIONAL_Handle *s = solver;
-  struct AddressWrapper *aw = address->solver_information;
-  struct Network *net = aw->network;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Deleting %s address for peer `%s' from network `%s' (total: %u/active: 
%u)\n",
-       (GNUNET_NO == address->active) ? "inactive" : "active",
-       GNUNET_i2s (&address->peer),
-       net->desc,
-       net->total_addresses,
-       net->active_addresses);
-
-  GNUNET_CONTAINER_DLL_remove (net->head,
-                               net->tail,
-                               aw);
-  GNUNET_assert (net->total_addresses > 0);
-  net->total_addresses--;
-  GNUNET_STATISTICS_update (s->env->stats,
-                            net->stat_total,
-                            -1,
-                            GNUNET_NO);
-  if (GNUNET_YES == address->active)
-  {
-    /* Address was active, remove from network and update quotas */
-    update_active_address (s,
-                           address,
-                           &address->peer);
-    distribute_bandwidth_in_network (s, net);
-  }
-  GNUNET_free (aw);
-  address->solver_information = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "After deleting address now total %u and active %u addresses in network 
`%s'\n",
-       net->total_addresses,
-       net->active_addresses,
-       net->desc);
-}
-
-
-/**
- * Function invoked when the plugin is loaded.
- *
- * @param[in,out] cls the `struct GNUNET_ATS_PluginEnvironment *` to use;
- *            modified to return the API functions (ugh).
- * @return the `struct GAS_PROPORTIONAL_Handle` to pass as a closure
- */
-void *
-libgnunet_plugin_ats_proportional_init (void *cls)
-{
-  static struct GNUNET_ATS_SolverFunctions sf;
-  struct GNUNET_ATS_PluginEnvironment *env = cls;
-  struct GAS_PROPORTIONAL_Handle *s;
-  struct Network *cur;
-  float f_tmp;
-  unsigned int c;
-
-  s = GNUNET_new (struct GAS_PROPORTIONAL_Handle);
-  s->env = env;
-  sf.cls = s;
-  sf.s_add = &GAS_proportional_address_add;
-  sf.s_address_update_property = &GAS_proportional_address_property_changed;
-  sf.s_get = &GAS_proportional_start_get_address;
-  sf.s_get_stop = &GAS_proportional_stop_get_address;
-  sf.s_pref = &GAS_proportional_change_preference;
-  sf.s_feedback = &GAS_proportional_feedback;
-  sf.s_del = &GAS_proportional_address_delete;
-  sf.s_bulk_start = &GAS_proportional_bulk_start;
-  sf.s_bulk_stop = &GAS_proportional_bulk_stop;
-  s->stability_factor = PROP_STABILITY_FACTOR;
-  if (GNUNET_SYSERR !=
-      GNUNET_CONFIGURATION_get_value_float (env->cfg,
-                                            "ats",
-                                            "PROP_STABILITY_FACTOR",
-                                            &f_tmp))
-  {
-    if ((f_tmp < 1.0) || (f_tmp > 2.0))
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Invalid %s configuration %f \n"),
-           "PROP_STABILITY_FACTOR",
-           f_tmp);
-    }
-    else
-    {
-      s->stability_factor = f_tmp;
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           "Using %s of %.3f\n",
-           "PROP_STABILITY_FACTOR",
-           f_tmp);
-    }
-  }
-  s->prop_factor = PROPORTIONALITY_FACTOR;
-  if (GNUNET_SYSERR !=
-      GNUNET_CONFIGURATION_get_value_float (env->cfg,
-                                            "ats",
-                                            "PROP_PROPORTIONALITY_FACTOR",
-                                            &f_tmp))
-  {
-    if (f_tmp < 1.0)
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Invalid %s configuration %f\n"),
-           "PROP_PROPORTIONALITY_FACTOR",
-           f_tmp);
-    }
-    else
-    {
-      s->prop_factor = f_tmp;
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           "Using %s of %.3f\n",
-           "PROP_PROPORTIONALITY_FACTOR",
-           f_tmp);
-    }
-  }
-
-  s->network_entries = GNUNET_malloc (env->network_count
-                                      * sizeof(struct Network));
-  for (c = 0; c < env->network_count; c++)
-  {
-    cur = &s->network_entries[c];
-    cur->type = c;
-    cur->total_quota_in = env->in_quota[c];
-    cur->total_quota_out = env->out_quota[c];
-    cur->desc = GNUNET_NT_to_string (c);
-    GNUNET_asprintf (&cur->stat_total,
-                     "# ATS addresses %s total",
-                     cur->desc);
-    GNUNET_asprintf (&cur->stat_active,
-                     "# ATS active addresses %s total",
-                     cur->desc);
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         "Added network %u `%s' (%llu/%llu)\n",
-         c,
-         cur->desc,
-         cur->total_quota_in,
-         cur->total_quota_out);
-  }
-  return &sf;
-}
-
-
-/**
- * Function used to unload the plugin.
- *
- * @param cls return value from #libgnunet_plugin_ats_proportional_init()
- */
-void *
-libgnunet_plugin_ats_proportional_done (void *cls)
-{
-  struct GNUNET_ATS_SolverFunctions *sf = cls;
-  struct GAS_PROPORTIONAL_Handle *s = sf->cls;
-  struct AddressWrapper *cur;
-  struct AddressWrapper *next;
-  unsigned int c;
-
-  for (c = 0; c < s->env->network_count; c++)
-  {
-    GNUNET_break (0 == s->network_entries[c].total_addresses);
-    GNUNET_break (0 == s->network_entries[c].active_addresses);
-    next = s->network_entries[c].head;
-    while (NULL != (cur = next))
-    {
-      next = cur->next;
-      GNUNET_CONTAINER_DLL_remove (s->network_entries[c].head,
-                                   s->network_entries[c].tail,
-                                   cur);
-      GNUNET_free (cur->addr->solver_information);
-      GNUNET_free (cur);
-    }
-    GNUNET_free (s->network_entries[c].stat_total);
-    GNUNET_free (s->network_entries[c].stat_active);
-  }
-  GNUNET_break (0 == s->active_addresses);
-  GNUNET_free (s->network_entries);
-  GNUNET_free (s);
-  return NULL;
-}
-
-
-/* end of plugin_ats_proportional.c */
diff --git a/src/ats/test_ats_api.c b/src/ats/test_ats_api.c
deleted file mode 100644
index 390cafe0f..000000000
--- a/src/ats/test_ats_api.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/test_ats_api.c
- * @brief test ATS
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "test_ats_lib.h"
-
-/**
- * Global timeout for the testcase.
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
-
-/**
- * Definition of the test as a sequence of commands.
- */
-static struct Command test_commands[] = {
-  {
-    .code = CMD_ADD_ADDRESS,
-    .label = "add-address-0-0",
-    .details.add_address = {
-      .pid = 0,
-      .addr_num = 0,
-      .addr_flags = GNUNET_HELLO_ADDRESS_INFO_NONE,
-      .session = 0,
-      .properties = {
-        .scope = GNUNET_NT_LAN
-      }
-
-
-    }
-
-
-  },
-  /* 1: adding same address again should fail */
-  {
-    .code = CMD_ADD_ADDRESS,
-    .label = "add-address-0-0:FAIL",
-    .details.add_address = {
-      .pid = 0,
-      .addr_num = 0,
-      .addr_flags = GNUNET_HELLO_ADDRESS_INFO_NONE,
-      .session = 0,
-      .properties = {
-        .scope = GNUNET_NT_LAN
-      },
-      .expect_fail = 1
-    }
-
-
-  },
-  /* 2: some solver still require explicit start */
-  {
-    .code = CMD_REQUEST_CONNECTION_START,
-    .label = "request-0",
-    .details.request_connection_start = {
-      .pid = 0
-    }
-
-
-  },
-  /* 3: check we got an address */
-  {
-    .code = CMD_AWAIT_ADDRESS_SUGGESTION,
-    .details.await_address_suggestion = {
-      .add_label = "add-address-0-0"
-    }
-
-
-  },
-  /* 4: check monitor also got the address */
-  {
-    .code = CMD_AWAIT_ADDRESS_INFORMATION,
-    .details.await_address_information = {
-      .add_label = "add-address-0-0"
-    }
-
-
-  },
-  /* 5: test session API */
-  {
-    .code = CMD_ADD_SESSION,
-    .label = "add-session-0-0-1",
-    .details.add_session = {
-      .add_label = "add-address-0-0",
-      .session = 1
-    }
-
-
-  },
-  {
-    .code = CMD_DEL_SESSION,
-    .details.del_session = {
-      .add_session_label = "add-session-0-0-1",
-    }
-
-
-  },
-  /* 7: test preference API */
-  {
-    .code = CMD_CHANGE_PREFERENCE,
-    .details.change_preference = {
-      .pid = 0
-             /* FIXME: preference details */
-    }
-
-
-  },
-  {
-    .code = CMD_PROVIDE_FEEDBACK,
-    .details.provide_feedback = {
-      .pid = 0,
-      .scope = { 50LL }
-      /* FIXME: preference details */
-    }
-
-
-  },
-  /* 9: test sanity check address listing */
-  {
-    .code = CMD_LIST_ADDRESSES,
-    .details.list_addresses = {
-      .pid = 0,
-      .all = 1,
-      .min_calls = 2, // ?
-      .max_calls = 2,
-      .min_active_calls = 1,
-      .max_active_calls = 1
-    }
-
-
-  },
-  /* 10: remove address testing */
-  {
-    .code = CMD_DEL_ADDRESS,
-    .details.del_address = {
-      .add_label = "add-address-0-0"
-    }
-
-
-  },
-  /* 11: check we got disconnected */
-  {
-    .code = CMD_AWAIT_DISCONNECT_SUGGESTION,
-    .details.await_disconnect_suggestion = {
-      .pid = 0
-    }
-
-
-  },
-  /* 12: just for symmetry, also stop asking for the connection */
-  {
-    .code = CMD_REQUEST_CONNECTION_STOP,
-    .details.request_connection_stop = {
-      .connect_label = "request-0",
-    }
-
-
-  },
-  /* 13: add address again */
-  {
-    .code = CMD_ADD_ADDRESS,
-    .label = "add-address-0-0:1",
-    .details.add_address = {
-      .pid = 0,
-      .addr_num = 0,
-      .session = 0,
-      .properties = {
-        .scope = GNUNET_NT_LAN
-      }
-
-
-    }
-
-
-  },
-  /* 14: some solver still require explicit start */
-  {
-    .code = CMD_REQUEST_CONNECTION_START,
-    .label = "request-0",
-    .details.request_connection_start = {
-      .pid = 0
-    }
-
-
-  },
-  /* 15: check we got an address */
-  {
-    .code = CMD_AWAIT_ADDRESS_SUGGESTION,
-    .details.await_address_suggestion = {
-      .add_label = "add-address-0-0:1"
-    }
-
-
-  },
-  /* 16: add alternative address */
-  {
-    .code = CMD_ADD_ADDRESS,
-    .label = "add-address-0-1",
-    .details.add_address = {
-      .pid = 0,
-      .addr_num = 1,
-      .addr_flags = GNUNET_HELLO_ADDRESS_INFO_NONE,
-      .session = 0,
-      .properties = {
-        .scope = GNUNET_NT_LAN
-      }
-
-
-    }
-
-
-  },
-  /* 17: remove original address */
-  {
-    .code = CMD_DEL_ADDRESS,
-    .details.del_address = {
-      .add_label = "add-address-0-0:1"
-    }
-
-
-  },
-  /* 18: check we switched to alternative address */
-  {
-    .code = CMD_AWAIT_ADDRESS_SUGGESTION,
-    .details.await_address_suggestion = {
-      .add_label = "add-address-0-1"
-    }
-
-
-  },
-  /* 19: remove alternative address */
-  {
-    .code = CMD_DEL_ADDRESS,
-    .details.del_address = {
-      .add_label = "add-address-0-1"
-    }
-
-
-  },
-  /* 20: check we got disconnected */
-  {
-    .code = CMD_AWAIT_DISCONNECT_SUGGESTION,
-    .details.await_disconnect_suggestion = {
-      .pid = 0
-    }
-
-
-  },
-  /* 21: just for symmetry, also stop asking for the connection */
-  {
-    .code = CMD_REQUEST_CONNECTION_STOP,
-    .details.request_connection_stop = {
-      .connect_label = "request-0",
-    }
-
-
-  },
-  /* Test ends successfully */
-  {
-    .code = CMD_END_PASS
-  }
-};
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  return TEST_ATS_run (argc,
-                       argv,
-                       test_commands,
-                       TIMEOUT);
-}
-
-
-/* end of file test_ats_api.c */
diff --git a/src/ats/test_ats_api.conf b/src/ats/test_ats_api.conf
deleted file mode 100644
index d45e84d18..000000000
--- a/src/ats/test_ats_api.conf
+++ /dev/null
@@ -1,35 +0,0 @@
-@INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf
-
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-ats-api-scheduling/
-
-[ats]
-# Enable MLP mode (default: NO)
-#MODE = ril
-MODE = mlp
-# Network specific inbound/outbound quotas
-# UNSPECIFIED
-UNSPECIFIED_QUOTA_IN = 64 KiB
-UNSPECIFIED_QUOTA_OUT = 64 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = 64 KiB
-WAN_QUOTA_OUT = 64 KiB
-# WLAN
-WLAN_QUOTA_IN = 512
-WLAN_QUOTA_OUT = 512
-
-# ATS extended options
-DUMP_MLP = NO
-DUMP_SOLUTION = NO
-DUMP_OVERWRITE = NO
-DUMP_MIN_PEERS = 0
-DUMP_MIN_ADDRS = 0
-DUMP_OVERWRITE = NO
-ATS_MIN_INTERVAL = 15000
-ATS_EXEC_INTERVAL = 30000
diff --git a/src/ats/test_ats_api_delayed.conf 
b/src/ats/test_ats_api_delayed.conf
deleted file mode 100644
index 3aac88cf9..000000000
--- a/src/ats/test_ats_api_delayed.conf
+++ /dev/null
@@ -1,36 +0,0 @@
-@INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf
-
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-ats-api-scheduling/
-
-[ats]
-PREFIX = ./test_delay -t 10 --
-# Enable MLP mode (default: NO)
-#MODE = ril
-MODE = mlp
-# Network specific inbound/outbound quotas
-# UNSPECIFIED
-UNSPECIFIED_QUOTA_IN = 64 KiB
-UNSPECIFIED_QUOTA_OUT = 64 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = 64 KiB
-WAN_QUOTA_OUT = 64 KiB
-# WLAN
-WLAN_QUOTA_IN = 512
-WLAN_QUOTA_OUT = 512
-
-# ATS extended options
-DUMP_MLP = NO
-DUMP_SOLUTION = NO
-DUMP_OVERWRITE = NO
-DUMP_MIN_PEERS = 0
-DUMP_MIN_ADDRS = 0
-DUMP_OVERWRITE = NO
-ATS_MIN_INTERVAL = 15000
-ATS_EXEC_INTERVAL = 30000
diff --git a/src/ats/test_ats_api_proportional.conf 
b/src/ats/test_ats_api_proportional.conf
deleted file mode 100644
index ee8f8f8e7..000000000
--- a/src/ats/test_ats_api_proportional.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-@INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf
-
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-ats-proportional/
-
-[ats]
-# Enable PROPORTIONAL mode (default: NO)
-MODE = proportional
-# Network specific inbound/outbound quotas
-# UNSPECIFIED
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = 5 MiB
-WAN_QUOTA_OUT = 5 MiB
-# WLAN
-WLAN_QUOTA_IN = 4096
-WLAN_QUOTA_OUT = 4096
diff --git a/src/ats/test_ats_lib.c b/src/ats/test_ats_lib.c
deleted file mode 100644
index d19da0106..000000000
--- a/src/ats/test_ats_lib.c
+++ /dev/null
@@ -1,1107 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/test_ats_lib.c
- * @brief test ATS library with a generic interpreter for running ATS tests
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_ats_service.h"
-#include "gnunet_testing_lib.h"
-#include "test_ats_lib.h"
-
-/**
- * Information about the last address suggestion we got for a peer.
- */
-struct AddressSuggestData
-{
-  /**
-   * Which session were we given?
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * What address was assigned?
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Outbound bandwidth assigned.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
-
-  /**
-   * Inbound bandwidth assigned.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
-
-  /**
-   * Was the bandwidth assigned non-zero?
-   */
-  int active;
-};
-
-
-/**
- * Information about the last address information we got for an address.
- */
-struct AddressInformationData
-{
-  /**
-   * What address is this data about?
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Which properties were given?
-   */
-  struct GNUNET_ATS_Properties properties;
-
-  /**
-   * Outbound bandwidth reported.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
-
-  /**
-   * Inbound bandwidth reported.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
-
-  /**
-   * Was the address said to be 'active'?
-   */
-  int active;
-};
-
-
-/**
- * Scheduling handle
- */
-static struct GNUNET_ATS_SchedulingHandle *sched_ats;
-
-/**
- * Connectivity handle
- */
-static struct GNUNET_ATS_ConnectivityHandle *con_ats;
-
-/**
- * Performance handle
- */
-static struct GNUNET_ATS_PerformanceHandle *perf_ats;
-
-/**
- * Handle for the interpreter task.
- */
-static struct GNUNET_SCHEDULER_Task *interpreter_task;
-
-/**
- * Map from peer identities to the last address suggestion
- * `struct AddressSuggestData` we got for the respective peer.
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *p2asd;
-
-/**
- * Map from peer identities to the last address information
- * sets for all addresses of this peer. Each peer is mapped
- * to one or more `struct AddressInformationData` entries.
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *p2aid;
-
-/**
- * Global timeout for the test.
- */
-static struct GNUNET_TIME_Relative TIMEOUT;
-
-/**
- * Return value from #main().
- */
-static int ret;
-
-/**
- * Current global command offset into the #commands array.
- */
-static unsigned int off;
-
-/**
- * Commands for the current test.
- */
-static struct Command *test_commands;
-
-
-/**
- * Free `struct AddressSuggestData` entry.
- *
- * @param cls NULL
- * @param key ignored
- * @param value the `struct AddressSuggestData` to release
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-free_asd (void *cls,
-          const struct GNUNET_PeerIdentity *key,
-          void *value)
-{
-  struct AddressSuggestData *asd = value;
-
-  GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CONTAINER_multipeermap_remove (p2asd,
-                                                       key,
-                                                       asd));
-  GNUNET_free (asd->address);
-  GNUNET_free (asd);
-  return GNUNET_OK;
-}
-
-
-/**
- * Free `struct AddressInformationData` entry.
- *
- * @param cls NULL
- * @param key ignored
- * @param value the `struct AddressSuggestData` to release
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-free_aid (void *cls,
-          const struct GNUNET_PeerIdentity *key,
-          void *value)
-{
-  struct AddressInformationData *aid = value;
-
-  GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CONTAINER_multipeermap_remove (p2aid,
-                                                       key,
-                                                       aid));
-  GNUNET_free (aid->address);
-  GNUNET_free (aid);
-  return GNUNET_OK;
-}
-
-
-/**
- * Find latest address suggestion made for the given peer.
- *
- * @param pid peer to look up
- * @return NULL if peer was never involved
- */
-static struct AddressSuggestData *
-find_address_suggestion (const struct GNUNET_PeerIdentity *pid)
-{
-  return GNUNET_CONTAINER_multipeermap_get (p2asd,
-                                            pid);
-}
-
-
-/**
- * Closure for #match_address()
- */
-struct MatchAddressContext
-{
-  /**
-   * Address to find.
-   */
-  const struct GNUNET_HELLO_Address *addr;
-
-  /**
-   * Where to return address information if found.
-   */
-  struct AddressInformationData *ret;
-};
-
-
-/**
- * Find matching address information.
- *
- * @param cls a `struct MatchAddressContext`
- * @param key unused
- * @param value a `struct AddressInformationData`
- * @return #GNUNET_OK if not found
- */
-static int
-match_address (void *cls,
-               const struct GNUNET_PeerIdentity *key,
-               void *value)
-{
-  struct MatchAddressContext *mac = cls;
-  struct AddressInformationData *aid = value;
-
-  if (0 == GNUNET_HELLO_address_cmp (mac->addr,
-                                     aid->address))
-  {
-    mac->ret = aid;
-    return GNUNET_NO;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Find latest address information made for the given address.
- *
- * @param addr address to look up
- * @return NULL if peer was never involved
- */
-static struct AddressInformationData *
-find_address_information (const struct GNUNET_HELLO_Address *addr)
-{
-  struct MatchAddressContext mac;
-
-  mac.ret = NULL;
-  mac.addr = addr;
-  GNUNET_CONTAINER_multipeermap_get_multiple (p2aid,
-                                              &addr->peer,
-                                              &match_address,
-                                              &mac);
-  return mac.ret;
-}
-
-
-/**
- * Task run to terminate the testcase.
- *
- * @param cls NULL
- */
-static void
-end (void *cls)
-{
-  if (0 != ret)
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Test failed at stage %u %s\n",
-                off,
-                (NULL != test_commands[off].label)
-                ? test_commands[off].label
-                : "");
-  if (NULL != interpreter_task)
-  {
-    GNUNET_SCHEDULER_cancel (interpreter_task);
-    interpreter_task = NULL;
-  }
-  if (NULL != sched_ats)
-  {
-    GNUNET_ATS_scheduling_done (sched_ats);
-    sched_ats = NULL;
-  }
-  if (NULL != con_ats)
-  {
-    GNUNET_ATS_connectivity_done (con_ats);
-    con_ats = NULL;
-  }
-  if (NULL != perf_ats)
-  {
-    GNUNET_ATS_performance_done (perf_ats);
-    perf_ats = NULL;
-  }
-  if (NULL != p2asd)
-  {
-    GNUNET_CONTAINER_multipeermap_iterate (p2asd,
-                                           &free_asd,
-                                           NULL);
-    GNUNET_CONTAINER_multipeermap_destroy (p2asd);
-    p2asd = NULL;
-  }
-  if (NULL != p2aid)
-  {
-    GNUNET_CONTAINER_multipeermap_iterate (p2aid,
-                                           &free_aid,
-                                           NULL);
-    GNUNET_CONTAINER_multipeermap_destroy (p2aid);
-    p2aid = NULL;
-  }
-}
-
-
-/**
- * Main interpreter loop. Runs the steps of the test.
- *
- * @param cls NULL
- */
-static void
-interpreter (void *cls);
-
-
-/**
- * Run the interpreter next.
- */
-static void
-run_interpreter ()
-{
-  if (NULL != interpreter_task)
-    GNUNET_SCHEDULER_cancel (interpreter_task);
-  interpreter_task = GNUNET_SCHEDULER_add_now (&interpreter,
-                                               NULL);
-}
-
-
-/**
- * Initialize public key of a peer based on a single number.
- *
- * @param pid number to use as the basis
- * @param pk resulting fake public key
- */
-static void
-make_peer (uint32_t pid,
-           struct GNUNET_PeerIdentity *pk)
-{
-  memset (pk,
-          (int) pid,
-          sizeof(struct GNUNET_PeerIdentity));
-  GNUNET_memcpy (pk,
-                 &pid,
-                 sizeof(uint32_t));
-}
-
-
-/**
- * Generate a fake address based on the given parameters.
- *
- * @param pid number of the peer
- * @param num number of the address at peer @a pid
- * @param addr_flags flags to use for the address
- * @return the address
- */
-static struct GNUNET_HELLO_Address *
-make_address (uint32_t pid,
-              uint32_t num,
-              enum GNUNET_HELLO_AddressInfo addr_flags)
-{
-  struct GNUNET_PeerIdentity pk;
-  uint32_t nbo;
-
-  nbo = htonl (num);
-  make_peer (pid,
-             &pk);
-  return GNUNET_HELLO_address_allocate (&pk,
-                                        "test",
-                                        &nbo,
-                                        sizeof(nbo),
-                                        addr_flags);
-}
-
-
-/**
- * Our dummy sessions.
- */
-struct GNUNET_ATS_Session
-{
-  /**
-   * Field to avoid `0 == sizeof(struct GNUNET_ATS_Session)`.
-   */
-  unsigned int non_empty;
-};
-
-
-/**
- * Create a session instance for ATS.
- *
- * @param i which session number to return
- * @return NULL if @a i is 0, otherwise a pointer unique to @a i
- */
-static struct GNUNET_ATS_Session *
-make_session (unsigned int i)
-{
-  struct GNUNET_ATS_Session *baseptr = NULL;
-
-  if (0 == i)
-    return NULL;
-  /* Yes, these are *intentionally* out-of-bounds,
-     and offset from NULL, as nobody should ever
-     use those other than to compare pointers! */
-  return baseptr + i;
-}
-
-
-/**
- * Find a @a code command before the global #off with the
- * specified @a label.
- *
- * @param code opcode to look for
- * @param label label to look for, NULL for none
- * @return previous command with the matching label
- */
-static struct Command *
-find_command (enum CommandCode code,
-              const char *label)
-{
-  int i;
-
-  if (NULL == label)
-    return NULL;
-  for (i = off - 1; i >= 0; i--)
-    if ((code == test_commands[i].code) &&
-        (0 == strcmp (test_commands[i].label,
-                      label)))
-      return &test_commands[i];
-  GNUNET_break (0);
-  return NULL;
-}
-
-
-/**
- * Function called from #GNUNET_ATS_performance_list_addresses when
- * we process a #CMD_LIST_ADDRESSES command.
- *
- * @param cls the `struct Command` that caused the call
- * @param address the address, NULL if ATS service was disconnected
- * @param address_active #GNUNET_YES if this address is actively used
- *        to maintain a connection to a peer;
- *        #GNUNET_NO if the address is not actively used;
- *        #GNUNET_SYSERR if this address is no longer available for ATS
- * @param bandwidth_out assigned outbound bandwidth for the connection
- * @param bandwidth_in assigned inbound bandwidth for the connection
- * @param prop performance data for the address
- */
-static void
-info_cb (void *cls,
-         const struct GNUNET_HELLO_Address *address,
-         int address_active,
-         struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-         struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-         const struct GNUNET_ATS_Properties *prop)
-{
-  struct Command *c = cls;
-  struct CommandListAddresses *cmd = &c->details.list_addresses;
-
-  if (NULL == address)
-  {
-    cmd->alh = NULL;
-    /* we are done with the iteration, continue to execute */
-    if ((cmd->calls < cmd->min_calls) &&
-        (cmd->active_calls < cmd->min_active_calls))
-    {
-      GNUNET_SCHEDULER_shutdown ();
-      return;
-    }
-    off++;
-    run_interpreter ();
-    return;
-  }
-  switch (address_active)
-  {
-  case GNUNET_YES:
-    cmd->active_calls++;
-    cmd->calls++;
-    break;
-
-  case GNUNET_NO:
-    cmd->calls++;
-    break;
-
-  case GNUNET_SYSERR:
-    return;
-  }
-  if ((cmd->calls > cmd->max_calls) &&
-      (cmd->active_calls < cmd->max_active_calls))
-  {
-    GNUNET_break (0);
-    GNUNET_ATS_performance_list_addresses_cancel (cmd->alh);
-    cmd->alh = NULL;
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-}
-
-
-/**
- * Function called with reservation result.
- *
- * @param cls closure with the reservation command (`struct Command`)
- * @param peer identifies the peer
- * @param amount set to the amount that was actually reserved or unreserved;
- *               either the full requested amount or zero (no partial 
reservations)
- * @param res_delay if the reservation could not be satisfied (amount was 0), 
how
- *        long should the client wait until re-trying?
- */
-static void
-reservation_cb (void *cls,
-                const struct GNUNET_PeerIdentity *peer,
-                int32_t amount,
-                struct GNUNET_TIME_Relative res_delay)
-{
-  struct Command *cmd = cls;
-  struct GNUNET_PeerIdentity pid;
-
-  cmd->details.reserve_bandwidth.rc = NULL;
-  make_peer (cmd->details.reserve_bandwidth.pid,
-             &pid);
-  GNUNET_assert (0 == GNUNET_memcmp (peer,
-                                     &pid));
-  switch (cmd->details.reserve_bandwidth.expected_result)
-  {
-  case GNUNET_OK:
-    if (amount != cmd->details.reserve_bandwidth.amount)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Unexpectedly failed to reserve %d/%d bytes with delay 
%s!\n",
-                  (int) amount,
-                  (int) cmd->details.reserve_bandwidth.amount,
-                  GNUNET_STRINGS_relative_time_to_string (res_delay,
-                                                          GNUNET_YES));
-      GNUNET_break (0);
-      GNUNET_SCHEDULER_shutdown ();
-      return;
-    }
-    break;
-
-  case GNUNET_NO:
-    GNUNET_break ((0 != amount) ||
-                  (0 != res_delay.rel_value_us));
-    break;
-
-  case GNUNET_SYSERR:
-    if ((amount != 0) ||
-        (0 == res_delay.rel_value_us))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Unexpectedly reserved %d bytes with delay %s!\n",
-                  (int) amount,
-                  GNUNET_STRINGS_relative_time_to_string (res_delay,
-                                                          GNUNET_YES));
-      GNUNET_break (0);
-      GNUNET_SCHEDULER_shutdown ();
-      return;
-    }
-    break;
-  }
-  off++;
-  run_interpreter ();
-}
-
-
-/**
- * Main interpreter loop. Runs the steps of the test.
- *
- * @param cls NULL
- */
-static void
-interpreter (void *cls)
-
-{
-  struct Command *cmd;
-
-  interpreter_task = NULL;
-  while (1)
-  {
-    cmd = &test_commands[off];
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "#%u: %d %s\n",
-                off,
-                (int) cmd->code,
-                (NULL != cmd->label) ? cmd->label : "");
-    switch (cmd->code)
-    {
-    case CMD_END_PASS:
-      ret = 0;
-      GNUNET_SCHEDULER_shutdown ();
-      return;
-
-    case CMD_ADD_ADDRESS:
-      {
-        struct GNUNET_HELLO_Address *addr;
-        struct GNUNET_ATS_Session *session;
-
-        addr = make_address (cmd->details.add_address.pid,
-                             cmd->details.add_address.addr_num,
-                             cmd->details.add_address.addr_flags);
-        session = make_session (cmd->details.add_address.session);
-        if (cmd->details.add_address.expect_fail)
-          GNUNET_log_skip (1, GNUNET_NO);
-        cmd->details.add_address.ar
-          = GNUNET_ATS_address_add (sched_ats,
-                                    addr,
-                                    session,
-                                    &cmd->details.add_address.properties);
-        GNUNET_free (addr);
-        if (cmd->details.add_address.expect_fail)
-        {
-          GNUNET_log_skip (0, GNUNET_YES);
-        }
-        else if (NULL == cmd->details.add_address.ar)
-        {
-          GNUNET_break (0);
-          GNUNET_SCHEDULER_shutdown ();
-          return;
-        }
-        off++;
-        break;
-      }
-
-    case CMD_DEL_ADDRESS:
-      {
-        struct Command *add;
-
-        add = find_command (CMD_ADD_ADDRESS,
-                            cmd->details.del_address.add_label);
-        GNUNET_assert (NULL != add->details.add_address.ar);
-        GNUNET_ATS_address_destroy (add->details.add_address.ar);
-        add->details.add_address.ar = NULL;
-        off++;
-        break;
-      }
-
-    case CMD_AWAIT_ADDRESS_SUGGESTION:
-      {
-        struct GNUNET_PeerIdentity pid;
-        struct GNUNET_HELLO_Address *addr;
-        struct Command *add;
-        struct AddressSuggestData *asd;
-        int done;
-
-        make_peer (cmd->details.await_address_suggestion.pid,
-                   &pid);
-        asd = find_address_suggestion (&pid);
-        if (NULL == asd)
-          return;
-        if (GNUNET_NO == asd->active)
-          return;   /* last suggestion was to disconnect, wait longer */
-        done = GNUNET_YES;
-        if (NULL != cmd->details.await_address_suggestion.add_label)
-        {
-          done = GNUNET_NO;
-          add = find_command (CMD_ADD_ADDRESS,
-                              cmd->details.await_address_suggestion.add_label);
-          addr = make_address (add->details.add_address.pid,
-                               add->details.add_address.addr_num,
-                               add->details.add_address.addr_flags);
-          if ((asd->session ==
-               make_session (add->details.add_address.session)) &&
-              (0 ==
-               GNUNET_HELLO_address_cmp (addr,
-                                         asd->address)))
-            done = GNUNET_YES;
-          GNUNET_free (addr);
-        }
-        if (GNUNET_NO == done)
-          return;
-        off++;
-        break;
-      }
-
-    case CMD_AWAIT_DISCONNECT_SUGGESTION:
-      {
-        struct GNUNET_PeerIdentity pid;
-        struct AddressSuggestData *asd;
-
-        make_peer (cmd->details.await_disconnect_suggestion.pid,
-                   &pid);
-        asd = find_address_suggestion (&pid);
-        if (NULL == asd)
-          return;   /* odd, no suggestion at all yet!? */
-        if (GNUNET_YES == asd->active)
-          return;   /* last suggestion was to activate, wait longer */
-        /* last suggestion was to deactivate, condition satisfied! */
-        off++;
-        break;
-      }
-
-    case CMD_REQUEST_CONNECTION_START:
-      {
-        struct GNUNET_PeerIdentity pid;
-
-        make_peer (cmd->details.request_connection_start.pid,
-                   &pid);
-        cmd->details.request_connection_start.csh
-          = GNUNET_ATS_connectivity_suggest (con_ats,
-                                             &pid,
-                                             1);
-        off++;
-        break;
-      }
-
-    case CMD_REQUEST_CONNECTION_STOP:
-      {
-        struct Command *start;
-
-        start = find_command (CMD_REQUEST_CONNECTION_START,
-                              
cmd->details.request_connection_stop.connect_label);
-        GNUNET_ATS_connectivity_suggest_cancel (
-          start->details.request_connection_start.csh);
-        start->details.request_connection_start.csh = NULL;
-        off++;
-        break;
-      }
-
-    case CMD_AWAIT_ADDRESS_INFORMATION:
-      {
-        struct AddressInformationData *aid;
-        struct Command *add;
-        struct Command *update;
-        struct GNUNET_HELLO_Address *addr;
-        const struct GNUNET_ATS_Properties *cmp;
-
-        add = find_command (CMD_ADD_ADDRESS,
-                            cmd->details.await_address_information.add_label);
-        update = find_command (CMD_UPDATE_ADDRESS,
-                               cmd->details.await_address_information.
-                               update_label);
-        addr = make_address (add->details.add_address.pid,
-                             add->details.add_address.addr_num,
-                             add->details.add_address.addr_flags);
-        aid = find_address_information (addr);
-        GNUNET_free (addr);
-        if (NULL == update)
-          cmp = &add->details.add_address.properties;
-        else
-          cmp = &update->details.update_address.properties;
-        if ((NULL != aid) &&
-            (cmp->delay.rel_value_us == aid->properties.delay.rel_value_us) &&
-            (cmp->utilization_out == aid->properties.utilization_out) &&
-            (cmp->utilization_in == aid->properties.utilization_in) &&
-            (cmp->distance == aid->properties.distance) &&
-            (cmp->scope == aid->properties.scope))
-        {
-          off++;
-          break;
-        }
-        return;
-      }
-
-    case CMD_UPDATE_ADDRESS:
-      {
-        struct Command *add;
-
-        add = find_command (CMD_ADD_ADDRESS,
-                            cmd->details.update_address.add_label);
-        GNUNET_assert (NULL != add->details.add_address.ar);
-        GNUNET_ATS_address_update (add->details.add_address.ar,
-                                   &cmd->details.update_address.properties);
-        off++;
-        break;
-      }
-
-    case CMD_ADD_SESSION:
-      {
-        struct Command *add;
-        struct GNUNET_ATS_Session *session;
-
-        add = find_command (CMD_ADD_ADDRESS,
-                            cmd->details.add_session.add_label);
-        session = make_session (cmd->details.add_session.session);
-        GNUNET_assert (NULL != add->details.add_address.ar);
-        GNUNET_ATS_address_add_session (add->details.add_address.ar,
-                                        session);
-        off++;
-        break;
-      }
-
-    case CMD_DEL_SESSION:
-      {
-        struct Command *add_address;
-        struct Command *add_session;
-        struct GNUNET_ATS_Session *session;
-
-        add_session = find_command (CMD_ADD_SESSION,
-                                    
cmd->details.del_session.add_session_label);
-        add_address = find_command (CMD_ADD_ADDRESS,
-                                    
add_session->details.add_session.add_label);
-        GNUNET_assert (NULL != add_address->details.add_address.ar);
-        session = make_session (add_session->details.add_session.session);
-        GNUNET_ATS_address_del_session (add_address->details.add_address.ar,
-                                        session);
-        off++;
-        break;
-      }
-
-    case CMD_CHANGE_PREFERENCE:
-      {
-        struct GNUNET_PeerIdentity pid;
-
-        make_peer (cmd->details.change_preference.pid,
-                   &pid);
-        GNUNET_ATS_performance_change_preference (perf_ats,
-                                                  &pid,
-                                                  GNUNET_ATS_PREFERENCE_END);
-        off++;
-        break;
-      }
-
-    case CMD_PROVIDE_FEEDBACK:
-      {
-        struct GNUNET_PeerIdentity pid;
-
-        make_peer (cmd->details.provide_feedback.pid,
-                   &pid);
-        GNUNET_ATS_performance_give_feedback (perf_ats,
-                                              &pid,
-                                              cmd->details.provide_feedback.
-                                              scope,
-                                              GNUNET_ATS_PREFERENCE_END);
-        off++;
-        break;
-      }
-
-    case CMD_LIST_ADDRESSES:
-      {
-        struct GNUNET_PeerIdentity pid;
-
-        make_peer (cmd->details.list_addresses.pid,
-                   &pid);
-        cmd->details.list_addresses.alh
-          = GNUNET_ATS_performance_list_addresses (perf_ats,
-                                                   &pid,
-                                                   cmd->details.list_addresses.
-                                                   all,
-                                                   &info_cb,
-                                                   cmd);
-        return;
-      }
-
-    case CMD_RESERVE_BANDWIDTH:
-      {
-        struct GNUNET_PeerIdentity pid;
-
-        make_peer (cmd->details.reserve_bandwidth.pid,
-                   &pid);
-        cmd->details.reserve_bandwidth.rc
-          = GNUNET_ATS_reserve_bandwidth (perf_ats,
-                                          &pid,
-                                          
cmd->details.reserve_bandwidth.amount,
-                                          &reservation_cb,
-                                          cmd);
-        return;
-      }
-
-    case CMD_SLEEP:
-      off++;
-      interpreter_task = GNUNET_SCHEDULER_add_delayed 
(cmd->details.sleep.delay,
-                                                       &interpreter,
-                                                       NULL);
-      return;
-    }     /* end switch */
-  }   /* end while(1) */
-}
-
-
-/**
- * Signature of a function called by ATS with the current bandwidth
- * and address preferences as determined by ATS.
- *
- * @param cls closure, should point to "asc-closure"
- * @param peer for which we suggest an address, NULL if ATS connection died
- * @param address suggested address (including peer identity of the peer),
- *             may be NULL to signal disconnect from peer
- * @param session session to use, NULL to establish a new outgoing session
- * @param bandwidth_out assigned outbound bandwidth for the connection,
- *        0 to signal disconnect
- * @param bandwidth_in assigned inbound bandwidth for the connection,
- *        0 to signal disconnect
- */
-static void
-address_suggest_cb (void *cls,
-                    const struct GNUNET_PeerIdentity *peer,
-                    const struct GNUNET_HELLO_Address *address,
-                    struct GNUNET_ATS_Session *session,
-                    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-                    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
-{
-  const char *asc_cls = cls;
-  struct AddressSuggestData *asd;
-
-  GNUNET_break (0 == strcmp (asc_cls, "asc-closure"));
-  if (NULL == peer)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Connection to ATS died, likely a crash!\n");
-    GNUNET_SCHEDULER_shutdown ();
-#if 0
-    /* This is what we should do if we wanted to continue past
-       the ATS crash. */
-    GNUNET_CONTAINER_multipeermap_iterate (p2asd,
-                                           &free_asd,
-                                           NULL);
-    GNUNET_CONTAINER_multipeermap_iterate (p2aid,
-                                           &free_aid,
-                                           NULL);
-#endif
-    return;
-  }
-
-  asd = find_address_suggestion (peer);
-  if (NULL == asd)
-  {
-    asd = GNUNET_new (struct AddressSuggestData);
-    GNUNET_assert (GNUNET_YES ==
-                   GNUNET_CONTAINER_multipeermap_put (p2asd,
-                                                      peer,
-                                                      asd,
-                                                      
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-  }
-  if ((0 == ntohl (bandwidth_out.value__)) &&
-      (0 == ntohl (bandwidth_in.value__)))
-    asd->active = GNUNET_NO;
-  else
-    asd->active = GNUNET_YES;
-  asd->bandwidth_out = bandwidth_out;
-  asd->bandwidth_in = bandwidth_in;
-  asd->session = session;
-  GNUNET_free (asd->address);
-  asd->address = NULL;
-  if (NULL != address)
-    asd->address = GNUNET_HELLO_address_copy (address);
-  if (NULL == interpreter_task)
-    run_interpreter ();
-}
-
-
-/**
- * Signature of a function that is called with QoS information about an 
address.
- *
- * @param cls closure, should point to "aic-closure"
- * @param address the address, NULL if ATS service was disconnected
- * @param address_active #GNUNET_YES if this address is actively used
- *        to maintain a connection to a peer;
- *        #GNUNET_NO if the address is not actively used;
- *        #GNUNET_SYSERR if this address is no longer available for ATS
- * @param bandwidth_out assigned outbound bandwidth for the connection
- * @param bandwidth_in assigned inbound bandwidth for the connection
- * @param prop performance data for the address
- */
-static void
-address_information_cb (void *cls,
-                        const struct GNUNET_HELLO_Address *address,
-                        int address_active,
-                        struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-                        struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                        const struct GNUNET_ATS_Properties *prop)
-{
-  const char *aic_cls = cls;
-  struct AddressInformationData *aid;
-
-  GNUNET_break (0 == strcmp (aic_cls, "aic-closure"));
-  if (NULL == address)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Connection to ATS died, likely a crash!\n");
-    GNUNET_CONTAINER_multipeermap_iterate (p2aid,
-                                           &free_aid,
-                                           NULL);
-    return;
-  }
-
-  aid = find_address_information (address);
-  if (NULL == aid)
-  {
-    aid = GNUNET_new (struct AddressInformationData);
-    aid->address = GNUNET_HELLO_address_copy (address);
-    GNUNET_assert (GNUNET_YES ==
-                   GNUNET_CONTAINER_multipeermap_put (p2aid,
-                                                      &address->peer,
-                                                      aid,
-                                                      
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
-  }
-  aid->active = address_active;
-  aid->bandwidth_out = bandwidth_out;
-  aid->bandwidth_in = bandwidth_in;
-  aid->properties = *prop;
-  if (NULL == interpreter_task)
-    run_interpreter ();
-}
-
-
-/**
- * Function run once the ATS service has been started.
- *
- * @param cls NULL
- * @param cfg configuration for the testcase
- * @param peer handle to the peer
- */
-static void
-run (void *cls,
-     const struct GNUNET_CONFIGURATION_Handle *cfg,
-     struct GNUNET_TESTING_Peer *peer)
-{
-  p2asd = GNUNET_CONTAINER_multipeermap_create (128,
-                                                GNUNET_NO);
-  p2aid = GNUNET_CONTAINER_multipeermap_create (128,
-                                                GNUNET_NO);
-  GNUNET_SCHEDULER_add_delayed (TIMEOUT,
-                                &end,
-                                NULL);
-
-  sched_ats = GNUNET_ATS_scheduling_init (cfg,
-                                          &address_suggest_cb,
-                                          "asc-closure");
-  if (NULL == sched_ats)
-  {
-    GNUNET_break (0);
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-  con_ats = GNUNET_ATS_connectivity_init (cfg);
-  if (NULL == con_ats)
-  {
-    GNUNET_break (0);
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-  perf_ats = GNUNET_ATS_performance_init (cfg,
-                                          &address_information_cb,
-                                          "aic-closure");
-  if (NULL == perf_ats)
-  {
-    GNUNET_break (0);
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-  run_interpreter ();
-}
-
-
-/**
- * Run ATS test.
- *
- * @param argc length of @a argv
- * @param argv command line
- * @param cmds commands to run with the interpreter
- * @param timeout how long is the test allowed to take?
- * @return 0 on success
- */
-int
-TEST_ATS_run (int argc,
-              char *argv[],
-              struct Command *cmds,
-              struct GNUNET_TIME_Relative timeout)
-{
-  char *test_filename = GNUNET_strdup (argv[0]);
-  char *sep;
-  char *config_file;
-  char *underscore;
-
-  test_commands = cmds;
-  TIMEOUT = timeout;
-  if (NULL != (sep = strstr (test_filename, ".exe")))
-    sep[0] = '\0';
-  underscore = strrchr (test_filename, (int) '_');
-  GNUNET_assert (NULL != underscore);
-  GNUNET_asprintf (&config_file,
-                   "test_ats_api_%s.conf",
-                   underscore + 1);
-  ret = 2;
-  if (0 != GNUNET_TESTING_peer_run ("test-ats-api",
-                                    config_file,
-                                    &run, NULL))
-    ret = 1;
-  GNUNET_free (test_filename);
-  GNUNET_free (config_file);
-  return ret;
-}
-
-
-/* end of test_ats_lib.c */
diff --git a/src/ats/test_ats_lib.h b/src/ats/test_ats_lib.h
deleted file mode 100644
index 60b459f79..000000000
--- a/src/ats/test_ats_lib.h
+++ /dev/null
@@ -1,512 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/test_ats_lib.h
- * @brief test ATS library with a generic interpreter for running ATS tests
- * @author Christian Grothoff
- */
-#ifndef TEST_ATS_LIB_H
-#define TEST_ATS_LIB_H
-
-#include "gnunet_util_lib.h"
-#include "gnunet_ats_service.h"
-#include "gnunet_testing_lib.h"
-
-
-/**
- * Commands for the interpreter.
- */
-enum CommandCode
-{
-  /**
-   * End the test (passing).
-   */
-  CMD_END_PASS = 0,
-
-  /**
-   * Call #GNUNET_ATS_address_add().
-   */
-  CMD_ADD_ADDRESS,
-
-  /**
-   * Call #GNUNET_ATS_address_del().
-   */
-  CMD_DEL_ADDRESS,
-
-  /**
-   * Wait for ATS to suggest address.
-   */
-  CMD_AWAIT_ADDRESS_SUGGESTION,
-
-  /**
-   * Wait for ATS to suggest disconnect.
-   */
-  CMD_AWAIT_DISCONNECT_SUGGESTION,
-
-  /**
-   * Ask ATS to connect to a peer, using
-   * #GNUNET_ATS_connectivity_suggest().
-   */
-  CMD_REQUEST_CONNECTION_START,
-
-  /**
-   * Tell ATS we no longer need a connection to a peer, using
-   * #GNUNET_ATS_connectivity_suggest_cancel().
-   */
-  CMD_REQUEST_CONNECTION_STOP,
-
-  /**
-   * Wait for certain address information to be provided.
-   */
-  CMD_AWAIT_ADDRESS_INFORMATION,
-
-  /**
-   * Update properties of an address, using
-   * #GNUNET_ATS_address_update().
-   */
-  CMD_UPDATE_ADDRESS,
-
-  /**
-   * Add session to an address, using
-   * #GNUNET_ATS_address_add_session().
-   */
-  CMD_ADD_SESSION,
-
-  /**
-   * Remove session from an address, using
-   * #GNUNET_ATS_address_del_session().
-   */
-  CMD_DEL_SESSION,
-
-  /**
-   * Change performance preferences for a peer, testing
-   * #GNUNET_ATS_performance_change_preference().
-   */
-  CMD_CHANGE_PREFERENCE,
-
-  /**
-   * Provide allocation quality feedback, testing
-   * #GNUNET_ATS_performance_give_feedback().
-   */
-  CMD_PROVIDE_FEEDBACK,
-
-  /**
-   * Obtain list of all addresses, testing
-   * #GNUNET_ATS_performance_list_addresses().
-   */
-  CMD_LIST_ADDRESSES,
-
-  /**
-   * Reserve bandwidth, testing
-   * #GNUNET_ATS_reserve_bandwidth().
-   */
-  CMD_RESERVE_BANDWIDTH,
-
-  /**
-   * Wait for a bit.
-   */
-  CMD_SLEEP
-};
-
-
-/**
- * Details for the #CMD_ADD_ADDRESS command.
- */
-struct CommandAddAddress
-{
-  /**
-   * Number of the peer (used to generate PID).
-   */
-  unsigned int pid;
-
-  /**
-   * Number of the address (used to generate binary address).
-   */
-  unsigned int addr_num;
-
-  /**
-   * Session to supply, 0 for NULL.
-   */
-  unsigned int session;
-
-  /**
-   * Flags to set for the address.
-   */
-  enum GNUNET_HELLO_AddressInfo addr_flags;
-
-  /**
-   * Performance properties to supply.
-   */
-  struct GNUNET_ATS_Properties properties;
-
-  /**
-   * Expect the operation to fail (duplicate).
-   */
-  int expect_fail;
-
-  /**
-   * Here the result of the add address operation will be stored.
-   */
-  struct GNUNET_ATS_AddressRecord *ar;
-};
-
-
-/**
- * Details for the #CMD_DEL_ADDRESS command.
- */
-struct CommandDelAddress
-{
-  /**
-   * Label of the corresponding #CMD_ADD_ADDRESS that
-   * we are now to remove.
-   */
-  const char *add_label;
-};
-
-
-/**
- * Details for the #CMD_AWAIT_ADDRESS_SUGGESTION command.
- */
-struct CommandAwaitAddressSuggestion
-{
-  /**
-   * For which peer do we expect a suggestion?
-   */
-  unsigned int pid;
-
-  /**
-   * If we expect the address suggested to match a particular
-   * addition, specify the label of the add operation here. Otherwise
-   * use NULL for "any" available address.
-   */
-  const char *add_label;
-};
-
-
-/**
- * Details for the #CMD_AWAIT_DISCONNECT_SUGGESTION command.
- */
-struct CommandAwaitDisconnectSuggestion
-{
-  /**
-   * For which peer do we expect the disconnect?
-   */
-  unsigned int pid;
-};
-
-
-/**
- * Details for the #CMD_REQUEST_CONNECTION_START command.
- */
-struct CommandRequestConnectionStart
-{
-  /**
-   * Identity of the peer we would like to connect to.
-   */
-  unsigned int pid;
-
-  /**
-   * Location where we store the handle returned from
-   * #GNUNET_ATS_connectivity_suggest().
-   */
-  struct GNUNET_ATS_ConnectivitySuggestHandle *csh;
-};
-
-
-/**
- * Details for the #CMD_REQUEST_CONNECTION_STOP command.
- */
-struct CommandRequestConnectionStop
-{
-  /**
-   * Label of the corresponding #CMD_REQUEST_CONNECTION_START that
-   * we are now stopping.
-   */
-  const char *connect_label;
-};
-
-
-/**
- * Details for the #CMD_AWAIT_ADDRESS_INFORMATION command.
- */
-struct CommandAwaitAddressInformation
-{
-  /**
-   * For which address do we expect information?
-   * The address is identified by the respective
-   * label of the corresponding add operation.
-   */
-  const char *add_label;
-
-  /**
-   * Label of a possible update operation that may
-   * have modified the properties.  NULL to use
-   * the properties from the @e add_label.
-   */
-  const char *update_label;
-};
-
-
-/**
- * Details for the #CMD_UPDATE_ADDRESS command.
- */
-struct CommandUpdateAddress
-{
-  /**
-   * Label of the addresses's add operation.
-   */
-  const char *add_label;
-
-  /**
-   * Performance properties to supply.
-   */
-  struct GNUNET_ATS_Properties properties;
-};
-
-
-/**
- * Details for the #CMD_ADD_SESSION command.
- */
-struct CommandAddSession
-{
-  /**
-   * Label of the addresses's add operation.
-   */
-  const char *add_label;
-
-  /**
-   * Session to supply.
-   */
-  unsigned int session;
-};
-
-
-/**
- * Details for the #CMD_DEL_SESSION command.
- */
-struct CommandDelSession
-{
-  /**
-   * Label of the addresses's add operation.
-   */
-  const char *add_session_label;
-};
-
-
-/**
- * Details for the #CMD_CHANGE_PREFERENCE command.
- */
-struct CommandChangePreference
-{
-  /**
-   * Identity of the peer we have a preference change towards.
-   */
-  unsigned int pid;
-
-  /* FIXME: preference details! */
-};
-
-
-/**
- * Details for the #CMD_PROVIDE_FEEDBACK command.
- */
-struct CommandProvideFeedback
-{
-  /**
-   * Identity of the peer we have a feedback for.
-   */
-  unsigned int pid;
-
-  /**
-   * Over which timeframe does the feedback apply?
-   */
-  struct GNUNET_TIME_Relative scope;
-
-  /* FIXME: feedback details! */
-};
-
-
-/**
- * Details for the #CMD_LIST_ADDRESSES command.
- */
-struct CommandListAddresses
-{
-  /**
-   * Identity of the peer we want a list for.
-   */
-  unsigned int pid;
-
-  /**
-   * All addresses or just active?
-   */
-  int all;
-
-  /**
-   * Minimum number of addresses the callback may report.
-   */
-  unsigned int min_calls;
-
-  /**
-   * Maximum number of addresses the callback may report.
-   */
-  unsigned int max_calls;
-
-  /**
-   * Minimum number of active addresses the callback may report.
-   */
-  unsigned int min_active_calls;
-
-  /**
-   * Maximum number of active addresses the callback may report.
-   */
-  unsigned int max_active_calls;
-
-  /**
-   * Number of calls the command invoked the callback with
-   * an address marked as active. (Set by command).
-   */
-  unsigned int active_calls;
-
-  /**
-   * Number of calls the command invoked the callback with
-   * any address marked as available to ATS. (Set by command).
-   */
-  unsigned int calls;
-
-  /**
-   * Location where we store the return value from
-   * #GNUNET_ATS_performance_list_addresses().
-   */
-  struct GNUNET_ATS_AddressListHandle *alh;
-};
-
-
-/**
- * Details for the #CMD_RESERVE_BANDWIDTH command.
- */
-struct CommandReserveBandwidth
-{
-  /**
-   * For which peer do we reserve bandwidth?
-   */
-  unsigned int pid;
-
-  /**
-   * How much should we try to reserve?
-   */
-  int32_t amount;
-
-  /**
-   * Should we expect this to work or fail?
-   * #GNUNET_YES: must work
-   * #GNUNET_NO: may work or fail
-   * #GNUNET_SYSERR: must fail
-   */
-  int expected_result;
-
-  /**
-   * Location where we store the return value from
-   * #GNUNET_ATS_reserve_bandwidth().
-   */
-  struct GNUNET_ATS_ReservationContext *rc;
-};
-
-
-/**
- * Details for the #CMD_SLEEP command.
- */
-struct CommandSleep
-{
-  /**
-   * How long should we wait before running the next command?
-   */
-  struct GNUNET_TIME_Relative delay;
-};
-
-
-/**
- * A command for the test case interpreter.
- */
-struct Command
-{
-  /**
-   * Command code to run.
-   */
-  enum CommandCode code;
-
-  /**
-   * Commands can be given a label so we can reference them later.
-   */
-  const char *label;
-
-  /**
-   * Additional arguments to commands, if any.
-   */
-  union
-  {
-    struct CommandAddAddress add_address;
-
-    struct CommandDelAddress del_address;
-
-    struct CommandAwaitAddressSuggestion await_address_suggestion;
-
-    struct CommandAwaitDisconnectSuggestion await_disconnect_suggestion;
-
-    struct CommandRequestConnectionStart request_connection_start;
-
-    struct CommandRequestConnectionStop request_connection_stop;
-
-    struct CommandAwaitAddressInformation await_address_information;
-
-    struct CommandUpdateAddress update_address;
-
-    struct CommandAddSession add_session;
-
-    struct CommandDelSession del_session;
-
-    struct CommandChangePreference change_preference;
-
-    struct CommandProvideFeedback provide_feedback;
-
-    struct CommandListAddresses list_addresses;
-
-    struct CommandReserveBandwidth reserve_bandwidth;
-
-    struct CommandSleep sleep;
-  } details;
-};
-
-
-/**
- * Run ATS test.
- *
- * @param argc length of @a argv
- * @param argv command line
- * @param cmds commands to run with the interpreter
- * @param timeout how long is the test allowed to take?
- * @return 0 on success
- */
-int
-TEST_ATS_run (int argc,
-              char *argv[],
-              struct Command *cmds,
-              struct GNUNET_TIME_Relative timeout);
-
-#endif
diff --git a/src/ats/test_ats_reservation_api.c 
b/src/ats/test_ats_reservation_api.c
deleted file mode 100644
index f6a964df4..000000000
--- a/src/ats/test_ats_reservation_api.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/test_ats_reservation_api.c
- * @brief test ATS bandwidth reservation API
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "test_ats_lib.h"
-
-/**
- * Global timeout for the testcase.
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
-
-/**
- * Definition of the test as a sequence of commands.
- */
-static struct Command test_commands[] = {
-  /* 0: add initial address */
-  {
-    .code = CMD_ADD_ADDRESS,
-    .label = "add-address-0-0",
-    .details.add_address = {
-      .pid = 0,
-      .addr_num = 0,
-      .session = 0,
-      .properties = {
-        /* use network with 65k quota! */
-        .scope = GNUNET_NT_WAN
-      }
-
-
-    }
-
-
-  },
-  /* 1: some solver still require explicit start */
-  {
-    .code = CMD_REQUEST_CONNECTION_START,
-    .label = "request-0",
-    .details.request_connection_start = {
-      .pid = 0
-    }
-
-
-  },
-  /* 2: check we got an address */
-  {
-    .code = CMD_AWAIT_ADDRESS_SUGGESTION,
-    .details.await_address_suggestion = {
-      .add_label = "add-address-0-0"
-    }
-
-
-  },
-  /* 3: sleep 7s, should give us 5s * 64k/s = 320k buffer;
-     Note that this depends on MAX_BANDWIDTH_CARRY_S.  We
-     sleep more than 5s to show that only MAX_BANDWIDTH carries. */
-  {
-    .code = CMD_SLEEP,
-    .label = "sleep",
-    .details.sleep.delay = { 7 * 1000LL * 1000LL }
-  },
-  /* 4: reserve 128k -- should work (5s carry, so we had 320k) */
-  {
-    .code = CMD_RESERVE_BANDWIDTH,
-    .details.reserve_bandwidth = {
-      .pid = 0,
-      .amount = 128 * 1024,
-      .expected_result = GNUNET_YES
-    }
-
-
-  },
-  /* 5: reserve another 192k -- should just work (now exactly pushing the 
limit) */
-  {
-    .code = CMD_RESERVE_BANDWIDTH,
-    .label = "big reservation",
-    .details.reserve_bandwidth = {
-      .pid = 0,
-      .amount = 192 * 1024,
-      .expected_result = GNUNET_YES
-    }
-
-
-  },
-  /* 6: reserve another 32M -- should now fail (if MAX_BANDWIDTH_CARRY_S
-     is precisely observed) */
-  {
-    .code = CMD_RESERVE_BANDWIDTH,
-    .label = "failing reservation",
-    .details.reserve_bandwidth = {
-      .pid = 0,
-      .amount = 32 * 1024 * 1024,
-      .expected_result = GNUNET_SYSERR
-    }
-
-
-  },
-  /* 7: sleep 3s, should give us 3s * 64k/s - 32k = 160k buffer */
-  {
-    .code = CMD_SLEEP,
-    .label = "sleep",
-    .details.sleep.delay = { 6 * 1000LL * 1000LL }
-  },
-  /* 8: reserve another 160k -- should now work */
-  {
-    .code = CMD_RESERVE_BANDWIDTH,
-    .label = "successful final reservation",
-    .details.reserve_bandwidth = {
-      .pid = 0,
-      .amount = 160 * 1024,
-      .expected_result = GNUNET_YES
-    }
-
-
-  },
-  /* 9: remove address */
-  {
-    .code = CMD_DEL_ADDRESS,
-    .details.del_address = {
-      .add_label = "add-address-0-0"
-    }
-
-
-  },
-  /* 10: check we got disconnected */
-  {
-    .code = CMD_AWAIT_DISCONNECT_SUGGESTION,
-    .details.await_disconnect_suggestion = {
-      .pid = 0
-    }
-
-
-  },
-  /* 11: just for symmetry, also stop asking for the connection */
-  {
-    .code = CMD_REQUEST_CONNECTION_STOP,
-    .details.request_connection_stop = {
-      .connect_label = "request-0",
-    }
-
-
-  },
-  /* Test ends successfully */
-  {
-    .code = CMD_END_PASS
-  }
-};
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  return TEST_ATS_run (argc,
-                       argv,
-                       test_commands,
-                       TIMEOUT);
-}
-
-
-/* end of file test_ats_reservation_api.c */
diff --git a/src/ats/test_ats_solver_default.conf 
b/src/ats/test_ats_solver_default.conf
deleted file mode 100644
index 2d8927abd..000000000
--- a/src/ats/test_ats_solver_default.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-@INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf
-
diff --git a/src/ats/test_ats_solver_delayed_proportional.conf 
b/src/ats/test_ats_solver_delayed_proportional.conf
deleted file mode 100644
index fdfeb90b8..000000000
--- a/src/ats/test_ats_solver_delayed_proportional.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-@INLINE@ test_ats_solver_default.conf
-
-[ats]
-PREFIX = ./test_delay -t 10 --
-MODE = proportional
-# UNSPECIFIED
-UNSPECIFIED_QUOTA_IN = 64 KiB
-UNSPECIFIED_QUOTA_OUT = 64 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = 64 KiB
-WAN_QUOTA_OUT = 64 KiB
-# WLAN
-WLAN_QUOTA_IN = 512
-WLAN_QUOTA_OUT = 512
diff --git a/src/ats/test_ats_solver_proportional.conf 
b/src/ats/test_ats_solver_proportional.conf
deleted file mode 100644
index 49815134b..000000000
--- a/src/ats/test_ats_solver_proportional.conf
+++ /dev/null
@@ -1,19 +0,0 @@
-@INLINE@ test_ats_solver_default.conf
-
-[ats]
-MODE = proportional
-# UNSPECIFIED
-UNSPECIFIED_QUOTA_IN = 64 KiB
-UNSPECIFIED_QUOTA_OUT = 64 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = 64 KiB
-WAN_QUOTA_OUT = 64 KiB
-# WLAN
-WLAN_QUOTA_IN = 512
-WLAN_QUOTA_OUT = 512
diff --git a/src/ats/test_delay b/src/ats/test_delay
deleted file mode 100755
index 31c7777c4..000000000
--- a/src/ats/test_delay
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-TEMP=$(getopt -o t: -- "$@")
-
-if [ $? != 0 ] ; then
-  exit 1
-fi
-
-eval set -- "$TEMP"
-
-while true ; do
-  case "$1" in
-    (-t) sleep "$2" ; shift 2 ;;
-    (--) shift ; break ;;
-    (*) echo "Error parsing getopt output" ; exit 1 ;;
-  esac
-done
-exec "$@"
diff --git a/src/cadet/Makefile.am b/src/cadet/Makefile.am
index d942c6495..9f59aba3c 100644
--- a/src/cadet/Makefile.am
+++ b/src/cadet/Makefile.am
@@ -18,15 +18,13 @@ plugindir = $(libdir)/gnunet
 AM_CLFAGS = -g
 
 libexec_PROGRAMS = \
- gnunet-service-cadet \
- $(EXP_LIBEXEC)
+ gnunet-service-cadet
 
 bin_PROGRAMS = \
  gnunet-cadet
 
 lib_LTLIBRARIES = \
-  libgnunetcadet.la \
-  $(EXP_LIB)
+  libgnunetcadet.la
 
 libgnunetcadet_la_SOURCES = \
   cadet_api.c \
@@ -64,47 +62,19 @@ gnunet_service_cadet_SOURCES = \
  gnunet-service-cadet_peer.c gnunet-service-cadet_peer.h
 gnunet_service_cadet_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/dht/libgnunetdht.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/transport/libgnunettransport.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
+  $(top_builddir)/src/transport/libgnunettransportapplication.la \
+  $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/hello/libgnunethello.la \
   $(top_builddir)/src/block/libgnunetblock.la
 if LINUX
-  gnunet_service_cadet_LDFLAGS = -lrt \
+gnunet_service_cadet_LDFLAGS = -lrt \
     $(GN_LIBINTL)
 endif
 
 
- noinst_LTLIBRARIES = libgnunetcadettest.la $(noinst_LIB_EXP)
-# noinst_PROGRAMS = gnunet-cadet-profiler
-
-check_PROGRAMS = \
-  test_cadet_local_mq \
-  test_cadet_2_forward \
-  test_cadet_2_forward \
-  test_cadet_2_signal \
-  test_cadet_2_keepalive \
-  test_cadet_2_speed \
-  test_cadet_2_speed_ack \
-  test_cadet_2_speed_backwards \
-  test_cadet_2_speed_reliable \
-  test_cadet_2_speed_reliable_backwards \
-  test_cadet_2_reopen \
-  test_cadet_2_destroy \
-  test_cadet_5_forward \
-  test_cadet_5_signal \
-  test_cadet_5_keepalive \
-  test_cadet_5_speed \
-  test_cadet_5_speed_ack \
-  test_cadet_5_speed_reliable \
-  test_cadet_5_speed_reliable_backwards \
-  test_cadet_5_speed_backwards \
-  test_cadet_5_reopen
-
-
 #gnunet_cadet_profiler_SOURCES = \
 #  gnunet-cadet-profiler.c
 #gnunet_cadet_profiler_LDADD = $(ld_cadet_test_lib)
@@ -117,106 +87,9 @@ test_cadet_local_mq_LDADD = \
   $(top_builddir)/src/testing/libgnunettesting.la \
   $(top_builddir)/src/util/libgnunetutil.la
 
-
-libgnunetcadettest_la_SOURCES = \
-  cadet_test_lib.c cadet_test_lib.h
-libgnunetcadettest_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- libgnunetcadet.la
-
-ld_cadet_test_lib = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/testing/libgnunettesting.la \
-  libgnunetcadet.la \
-  libgnunetcadettest.la \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la
-dep_cadet_test_lib = \
-  libgnunetcadet.la \
-  libgnunetcadettest.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la
-
-test_cadet_2_forward_SOURCES = \
-  test_cadet.c
-test_cadet_2_forward_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_2_signal_SOURCES = \
-  test_cadet.c
-test_cadet_2_signal_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_2_keepalive_SOURCES = \
-  test_cadet.c
-test_cadet_2_keepalive_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_2_speed_SOURCES = \
-  test_cadet.c
-test_cadet_2_speed_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_2_speed_ack_SOURCES = \
-  test_cadet.c
-test_cadet_2_speed_ack_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_2_speed_backwards_SOURCES = \
-  test_cadet.c
-test_cadet_2_speed_backwards_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_2_speed_reliable_SOURCES = \
-  test_cadet.c
-test_cadet_2_speed_reliable_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_2_speed_reliable_backwards_SOURCES = \
-  test_cadet.c
-test_cadet_2_speed_reliable_backwards_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_5_forward_SOURCES = \
-  test_cadet.c
-test_cadet_5_forward_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_5_signal_SOURCES = \
-  test_cadet.c
-test_cadet_5_signal_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_5_keepalive_SOURCES = \
-  test_cadet.c
-test_cadet_5_keepalive_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_5_speed_SOURCES = \
-  test_cadet.c
-test_cadet_5_speed_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_5_speed_ack_SOURCES = \
-  test_cadet.c
-test_cadet_5_speed_ack_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_5_speed_backwards_SOURCES = \
-  test_cadet.c
-test_cadet_5_speed_backwards_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_5_speed_reliable_SOURCES = \
-  test_cadet.c
-test_cadet_5_speed_reliable_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_5_speed_reliable_backwards_SOURCES = \
-  test_cadet.c
-test_cadet_5_speed_reliable_backwards_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_2_reopen_SOURCES = \
-  test_cadet.c
-test_cadet_2_reopen_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_5_reopen_SOURCES = \
-  test_cadet.c
-test_cadet_5_reopen_LDADD = $(ld_cadet_test_lib)
-
-test_cadet_2_destroy_SOURCES = \
-  test_cadet.c
-test_cadet_2_destroy_LDADD = $(ld_cadet_test_lib)
-
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
-TESTS = \
- $(check_PROGRAMS)
+TESTS = $(check_PROGRAMS)
 endif
 
 EXTRA_DIST = \
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c
index 07b580005..620e43cc8 100644
--- a/src/cadet/gnunet-service-cadet.c
+++ b/src/cadet/gnunet-service-cadet.c
@@ -36,6 +36,7 @@
 #include "gnunet_util_lib.h"
 #include "cadet.h"
 #include "gnunet_statistics_service.h"
+#include "gnunet_transport_application_service.h"
 #include "gnunet-service-cadet.h"
 #include "gnunet-service-cadet_channel.h"
 #include "gnunet-service-cadet_connection.h"
@@ -45,6 +46,8 @@
 #include "gnunet-service-cadet_tunnels.h"
 #include "gnunet-service-cadet_peer.h"
 #include "gnunet-service-cadet_paths.h"
+#include "gnunet_constants.h"
+
 
 #define LOG(level, ...) GNUNET_log (level, __VA_ARGS__)
 
@@ -116,9 +119,9 @@ const struct GNUNET_CONFIGURATION_Handle *cfg;
 struct GNUNET_STATISTICS_Handle *stats;
 
 /**
- * Handle to communicate with ATS.
+ * Handle to Transport service.
  */
-struct GNUNET_ATS_ConnectivityHandle *ats_ch;
+struct GNUNET_TRANSPORT_ApplicationHandle *transport;
 
 /**
  * Local peer own ID.
@@ -408,10 +411,10 @@ shutdown_rest ()
     GNUNET_CONTAINER_multishortmap_destroy (connections);
     connections = NULL;
   }
-  if (NULL != ats_ch)
+  if (NULL != transport)
   {
-    GNUNET_ATS_connectivity_done (ats_ch);
-    ats_ch = NULL;
+    GNUNET_TRANSPORT_application_done (transport);
+    transport = NULL;
   }
   GCD_shutdown ();
   GCH_shutdown ();
@@ -1299,7 +1302,7 @@ run (void *cls,
                                     c);
   GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
                                  NULL);
-  ats_ch = GNUNET_ATS_connectivity_init (c);
+  transport = GNUNET_TRANSPORT_application_init (c);
   /* FIXME: optimize code to allow GNUNET_YES here! */
   open_ports = GNUNET_CONTAINER_multihashmap_create (16,
                                                      GNUNET_NO);
diff --git a/src/cadet/gnunet-service-cadet.h b/src/cadet/gnunet-service-cadet.h
index 3d61b9973..8f2386d00 100644
--- a/src/cadet/gnunet-service-cadet.h
+++ b/src/cadet/gnunet-service-cadet.h
@@ -197,9 +197,9 @@ extern const struct GNUNET_CONFIGURATION_Handle *cfg;
 extern struct GNUNET_STATISTICS_Handle *stats;
 
 /**
- * Handle to communicate with ATS.
+ * Handle to Transport service.
  */
-extern struct GNUNET_ATS_ConnectivityHandle *ats_ch;
+extern struct GNUNET_TRANSPORT_ApplicationHandle *transport;
 
 /**
  * Local peer own ID.
diff --git a/src/cadet/gnunet-service-cadet_dht.c 
b/src/cadet/gnunet-service-cadet_dht.c
index 576753a38..9a8082339 100644
--- a/src/cadet/gnunet-service-cadet_dht.c
+++ b/src/cadet/gnunet-service-cadet_dht.c
@@ -119,7 +119,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute 
exp,
                     size_t size,
                     const void *data)
 {
-  const struct GNUNET_HELLO_Message *hello = data;
+  const struct GNUNET_MessageHeader *hello = data;
 
   (void) trunc_peer;
   GCPP_try_path_from_dht (get_path,
@@ -127,8 +127,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute 
exp,
                           put_path,
                           put_path_length);
   if ((size >= sizeof(struct GNUNET_HELLO_Message)) &&
-      (ntohs (hello->header.size) == size) &&
-      (size == GNUNET_HELLO_size (hello)))
+      (ntohs (hello->size) == size))
   {
     struct CadetPeer *peer;
 
@@ -152,13 +151,13 @@ static void
 announce_id (void *cls)
 {
   struct GNUNET_HashCode phash;
-  const struct GNUNET_HELLO_Message *hello;
+  const struct GNUNET_MessageHeader *hello;
   size_t size;
   struct GNUNET_TIME_Absolute expiration;
   struct GNUNET_TIME_Relative next_put;
 
   hello = GCH_get_mine ();
-  size = (NULL != hello) ? GNUNET_HELLO_size (hello) : 0;
+  size = (NULL != hello) ? ntohs(hello->size) : 0;
   if (0 == size)
   {
     expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
@@ -167,7 +166,7 @@ announce_id (void *cls)
   }
   else
   {
-    expiration = GNUNET_HELLO_get_last_expiration (hello);
+    expiration = GNUNET_HELLO_builder_get_expiration_time (hello);
     announce_delay = GNUNET_TIME_UNIT_SECONDS;
   }
 
diff --git a/src/cadet/gnunet-service-cadet_hello.c 
b/src/cadet/gnunet-service-cadet_hello.c
index e1850d60a..135fde25a 100644
--- a/src/cadet/gnunet-service-cadet_hello.c
+++ b/src/cadet/gnunet-service-cadet_hello.c
@@ -26,9 +26,8 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
-
 #include "gnunet_statistics_service.h"
-#include "gnunet_peerinfo_service.h"
+#include "gnunet_peerstore_service.h"
 #include "cadet_protocol.h"
 #include "gnunet-service-cadet.h"
 #include "gnunet-service-cadet_dht.h"
@@ -40,17 +39,18 @@
 /**
  * Hello message of local peer.
  */
-static struct GNUNET_HELLO_Message *mine;
+static struct GNUNET_MessageHeader *mine;
 
 /**
- * Handle to peerinfo service.
+ * Handle to the PEERSTORE service.
  */
-static struct GNUNET_PEERINFO_Handle *peerinfo;
+static struct GNUNET_PEERSTORE_Handle *peerstore;
 
 /**
- * Iterator context.
+ * Our peerstore notification context.  We use notification
+ * to instantly learn about new peers as they are discovered.
  */
-static struct GNUNET_PEERINFO_NotifyContext *nc;
+static struct GNUNET_PEERSTORE_NotifyContext *peerstore_notify;
 
 
 /**
@@ -64,7 +64,7 @@ static struct GNUNET_PEERINFO_NotifyContext *nc;
 static void
 got_hello (void *cls,
            const struct GNUNET_PeerIdentity *id,
-           const struct GNUNET_HELLO_Message *hello,
+           const struct GNUNET_MessageHeader *hello,
            const char *err_msg)
 {
   struct CadetPeer *peer;
@@ -76,7 +76,7 @@ got_hello (void *cls,
                           &my_full_id))
   {
     GNUNET_free (mine);
-    mine = (struct GNUNET_HELLO_Message *) GNUNET_copy_message 
(&hello->header);
+    mine = GNUNET_copy_message (hello);
     GCD_hello_update ();
     return;
   }
@@ -84,9 +84,9 @@ got_hello (void *cls,
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Hello for %s (%d bytes), expires on %s\n",
        GNUNET_i2s (id),
-       GNUNET_HELLO_size (hello),
+       ntohs (hello->size),
        GNUNET_STRINGS_absolute_time_to_string (
-         GNUNET_HELLO_get_last_expiration (hello)));
+         GNUNET_HELLO_builder_get_expiration_time (hello)));
   peer = GCP_get (id,
                   GNUNET_YES);
   GCP_set_hello (peer,
@@ -102,12 +102,11 @@ got_hello (void *cls,
 void
 GCH_init (const struct GNUNET_CONFIGURATION_Handle *c)
 {
-  GNUNET_assert (NULL == nc);
-  peerinfo = GNUNET_PEERINFO_connect (c);
-  nc = GNUNET_PEERINFO_notify (c,
-                               GNUNET_NO,
-                               &got_hello,
-                               NULL);
+  GNUNET_assert (NULL == peerstore_notify);
+  peerstore = GNUNET_PEERSTORE_connect (c);
+  peerstore_notify =
+    GNUNET_PEERSTORE_hello_changed_notify (peerstore, GNUNET_NO, &got_hello,
+                                           NULL);
 }
 
 
@@ -117,15 +116,15 @@ GCH_init (const struct GNUNET_CONFIGURATION_Handle *c)
 void
 GCH_shutdown ()
 {
-  if (NULL != nc)
+  if (NULL != peerstore_notify)
   {
-    GNUNET_PEERINFO_notify_cancel (nc);
-    nc = NULL;
+    GNUNET_PEERSTORE_hello_changed_notify_cancel (peerstore_notify);
+    peerstore_notify = NULL;
   }
-  if (NULL != peerinfo)
+  if (NULL != peerstore)
   {
-    GNUNET_PEERINFO_disconnect (peerinfo);
-    peerinfo = NULL;
+    GNUNET_PEERSTORE_disconnect (peerstore, GNUNET_YES);
+    peerstore = NULL;
   }
   if (NULL != mine)
   {
@@ -140,7 +139,7 @@ GCH_shutdown ()
  *
  * @return Own hello message.
  */
-const struct GNUNET_HELLO_Message *
+const struct GNUNET_MessageHeader *
 GCH_get_mine (void)
 {
   return mine;
diff --git a/src/cadet/gnunet-service-cadet_hello.h 
b/src/cadet/gnunet-service-cadet_hello.h
index 2cb444b4a..88c955bb9 100644
--- a/src/cadet/gnunet-service-cadet_hello.h
+++ b/src/cadet/gnunet-service-cadet_hello.h
@@ -40,7 +40,7 @@ extern "C"
 
 #include "platform.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
+#include "gnunet_hello_uri_lib.h"
 
 
 /**
@@ -64,7 +64,7 @@ GCH_shutdown (void);
  *
  * @return Own hello message.
  */
-const struct GNUNET_HELLO_Message *
+const struct GNUNET_MessageHeader *
 GCH_get_mine (void);
 
 
diff --git a/src/cadet/gnunet-service-cadet_peer.c 
b/src/cadet/gnunet-service-cadet_peer.c
index f2b508ae0..48e288495 100644
--- a/src/cadet/gnunet-service-cadet_peer.c
+++ b/src/cadet/gnunet-service-cadet_peer.c
@@ -33,10 +33,9 @@
 #include "platform.h"
 #include "gnunet_time_lib.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
+#include "gnunet_hello_uri_lib.h"
 #include "gnunet_signatures.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_ats_service.h"
+#include "gnunet_transport_application_service.h"
 #include "gnunet_core_service.h"
 #include "gnunet_statistics_service.h"
 #include "gnunet-service-cadet_peer.h"
@@ -186,7 +185,7 @@ struct CadetPeer
   /**
    * Hello message of the peer.
    */
-  struct GNUNET_HELLO_Message *hello;
+  struct GNUNET_MessageHeader *hello;
 
   /**
    * Handle to us offering the HELLO to the transport.
@@ -194,10 +193,9 @@ struct CadetPeer
   struct GNUNET_TRANSPORT_OfferHelloHandle *hello_offer;
 
   /**
-   * Handle to our ATS request asking ATS to suggest an address
-   * to TRANSPORT for this peer (to establish a direct link).
+   * Transport suggest handle.
    */
-  struct GNUNET_ATS_ConnectivitySuggestHandle *connectivity_suggestion;
+  struct GNUNET_TRANSPORT_ApplicationSuggestHandle *ash;
 
   /**
    * How many messages are in the queue to this peer.
@@ -334,15 +332,11 @@ destroy_peer (void *cls)
   }
   /* FIXME: clean up search_delayedXXX! */
 
-  if (NULL != cp->hello_offer)
-  {
-    GNUNET_TRANSPORT_offer_hello_cancel (cp->hello_offer);
-    cp->hello_offer = NULL;
-  }
-  if (NULL != cp->connectivity_suggestion)
+
+  if (NULL != cp->ash)
   {
-    GNUNET_ATS_connectivity_suggest_cancel (cp->connectivity_suggestion);
-    cp->connectivity_suggestion = NULL;
+    GNUNET_TRANSPORT_application_suggest_cancel (cp->ash);
+    cp->ash = NULL;
   }
   GNUNET_CONTAINER_multishortmap_destroy (cp->connections);
   if (NULL != cp->path_heap)
@@ -375,6 +369,7 @@ static void
 consider_peer_activate (struct CadetPeer *cp)
 {
   uint32_t strength;
+  struct GNUNET_BANDWIDTH_Value32NBO bw;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Updating peer %s activation state (%u connections)%s%s\n",
@@ -392,10 +387,10 @@ consider_peer_activate (struct CadetPeer *cp)
       (NULL == cp->t))
   {
     /* We're just on a path or directly connected; don't bother too much */
-    if (NULL != cp->connectivity_suggestion)
+    if (NULL != cp->ash)
     {
-      GNUNET_ATS_connectivity_suggest_cancel (cp->connectivity_suggestion);
-      cp->connectivity_suggestion = NULL;
+      GNUNET_TRANSPORT_application_suggest_cancel (cp->ash);
+      cp->ash = NULL;
     }
     if (NULL != cp->search_h)
     {
@@ -424,12 +419,13 @@ consider_peer_activate (struct CadetPeer *cp)
 
   /* If we have a tunnel, our urge for connections is much bigger */
   strength = (NULL != cp->t) ? 32 : 1;
-  if (NULL != cp->connectivity_suggestion)
-    GNUNET_ATS_connectivity_suggest_cancel (cp->connectivity_suggestion);
-  cp->connectivity_suggestion
-    = GNUNET_ATS_connectivity_suggest (ats_ch,
-                                       &cp->pid,
-                                       strength);
+  if (NULL != cp->ash)
+    GNUNET_TRANSPORT_application_suggest_cancel (cp->ash);
+  cp->ash
+    = GNUNET_TRANSPORT_application_suggest (transport,
+                                            &cp->pid,
+                                            GNUNET_MQ_PRIO_BEST_EFFORT,
+                                            bw);
 }
 
 
@@ -495,8 +491,9 @@ consider_peer_destroy (struct CadetPeer *cp)
   if (NULL != cp->hello)
   {
     /* relevant only until HELLO expires */
-    exp = GNUNET_TIME_absolute_get_remaining (GNUNET_HELLO_get_last_expiration 
(
-                                                cp->hello));
+    exp = GNUNET_TIME_absolute_get_remaining (
+      GNUNET_HELLO_builder_get_expiration_time (cp
+                                                ->hello));
     cp->destroy_task = GNUNET_SCHEDULER_add_delayed (exp,
                                                      &destroy_peer,
                                                      cp);
@@ -1308,53 +1305,52 @@ GCP_get_tunnel (struct CadetPeer *cp,
 }
 
 
-/**
- * Hello offer was passed to the transport service. Mark it
- * as done.
- *
- * @param cls the `struct CadetPeer` where the offer completed
- */
-static void
-hello_offer_done (void *cls)
-{
-  struct CadetPeer *cp = cls;
-
-  cp->hello_offer = NULL;
-}
-
-
 void
 GCP_set_hello (struct CadetPeer *cp,
-               const struct GNUNET_HELLO_Message *hello)
+               const struct GNUNET_MessageHeader *hello)
 {
   struct GNUNET_HELLO_Message *mrg;
+  struct GNUNET_BANDWIDTH_Value32NBO bw;
+  uint16_t size = sizeof (hello);
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Got %u byte HELLO for peer %s\n",
-       (unsigned int) GNUNET_HELLO_size (hello),
+       (unsigned int) size,
        GCP_2s (cp));
-  if (NULL != cp->hello_offer)
-  {
-    GNUNET_TRANSPORT_offer_hello_cancel (cp->hello_offer);
-    cp->hello_offer = NULL;
-  }
   if (NULL != cp->hello)
   {
-    mrg = GNUNET_HELLO_merge (hello,
-                              cp->hello);
-    GNUNET_free (cp->hello);
-    cp->hello = mrg;
+    struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+
+    struct GNUNET_TIME_Absolute new_hello_exp =
+      GNUNET_HELLO_builder_get_expiration_time (hello);
+    struct GNUNET_TIME_Absolute old_hello_exp =
+      GNUNET_HELLO_builder_get_expiration_time (cp
+                                                ->hello);
+
+    if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) &&
+        GNUNET_TIME_absolute_cmp (new_hello_exp, >, old_hello_exp))
+    {
+      GNUNET_free (cp->hello);
+      cp->hello = GNUNET_malloc (size);
+      GNUNET_memcpy (cp->hello, hello, size);
+    }
+    else
+    {
+      return;
+    }
   }
   else
   {
     cp->hello = GNUNET_memdup (hello,
-                               GNUNET_HELLO_size (hello));
+                               size);
   }
-  cp->hello_offer
-    = GNUNET_TRANSPORT_offer_hello (cfg,
-                                    GNUNET_HELLO_get_header (cp->hello),
-                                    &hello_offer_done,
-                                    cp);
+  if (NULL != cp->ash)
+    GNUNET_TRANSPORT_application_suggest_cancel (cp->ash);
+  cp->ash
+    = GNUNET_TRANSPORT_application_suggest (transport,
+                                            &cp->pid,
+                                            GNUNET_MQ_PRIO_BEST_EFFORT,
+                                            bw);
   /* New HELLO means cp's destruction time may change... */
   consider_peer_destroy (cp);
 }
diff --git a/src/cadet/gnunet-service-cadet_peer.h 
b/src/cadet/gnunet-service-cadet_peer.h
index 69436d766..4c5ad4252 100644
--- a/src/cadet/gnunet-service-cadet_peer.h
+++ b/src/cadet/gnunet-service-cadet_peer.h
@@ -28,7 +28,7 @@
 #define GNUNET_SERVICE_CADET_PEER_H
 
 #include "gnunet-service-cadet.h"
-#include "gnunet_hello_lib.h"
+#include "gnunet_util_lib.h"
 
 
 /**
@@ -292,7 +292,7 @@ GCP_remove_connection (struct CadetPeer *cp,
  */
 void
 GCP_set_hello (struct CadetPeer *cp,
-               const struct GNUNET_HELLO_Message *hello);
+               const struct GNUNET_MessageHeader *hello);
 
 
 /**
diff --git a/src/cadet/meson.build b/src/cadet/meson.build
index 91587590d..dfaf77af8 100644
--- a/src/cadet/meson.build
+++ b/src/cadet/meson.build
@@ -49,9 +49,8 @@ executable ('gnunet-cadet',
                            libgnunetdht_dep,
                            m_dep,
                            libgnunetstatistics_dep,
-                           libgnunetpeerinfo_dep,
-                           libgnunetats_dep,
-                           libgnunettransport_dep,
+                           libgnunetpeerstore_dep,
+                           libgnunettransportapplication_dep,
                            libgnunethello_dep],
             include_directories: [incdir, configuration_inc],
             install: true,
@@ -60,13 +59,12 @@ executable ('gnunet-service-cadet',
             gnunetservicecadet_src,
             dependencies: [libgnunetcadet_dep,
                            libgnunetutil_dep,
-                           libgnunetats_dep,
                            m_dep,
                            libgnunetcore_dep,
                            libgnunetdht_dep,
                            libgnunetstatistics_dep,
-                           libgnunettransport_dep,
-                           libgnunetpeerinfo_dep,
+                           libgnunettransportapplication_dep,
+                           libgnunetpeerstore_dep,
                            libgnunethello_dep,
                            libgnunetblock_dep],
             include_directories: [incdir, configuration_inc],
diff --git a/src/consensus/Makefile.am b/src/consensus/Makefile.am
index 4a04883c0..f77f49f94 100644
--- a/src/consensus/Makefile.am
+++ b/src/consensus/Makefile.am
@@ -18,8 +18,8 @@ endif
 libexec_PROGRAMS = \
  gnunet-service-consensus
 
-noinst_PROGRAMS = \
- gnunet-consensus-profiler
+#noinst_PROGRAMS = \
+# gnunet-consensus-profiler
 
 if ENABLE_MALICIOUS
 libexec_PROGRAMS += \
@@ -38,14 +38,15 @@ check-python-style:
 lib_LTLIBRARIES = \
   libgnunetconsensus.la
 
-gnunet_consensus_profiler_SOURCES = \
- gnunet-consensus-profiler.c
-gnunet_consensus_profiler_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  libgnunetconsensus.la \
-  $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  $(GN_LIBINTL)
+# TNG
+#gnunet_consensus_profiler_SOURCES = \
+# gnunet-consensus-profiler.c
+#gnunet_consensus_profiler_LDADD = \
+#  $(top_builddir)/src/util/libgnunetutil.la \
+#  libgnunetconsensus.la \
+#  $(top_builddir)/src/testing/libgnunettesting.la \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  $(GN_LIBINTL)
 
 gnunet_service_consensus_SOURCES = \
  gnunet-service-consensus.c
@@ -93,7 +94,7 @@ libgnunet_plugin_block_consensus_la_LDFLAGS = \
 
 
 check_PROGRAMS = \
- test_consensus_api
+ # test_consensus_api
 
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index e51247e18..062aa0266 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -3,6 +3,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include
 
 pkgcfgdir= $(pkgdatadir)/config.d/
 
+plugindir = $(libdir)/gnunet
+
 libexecdir= $(pkglibdir)/libexec/
 
 pkgcfg_DATA = \
@@ -13,9 +15,15 @@ if USE_COVERAGE
   XLIB = -lgcov
 endif
 
+plugin_LTLIBRARIES = \
+  libgnunet_test_core_plugin_cmd_just_run.la
+
+TESTING_LIBS = \
+  libgnunetcoretesting.la
 
 lib_LTLIBRARIES = \
-  libgnunetcore.la
+  libgnunetcore.la \
+  $(TESTING_LIBS)
 
 libgnunetcore_la_SOURCES = \
   core_api.c core.h \
@@ -27,6 +35,34 @@ libgnunetcore_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)  \
   -version-info 0:1:0
 
+libgnunet_test_core_plugin_cmd_just_run_la_SOURCES = \
+ test_core_plugin_cmd_just_run.c
+libgnunet_test_core_plugin_cmd_just_run_la_LIBADD = \
+  $(top_builddir)/src/transport/libgnunettransportapplication.la \
+  $(top_builddir)/src/transport/libgnunettransportcore.la \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
+  $(top_builddir)/src/core/libgnunetcoretesting.la \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+  $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/arm/libgnunetarm.la \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(LTLIBINTL)
+libgnunet_test_core_plugin_cmd_just_run_la_LDFLAGS = \
+  $(GN_PLUGIN_LDFLAGS)
+
+libgnunetcoretesting_la_SOURCES = \
+  core_api_cmd_connecting_peers.c 
+libgnunetcoretesting_la_LIBADD = \
+  $(top_builddir)/src/testing/libgnunettesting.la \
+  $(top_builddir)/src/transport/libgnunettransportapplication.la \
+  $(top_builddir)/src/transport/libgnunettransportcore.la \
+  $(top_builddir)/src/util/libgnunetutil.la
+libgnunetcoretesting_la_LDFLAGS = \
+  $(GN_LIBINTL) \
+  $(GN_LIB_LDFLAGS) \
+  -version-info 0:0:0
+
 
 libexec_PROGRAMS = \
  gnunet-service-core
@@ -41,7 +77,8 @@ gnunet_service_core_SOURCES = \
  gnunet-service-core_typemap.c gnunet-service-core_typemap.h
 gnunet_service_core_LDADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/transport/libgnunettransport.la \
+  $(top_builddir)/src/transport/libgnunettransportapplication.la \
+  $(top_builddir)/src/transport/libgnunettransportcore.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(GN_LIBINTL) $(Z_LIBS)
 
@@ -59,40 +96,23 @@ TESTING_TESTS = \
 
 check_PROGRAMS = \
  test_core_api_start_only \
- test_core_api \
- test_core_api_reliability \
- test_core_quota_compliance_symmetric \
- test_core_quota_compliance_asymmetric_send_limited \
- test_core_quota_compliance_asymmetric_recv_limited \
  $(TESTING_TESTS)
 
+# Only test TNG if we run experimental
+check_SCRIPTS= \
+  test_core_start_testcase.sh
+
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
-TESTS = $(check_PROGRAMS)
+TESTS = $(check_PROGRAMS) \
+ $(check_SCRIPTS)
 endif
 
-test_core_api_SOURCES = \
- test_core_api.c
-test_core_api_LDADD = \
- libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-test_core_api_reliability_SOURCES = \
- test_core_api_reliability.c
-test_core_api_reliability_LDADD = \
- libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
 test_core_api_send_to_self_SOURCES = \
  test_core_api_send_to_self.c
 test_core_api_send_to_self_LDADD = \
  libgnunetcore.la \
  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
  $(top_builddir)/src/util/libgnunetutil.la
 
 test_core_api_start_only_SOURCES = \
@@ -102,34 +122,8 @@ test_core_api_start_only_LDADD = \
  libgnunetcore.la \
  $(top_builddir)/src/util/libgnunetutil.la
 
-test_core_quota_compliance_symmetric_SOURCES = \
- test_core_quota_compliance.c
-test_core_quota_compliance_symmetric_LDADD = \
- libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la
-
-test_core_quota_compliance_asymmetric_send_limited_SOURCES = \
- test_core_quota_compliance.c
-test_core_quota_compliance_asymmetric_send_limited_LDADD = \
- libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la
-
-test_core_quota_compliance_asymmetric_recv_limited_SOURCES = \
- test_core_quota_compliance.c
-test_core_quota_compliance_asymmetric_recv_limited_LDADD = \
- libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la
-
 EXTRA_DIST = \
+  test_core_start_testcase.sh \
   test_core_defaults.conf \
   test_core_api_data.conf \
   test_core_api_peer1.conf \
diff --git a/src/core/core.h b/src/core/core.h
index 17df7acb7..d4596f038 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -26,7 +26,6 @@
 #ifndef CORE_H
 #define CORE_H
 
-#include "gnunet_transport_service.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_time_lib.h"
 
diff --git a/src/transport/transport_api_cmd_connecting_peers.c 
b/src/core/core_api_cmd_connecting_peers.c
similarity index 70%
copy from src/transport/transport_api_cmd_connecting_peers.c
copy to src/core/core_api_cmd_connecting_peers.c
index 6bc145880..ce2184a3c 100644
--- a/src/transport/transport_api_cmd_connecting_peers.c
+++ b/src/core/core_api_cmd_connecting_peers.c
@@ -29,14 +29,14 @@
 #include "gnunet_testing_netjail_lib.h"
 #include "gnunet_transport_application_service.h"
 #include "gnunet_hello_lib.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing-cmds.h"
+#include "gnunet_transport_core_service.h"
 
 /**
  * Generic logging shortcut
  */
 #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
 
+
 /**
  * The run method of this cmd will connect to peers.
  *
@@ -45,30 +45,29 @@ static void
 connect_peers_run (void *cls,
                    struct GNUNET_TESTING_Interpreter *is)
 {
-  struct ConnectPeersState *cps = cls;
+  struct GNUNET_TESTING_ConnectPeersState *cps = cls;
+  const struct GNUNET_TESTING_StartPeerState *sps;
   const struct GNUNET_TESTING_Command *system_cmd;
   const struct GNUNET_TESTING_System *tl_system;
-
-
   const struct GNUNET_TESTING_Command *peer1_cmd;
-  const struct GNUNET_TRANSPORT_ApplicationHandle *ah;
   struct GNUNET_PeerIdentity *peer;
-  char *addr;
-  char *addr_and_port;
   enum GNUNET_NetworkType nt = 0;
-  uint32_t num;
   struct GNUNET_TESTING_NodeConnection *pos_connection;
   struct GNUNET_TESTING_AddressPrefix *pos_prefix;
-  unsigned int con_num = 0;
   const enum GNUNET_GenericReturnValue *broadcast;
+  unsigned int con_num = 0;
+  uint32_t num;
+  char *addr;
+  char *addr_and_port;
+  char *emsg = NULL;
 
   cps->is = is;
   peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
                                                          
cps->start_peer_label);
-  GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd,
-                                                 &ah);
-  GNUNET_TRANSPORT_get_trait_broadcast (peer1_cmd,
+  GNUNET_TESTING_get_trait_broadcast (peer1_cmd,
                                         &broadcast);
+  GNUNET_TESTING_get_trait_state (peer1_cmd,
+                                    &sps);
 
   system_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
                                                           cps->create_label);
@@ -80,6 +79,19 @@ connect_peers_run (void *cls,
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "cps->num: %u \n",
        cps->num);
+  
+
+  cps->ah = GNUNET_TRANSPORT_application_init (sps->cfg);
+  if (NULL == cps->ah)
+  {
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+         "Failed to initialize the TRANSPORT application suggestion client 
handle for peer `%s': `%s'\n",
+         sps->cfgname,
+         emsg);
+    GNUNET_free (emsg);
+    GNUNET_TESTING_interpreter_fail (is);
+    return;
+  }
 
   cps->node_connections_head = GNUNET_TESTING_get_connections (cps->num,
                                                                cps->topology);
@@ -139,15 +151,16 @@ connect_peers_run (void *cls,
         }
         peer = GNUNET_TESTING_get_peer (num, tl_system);
         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "validating peer number %u with identity %s and address %s 
%u %s\n",
+                    "validating peer number %u with identity %s and address %s 
%u %s and handle %p\n",
                     num,
                     GNUNET_i2s (peer),
                     addr_and_port,
                     *broadcast,
-                    pos_prefix->address_prefix);
+                    pos_prefix->address_prefix,
+                    cps->ah);
         GNUNET_TRANSPORT_application_validate ((struct
                                                 
GNUNET_TRANSPORT_ApplicationHandle
-                                                *) ah,
+                                                *) cps->ah,
                                                peer,
                                                nt,
                                                addr_and_port);
@@ -161,58 +174,6 @@ connect_peers_run (void *cls,
 }
 
 
-/**
- * Callback from start peer cmd for signaling a peer got connected.
- *
- */
-static void *
-notify_connect (struct GNUNET_TESTING_Interpreter *is,
-                const struct GNUNET_PeerIdentity *peer)
-{
-  const struct GNUNET_TESTING_Command *cmd;
-  struct ConnectPeersState *cps;
-  struct GNUNET_PeerIdentity *peer_connection;
-  unsigned int num;
-  unsigned int con_num;
-  void *ret = NULL;
-
-  cmd = GNUNET_TESTING_interpreter_lookup_command_all (is,
-                                                       "connect-peers");
-  cps = cmd->cls; // WTF? Never go directly into cls of another command! FIXME!
-  con_num = cps->con_num_notified;
-  for (struct GNUNET_TESTING_NodeConnection *pos_connection =
-         cps->node_connections_head;
-       NULL != pos_connection;
-       pos_connection = pos_connection->next)
-  {
-    num = GNUNET_TESTING_calculate_num (pos_connection,
-                                        cps->topology);
-    peer_connection = GNUNET_TESTING_get_peer (num,
-                                               cps->tl_system);
-    if (0 == GNUNET_memcmp (peer,
-                            peer_connection))
-      cps->con_num_notified++;
-    GNUNET_free (peer_connection);
-  }
-  if (cps->con_num_notified == con_num)
-    cps->additional_connects_notified++;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "con_num: %u add: %u num_notified: %u add_notified: %u peer: 
%s\n",
-              cps->con_num,
-              cps->additional_connects,
-              cps->con_num_notified,
-              cps->additional_connects_notified,
-              GNUNET_i2s (peer));
-  if ((cps->con_num == cps->con_num_notified) &&
-      (cps->additional_connects <= cps->additional_connects_notified))
-  {
-    GNUNET_TESTING_async_finish (&cps->ac);
-  }
-  return ret;
-}
-
-
 /**
  * The cleanup function of this cmd frees resources the cmd allocated.
  *
@@ -220,8 +181,9 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
 static void
 connect_peers_cleanup (void *cls)
 {
-  struct ConnectPeersState *cps = cls;
+  struct GNUNET_TESTING_ConnectPeersState *cps = cls;
 
+  GNUNET_free (cps->connected_peers_map);
   GNUNET_free (cps);
 }
 
@@ -236,9 +198,9 @@ connect_peers_traits (void *cls,
                       const char *trait,
                       unsigned int index)
 {
-  struct ConnectPeersState *cps = cls;
+  struct GNUNET_TESTING_ConnectPeersState *cps = cls;
   struct GNUNET_TESTING_Trait traits[] = {
-    GNUNET_TRANSPORT_make_trait_connect_peer_state ((const void *) cps),
+    GNUNET_TESTING_make_trait_connect_peer_state ((const void *) cps),
     GNUNET_TESTING_trait_end ()
   };
   return GNUNET_TESTING_get_trait (traits,
@@ -249,17 +211,22 @@ connect_peers_traits (void *cls,
 
 
 struct GNUNET_TESTING_Command
-GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
+GNUNET_CORE_cmd_connect_peers (const char *label,
                                     const char *start_peer_label,
                                     const char *create_label,
                                     uint32_t num,
                                     struct GNUNET_TESTING_NetjailTopology *
                                     topology,
-                                    unsigned int additional_connects)
+                                    unsigned int additional_connects,
+                                    unsigned int wait_for_connect,
+                                    struct GNUNET_MQ_MessageHandler *handlers)
 {
-  struct ConnectPeersState *cps;
+  struct GNUNET_TESTING_ConnectPeersState *cps;
   unsigned int node_additional_connects;
-
+  struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map =
+    GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
+  unsigned int i;
+  
   node_additional_connects = GNUNET_TESTING_get_additional_connects (num,
                                                                      topology);
 
@@ -271,18 +238,38 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
   if (0 != node_additional_connects)
     additional_connects = node_additional_connects;
 
-  cps = GNUNET_new (struct ConnectPeersState);
+  cps = GNUNET_new (struct GNUNET_TESTING_ConnectPeersState);
   cps->start_peer_label = start_peer_label;
   cps->num = num;
   cps->create_label = create_label;
   cps->topology = topology;
-  cps->notify_connect = notify_connect;
   cps->additional_connects = additional_connects;
+  cps->wait_for_connect = wait_for_connect;
+  cps->connected_peers_map = connected_peers_map;
+
+  if (NULL != handlers)
+  {
+    for (i = 0; NULL != handlers[i].cb; i++)
+      ;
+    cps->handlers = GNUNET_new_array (i + 1,
+                                      struct GNUNET_MQ_MessageHandler);
+    GNUNET_memcpy (cps->handlers,
+                   handlers,
+                   i * sizeof(struct GNUNET_MQ_MessageHandler));
+  }
 
-  return GNUNET_TESTING_command_new (cps,
-                                     label,
-                                     &connect_peers_run,
-                                     &connect_peers_cleanup,
-                                     &connect_peers_traits,
-                                     &cps->ac);
+  if (GNUNET_YES == wait_for_connect)
+    return GNUNET_TESTING_command_new (cps,
+                                       label,
+                                       &connect_peers_run,
+                                       &connect_peers_cleanup,
+                                       &connect_peers_traits,
+                                       &cps->ac);
+  else
+    return GNUNET_TESTING_command_new (cps,
+                                       label,
+                                       &connect_peers_run,
+                                       &connect_peers_cleanup,
+                                       &connect_peers_traits,
+                                       NULL);
 }
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c
index c9c3e3ff5..e387fecc9 100644
--- a/src/core/gnunet-service-core.c
+++ b/src/core/gnunet-service-core.c
@@ -30,6 +30,7 @@
 #include "gnunet-service-core_kx.h"
 #include "gnunet-service-core_sessions.h"
 #include "gnunet-service-core_typemap.h"
+#include "gnunet_constants.h"
 
 /**
  * How many messages do we queue up at most for any client? This can
diff --git a/src/core/gnunet-service-core_kx.c 
b/src/core/gnunet-service-core_kx.c
index b203f4902..ca7bccbd9 100644
--- a/src/core/gnunet-service-core_kx.c
+++ b/src/core/gnunet-service-core_kx.c
@@ -26,14 +26,12 @@
  */
 #include "platform.h"
 #include "gnunet-service-core_kx.h"
-#include "gnunet-service-core.h"
+#include "gnunet_transport_core_service.h"
 #include "gnunet-service-core_sessions.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
+#include "gnunet-service-core.h"
 #include "gnunet_constants.h"
 #include "gnunet_signatures.h"
 #include "gnunet_protocols.h"
-#include "core.h"
 
 /**
  * Enable expensive (and possibly problematic for privacy!) logging of KX.
@@ -517,10 +515,10 @@ do_encrypt (struct GSC_KeyExchangeInfo *kx,
      so we require manual intervention to get this one... */
 #if DEBUG_KX
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Encrypted %u bytes for `%s' using key %u, IV %u\n",
+              "Encrypted %u bytes for `%s' using key %s, IV %u\n",
               (unsigned int) size,
               GNUNET_i2s (kx->peer),
-              (unsigned int) kx->encrypt_key.crc32,
+              kx->encrypt_key.aes_key,
               GNUNET_CRYPTO_crc32_n (iv, sizeof(iv)));
 #endif
   return GNUNET_OK;
@@ -575,10 +573,10 @@ do_decrypt (struct GSC_KeyExchangeInfo *kx,
      so we require manual intervention to get this one... */
 #if DEBUG_KX
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Decrypted %u bytes from `%s' using key %u, IV %u\n",
+              "Decrypted %u bytes from `%s' using key %s, IV %u\n",
               (unsigned int) size,
               GNUNET_i2s (kx->peer),
-              (unsigned int) kx->decrypt_key.crc32,
+              kx->decrypt_key.aes_key,
               GNUNET_CRYPTO_crc32_n (iv, sizeof(*iv)));
 #endif
   return GNUNET_OK;
@@ -870,6 +868,7 @@ handle_ephemeral_key (void *cls, const struct 
EphemeralKeyMessage *m)
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Received expired EPHEMERAL_KEY from %s\n",
                 GNUNET_i2s (&m->origin_identity));
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   if (0 == memcmp (&m->ephemeral_key,
@@ -884,6 +883,7 @@ handle_ephemeral_key (void *cls, const struct 
EphemeralKeyMessage *m)
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Ignoring duplicate EPHEMERAL_KEY from %s\n",
                 GNUNET_i2s (&m->origin_identity));
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   if (0 != memcmp (&m->origin_identity,
@@ -895,6 +895,7 @@ handle_ephemeral_key (void *cls, const struct 
EphemeralKeyMessage *m)
                 GNUNET_i2s (&m->origin_identity),
                 GNUNET_i2s_full (kx->peer));
     GNUNET_break_op (0);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   if ((ntohl (m->purpose.size) !=
@@ -919,6 +920,7 @@ handle_ephemeral_key (void *cls, const struct 
EphemeralKeyMessage *m)
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Received EPHEMERAL_KEY from %s with bad signature\n",
                 GNUNET_i2s (&m->origin_identity));
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   now = GNUNET_TIME_absolute_get ();
@@ -941,6 +943,7 @@ handle_ephemeral_key (void *cls, const struct 
EphemeralKeyMessage *m)
                                 "# EPHEMERAL_KEY messages rejected due to 
time"),
                               1,
                               GNUNET_NO);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
 #if DEBUG_KX
@@ -1044,6 +1047,7 @@ handle_ephemeral_key (void *cls, const struct 
EphemeralKeyMessage *m)
     GNUNET_break (0);
     break;
   }
+  GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
 }
 
 
@@ -1078,6 +1082,7 @@ handle_ping (void *cls, const struct PingMessage *m)
                                 "# PING messages dropped (out of order)"),
                               1,
                               GNUNET_NO);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1092,6 +1097,7 @@ handle_ping (void *cls, const struct PingMessage *m)
                                - ((void *) &m->target - (void *) m)))
   {
     GNUNET_break_op (0);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   if (0 !=
@@ -1108,6 +1114,7 @@ handle_ping (void *cls, const struct PingMessage *m)
         "Decryption of PING from peer `%s' failed after rekey (harmless)\n",
         GNUNET_i2s (kx->peer));
     GNUNET_break_op (0);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   /* construct PONG */
@@ -1230,6 +1237,7 @@ handle_pong (void *cls, const struct PongMessage *m)
                                 "# PONG messages dropped (connection down)"),
                               1,
                               GNUNET_NO);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
 
   case GNUNET_CORE_KX_STATE_KEY_SENT:
@@ -1238,6 +1246,7 @@ handle_pong (void *cls, const struct PongMessage *m)
                                 "# PONG messages dropped (out of order)"),
                               1,
                               GNUNET_NO);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
 
   case GNUNET_CORE_KX_STATE_KEY_RECEIVED:
@@ -1251,6 +1260,7 @@ handle_pong (void *cls, const struct PongMessage *m)
 
   default:
     GNUNET_break (0);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1271,6 +1281,7 @@ handle_pong (void *cls, const struct PongMessage *m)
                                - ((void *) &m->challenge - (void *) m)))
   {
     GNUNET_break_op (0);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   GNUNET_STATISTICS_update (GSC_stats,
@@ -1290,6 +1301,7 @@ handle_pong (void *cls, const struct PongMessage *m)
                 "Received malformed PONG received from `%s' with challenge 
%u\n",
                 GNUNET_i2s (&t.target),
                 (unsigned int) t.challenge);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1305,10 +1317,12 @@ handle_pong (void *cls, const struct PongMessage *m)
   {
   case GNUNET_CORE_KX_STATE_DOWN:
     GNUNET_assert (0);  /* should be impossible */
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
 
   case GNUNET_CORE_KX_STATE_KEY_SENT:
     GNUNET_assert (0);  /* should be impossible */
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
 
   case GNUNET_CORE_KX_STATE_KEY_RECEIVED:
@@ -1507,6 +1521,7 @@ handle_encrypted (void *cls, const struct 
EncryptedMessage *m)
                                 "# DATA message dropped (out of order)"),
                               1,
                               GNUNET_NO);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   if (0 ==
@@ -1531,6 +1546,7 @@ handle_encrypted (void *cls, const struct 
EncryptedMessage *m)
     kx->status = GNUNET_CORE_KX_STATE_KEY_SENT;
     monitor_notify_all (kx);
     send_key (kx);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
 
@@ -1570,6 +1586,7 @@ handle_encrypted (void *cls, const struct 
EncryptedMessage *m)
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Failed checksum validation for a message from `%s'\n",
                 GNUNET_i2s (kx->peer));
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   derive_iv (&iv, &kx->decrypt_key, m->iv_seed, &GSC_my_identity);
@@ -1581,6 +1598,7 @@ handle_encrypted (void *cls, const struct 
EncryptedMessage *m)
                                size - ENCRYPTED_HEADER_SIZE))
   {
     GNUNET_break_op (0);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1600,6 +1618,7 @@ handle_encrypted (void *cls, const struct 
EncryptedMessage *m)
                               gettext_noop ("# bytes dropped (duplicates)"),
                               size,
                               GNUNET_NO);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   if ((kx->last_sequence_number_received > snum) &&
@@ -1613,6 +1632,7 @@ handle_encrypted (void *cls, const struct 
EncryptedMessage *m)
                                 "# bytes dropped (out of sequence)"),
                               size,
                               GNUNET_NO);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
   if (kx->last_sequence_number_received > snum)
@@ -1628,6 +1648,7 @@ handle_encrypted (void *cls, const struct 
EncryptedMessage *m)
                                 size,
                                 GNUNET_NO);
       /* duplicate, ignore */
+      GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
       return;
     }
     kx->last_packets_bitmap |= rotbit;
@@ -1658,6 +1679,7 @@ handle_encrypted (void *cls, const struct 
EncryptedMessage *m)
                                 "# bytes dropped (ancient message)"),
                               size,
                               GNUNET_NO);
+    GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
     return;
   }
 
@@ -1674,28 +1696,8 @@ handle_encrypted (void *cls, const struct 
EncryptedMessage *m)
                               GNUNET_YES,
                               GNUNET_NO))
     GNUNET_break_op (0);
-}
-
-
-/**
- * One of our neighbours has excess bandwidth, remember this.
- *
- * @param cls NULL
- * @param pid identity of the peer with excess bandwidth
- * @param connect_cls the `struct Neighbour`
- */
-static void
-handle_transport_notify_excess_bw (void *cls,
-                                   const struct GNUNET_PeerIdentity *pid,
-                                   void *connect_cls)
-{
-  struct GSC_KeyExchangeInfo *kx = connect_cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Peer %s has excess bandwidth available\n",
-              GNUNET_i2s (pid));
-  kx->has_excess_bandwidth = GNUNET_YES;
-  GSC_SESSIONS_solicit (pid);
+  
+  GNUNET_TRANSPORT_core_receive_continue (transport, kx->peer);
 }
 
 
@@ -1835,8 +1837,7 @@ GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk)
                                    handlers,
                                    NULL,
                                    &handle_transport_notify_connect,
-                                   &handle_transport_notify_disconnect,
-                                   &handle_transport_notify_excess_bw);
+                                   &handle_transport_notify_disconnect);
   if (NULL == transport)
   {
     GSC_KX_done ();
diff --git a/src/core/gnunet-service-core_kx.h 
b/src/core/gnunet-service-core_kx.h
index 77f3e43b6..8bcac3f68 100644
--- a/src/core/gnunet-service-core_kx.h
+++ b/src/core/gnunet-service-core_kx.h
@@ -27,7 +27,6 @@
 #define GNUNET_SERVICE_CORE_KX_H
 
 #include "gnunet_util_lib.h"
-#include "gnunet_transport_service.h"
 
 
 /**
diff --git a/src/core/gnunet-service-core_typemap.c 
b/src/core/gnunet-service-core_typemap.c
index 7b7df2fe9..200a84b23 100644
--- a/src/core/gnunet-service-core_typemap.c
+++ b/src/core/gnunet-service-core_typemap.c
@@ -25,7 +25,6 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_transport_service.h"
 #include "gnunet-service-core.h"
 #include "gnunet-service-core_sessions.h"
 #include "gnunet-service-core_typemap.h"
diff --git a/src/core/gnunet-service-core_typemap.h 
b/src/core/gnunet-service-core_typemap.h
index 7acdec53b..de41f4220 100644
--- a/src/core/gnunet-service-core_typemap.h
+++ b/src/core/gnunet-service-core_typemap.h
@@ -27,7 +27,6 @@
 #define GNUNET_SERVICE_CORE_TYPEMAP_H
 
 #include "gnunet_util_lib.h"
-#include "gnunet_transport_service.h"
 
 /**
  * Map specifying which message types a peer supports.
diff --git a/src/core/meson.build b/src/core/meson.build
index cdc5fe99a..f64896737 100644
--- a/src/core/meson.build
+++ b/src/core/meson.build
@@ -42,7 +42,7 @@ executable ('gnunet-service-core',
             gnunetservicecore_src,
             dependencies: [libgnunetcore_dep, libgnunetutil_dep,
                            libgnunetstatistics_dep,
-                           libgnunettransport_dep,
+                           libgnunettransportcore_dep,
                            zlib_dep],
             include_directories: [incdir, configuration_inc],
             install: true,
diff --git a/src/transport/test_transport_plugin_cmd_nat_upnp.c 
b/src/core/test_core_plugin_cmd_just_run.c
similarity index 68%
copy from src/transport/test_transport_plugin_cmd_nat_upnp.c
copy to src/core/test_core_plugin_cmd_just_run.c
index bb1c2be0a..176d055c8 100644
--- a/src/transport/test_transport_plugin_cmd_nat_upnp.c
+++ b/src/core/test_core_plugin_cmd_just_run.c
@@ -28,9 +28,10 @@
 #include "gnunet_testing_netjail_lib.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_transport_application_service.h"
-#include "transport-testing2.h"
-#include "transport-testing-cmds.h"
+#include "gnunet_transport_core_service.h"
 #include "gnunet_testing_barrier.h"
+#include "gnunet_core_service.h"
+#include "gnunet_transport_testing_ng_lib.h"
 
 /**
  * Generic logging shortcut
@@ -39,52 +40,72 @@
 
 #define BASE_DIR "testdir"
 
-#define TOPOLOGY_CONFIG "test_transport_simple_send_topo.conf"
-
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
 
-static struct GNUNET_TESTING_Command block_send;
+#define MAX_RECEIVED 1000
+
+#define MESSAGE_SIZE 65000
 
-static struct GNUNET_TESTING_Command block_receive;
+static struct GNUNET_TESTING_Command block_script;
 
 static struct GNUNET_TESTING_Command connect_peers;
 
 static struct GNUNET_TESTING_Command local_prepared;
 
+static struct GNUNET_TESTING_Command start_peer;
+
 static struct GNUNET_TESTING_Interpreter *is;
 
-/**
- * Function called to check a message of type 
GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being
- * received.
- *
- */
-static int
-check_test (void *cls,
-            const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  return GNUNET_OK;
-}
+static struct GNUNET_CONTAINER_MultiPeerMap *senders;
 
+struct TestState
+{
+  /**
+   * Callback to write messages to the master loop.
+   *
+   */
+  GNUNET_TESTING_cmd_helper_write_cb write_message;
+
+  /**
+   * Callback to notify the helper test case has finished.
+   */
+  GNUNET_TESTING_cmd_helper_finish_cb finished_cb;
+
+  /**
+   * The name for a specific test environment directory.
+   *
+   */
+  char *testdir;
+
+  /**
+   * The name for the configuration file of the specific node.
+   *
+   */
+  char *cfgname;
+
+  /**
+   * The complete topology information.
+   */
+  struct GNUNET_TESTING_NetjailTopology *topology;
+};
 
-/**
- * Function called to handle a message of type 
GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE
- * being received.
- *
- */
-static void
-handle_test (void *cls,
-             const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
+struct Sender
 {
-  const struct GNUNET_TESTING_AsyncContext *ac;
+  /**
+   * Number of received messages from sender.
+   */
+  unsigned long long num_received;
 
-  GNUNET_TESTING_get_trait_async_context (&block_receive,
-                                          &ac);
-  GNUNET_assert  (NULL != ac);
-  if (NULL == ac->cont)
-    GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac);
-  else
-    GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac);
-}
+  /**
+   * Sample mean time the message traveled.
+   */
+  struct GNUNET_TIME_Relative mean_time;
+
+  /**
+   * Time the first message was send.
+   */
+  struct GNUNET_TIME_Absolute time_first;
+};
 
 
 struct GNUNET_TESTING_BarrierList*
@@ -118,15 +139,6 @@ get_waiting_for_barriers ()
 static void
 all_peers_started ()
 {
-  const struct GNUNET_TESTING_AsyncContext *ac;
-
-  GNUNET_TESTING_get_trait_async_context (&block_send,
-                                          &ac);
-  GNUNET_assert  (NULL != ac);
-  if (NULL == ac->cont)
-    GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac);
-  else
-    GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac);
 }
 
 
@@ -157,7 +169,7 @@ handle_result (void *cls,
 /**
  * Callback from start peer cmd for signaling a peer got connected.
  *
- */
+ *
 static void *
 notify_connect (struct GNUNET_TESTING_Interpreter *is,
                 const struct GNUNET_PeerIdentity *peer)
@@ -174,7 +186,7 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
   cps->notify_connect (is,
                        peer);
   return ret;
-}
+  }*/
 
 
 /**
@@ -196,6 +208,91 @@ all_local_tests_prepared ()
 }
 
 
+static void
+child_completed_callback (void *cls,
+                          enum GNUNET_OS_ProcessStatusType type,
+                          long unsigned int exit_code)
+{
+
+}
+
+
+/**
+ * Function called to check a message being
+ * received.
+ *
+ */
+static int
+check_encrypted (void *cls, struct GNUNET_MessageHeader *header)
+{
+  return GNUNET_OK;
+}
+
+
+static void
+core_receive_continue (struct GNUNET_PeerIdentity *peer)
+{
+  const struct GNUNET_TESTING_StartPeerState *sps;
+
+  GNUNET_TESTING_get_trait_state (&start_peer,
+                                    &sps);
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Executing core receive continue\n");
+
+  GNUNET_TRANSPORT_core_receive_continue (sps->th, peer);
+}
+
+
+/*static void
+handle_core (void *cls, struct GNUNET_MessageHeader *header)
+{
+  struct GNUNET_PeerIdentity *peer = cls;
+
+  core_receive_continue (peer);
+  }*/
+
+
+/**
+ * Function called to handle a message being received.
+ *
+ */
+static void
+handle_encrypted (void *cls, struct GNUNET_MessageHeader *header)
+{
+  struct GNUNET_PeerIdentity *peer = cls;
+
+  core_receive_continue (peer);
+}
+
+
+static void
+handle_ephemeral_key (void *cls, struct GNUNET_MessageHeader *header)
+{
+  struct GNUNET_PeerIdentity *peer = cls;
+
+  core_receive_continue (peer);
+}
+
+
+static void
+handle_ping (void *cls, struct GNUNET_MessageHeader *header)
+{
+  struct GNUNET_PeerIdentity *peer = cls;
+
+  core_receive_continue (peer);
+}
+
+
+static void
+handle_pong (void *cls, struct GNUNET_MessageHeader *header)
+{
+  struct GNUNET_PeerIdentity *peer = cls;
+
+  core_receive_continue (peer);
+}
+
+
 /**
  * Function to start a local test case.
  *
@@ -232,6 +329,8 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
   struct TestState *ts = GNUNET_new (struct TestState);
   struct GNUNET_TESTING_NetjailTopology *topology;
   unsigned int sscanf_ret = 0;
+  char **argv = NULL;
+  int argc = 0;
 
   ts->finished_cb = finished_cb;
   LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -277,23 +376,23 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
   else
     num = (n_int - 1) * local_m_int + m_int + topology->nodes_x;
 
-  block_send = GNUNET_TESTING_cmd_block_until_external_trigger (
-    "block");
-  block_receive = GNUNET_TESTING_cmd_block_until_external_trigger (
-    "block-receive");
-  connect_peers = GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers",
+  block_script = GNUNET_TESTING_cmd_block_until_external_trigger (
+    "block-script");
+  connect_peers = GNUNET_CORE_cmd_connect_peers ("connect-peers",
                                                       "start-peer",
                                                       "system-create",
                                                       num,
                                                       topology,
-                                                      0);
+                                                      0,
+                                                 GNUNET_NO,
+                                                 NULL);
   local_prepared = GNUNET_TESTING_cmd_local_test_prepared (
     "local-test-prepared",
     write_message);
 
 
   GNUNET_asprintf (&ts->cfgname,
-                   "test_transport_api2_tcp_node1.conf");
+                   "test_core_just_run.conf");
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "plugin cfgname: %s\n",
@@ -309,25 +408,33 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
                    m,
                    n);
 
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_var_size (test,
-                           GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE,
-                           struct GNUNET_TRANSPORT_TESTING_TestMessage,
-                           ts),
+  /*struct GNUNET_MQ_MessageHandler handlers[] = {
+    GNUNET_MQ_hd_fixed_size (ephemeral_key,
+                             GNUNET_MESSAGE_TYPE_CORE_EPHEMERAL_KEY,
+                             struct EphemeralKeyMessage,
+                             NULL),
+    GNUNET_MQ_hd_fixed_size (ping,
+                             GNUNET_MESSAGE_TYPE_CORE_PING,
+                             struct PingMessage,
+                             NULL),
+    GNUNET_MQ_hd_fixed_size (pong,
+                             GNUNET_MESSAGE_TYPE_CORE_PONG,
+                             struct PongMessage,
+                             NULL),
     GNUNET_MQ_handler_end ()
-  };
+  };*/
+
+  start_peer = GNUNET_TESTING_cmd_start_peer ("start-peer",
+                                              "system-create",
+                                              num,
+                                              node_ip,
+                                              ts->cfgname,
+                                              GNUNET_NO);
 
   struct GNUNET_TESTING_Command commands[] = {
     GNUNET_TESTING_cmd_system_create ("system-create",
                                       ts->testdir),
-    GNUNET_TRANSPORT_cmd_start_peer ("start-peer",
-                                     "system-create",
-                                     num,
-                                     node_ip,
-                                     handlers,
-                                     ts->cfgname,
-                                     notify_connect,
-                                     GNUNET_NO),
+    start_peer,
     GNUNET_TESTING_cmd_barrier_reached ("ready-to-connect-reached",
                                         "ready-to-connect",
                                         GNUNET_NO,
@@ -335,19 +442,19 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
                                         GNUNET_NO,
                                         write_message),
     connect_peers,
-    GNUNET_TRANSPORT_cmd_send_simple ("send-simple",
-                                      "start-peer",
-                                      "system-create",
-                                      num,
-                                      topology),
-    block_receive,
+    GNUNET_TESTING_cmd_exec_bash_script ("script",
+                                         "block.sh",
+                                         argv,
+                                         argc,
+                                         &child_completed_callback),
+    block_script,
     GNUNET_TESTING_cmd_barrier_reached ("test-case-finished-reached",
                                         "test-case-finished",
                                         GNUNET_NO,
                                         num,
                                         GNUNET_NO,
                                         write_message),
-    GNUNET_TRANSPORT_cmd_stop_peer ("stop-peer",
+    GNUNET_TESTING_cmd_stop_peer ("stop-peer",
                                     "start-peer"),
     GNUNET_TESTING_cmd_system_destroy ("system-destroy",
                                        "system-create"),
@@ -371,7 +478,7 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
  * @return the exported block API
  */
 void *
-libgnunet_test_transport_plugin_cmd_nat_upnp_init (void *cls)
+libgnunet_test_core_plugin_cmd_just_run_init (void *cls)
 {
   struct GNUNET_TESTING_PluginFunctions *api;
 
@@ -389,11 +496,11 @@ libgnunet_test_transport_plugin_cmd_nat_upnp_init (void 
*cls)
 /**
  * Exit point from the plugin.
  *
- * @param cls the return value from 
#libgnunet_test_transport_plugin_nat_upnp_init
+ * @param cls the return value from 
#libgnunet_test_transport_plugin_just_run_init
  * @return NULL
  */
 void *
-libgnunet_test_transport_plugin_cmd_nat_upnp_done (void *cls)
+libgnunet_test_core_plugin_cmd_just_run_done (void *cls)
 {
   struct GNUNET_TESTING_PluginFunctions *api = cls;
 
diff --git a/src/transport/test_transport_simple_send.sh 
b/src/core/test_core_start_testcase.sh
similarity index 71%
copy from src/transport/test_transport_simple_send.sh
copy to src/core/test_core_start_testcase.sh
index 0250070be..78e67dbf5 100755
--- a/src/transport/test_transport_simple_send.sh
+++ b/src/core/test_core_start_testcase.sh
@@ -1,4 +1,6 @@
 #!/bin/bash
+echo gaga1 > gaga.txt
+read -p "Test case configuration to use:" conf
 if ! [ -d "/run/netns" ]; then
     echo You have to create the directory /run/netns.
 fi
@@ -8,4 +10,6 @@ if [ -f /proc/sys/kernel/unprivileged_userns_clone ]; then
     exit 78
   fi
 fi
-exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; 
./test_transport_start_with_config test_transport_simple_send_topo.conf"
+echo gaga2 >> gaga.txt
+exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; 
/usr/local/lib/gnunet/libexec/test_testing_start_with_config $conf"
+echo gaga3 >> gaga.txt
diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am
index 124f95a77..c0ff34449 100644
--- a/src/dht/Makefile.am
+++ b/src/dht/Makefile.am
@@ -53,8 +53,8 @@ bin_PROGRAMS = \
  gnunet-dht-put \
  gnunet-dht-hello
 
-noinst_PROGRAMS = \
- gnunet-dht-profiler
+#noinst_PROGRAMS = \
+# gnunet-dht-profiler
 
 gnunet_service_dht_SOURCES = \
  gnunet-service-dht.c gnunet-service-dht.h \
@@ -66,9 +66,7 @@ gnunet_service_dht_LDADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/nse/libgnunetnse.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
-  $(top_builddir)/src/transport/libgnunettransport.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
+  $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/hello/libgnunethello.la \
   $(top_builddir)/src/block/libgnunetblock.la \
   $(top_builddir)/src/block/libgnunetblockgroup.la \
@@ -110,25 +108,26 @@ gnunet_dht_monitor_LDADD = \
 gnunet_dht_monitor_LDFLAGS = \
   $(GN_LIBINTL)
 
-gnunet_dht_profiler_SOURCES = \
-  gnunet_dht_profiler.c
-gnunet_dht_profiler_LDADD = \
-  libgnunetdht.la \
-  $(top_builddir)/src/core/libgnunetcore.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la
-gnunet_dht_profiler_LDFLAGS = \
-  $(GN_LIBINTL)
-
-noinst_LIBRARIES = libgnunetdhttest.a
-
-libgnunetdhttest_a_SOURCES = \
-  dht_test_lib.c dht_test_lib.h
-libgnunetdhttest_a_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- libgnunetdht.la
+# TNG
+#gnunet_dht_profiler_SOURCES = \
+#  gnunet_dht_profiler.c
+#gnunet_dht_profiler_LDADD = \
+#  libgnunetdht.la \
+#  $(top_builddir)/src/core/libgnunetcore.la \
+#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(top_builddir)/src/testing/libgnunettesting.la \
+# $(top_builddir)/src/testbed/libgnunettestbed.la
+#gnunet_dht_profiler_LDFLAGS = \
+#  $(GN_LIBINTL)
+
+#noinst_LIBRARIES = libgnunetdhttest.a
+#
+#libgnunetdhttest_a_SOURCES = \
+#  dht_test_lib.c dht_test_lib.h
+#libgnunetdhttest_a_LIBADD = \
+# $(top_builddir)/src/util/libgnunetutil.la \
+# $(top_builddir)/src/testbed/libgnunettestbed.la \
+# libgnunetdht.la
 
 check_PROGRAMS = \
  test_dht_api \
@@ -161,69 +160,7 @@ test_dht_api_LDADD = \
  $(top_builddir)/src/hello/libgnunethello.la \
  libgnunetdht.la
 
-test_dht_twopeer_SOURCES = \
- test_dht_topo.c
-test_dht_twopeer_LDADD = \
- libgnunetdhttest.a \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunetdhttest.a \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- libgnunetdht.la
-
-test_dht_2dtorus_SOURCES = \
- test_dht_topo.c
-test_dht_2dtorus_LDADD = \
- libgnunetdhttest.a \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- libgnunetdht.la
-
-test_dht_line_SOURCES = \
- test_dht_topo.c
-test_dht_line_LDADD = \
- libgnunetdhttest.a \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- libgnunetdht.la
-
-test_dht_multipeer_SOURCES = \
- test_dht_topo.c
-test_dht_multipeer_LDADD = \
- libgnunetdhttest.a \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- libgnunetdht.la
-
-test_dht_monitor_SOURCES = \
-  test_dht_monitor.c
-test_dht_monitor_LDADD = \
- libgnunetdhttest.a \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- libgnunetdht.la
-
 EXTRA_DIST = \
-  gnunet-service-dht_clients.c \
-  test_dht_api_data.conf \
-  test_dht_api_peer1.conf \
-  test_dht_monitor.conf \
-  test_dht_multipeer.conf \
-  test_dht_2dtorus.conf \
-  test_dht_line.conf \
-  test_dht_tools.conf \
-  test_dht_tools.py.in \
-  test_dht_multipeer_topology.dat \
   dhtu_testbed_connect.sh \
   dhtu_testbed_deploy.conf \
   dhtu_testbed_deploy.sh
-
-if HAVE_PYTHON
-check_SCRIPTS = \
-  test_dht_tools.py
-endif
-
-SUFFIXES = .py.in .py
-.py.in.py:
-       $(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" 
-v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v 
pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < 
$(srcdir)/$< > $@
-       chmod +x $@
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c
index e31ac596c..62a8dd0fd 100644
--- a/src/dht/dht_api.c
+++ b/src/dht/dht_api.c
@@ -26,7 +26,6 @@
  */
 
 #include "platform.h"
-#include "gnunet_util_lib.h"
 #include "gnunet_constants.h"
 #include "gnunet_signatures.h"
 #include "gnunet_arm_service.h"
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 39433791d..c3ce2f284 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -27,7 +27,6 @@
 #include "platform.h"
 #include "gnunet_block_lib.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
 #include "gnunet_hello_uri_lib.h"
 #include "gnunet_dht_service.h"
 #include "gnunet_statistics_service.h"
@@ -236,7 +235,8 @@ broadcast_hello (void *cls)
                                              &broadcast_hello,
                                              NULL);
   hello = GNUNET_HELLO_builder_to_dht_hello_msg (GDS_my_hello,
-                                                 &GDS_my_private_key);
+                                                 &GDS_my_private_key,
+                                                 GNUNET_TIME_UNIT_ZERO);
   if (NULL == hello)
   {
     GNUNET_break (0);
diff --git a/src/dht/gnunet-service-dht.h b/src/dht/gnunet-service-dht.h
index dcc972fc2..893c90109 100644
--- a/src/dht/gnunet-service-dht.h
+++ b/src/dht/gnunet-service-dht.h
@@ -29,7 +29,6 @@
 #include "gnunet-service-dht_datacache.h"
 #include "gnunet-service-dht_neighbours.h"
 #include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
 
 
 #define DEBUG_DHT GNUNET_EXTRA_LOGGING
diff --git a/src/dht/gnunet-service-dht_neighbours.c 
b/src/dht/gnunet-service-dht_neighbours.c
index 010a7dd62..a2dc63808 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -28,7 +28,6 @@
 #include "gnunet_constants.h"
 #include "gnunet_protocols.h"
 #include "gnunet_signatures.h"
-#include "gnunet_hello_lib.h"
 #include "gnunet_hello_uri_lib.h"
 #include "gnunet-service-dht.h"
 #include "gnunet-service-dht_neighbours.h"
@@ -665,7 +664,7 @@ send_find_peer_message (void *cls)
                                     GNUNET_BLOCK_TYPE_DHT_HELLO,
                                     NULL,
                                     0,
-                                    "set-seen-size",
+                                    "seen-set-size",
                                     GNUNET_CONTAINER_multipeermap_size (
                                       all_connected_peers),
                                     NULL);
@@ -2183,7 +2182,8 @@ handle_find_my_hello (struct PeerInfo *pi,
                 GNUNET_HELLO_builder_to_block (GDS_my_hello,
                                                &GDS_my_private_key,
                                                NULL,
-                                               &block_size));
+                                               &block_size,
+                                               GNUNET_TIME_UNIT_ZERO));
   {
     char block[block_size];
 
@@ -2191,7 +2191,8 @@ handle_find_my_hello (struct PeerInfo *pi,
         GNUNET_HELLO_builder_to_block (GDS_my_hello,
                                        &GDS_my_private_key,
                                        block,
-                                       &block_size))
+                                       &block_size,
+                                       GNUNET_TIME_UNIT_ZERO))
     {
       GNUNET_STATISTICS_update (GDS_stats,
                                 "# FIND PEER requests ignored due to lack of 
HELLO",
diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c
index 6375fa272..aa5ffc719 100644
--- a/src/dht/plugin_block_dht.c
+++ b/src/dht/plugin_block_dht.c
@@ -27,7 +27,6 @@
  */
 #include "platform.h"
 #include "gnunet_constants.h"
-#include "gnunet_hello_lib.h"
 #include "gnunet_hello_uri_lib.h"
 #include "gnunet_block_plugin.h"
 #include "gnunet_block_group_lib.h"
@@ -105,13 +104,6 @@ block_plugin_dht_check_query (void *cls,
 {
   switch (type)
   {
-  case GNUNET_BLOCK_TYPE_LEGACY_HELLO:
-    if (0 != xquery_size)
-    {
-      GNUNET_break_op (0);
-      return GNUNET_NO;
-    }
-    return GNUNET_OK;
   case GNUNET_BLOCK_TYPE_DHT_HELLO:
     if (0 != xquery_size)
     {
@@ -143,33 +135,6 @@ block_plugin_dht_check_block (void *cls,
 {
   switch (type)
   {
-  case GNUNET_BLOCK_TYPE_LEGACY_HELLO:
-    {
-      const struct GNUNET_HELLO_Message *hello;
-      struct GNUNET_PeerIdentity pid;
-      const struct GNUNET_MessageHeader *msg;
-
-      if (block_size < sizeof(struct GNUNET_MessageHeader))
-      {
-        GNUNET_break_op (0);
-        return GNUNET_NO;
-      }
-      msg = block;
-      if (block_size != ntohs (msg->size))
-      {
-        GNUNET_break_op (0);
-        return GNUNET_NO;
-      }
-      hello = block;
-      if (GNUNET_OK !=
-          GNUNET_HELLO_get_id (hello,
-                               &pid))
-      {
-        GNUNET_break_op (0);
-        return GNUNET_NO;
-      }
-      return GNUNET_OK;
-    }
   case GNUNET_BLOCK_TYPE_DHT_HELLO:
     {
       struct GNUNET_HELLO_Builder *b;
@@ -228,28 +193,6 @@ block_plugin_dht_check_reply (
 {
   switch (type)
   {
-  case GNUNET_BLOCK_TYPE_LEGACY_HELLO:
-    {
-      /* LEGACY */
-      const struct GNUNET_MessageHeader *msg = reply_block;
-      const struct GNUNET_HELLO_Message *hello = reply_block;
-      struct GNUNET_PeerIdentity pid;
-      struct GNUNET_HashCode phash;
-
-      GNUNET_assert (reply_block_size >= sizeof(struct GNUNET_MessageHeader));
-      GNUNET_assert (reply_block_size == ntohs (msg->size));
-      GNUNET_assert (GNUNET_OK ==
-                     GNUNET_HELLO_get_id (hello,
-                                          &pid));
-      GNUNET_CRYPTO_hash (&pid,
-                          sizeof(pid),
-                          &phash);
-      if (GNUNET_YES ==
-          GNUNET_BLOCK_GROUP_bf_test_and_set (group,
-                                              &phash))
-        return GNUNET_BLOCK_REPLY_OK_DUPLICATE;
-      return GNUNET_BLOCK_REPLY_OK_MORE;
-    }
   case GNUNET_BLOCK_TYPE_DHT_HELLO:
     {
       struct GNUNET_HELLO_Builder *b;
@@ -298,47 +241,6 @@ block_plugin_dht_get_key (void *cls,
 {
   switch (type)
   {
-  case GNUNET_BLOCK_TYPE_LEGACY_HELLO:
-    {
-      /* LEGACY */
-      const struct GNUNET_MessageHeader *msg;
-      const struct GNUNET_HELLO_Message *hello;
-      struct GNUNET_PeerIdentity *pid;
-
-      if (block_size < sizeof(struct GNUNET_MessageHeader))
-      {
-        GNUNET_break_op (0);
-        memset (key,
-                0,
-                sizeof (*key));
-        return GNUNET_OK;
-      }
-      msg = block;
-      if (block_size != ntohs (msg->size))
-      {
-        GNUNET_break_op (0);
-        memset (key,
-                0,
-                sizeof (*key));
-        return GNUNET_OK;
-      }
-      hello = block;
-      memset (key,
-              0,
-              sizeof(*key));
-      pid = (struct GNUNET_PeerIdentity *) key;
-      if (GNUNET_OK !=
-          GNUNET_HELLO_get_id (hello,
-                               pid))
-      {
-        GNUNET_break_op (0);
-        memset (key,
-                0,
-                sizeof (*key));
-        return GNUNET_OK;
-      }
-      return GNUNET_OK;
-    }
   case GNUNET_BLOCK_TYPE_DHT_HELLO:
     {
       struct GNUNET_HELLO_Builder *b;
@@ -377,7 +279,6 @@ void *
 libgnunet_plugin_block_dht_init (void *cls)
 {
   static enum GNUNET_BLOCK_Type types[] = {
-    GNUNET_BLOCK_TYPE_LEGACY_HELLO,
     GNUNET_BLOCK_TYPE_DHT_HELLO,
     GNUNET_BLOCK_TYPE_ANY       /* end of list */
   };
diff --git a/src/dhtu/Makefile.am b/src/dhtu/Makefile.am
index 4d210b71f..732b37ff7 100644
--- a/src/dhtu/Makefile.am
+++ b/src/dhtu/Makefile.am
@@ -33,10 +33,9 @@ endif
 libgnunet_plugin_dhtu_gnunet_la_SOURCES = \
   plugin_dhtu_gnunet.c
 libgnunet_plugin_dhtu_gnunet_la_LIBADD = \
-  $(top_builddir)/src/ats/libgnunetats.la \
   $(top_builddir)/src/core/libgnunetcore.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  $(top_builddir)/src/transport/libgnunettransport.la \
+  $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
+  $(top_builddir)/src/transport/libgnunettransportapplication.la \
   $(top_builddir)/src/hello/libgnunethello.la \
   $(top_builddir)/src/nse/libgnunetnse.la \
   $(top_builddir)/src/util/libgnunetutil.la \
diff --git a/src/dhtu/meson.build b/src/dhtu/meson.build
index 34919bb55..8d076cc3f 100644
--- a/src/dhtu/meson.build
+++ b/src/dhtu/meson.build
@@ -37,13 +37,12 @@ shared_module('gnunet_plugin_dhtu_ip',
 shared_module('gnunet_plugin_dhtu_gnunet',
           libgnunetplugindhtugnunet_src,
           dependencies: [libgnunetutil_dep,
-                         libgnunetats_dep,
                          m_dep,
                          libgnunetcore_dep,
                          libgnunethello_dep,
-                         libgnunetpeerinfo_dep,
+                         libgnunetpeerstore_dep,
                          libgnunetnse_dep,
-                         libgnunettransport_dep],
+                         ],
           include_directories: [incdir, configuration_inc],
           install: true,
           install_dir: get_option('libdir')/'gnunet')
diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c
index b0cee7e01..2c1be6e36 100644
--- a/src/dhtu/plugin_dhtu_gnunet.c
+++ b/src/dhtu/plugin_dhtu_gnunet.c
@@ -26,42 +26,12 @@
  */
 #include "platform.h"
 #include "gnunet_dhtu_plugin.h"
-#include "gnunet_ats_service.h"
 #include "gnunet_core_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_peerinfo_service.h"
+#include "gnunet_transport_application_service.h"
+#include "gnunet_hello_uri_lib.h"
+#include "gnunet_peerstore_service.h"
 #include "gnunet_nse_service.h"
 
-
-/**
- * Handle for a HELLO we're offering the transport.
- */
-struct HelloHandle
-{
-  /**
-   * Kept in a DLL.
-   */
-  struct HelloHandle *next;
-
-  /**
-   * Kept in a DLL.
-   */
-  struct HelloHandle *prev;
-
-  /**
-   * Our plugin.
-   */
-  struct Plugin *plugin;
-
-  /**
-   * Offer handle.
-   */
-  struct GNUNET_TRANSPORT_OfferHelloHandle *ohh;
-
-};
-
-
 /**
  * Opaque handle that the underlay offers for our address to be used when
  * sending messages to another peer.
@@ -110,9 +80,9 @@ struct GNUNET_DHTU_Target
   struct GNUNET_DHTU_PreferenceHandle *ph_tail;
 
   /**
-   * ATS preference handle for this peer, or NULL.
+   * Transport suggest handle.
    */
-  struct GNUNET_ATS_ConnectivitySuggestHandle *csh;
+  struct GNUNET_TRANSPORT_ApplicationSuggestHandle *ash;
 
   /**
    * Identity of this peer.
@@ -167,15 +137,20 @@ struct Plugin
    */
   struct GNUNET_DHTU_PluginEnvironment *env;
 
+  /**
+   * Handle to the PEERSTORE service.
+   */
+  struct GNUNET_PEERSTORE_Handle *peerstore;
+
   /**
    * Handle to the CORE service.
    */
   struct GNUNET_CORE_Handle *core;
 
   /**
-   * Handle to ATS service.
+   * Handle to Transport service.
    */
-  struct GNUNET_ATS_ConnectivityHandle *ats;
+  struct GNUNET_TRANSPORT_ApplicationHandle *transport;
 
   /**
    * Handle to the NSE service.
@@ -183,47 +158,25 @@ struct Plugin
   struct GNUNET_NSE_Handle *nse;
 
   /**
-   * Watching for our address to change.
+   * Our peerstore notification context.  We use notification
+   * to instantly learn about new peers as they are discovered.
    */
-  struct GNUNET_PEERINFO_NotifyContext *nc;
+  struct GNUNET_PEERSTORE_NotifyContext *peerstore_notify;
 
   /**
-   * Hellos we are offering to transport.
-   */
-  struct HelloHandle *hh_head;
-
-  /**
-   * Hellos we are offering to transport.
+   * Identity of this peer.
    */
-  struct HelloHandle *hh_tail;
+  struct GNUNET_PeerIdentity my_identity;
 
   /**
-   * Identity of this peer.
+   * Our private key.
    */
-  struct GNUNET_PeerIdentity my_identity;
+  struct GNUNET_CRYPTO_EddsaPrivateKey *my_priv;
 
 };
 
 
-/**
- * Function called once a hello offer is completed.
- *
- * @param cls a `struct HelloHandle`
- */
-static void
-hello_offered_cb (void *cls)
-{
-  struct HelloHandle *hh = cls;
-  struct Plugin *plugin = hh->plugin;
-
-  GNUNET_CONTAINER_DLL_remove (plugin->hh_head,
-                               plugin->hh_tail,
-                               hh);
-  GNUNET_free (hh);
-}
-
-
-#include "../peerinfo-tool/gnunet-peerinfo_plugins.c"
+//#include "../peerinfo-tool/gnunet-peerinfo_plugins.c"
 
 
 /**
@@ -239,27 +192,30 @@ gnunet_try_connect (void *cls,
                     const char *address)
 {
   struct Plugin *plugin = cls;
-  struct GNUNET_HELLO_Message *hello = NULL;
-  struct HelloHandle *hh;
-  struct GNUNET_CRYPTO_EddsaPublicKey pubkey;
-
-  (void) pid; /* will be needed with future address URIs */
-  if (GNUNET_OK !=
-      GNUNET_HELLO_parse_uri (address,
-                              &pubkey,
-                              &hello,
-                              &GPI_plugins_find))
+  enum GNUNET_NetworkType nt = 0;
+  char *addr;
+  const char *eou;
+  int pfx_len;
+
+  eou = strstr (address,
+                  "://");
+  if (NULL == eou)
+  {
+    GNUNET_break (0);
     return;
-  hh = GNUNET_new (struct HelloHandle);
-  hh->plugin = plugin;
-  GNUNET_CONTAINER_DLL_insert (plugin->hh_head,
-                               plugin->hh_tail,
-                               hh);
-  hh->ohh = GNUNET_TRANSPORT_offer_hello (plugin->env->cfg,
-                                          &hello->header,
-                                          &hello_offered_cb,
-                                          hh);
-  GNUNET_free (hello);
+  }
+  pfx_len = eou - address;
+  eou += 3;
+  GNUNET_asprintf (&addr,
+                   "%.*s-%s",
+                   pfx_len,
+                   address,
+                   eou);
+  GNUNET_TRANSPORT_application_validate (plugin->transport,
+                                         pid,
+                                         nt,
+                                         addr);
+  GNUNET_free (addr);
 }
 
 
@@ -277,6 +233,7 @@ gnunet_hold (void *cls,
 {
   struct Plugin *plugin = cls;
   struct GNUNET_DHTU_PreferenceHandle *ph;
+  struct GNUNET_BANDWIDTH_Value32NBO bw;
 
   ph = GNUNET_new (struct GNUNET_DHTU_PreferenceHandle);
   ph->target = target;
@@ -284,12 +241,13 @@ gnunet_hold (void *cls,
                                target->ph_tail,
                                ph);
   target->ph_count++;
-  if (NULL != target->csh)
-    GNUNET_ATS_connectivity_suggest_cancel (target->csh);
-  target->csh
-    = GNUNET_ATS_connectivity_suggest (plugin->ats,
-                                       &target->pid,
-                                       target->ph_count);
+  if (NULL != target->ash)
+    GNUNET_TRANSPORT_application_suggest_cancel (target->ash);
+  target->ash
+    = GNUNET_TRANSPORT_application_suggest (plugin->transport,
+                                            &target->pid,
+                                            GNUNET_MQ_PRIO_BEST_EFFORT,
+                                            bw);
   return ph;
 }
 
@@ -305,21 +263,23 @@ gnunet_drop (struct GNUNET_DHTU_PreferenceHandle *ph)
 {
   struct GNUNET_DHTU_Target *target = ph->target;
   struct Plugin *plugin = target->plugin;
+  struct GNUNET_BANDWIDTH_Value32NBO bw;
 
   GNUNET_CONTAINER_DLL_remove (target->ph_head,
                                target->ph_tail,
                                ph);
   target->ph_count--;
   GNUNET_free (ph);
-  if (NULL != target->csh)
-    GNUNET_ATS_connectivity_suggest_cancel (target->csh);
+  if (NULL != target->ash)
+    GNUNET_TRANSPORT_application_suggest_cancel (target->ash);
   if (0 == target->ph_count)
-    target->csh = NULL;
+    target->ash = NULL;
   else
-    target->csh
-      = GNUNET_ATS_connectivity_suggest (plugin->ats,
-                                         &target->pid,
-                                         target->ph_count);
+    target->ash
+      = GNUNET_TRANSPORT_application_suggest (plugin->transport,
+                                              &target->pid,
+                                              GNUNET_MQ_PRIO_BEST_EFFORT,
+                                              bw);
 }
 
 
@@ -408,12 +368,28 @@ core_disconnect_cb (void *cls,
   struct GNUNET_DHTU_Target *target = peer_cls;
 
   plugin->env->disconnect_cb (target->app_ctx);
-  if (NULL != target->csh)
-    GNUNET_ATS_connectivity_suggest_cancel (target->csh);
+  if (NULL != target->ash)
+    GNUNET_TRANSPORT_application_suggest_cancel (target->ash);
   GNUNET_free (target);
 }
 
 
+static void
+add_addr (void *cls,
+          const char *addr)
+{
+  struct Plugin *plugin = cls;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG ,
+              "peerinfo_cb addr %s\n",
+              addr);
+  plugin->env->address_add_cb (plugin->env->cls,
+                               addr,
+                               &plugin->src,
+                               &plugin->src.app_ctx);
+}
+
+
 /**
  * Find the @a hello for our identity and then pass
  * it to the DHT as a URL.  Note that we only
@@ -429,10 +405,11 @@ core_disconnect_cb (void *cls,
 static void
 peerinfo_cb (void *cls,
              const struct GNUNET_PeerIdentity *peer,
-             const struct GNUNET_HELLO_Message *hello,
-             const char *err_msg)
+             const struct GNUNET_MessageHeader *hello,
+             const char *emsg)
 {
   struct Plugin *plugin = cls;
+  struct GNUNET_HELLO_Builder *builder;
   char *addr;
 
   if (NULL == hello)
@@ -443,15 +420,12 @@ peerinfo_cb (void *cls,
       GNUNET_memcmp (peer,
                      &plugin->my_identity))
     return;
-  addr = GNUNET_HELLO_compose_uri (hello,
-                                   &GPI_plugins_find);
-  if (NULL == addr)
-    return;
-  plugin->env->address_add_cb (plugin->env->cls,
-                               addr,
-                               &plugin->src,
-                               &plugin->src.app_ctx);
-  GNUNET_free (addr);
+  builder = GNUNET_HELLO_builder_from_msg (hello);
+  GNUNET_HELLO_builder_iterate (builder,
+                                (struct GNUNET_PeerIdentity *) peer,
+                                add_addr,
+                                plugin);
+  GNUNET_HELLO_builder_free (builder);
 }
 
 
@@ -468,16 +442,17 @@ peerinfo_cb (void *cls,
  * @param my_identity ID of this peer, NULL if we failed
  */
 static void
-core_init_cb (void *cls,
+ core_init_cb (void *cls,
               const struct GNUNET_PeerIdentity *my_identity)
 {
   struct Plugin *plugin = cls;
 
   plugin->my_identity = *my_identity;
-  plugin->nc = GNUNET_PEERINFO_notify (plugin->env->cfg,
-                                       GNUNET_NO,
-                                       &peerinfo_cb,
-                                       plugin);
+  plugin->peerstore_notify =
+      GNUNET_PEERSTORE_hello_changed_notify (plugin->peerstore,
+                                             GNUNET_NO,
+                                             &peerinfo_cb,
+                                             plugin);
 }
 
 
@@ -556,14 +531,6 @@ libgnunet_plugin_dhtu_gnunet_done (void *cls)
   struct Plugin *plugin = api->cls;
   struct HelloHandle *hh;
 
-  while (NULL != (hh = plugin->hh_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (plugin->hh_head,
-                                 plugin->hh_tail,
-                                 hh);
-    GNUNET_TRANSPORT_offer_hello_cancel (hh->ohh);
-    GNUNET_free (hh);
-  }
   if (NULL != plugin->nse)
     GNUNET_NSE_disconnect (plugin->nse);
   plugin->env->network_size_cb (plugin->env->cls,
@@ -572,11 +539,14 @@ libgnunet_plugin_dhtu_gnunet_done (void *cls)
                                 0.0);
   if (NULL != plugin->core)
     GNUNET_CORE_disconnect (plugin->core);
-  if (NULL != plugin->ats)
-    GNUNET_ATS_connectivity_done (plugin->ats);
-  if (NULL != plugin->nc)
-    GNUNET_PEERINFO_notify_cancel (plugin->nc);
-  GPI_plugins_unload ();
+  if (NULL != plugin->transport)
+    GNUNET_TRANSPORT_application_done (plugin->transport);
+  if (NULL != plugin->peerstore_notify)
+    GNUNET_PEERSTORE_hello_changed_notify_cancel (plugin->peerstore_notify);
+  if (NULL != plugin->peerstore)
+    GNUNET_PEERSTORE_disconnect (plugin->peerstore, GNUNET_YES);
+  //GPI_plugins_unload ();
+  GNUNET_free (plugin->my_priv);
   GNUNET_free (plugin);
   GNUNET_free (api);
   return NULL;
@@ -603,6 +573,7 @@ libgnunet_plugin_dhtu_gnunet_init (void *cls)
     GNUNET_MQ_handler_end ()
   };
 
+  plugin->my_priv = GNUNET_CRYPTO_eddsa_key_create_from_configuration 
(env->cfg);
   plugin = GNUNET_new (struct Plugin);
   plugin->env = env;
   api = GNUNET_new (struct GNUNET_DHTU_PluginFunctions);
@@ -611,7 +582,8 @@ libgnunet_plugin_dhtu_gnunet_init (void *cls)
   api->hold = &gnunet_hold;
   api->drop = &gnunet_drop;
   api->send = &gnunet_send;
-  plugin->ats = GNUNET_ATS_connectivity_init (env->cfg);
+  plugin->peerstore = GNUNET_PEERSTORE_connect (env->cfg);
+  plugin->transport = GNUNET_TRANSPORT_application_init (env->cfg);
   plugin->core = GNUNET_CORE_connect (env->cfg,
                                       plugin,
                                       &core_init_cb,
@@ -621,7 +593,7 @@ libgnunet_plugin_dhtu_gnunet_init (void *cls)
   plugin->nse = GNUNET_NSE_connect (env->cfg,
                                     &nse_cb,
                                     plugin);
-  if ( (NULL == plugin->ats) ||
+  if ( (NULL == plugin->transport) ||
        (NULL == plugin->core) ||
        (NULL == plugin->nse) )
   {
@@ -630,6 +602,6 @@ libgnunet_plugin_dhtu_gnunet_init (void *cls)
     libgnunet_plugin_dhtu_gnunet_done (plugin);
     return NULL;
   }
-  GPI_plugins_load (env->cfg);
+  //GPI_plugins_load (env->cfg);
   return api;
 }
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 7773c58ee..046105589 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -21,7 +21,7 @@ lib_LTLIBRARIES = libgnunetfs.la
 plugin_LTLIBRARIES = \
   libgnunet_plugin_block_fs.la
 
-noinst_LIBRARIES = libgnunetfstest.a
+# noinst_LIBRARIES = libgnunetfstest.a
 
 libgnunetfs_la_SOURCES = \
   fs_api.c fs_api.h fs.h \
@@ -59,19 +59,18 @@ libgnunetfs_la_LDFLAGS = \
   -version-info 3:1:1
 
 
-libgnunetfstest_a_SOURCES = \
-  fs_test_lib.c fs_test_lib.h
-
-libgnunetfstest_a_LIBADD = \
-  $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/testbed/libgnunettestbed.la
+#libgnunetfstest_a_SOURCES = \
+#  fs_test_lib.c fs_test_lib.h
+#
+#libgnunetfstest_a_LIBADD = \
+#  $(top_builddir)/src/testing/libgnunettesting.la \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la
 
 libexec_PROGRAMS = \
   gnunet-helper-fs-publish \
   gnunet-service-fs
 
 noinst_PROGRAMS = \
-  gnunet-fs-profiler \
   gnunet-daemon-fsprofiler
 
 bin_PROGRAMS = \
@@ -95,13 +94,14 @@ gnunet_directory_LDADD += \
   -lextractor
 endif
 
-gnunet_fs_profiler_SOURCES = \
- gnunet-fs-profiler.c
-gnunet_fs_profiler_LDADD = \
-  $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(GN_LIBINTL)
+# TNG
+#gnunet_fs_profiler_SOURCES = \
+# gnunet-fs-profiler.c
+#gnunet_fs_profiler_LDADD = \
+#  $(top_builddir)/src/testing/libgnunettesting.la \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(GN_LIBINTL)
 
 gnunet_fs_SOURCES = \
  gnunet-fs.c
@@ -196,7 +196,6 @@ gnunet_service_fs_LDADD =  \
  $(top_builddir)/src/datastore/libgnunetdatastore.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la \
  $(top_builddir)/src/cadet/libgnunetcadet.la \
- $(top_builddir)/src/ats/libgnunetats.la \
  $(top_builddir)/src/core/libgnunetcore.la \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
@@ -277,34 +276,33 @@ endif
 
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
-TESTS = \
- test_fs_directory \
- test_fs_download \
- test_fs_download_indexed \
- test_fs_download_persistence \
+TESTS = test_fs_directory \
  test_fs_file_information \
- test_fs_list_indexed \
  test_fs_namespace \
  test_fs_namespace_list_updateable \
- test_fs_publish \
- test_fs_publish_persistence \
  test_fs_search \
  test_fs_search_with_and \
  test_fs_search_probes \
  test_fs_search_persistence \
  test_fs_start_stop \
- test_fs_unindex \
- test_fs_unindex_persistence \
  test_fs_uri \
- test_fs_test_lib \
- test_fs_meta_data \
- test_gnunet_service_fs_migration \
- test_gnunet_service_fs_p2p \
- test_gnunet_service_fs_p2p_cadet \
- perf_gnunet_service_fs_p2p \
- perf_gnunet_service_fs_p2p_index \
- perf_gnunet_service_fs_p2p_respect \
- $(check_SCRIPTS)
+ test_fs_meta_data 
+ # test_fs_download \
+ # test_fs_download_indexed \
+ # test_fs_download_persistence \
+ # test_fs_list_indexed \
+ # test_fs_publish \
+ # test_fs_publish_persistence \
+ # test_fs_unindex \
+ # test_fs_unindex_persistence \
+ # test_fs_test_lib \
+ # test_gnunet_service_fs_migration \
+ # test_gnunet_service_fs_p2p \
+ # test_gnunet_service_fs_p2p_cadet \
+ # perf_gnunet_service_fs_p2p \
+ # perf_gnunet_service_fs_p2p_index \
+ # perf_gnunet_service_fs_p2p_respect \
+ # $(check_SCRIPTS)
 endif
 
 
@@ -463,73 +461,74 @@ test_fs_uri_LDADD = \
   libgnunetfs.la  \
   $(top_builddir)/src/util/libgnunetutil.la
 
-test_fs_test_lib_SOURCES = \
- test_fs_test_lib.c
-test_fs_test_lib_LDADD = \
-  libgnunetfstest.a \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-test_gnunet_service_fs_p2p_SOURCES = \
- test_gnunet_service_fs_p2p.c
-test_gnunet_service_fs_p2p_LDADD = \
-  libgnunetfstest.a \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-test_gnunet_service_fs_p2p_cadet_SOURCES = \
- test_gnunet_service_fs_p2p.c
-test_gnunet_service_fs_p2p_cadet_LDADD = \
-  libgnunetfstest.a \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-test_gnunet_service_fs_migration_SOURCES = \
- test_gnunet_service_fs_migration.c
-test_gnunet_service_fs_migration_LDADD = \
-  libgnunetfstest.a \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-perf_gnunet_service_fs_p2p_SOURCES = \
- perf_gnunet_service_fs_p2p.c
-perf_gnunet_service_fs_p2p_LDADD = \
-  libgnunetfstest.a \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-perf_gnunet_service_fs_p2p_index_SOURCES = \
- perf_gnunet_service_fs_p2p.c
-perf_gnunet_service_fs_p2p_index_LDADD = \
-  libgnunetfstest.a \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-perf_gnunet_service_fs_p2p_dht_SOURCES = \
- perf_gnunet_service_fs_p2p.c
-perf_gnunet_service_fs_p2p_dht_LDADD = \
-  libgnunetfstest.a \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-perf_gnunet_service_fs_p2p_respect_SOURCES = \
- perf_gnunet_service_fs_p2p_respect.c
-perf_gnunet_service_fs_p2p_respect_LDADD = \
-  libgnunetfstest.a \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  libgnunetfs.la  \
-  $(top_builddir)/src/util/libgnunetutil.la
+# TNG
+#test_fs_test_lib_SOURCES = \
+# test_fs_test_lib.c
+#test_fs_test_lib_LDADD = \
+#  libgnunetfstest.a \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  libgnunetfs.la  \
+#  $(top_builddir)/src/util/libgnunetutil.la
+
+#test_gnunet_service_fs_p2p_SOURCES = \
+# test_gnunet_service_fs_p2p.c
+#test_gnunet_service_fs_p2p_LDADD = \
+#  libgnunetfstest.a \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  libgnunetfs.la  \
+#  $(top_builddir)/src/util/libgnunetutil.la
+#
+#test_gnunet_service_fs_p2p_cadet_SOURCES = \
+# test_gnunet_service_fs_p2p.c
+#test_gnunet_service_fs_p2p_cadet_LDADD = \
+#  libgnunetfstest.a \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  libgnunetfs.la  \
+#  $(top_builddir)/src/util/libgnunetutil.la
+#
+#test_gnunet_service_fs_migration_SOURCES = \
+# test_gnunet_service_fs_migration.c
+#test_gnunet_service_fs_migration_LDADD = \
+#  libgnunetfstest.a \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  libgnunetfs.la  \
+#  $(top_builddir)/src/util/libgnunetutil.la
+#
+#perf_gnunet_service_fs_p2p_SOURCES = \
+# perf_gnunet_service_fs_p2p.c
+#perf_gnunet_service_fs_p2p_LDADD = \
+#  libgnunetfstest.a \
+#  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  libgnunetfs.la  \
+#  $(top_builddir)/src/util/libgnunetutil.la
+#
+#perf_gnunet_service_fs_p2p_index_SOURCES = \
+# perf_gnunet_service_fs_p2p.c
+#perf_gnunet_service_fs_p2p_index_LDADD = \
+#  libgnunetfstest.a \
+#  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  libgnunetfs.la  \
+#  $(top_builddir)/src/util/libgnunetutil.la
+#
+#perf_gnunet_service_fs_p2p_dht_SOURCES = \
+# perf_gnunet_service_fs_p2p.c
+#perf_gnunet_service_fs_p2p_dht_LDADD = \
+#  libgnunetfstest.a \
+#  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  libgnunetfs.la  \
+#  $(top_builddir)/src/util/libgnunetutil.la
+#
+#perf_gnunet_service_fs_p2p_respect_SOURCES = \
+# perf_gnunet_service_fs_p2p_respect.c
+#perf_gnunet_service_fs_p2p_respect_LDADD = \
+#  libgnunetfstest.a \
+#  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  libgnunetfs.la  \
+#  $(top_builddir)/src/util/libgnunetutil.la
 
 test_gnunet_fs_psd.py: test_gnunet_fs_psd.py.in Makefile
        $(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" 
-v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v 
pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < 
$(srcdir)/test_gnunet_fs_psd.py.in > test_gnunet_fs_psd.py
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 597e89e14..1ab6ac2b8 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -33,7 +33,6 @@
 #include "gnunet_protocols.h"
 #include "gnunet_signatures.h"
 #include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
 #include "gnunet_util_lib.h"
 #include "gnunet-service-fs_cp.h"
 #include "gnunet-service-fs_indexing.h"
@@ -248,11 +247,6 @@ struct GNUNET_LOAD_Value *GSF_rt_entry_lifetime;
  */
 struct GNUNET_TIME_Relative GSF_avg_latency = { 500 };
 
-/**
- * Handle to ATS service.
- */
-struct GNUNET_ATS_PerformanceHandle *GSF_ats;
-
 
 /**
  * Typical priorities we're seeing from other peers right now.  Since
@@ -559,45 +553,6 @@ GSF_test_get_load_too_high_ (uint32_t priority)
 }
 
 
-/**
- * We've received peer performance information. Update
- * our running average for the P2P latency.
- *
- * @param cls closure
- * @param address the address
- * @param active is this address in active use
- * @param bandwidth_out assigned outbound bandwidth for the connection
- * @param bandwidth_in assigned inbound bandwidth for the connection
- * @param prop performance data for the address (as far as known)
- */
-static void
-update_latencies (void *cls,
-                  const struct GNUNET_HELLO_Address *address,
-                  int active,
-                  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-                  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                  const struct GNUNET_ATS_Properties *prop)
-{
-  if (NULL == address)
-  {
-    /* ATS service temporarily disconnected */
-    return;
-  }
-
-  if (GNUNET_YES != active)
-    return;
-  GSF_update_peer_latency_ (&address->peer,
-                            prop->delay);
-  GSF_avg_latency.rel_value_us =
-    (GSF_avg_latency.rel_value_us * 31
-     + GNUNET_MIN (5000, prop->delay.rel_value_us)) / 32;
-  GNUNET_STATISTICS_set (GSF_stats,
-                         gettext_noop ("# running average P2P latency (ms)"),
-                         GSF_avg_latency.rel_value_us / 1000LL,
-                         GNUNET_NO);
-}
-
-
 /**
  * Check P2P "PUT" message.
  *
@@ -1042,12 +997,12 @@ hash_for_index_val (void *cls,
                 GNUNET_h2s (&isc->file_id));
 
     const char *emsg = "hash mismatch";
-    const size_t msize = strlen(emsg) + 1;
+    const size_t msize = strlen (emsg) + 1;
 
     env = GNUNET_MQ_msg_extra (msg,
                                msize,
                                GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED);
-    memcpy((char*) &msg[1], emsg, msize);
+    memcpy ((char*) &msg[1], emsg, msize);
     GNUNET_MQ_send (lc->mq,
                     env);
     GNUNET_SERVICE_client_continue (lc->client);
@@ -1182,11 +1137,6 @@ shutdown_task (void *cls)
     GNUNET_CORE_disconnect (GSF_core);
     GSF_core = NULL;
   }
-  if (NULL != GSF_ats)
-  {
-    GNUNET_ATS_performance_done (GSF_ats);
-    GSF_ats = NULL;
-  }
   GSF_put_done_ ();
   GSF_push_done_ ();
   GSF_pending_request_done_ ();
@@ -1378,9 +1328,7 @@ run (void *cls,
   GSF_plan_init ();
   GSF_pending_request_init_ ();
   GSF_connected_peer_init_ ();
-  GSF_ats = GNUNET_ATS_performance_init (GSF_cfg,
-                                         &update_latencies,
-                                         NULL);
+
   GSF_push_init_ ();
   GSF_put_init_ ();
   if ((GNUNET_OK != GNUNET_FS_indexing_init (cfg,
diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h
index 56d102673..e102a1fba 100644
--- a/src/fs/gnunet-service-fs.h
+++ b/src/fs/gnunet-service-fs.h
@@ -28,10 +28,8 @@
 
 #include "gnunet_util_lib.h"
 #include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
 #include "gnunet_core_service.h"
 #include "gnunet_block_lib.h"
-#include "gnunet_ats_service.h"
 #include "fs.h"
 
 
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 29e4c5910..74dd42daf 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -93,11 +93,6 @@ struct GSF_PeerTransmitHandle
    */
   int is_query;
 
-  /**
-   * Did we get a reservation already?
-   */
-  int was_reserved;
-
   /**
    * Priority of this request.
    */
@@ -209,11 +204,6 @@ struct GSF_ConnectedPeer
    */
   struct GSF_DelayedHandle *delayed_tail;
 
-  /**
-   * Context of our GNUNET_ATS_reserve_bandwidth call (or NULL).
-   */
-  struct GNUNET_ATS_ReservationContext *rc;
-
   /**
    * Task scheduled if we need to retry bandwidth reservation later.
    */
@@ -263,12 +253,6 @@ struct GSF_ConnectedPeer
    */
   unsigned int last_request_times_off;
 
-  /**
-   * #GNUNET_YES if we did successfully reserve 32k bandwidth,
-   * #GNUNET_NO if not.
-   */
-  int did_reserve;
-
   /**
    * Handle to the PEERSTORE iterate request for peer respect value
    */
@@ -334,23 +318,6 @@ static void
 peer_transmit (struct GSF_ConnectedPeer *cp);
 
 
-/**
- * Function called by core upon success or failure of our bandwidth 
reservation request.
- *
- * @param cls the `struct GSF_ConnectedPeer` of the peer for which we made the 
request
- * @param peer identifies the peer
- * @param amount set to the amount that was actually reserved or unreserved;
- *               either the full requested amount or zero (no partial 
reservations)
- * @param res_delay if the reservation could not be satisfied (amount was 0), 
how
- *        long should the client wait until re-trying?
- */
-static void
-ats_reserve_callback (void *cls,
-                      const struct GNUNET_PeerIdentity *peer,
-                      int32_t amount,
-                      struct GNUNET_TIME_Relative res_delay);
-
-
 /**
  * If ready (bandwidth reserved), try to schedule transmission via
  * core for the given handle.
@@ -367,32 +334,6 @@ schedule_transmission (struct GSF_PeerTransmitHandle *pth)
   GNUNET_assert (0 != cp->ppd.pid);
   GNUNET_PEER_resolve (cp->ppd.pid, &target);
 
-  if (0 != cp->inc_preference)
-  {
-    GNUNET_ATS_performance_change_preference (GSF_ats,
-                                              &target,
-                                              GNUNET_ATS_PREFERENCE_BANDWIDTH,
-                                              (double) cp->inc_preference,
-                                              GNUNET_ATS_PREFERENCE_END);
-    cp->inc_preference = 0;
-  }
-
-  if ((GNUNET_YES == pth->is_query) &&
-      (GNUNET_YES != pth->was_reserved))
-  {
-    /* query, need reservation */
-    if (GNUNET_YES != cp->did_reserve)
-      return;                   /* not ready */
-    cp->did_reserve = GNUNET_NO;
-    /* reservation already done! */
-    pth->was_reserved = GNUNET_YES;
-    cp->rc = GNUNET_ATS_reserve_bandwidth (GSF_ats,
-                                           &target,
-                                           DBLOCK_SIZE,
-                                           &ats_reserve_callback,
-                                           cp);
-    return;
-  }
   peer_transmit (cp);
 }
 
@@ -438,69 +379,6 @@ peer_transmit (struct GSF_ConnectedPeer *cp)
 }
 
 
-/**
- * (re)try to reserve bandwidth from the given peer.
- *
- * @param cls the `struct GSF_ConnectedPeer` to reserve from
- */
-static void
-retry_reservation (void *cls)
-{
-  struct GSF_ConnectedPeer *cp = cls;
-  struct GNUNET_PeerIdentity target;
-
-  GNUNET_PEER_resolve (cp->ppd.pid, &target);
-  cp->rc_delay_task = NULL;
-  cp->rc =
-    GNUNET_ATS_reserve_bandwidth (GSF_ats,
-                                  &target,
-                                  DBLOCK_SIZE,
-                                  &ats_reserve_callback, cp);
-}
-
-
-/**
- * Function called by core upon success or failure of our bandwidth 
reservation request.
- *
- * @param cls the `struct GSF_ConnectedPeer` of the peer for which we made the 
request
- * @param peer identifies the peer
- * @param amount set to the amount that was actually reserved or unreserved;
- *               either the full requested amount or zero (no partial 
reservations)
- * @param res_delay if the reservation could not be satisfied (amount was 0), 
how
- *        long should the client wait until re-trying?
- */
-static void
-ats_reserve_callback (void *cls,
-                      const struct GNUNET_PeerIdentity *peer,
-                      int32_t amount,
-                      struct GNUNET_TIME_Relative res_delay)
-{
-  struct GSF_ConnectedPeer *cp = cls;
-  struct GSF_PeerTransmitHandle *pth;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Reserved %d bytes / need to wait %s for reservation\n",
-              (int) amount,
-              GNUNET_STRINGS_relative_time_to_string (res_delay, GNUNET_YES));
-  cp->rc = NULL;
-  if (0 == amount)
-  {
-    cp->rc_delay_task =
-      GNUNET_SCHEDULER_add_delayed (res_delay,
-                                    &retry_reservation,
-                                    cp);
-    return;
-  }
-  cp->did_reserve = GNUNET_YES;
-  pth = cp->pth_head;
-  if (NULL != pth)
-  {
-    /* reservation success, try transmission now! */
-    peer_transmit (cp);
-  }
-}
-
-
 /**
  * Function called by PEERSTORE with peer respect record
  *
@@ -584,11 +462,7 @@ GSF_peer_connect_handler (void *cls,
   cp->ppd.peer = peer;
   cp->mq = mq;
   cp->ppd.transmission_delay = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_ZERO);
-  cp->rc =
-    GNUNET_ATS_reserve_bandwidth (GSF_ats,
-                                  peer,
-                                  DBLOCK_SIZE,
-                                  &ats_reserve_callback, cp);
+
   cp->request_map = GNUNET_CONTAINER_multihashmap_create (128,
                                                           GNUNET_YES);
   GNUNET_break (GNUNET_OK ==
@@ -1499,16 +1373,6 @@ GSF_peer_disconnect_handler (void *cls,
     GNUNET_PEERSTORE_iterate_cancel (cp->respect_iterate_req);
     cp->respect_iterate_req = NULL;
   }
-  if (NULL != cp->rc)
-  {
-    GNUNET_ATS_reserve_bandwidth_cancel (cp->rc);
-    cp->rc = NULL;
-  }
-  if (NULL != cp->rc_delay_task)
-  {
-    GNUNET_SCHEDULER_cancel (cp->rc_delay_task);
-    cp->rc_delay_task = NULL;
-  }
   GNUNET_CONTAINER_multihashmap_iterate (cp->request_map,
                                          &cancel_pending_request,
                                          cp);
diff --git a/src/fs/meson.build b/src/fs/meson.build
index 63a5d9a39..73e55b65a 100644
--- a/src/fs/meson.build
+++ b/src/fs/meson.build
@@ -122,7 +122,6 @@ executable ('gnunet-service-fs',
                            libgnunetdht_dep,
                            libgnunetidentity_dep,
                            m_dep,
-                           libgnunetats_dep,
                            libgnunetcadet_dep,
                            libgnunetpeerstore_dep,
                            libgnunetdatastore_dep,
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index a164efee1..8fcd3c7c0 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -239,31 +239,31 @@ check_PROGRAMS = \
   test_gns_proxy
 endif
 
-check_SCRIPTS = \
-  test_gns_lookup.sh \
-  test_gns_config_lookup.sh \
-  test_gns_ipv6_lookup.sh\
-  test_gns_txt_lookup.sh\
-  test_gns_caa_lookup.sh\
-  test_gns_mx_lookup.sh \
-  test_gns_gns2dns_lookup.sh \
-  test_gns_gns2dns_zkey_lookup.sh \
-  test_gns_gns2dns_cname_lookup.sh \
-  test_gns_dht_lookup.sh\
-  test_gns_delegated_lookup.sh \
-  test_gns_at_lookup.sh\
-  test_gns_zkey_lookup.sh\
-  test_gns_rel_expiration.sh\
-  test_gns_soa_lookup.sh\
-  test_gns_revocation.sh\
-  test_gns_redirect_lookup.sh
+check_SCRIPTS = 
+  # test_gns_lookup.sh \
+  # test_gns_config_lookup.sh \
+  # test_gns_ipv6_lookup.sh\
+  # test_gns_txt_lookup.sh\
+  # test_gns_caa_lookup.sh\
+  # test_gns_mx_lookup.sh \
+  # test_gns_gns2dns_lookup.sh \
+  # test_gns_gns2dns_zkey_lookup.sh \
+  # test_gns_gns2dns_cname_lookup.sh \
+  # test_gns_dht_lookup.sh\
+  # test_gns_delegated_lookup.sh \
+  # test_gns_at_lookup.sh\
+  # test_gns_zkey_lookup.sh\
+  # test_gns_rel_expiration.sh\
+  #test_gns_soa_lookup.sh\
+  #test_gns_revocation.sh\
+  #test_gns_redirect_lookup.sh
 
 if HAVE_GNUTLS_CURL
 check_SCRIPTS += \
-  test_proxy.sh
+  #test_proxy.sh
 endif
 check_SCRIPTS += \
-  test_plugin_rest_gns.sh
+  #test_plugin_rest_gns.sh
 
 EXTRA_DIST = \
   test_gns_defaults.conf \
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 9e25154ef..2e5ddc2b7 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -27,7 +27,6 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_constants.h"
 #include "gnunet_arm_service.h"
-#include "gnunet_hello_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_dht_service.h"
 #include "gns.h"
diff --git a/src/gns/gns_tld_api.c b/src/gns/gns_tld_api.c
index c88ce776e..78a70f14e 100644
--- a/src/gns/gns_tld_api.c
+++ b/src/gns/gns_tld_api.c
@@ -28,7 +28,6 @@
 #include "gnunet_constants.h"
 #include "gnunet_arm_service.h"
 #include "gnunet_identity_service.h"
-#include "gnunet_hello_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_dht_service.h"
 #include "gns.h"
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 4727842ea..931654c49 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -25,7 +25,6 @@
  * @author Matthias Wachs
  * @author Christian Grothoff
  */
-#include "gnunet_common.h"
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_constants.h"
diff --git a/src/hello/Makefile.am b/src/hello/Makefile.am
index c04b85106..5b923055b 100644
--- a/src/hello/Makefile.am
+++ b/src/hello/Makefile.am
@@ -9,7 +9,6 @@ endif
 lib_LTLIBRARIES = libgnunethello.la
 
 libgnunethello_la_SOURCES = \
-  hello.c \
   address.c \
   hello-ng.c \
   hello-uri.c
@@ -20,8 +19,8 @@ libgnunethello_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS) \
   -version-info 1:0:1
 
-noinst_PROGRAMS = \
- gnunet-hello
+#noinst_PROGRAMS = \
+# gnunet-hello
 
 check_PROGRAMS = \
  test_hello \
@@ -60,10 +59,11 @@ test_friend_hello_LDADD = \
  libgnunethello.la \
  $(top_builddir)/src/util/libgnunetutil.la
 
-gnunet_hello_SOURCES = \
- gnunet-hello.c
-gnunet_hello_LDADD = \
- libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la
-gnunet_hello_LDFLAGS = \
-  $(GN_LIBINTL)
+# Not TNG ready
+#gnunet_hello_SOURCES = \
+# gnunet-hello.c
+#gnunet_hello_LDADD = \
+# libgnunethello.la \
+# $(top_builddir)/src/util/libgnunetutil.la
+#gnunet_hello_LDFLAGS = \
+#  $(GN_LIBINTL)
diff --git a/src/hello/gnunet-hello.c b/src/hello/gnunet-hello.c
index 1f110ac18..dffc61460 100644
--- a/src/hello/gnunet-hello.c
+++ b/src/hello/gnunet-hello.c
@@ -25,6 +25,8 @@
 #include "platform.h"
 #include "gnunet_protocols.h"
 #include "gnunet_hello_lib.h"
+#include "gnunet_hello_uri_lib.h"
+#include "gnunet_transport_plugin.h"
 
 /**
  * Closure for #add_to_buf().
@@ -45,10 +47,162 @@ struct AddContext
    * Number of bytes added so far.
    */
   size_t ret;
+
+  struct GNUNET_HELLO_Builder *builder;
+};
+
+/**
+ * Entry in doubly-linked list of all of our plugins.
+ */
+struct TransportPlugin
+{
+  /**
+   * This is a doubly-linked list.
+   */
+  struct TransportPlugin *next;
+
+  /**
+   * This is a doubly-linked list.
+   */
+  struct TransportPlugin *prev;
+
+  /**
+   * API of the transport as returned by the plugin's
+   * initialization function.
+   */
+  struct GNUNET_TRANSPORT_PluginFunctions *api;
+
+  /**
+   * Short name for the plugin (e.g. "tcp").
+   */
+  char *short_name;
+
+  /**
+   * Name of the library (e.g. "gnunet_plugin_transport_tcp").
+   */
+  char *lib_name;
+
+  /**
+   * Environment this transport service is using
+   * for this plugin.
+   */
+  struct GNUNET_TRANSPORT_PluginEnvironment env;
 };
 
 static int address_count;
 
+/**
+ * Our private key.
+ */
+static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
+
+/**
+ * Local peer own ID.
+ */
+struct GNUNET_PeerIdentity my_full_id;
+
+/**
+ * The file with hello in old style which we like to replace with the new one.
+ */
+static char *hello_file;
+
+/**
+ * Head of DLL of all loaded plugins.
+ */
+static struct TransportPlugin *plugins_head;
+
+/**
+ * Head of DLL of all loaded plugins.
+ */
+static struct TransportPlugin *plugins_tail;
+
+static void
+plugins_load (const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  struct TransportPlugin *plug;
+  struct TransportPlugin *next;
+  char *libname;
+  char *plugs;
+  char *pos;
+
+  if (NULL != plugins_head)
+    return; /* already loaded */
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_string (cfg, "TRANSPORT", "PLUGINS",
+                                             &plugs))
+    return;
+  fprintf (stdout,"Starting transport plugins `%s'\n",
+              plugs);
+  for (pos = strtok (plugs, " "); pos != NULL; pos = strtok (NULL, " "))
+  {
+    fprintf (stdout,"Loading `%s' transport plugin\n",
+                pos);
+    GNUNET_asprintf (&libname, "libgnunet_plugin_transport_%s", pos);
+    plug = GNUNET_new (struct TransportPlugin);
+    plug->short_name = GNUNET_strdup (pos);
+    plug->lib_name = libname;
+    plug->env.cfg = cfg;
+    plug->env.cls = plug->short_name;
+    GNUNET_CONTAINER_DLL_insert (plugins_head, plugins_tail, plug);
+  }
+  GNUNET_free (plugs);
+  next = plugins_head;
+  while (next != NULL)
+  {
+    plug = next;
+    next = plug->next;
+    plug->api = GNUNET_PLUGIN_load (plug->lib_name, &plug->env);
+    if (plug->api == NULL)
+    {
+      fprintf (stdout,"Failed to load transport plugin for `%s'\n",
+                  plug->lib_name);
+      GNUNET_CONTAINER_DLL_remove (plugins_head, plugins_tail, plug);
+      GNUNET_free (plug->short_name);
+      GNUNET_free (plug->lib_name);
+      GNUNET_free (plug);
+    }
+  }
+}
+
+
+static int
+add_to_builder (void *cls,
+            const struct GNUNET_HELLO_Address *address,
+            struct GNUNET_TIME_Absolute expiration)
+{
+  struct GNUNET_HELLO_Builder *builder= cls;
+  struct TransportPlugin *pos = plugins_head;
+  const char *addr;
+  char *uri;
+
+  while (NULL != pos)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "short_name: %s transport_name: %s\n",
+                pos->short_name,
+              address->transport_name);
+    if (0 == strcmp (address->transport_name, pos->short_name))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "short_name: %s transport_name: %s are the same\n",
+                  pos->short_name,
+              address->transport_name);
+      addr = strchr (strchr (pos->api->address_to_string (pos, address, 
address->address_length), '.')+1, '.') + 1;
+    }
+    pos = plugins_head->next;
+  }
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Hello address string: %s\n",
+              addr);
+  GNUNET_asprintf (&uri, "%s://%s", address->transport_name, addr);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Hello address uri string: %s\n",
+              uri);
+  GNUNET_HELLO_builder_add_address (builder,
+                                    uri);
+}
+
 
 /**
  * Add the given address with infinite expiration to the buffer.
@@ -70,6 +224,7 @@ add_to_buf (void *cls,
                                   GNUNET_TIME_UNIT_FOREVER_ABS,
                                   ac->buf,
                                   ac->max);
+
   ac->buf += ret;
   ac->max -= ret;
   ac->ret += ret;
@@ -105,52 +260,71 @@ add_from_hello (void *cls, size_t max, void *buf)
 }
 
 
-int
-main (int argc, char *argv[])
+/**
+ * Main function that will be run without the scheduler.
+ *
+ * @param cls closure
+ * @param args remaining command-line arguments
+ * @param cfgfile name of the configuration file used (for saving, can be 
NULL!)
+ * @param c configuration
+ */
+static void
+run (void *cls,
+     char *const *args,
+     const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *c)
 {
   struct GNUNET_DISK_FileHandle *fh;
   struct GNUNET_HELLO_Message *orig;
   struct GNUNET_HELLO_Message *result;
   struct GNUNET_PeerIdentity pid;
   uint64_t fsize;
+  ssize_t size_written;
+  struct GNUNET_HELLO_Builder *builder;
+  char *url;
+  const struct GNUNET_MessageHeader *msg;
+  struct GNUNET_MQ_Envelope *env;
 
+  plugins_load (c);
   address_count = 0;
 
-  GNUNET_log_setup ("gnunet-hello", "INFO", NULL);
-  if (argc != 2)
-  {
-    fprintf (stderr, "%s", _ ("Call with name of HELLO file to modify.\n"));
-    return 1;
-  }
+  my_private_key =
+    GNUNET_CRYPTO_eddsa_key_create_from_configuration (c);
+  GNUNET_CRYPTO_eddsa_key_get_public (my_private_key,
+                                      &my_full_id.public_key);
+  fprintf (stdout,"We are peer %s\n", GNUNET_i2s (&my_full_id));
+
+  GNUNET_log_setup ("gnunet-hello", "DEBUG", NULL);
+
   if (GNUNET_OK !=
-      GNUNET_DISK_file_size (argv[1], &fsize, GNUNET_YES, GNUNET_YES))
+      GNUNET_DISK_file_size (hello_file, &fsize, GNUNET_YES, GNUNET_YES))
   {
     fprintf (stderr,
              _ ("Error accessing file `%s': %s\n"),
-             argv[1],
+             hello_file,
              strerror (errno));
-    return 1;
+    return;
   }
   if (fsize > 65536)
   {
-    fprintf (stderr, _ ("File `%s' is too big to be a HELLO\n"), argv[1]);
-    return 1;
+    fprintf (stderr, _ ("File `%s' is too big to be a HELLO\n"), hello_file);
+    return;
   }
   if (fsize < sizeof(struct GNUNET_MessageHeader))
   {
-    fprintf (stderr, _ ("File `%s' is too small to be a HELLO\n"), argv[1]);
-    return 1;
+    fprintf (stderr, _ ("File `%s' is too small to be a HELLO\n"), hello_file);
+    return;
   }
-  fh = GNUNET_DISK_file_open (argv[1],
+  fh = GNUNET_DISK_file_open (hello_file,
                               GNUNET_DISK_OPEN_READ,
                               GNUNET_DISK_PERM_USER_READ);
   if (NULL == fh)
   {
     fprintf (stderr,
              _ ("Error opening file `%s': %s\n"),
-             argv[1],
+             hello_file,
              strerror (errno));
-    return 1;
+    return;
   }
   {
     char buf[fsize] GNUNET_ALIGN;
@@ -163,8 +337,8 @@ main (int argc, char *argv[])
     {
       fprintf (stderr,
                _ ("Did not find well-formed HELLO in file `%s'\n"),
-               argv[1]);
-      return 1;
+               hello_file);
+      return;
     }
     {
       char *pids;
@@ -173,13 +347,25 @@ main (int argc, char *argv[])
       fprintf (stdout, "Processing HELLO for peer `%s'\n", pids);
       GNUNET_free (pids);
     }
-    result = GNUNET_HELLO_create (&pid.public_key,
-                                  &add_from_hello,
-                                  &orig,
-                                  GNUNET_HELLO_is_friend_only (orig));
-    GNUNET_assert (NULL != result);
+    /* result = GNUNET_HELLO_create (&pid.public_key, */
+    /*                               &add_from_hello, */
+    /*                               &orig, */
+    /*                               GNUNET_HELLO_is_friend_only (orig)); */
+
+    builder = GNUNET_HELLO_builder_new (&pid);
+    GNUNET_assert (
+    NULL ==
+    GNUNET_HELLO_iterate_addresses ((const struct GNUNET_HELLO_Message *) 
orig, GNUNET_NO, &add_to_builder, builder));
+    url = GNUNET_HELLO_builder_to_url (builder, my_private_key);
+    fprintf (stdout,"url: %s\n", url);
+    env = GNUNET_HELLO_builder_to_env (builder,
+                                 my_private_key,
+                                 GNUNET_TIME_UNIT_ZERO);
+    msg = GNUNET_MQ_env_get_msg (env);
+    //GNUNET_assert (NULL != result);
+    GNUNET_assert (NULL != msg);
     fh =
-      GNUNET_DISK_file_open (argv[1],
+      GNUNET_DISK_file_open (hello_file,
                              GNUNET_DISK_OPEN_WRITE | 
GNUNET_DISK_OPEN_TRUNCATE,
                              GNUNET_DISK_PERM_USER_READ
                              | GNUNET_DISK_PERM_USER_WRITE);
@@ -187,28 +373,54 @@ main (int argc, char *argv[])
     {
       fprintf (stderr,
                _ ("Error opening file `%s': %s\n"),
-               argv[1],
+               hello_file,
                strerror (errno));
       GNUNET_free (result);
-      return 1;
+      return;
     }
-    fsize = GNUNET_HELLO_size (result);
-    if (fsize != GNUNET_DISK_file_write (fh, result, fsize))
+    //fsize = GNUNET_HELLO_size (result);
+    size_written = GNUNET_DISK_file_write (fh, msg, ntohs (msg->size));
+    if (ntohs (msg->size) != size_written)
     {
       fprintf (stderr,
-               _ ("Error writing HELLO to file `%s': %s\n"),
-               argv[1],
+               _ ("Error writing HELLO to file `%s': %s expected size %u size 
written %u\n"),
+               hello_file,
                strerror (errno));
       (void) GNUNET_DISK_file_close (fh);
-      return 1;
+      return;
     }
     GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
   }
   fprintf (stderr,
            _ ("Modified %u addresses, wrote %u bytes\n"),
            address_count,
-           (unsigned int) fsize);
-  return 0;
+           (unsigned int) ntohs (msg->size));
+  GNUNET_HELLO_builder_free (builder);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+  struct GNUNET_GETOPT_CommandLineOption options[] =
+  { GNUNET_GETOPT_option_string ('h',
+                               "hello-file",
+                               "HELLO_FILE",
+                               gettext_noop ("Hello file to read"),
+                               &hello_file),
+    GNUNET_GETOPT_OPTION_END };
+  int ret;
+
+  ret = (GNUNET_OK ==
+         GNUNET_PROGRAM_run2 (argc,
+                             argv,
+                             "gnunet-peerinfo",
+                             gettext_noop ("Print information about peers."),
+                             options,
+                             &run,
+                             NULL,
+                             GNUNET_YES));
+  return ret;
 }
 
 
diff --git a/src/hello/hello-ng.c b/src/hello/hello-ng.c
index 9d77e4f80..9c255b361 100644
--- a/src/hello/hello-ng.c
+++ b/src/hello/hello-ng.c
@@ -28,7 +28,6 @@
 #include "gnunet_hello_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_ats_service.h"
 
 GNUNET_NETWORK_STRUCT_BEGIN
 /**
diff --git a/src/hello/hello-uri.c b/src/hello/hello-uri.c
index dd191738f..4a8591ed1 100644
--- a/src/hello/hello-uri.c
+++ b/src/hello/hello-uri.c
@@ -204,6 +204,32 @@ struct GNUNET_HELLO_Builder
 
 };
 
+/**
+ * Struct to wrap data to do the merge of to hello uris.
+ */
+struct AddressUriMergeResult
+{
+  /**
+   * The builder of the hello uri we merge with.
+   */
+  struct GNUNET_HELLO_Builder *builder;
+
+  /**
+   * The actual address to check, if it is allready in the hello uri we merge 
with.
+   */
+  const char *address_uri;
+
+  /**
+   * Did we found the actual address to check.
+   */
+  unsigned int found;
+
+  /**
+   * Did we found at least one address to merge.
+   */
+  unsigned int merged;
+};
+
 
 /**
  * Compute @a hash over addresses in @a builder.
@@ -315,6 +341,13 @@ GNUNET_HELLO_builder_new (const struct GNUNET_PeerIdentity 
*pid)
 }
 
 
+struct GNUNET_PeerIdentity *
+GNUNET_HELLO_builder_get_id (struct GNUNET_HELLO_Builder *builder)
+{
+  return &builder->pid;
+}
+
+
 void
 GNUNET_HELLO_builder_free (struct GNUNET_HELLO_Builder *builder)
 {
@@ -412,6 +445,28 @@ GNUNET_HELLO_builder_from_block (const void *block,
 }
 
 
+struct GNUNET_TIME_Absolute
+GNUNET_HELLO_builder_get_expiration_time (const struct
+                                          GNUNET_MessageHeader *msg)
+{
+  if (GNUNET_MESSAGE_TYPE_HELLO_URI == ntohs (msg->type))
+  {
+    const struct HelloUriMessage *h = (struct HelloUriMessage *) msg;
+    const struct BlockHeader *bh = (const struct BlockHeader *) &h[1];
+
+    return GNUNET_TIME_absolute_ntoh (bh->expiration_time);
+  }
+  else if (GNUNET_MESSAGE_TYPE_DHT_P2P_HELLO == ntohs (msg->type))
+  {
+    const struct DhtHelloMessage *dht_hello = (struct DhtHelloMessage *) msg;
+
+    return GNUNET_TIME_absolute_ntoh (dht_hello->expiration_time);
+  }
+  else
+    GNUNET_break (0);
+}
+
+
 struct GNUNET_HELLO_Builder *
 GNUNET_HELLO_builder_from_url (const char *url)
 {
@@ -552,7 +607,8 @@ GNUNET_HELLO_builder_from_url (const char *url)
 
 struct GNUNET_MQ_Envelope *
 GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder,
-                             const struct GNUNET_CRYPTO_EddsaPrivateKey *priv)
+                             const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
+                             struct GNUNET_TIME_Relative expiration_time)
 {
   struct GNUNET_MQ_Envelope *env;
   struct HelloUriMessage *msg;
@@ -568,7 +624,8 @@ GNUNET_HELLO_builder_to_env (const struct 
GNUNET_HELLO_Builder *builder,
                  GNUNET_HELLO_builder_to_block (builder,
                                                 priv,
                                                 NULL,
-                                                &blen));
+                                                &blen,
+                                                expiration_time));
   env = GNUNET_MQ_msg_extra (msg,
                              blen,
                              GNUNET_MESSAGE_TYPE_HELLO_URI);
@@ -577,7 +634,8 @@ GNUNET_HELLO_builder_to_env (const struct 
GNUNET_HELLO_Builder *builder,
                  GNUNET_HELLO_builder_to_block (builder,
                                                 priv,
                                                 &msg[1],
-                                                &blen));
+                                                &blen,
+                                                expiration_time));
   return env;
 }
 
@@ -585,7 +643,8 @@ GNUNET_HELLO_builder_to_env (const struct 
GNUNET_HELLO_Builder *builder,
 struct GNUNET_MessageHeader *
 GNUNET_HELLO_builder_to_dht_hello_msg (
   const struct GNUNET_HELLO_Builder *builder,
-  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv)
+  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
+  struct GNUNET_TIME_Relative expiration_time)
 {
   struct DhtHelloMessage *msg;
   size_t blen;
@@ -600,7 +659,8 @@ GNUNET_HELLO_builder_to_dht_hello_msg (
                  GNUNET_HELLO_builder_to_block (builder,
                                                 priv,
                                                 NULL,
-                                                &blen));
+                                                &blen,
+                                                expiration_time));
   GNUNET_assert (blen < UINT16_MAX);
   GNUNET_assert (blen >= sizeof (struct BlockHeader));
   {
@@ -611,7 +671,8 @@ GNUNET_HELLO_builder_to_dht_hello_msg (
                    GNUNET_HELLO_builder_to_block (builder,
                                                   priv,
                                                   buf,
-                                                  &blen));
+                                                  &blen,
+                                                  expiration_time));
     msg = GNUNET_malloc (sizeof (*msg)
                          + blen
                          - sizeof (*block));
@@ -699,7 +760,8 @@ enum GNUNET_GenericReturnValue
 GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder,
                                const struct GNUNET_CRYPTO_EddsaPrivateKey 
*priv,
                                void *block,
-                               size_t *block_size)
+                               size_t *block_size,
+                               struct GNUNET_TIME_Relative expiration_time)
 {
   struct BlockHeader bh;
   size_t needed = sizeof (bh);
@@ -720,7 +782,10 @@ GNUNET_HELLO_builder_to_block (const struct 
GNUNET_HELLO_Builder *builder,
     return GNUNET_NO;
   }
   bh.pid = builder->pid;
-  et = GNUNET_TIME_relative_to_timestamp (GNUNET_HELLO_ADDRESS_EXPIRATION);
+  if (GNUNET_TIME_UNIT_ZERO.rel_value_us == expiration_time.rel_value_us)
+    et = GNUNET_TIME_relative_to_timestamp (GNUNET_HELLO_ADDRESS_EXPIRATION);
+  else
+    et = GNUNET_TIME_relative_to_timestamp (expiration_time);
   bh.expiration_time = GNUNET_TIME_absolute_hton (et.abs_time);
   sign_hello (builder,
               et,
diff --git a/src/hello/test_hello-uri.c b/src/hello/test_hello-uri.c
index 01b6f2d8e..1062f446b 100644
--- a/src/hello/test_hello-uri.c
+++ b/src/hello/test_hello-uri.c
@@ -95,19 +95,22 @@ main (int argc,
                    GNUNET_HELLO_builder_to_block (b,
                                                   &priv,
                                                   NULL,
-                                                  &block_size));
+                                                  &block_size,
+                                                  NULL));
     GNUNET_assert (GNUNET_NO ==
                    GNUNET_HELLO_builder_to_block (b,
                                                   &priv,
                                                   NULL,
-                                                  &block_size));
+                                                  &block_size,
+                                                  NULL));
     GNUNET_assert (0 != block_size);
     block = GNUNET_malloc (block_size);
     GNUNET_assert (GNUNET_OK ==
                    GNUNET_HELLO_builder_to_block (b,
                                                   &priv,
                                                   block,
-                                                  &block_size));
+                                                  &block_size,
+                                                  NULL));
     b2 = GNUNET_HELLO_builder_from_block (block,
                                           block_size);
     GNUNET_free (block);
@@ -154,7 +157,8 @@ main (int argc,
     unsigned int found;
 
     env = GNUNET_HELLO_builder_to_env (b,
-                                       &priv);
+                                       &priv,
+                                       NULL);
     b2 = GNUNET_HELLO_builder_from_msg (GNUNET_MQ_env_get_msg (env));
     GNUNET_free (env);
     GNUNET_assert (NULL != b2);
diff --git a/src/hostlist/Makefile.am b/src/hostlist/Makefile.am
index 77c9eb1de..31f2c258d 100644
--- a/src/hostlist/Makefile.am
+++ b/src/hostlist/Makefile.am
@@ -28,9 +28,8 @@ gnunet_daemon_hostlist_SOURCES = \
 gnunet_daemon_hostlist_LDADD = \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
+  $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/transport/libgnunettransport.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(GN_LIBMHD) \
   @LIBCURL@ \
@@ -52,25 +51,25 @@ TESTS = \
  $(check_PROGRAMS)
 endif
 
-test_gnunet_daemon_hostlist_SOURCES = \
- test_gnunet_daemon_hostlist.c
-test_gnunet_daemon_hostlist_LDADD = \
-  $(top_builddir)/src/transport/libgnunettransport.la \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-test_gnunet_daemon_hostlist_reconnect_SOURCES = \
- test_gnunet_daemon_hostlist_reconnect.c
-test_gnunet_daemon_hostlist_reconnect_LDADD = \
-  $(top_builddir)/src/transport/libgnunettransport.la \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-test_gnunet_daemon_hostlist_learning_SOURCES = \
- test_gnunet_daemon_hostlist_learning.c
-test_gnunet_daemon_hostlist_learning_LDADD = \
-  $(top_builddir)/src/transport/libgnunettransport.la \
-  $(top_builddir)/src/core/libgnunetcore.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
+#test_gnunet_daemon_hostlist_SOURCES = \
+# test_gnunet_daemon_hostlist.c
+#test_gnunet_daemon_hostlist_LDADD = \
+#  $(top_builddir)/src/transport/libgnunettransport.la \
+#  $(top_builddir)/src/util/libgnunetutil.la
+#
+#test_gnunet_daemon_hostlist_reconnect_SOURCES = \
+# test_gnunet_daemon_hostlist_reconnect.c
+#test_gnunet_daemon_hostlist_reconnect_LDADD = \
+#  $(top_builddir)/src/transport/libgnunettransport.la \
+#  $(top_builddir)/src/util/libgnunetutil.la
+#
+#test_gnunet_daemon_hostlist_learning_SOURCES = \
+# test_gnunet_daemon_hostlist_learning.c
+#test_gnunet_daemon_hostlist_learning_LDADD = \
+#  $(top_builddir)/src/transport/libgnunettransport.la \
+#  $(top_builddir)/src/core/libgnunetcore.la \
+#  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+#  $(top_builddir)/src/util/libgnunetutil.la
 
 EXTRA_DIST = \
   test_hostlist_defaults.conf \
diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c 
b/src/hostlist/gnunet-daemon-hostlist_client.c
index 399a7dc39..2932df07c 100644
--- a/src/hostlist/gnunet-daemon-hostlist_client.c
+++ b/src/hostlist/gnunet-daemon-hostlist_client.c
@@ -25,10 +25,9 @@
  */
 #include "platform.h"
 #include "gnunet-daemon-hostlist_client.h"
-#include "gnunet_hello_lib.h"
+#include "gnunet_util_lib.h"
 #include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_peerinfo_service.h"
+#include "gnunet_peerstore_service.h"
 #include "gnunet-daemon-hostlist.h"
 /* Just included for the right curl.h */
 #include "gnunet_curl_lib.h"
@@ -306,9 +305,16 @@ static unsigned int stat_hellos_obtained;
 static unsigned int stat_connection_count;
 
 /**
- * Handle to peerinfo service.
+ * Handle to the PEERSTORE service.
  */
-static struct GNUNET_PEERINFO_Handle *pi;
+static struct GNUNET_PEERSTORE_Handle *peerstore;
+
+
+static void
+shc_cont (void *cls, int success)
+{
+  GNUNET_free (cls);
+}
 
 
 /**
@@ -324,6 +330,7 @@ static size_t
 callback_download (void *ptr, size_t size, size_t nmemb, void *ctx)
 {
   static char download_buffer[GNUNET_MAX_MESSAGE_SIZE - 1];
+  struct GNUNET_PEERSTORE_StoreHelloContext *shc;
   const char *cbuf = ptr;
   const struct GNUNET_MessageHeader *msg;
   size_t total;
@@ -378,7 +385,7 @@ callback_download (void *ptr, size_t size, size_t nmemb, 
void *ctx)
       GNUNET_assert (left == 0);
       break;
     }
-    if (GNUNET_HELLO_size ((const struct GNUNET_HELLO_Message *) msg) == msize)
+    if (sizeof (msg) == msize)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Received valid `%s' message from hostlist server.\n",
@@ -389,11 +396,10 @@ callback_download (void *ptr, size_t size, size_t nmemb, 
void *ctx)
         1,
         GNUNET_NO);
       stat_hellos_obtained++;
-      (void)
-      GNUNET_PEERINFO_add_peer (pi,
-                                (const struct GNUNET_HELLO_Message *) msg,
-                                NULL,
-                                NULL);
+      shc = GNUNET_PEERSTORE_hello_add (peerstore,
+                                        msg,
+                                        shc_cont,
+                                        shc);
     }
     else
     {
@@ -1593,7 +1599,7 @@ GNUNET_HOSTLIST_client_start (const struct 
GNUNET_CONFIGURATION_Handle *c,
   stats = st;
 
   /* Read proxy configuration */
-  pi = GNUNET_PEERINFO_connect (c);
+  peerstore = GNUNET_PEERSTORE_connect (c);
   if (GNUNET_OK ==
       GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST", "PROXY", &proxy))
   {
@@ -1789,10 +1795,10 @@ GNUNET_HOSTLIST_client_stop ()
   proxy_username = NULL;
   GNUNET_free (proxy_password);
   proxy_password = NULL;
-  if (NULL != pi)
+  if (NULL != peerstore)
   {
-    GNUNET_PEERINFO_disconnect (pi);
-    pi = NULL;
+    GNUNET_PEERSTORE_disconnect (peerstore, GNUNET_YES);
+    peerstore = NULL;
   }
   cfg = NULL;
 }
diff --git a/src/hostlist/gnunet-daemon-hostlist_server.c 
b/src/hostlist/gnunet-daemon-hostlist_server.c
index 46b18b266..f383ec394 100644
--- a/src/hostlist/gnunet-daemon-hostlist_server.c
+++ b/src/hostlist/gnunet-daemon-hostlist_server.c
@@ -28,8 +28,8 @@
 #include "platform.h"
 #include <microhttpd.h>
 #include "gnunet-daemon-hostlist_server.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_peerinfo_service.h"
+#include "gnunet_hello_uri_lib.h"
+#include "gnunet_peerstore_service.h"
 #include "gnunet-daemon-hostlist.h"
 #include "gnunet_resolver_service.h"
 #include "gnunet_mhd_compat.h"
@@ -69,9 +69,10 @@ static struct GNUNET_STATISTICS_Handle *stats;
 static struct GNUNET_CORE_Handle *core;
 
 /**
- * Handle to the peerinfo notify service (NULL until we've connected to it).
+ * Our peerstore notification context.  We use notification
+ * to instantly learn about new peers as they are discovered.
  */
-static struct GNUNET_PEERINFO_NotifyContext *notify;
+static struct GNUNET_PEERSTORE_NotifyContext *peerstore_notify;
 
 /**
  * Our primary task for IPv4.
@@ -89,9 +90,9 @@ static struct GNUNET_SCHEDULER_Task *hostlist_task_v6;
 static struct MHD_Response *response;
 
 /**
- * Handle for accessing peerinfo service.
+ * Handle to the PEERSTORE service.
  */
-static struct GNUNET_PEERINFO_Handle *peerinfo;
+static struct GNUNET_PEERSTORE_Handle *peerstore;
 
 /**
  * Set if we are allowed to advertise our hostlist to others.
@@ -112,7 +113,7 @@ struct HostSet
   /**
    * Iterator used to build @e data (NULL when done).
    */
-  struct GNUNET_PEERINFO_IteratorContext *pitr;
+  struct GNUNET_PEERSTORE_IterateContext *pitr;
 
   /**
    * Place where we accumulate all of the HELLO messages.
@@ -178,34 +179,6 @@ finish_response ()
 }
 
 
-/**
- * Set @a cls to #GNUNET_YES (we have an address!).
- *
- * @param cls closure, an `int *`
- * @param address the address (ignored)
- * @param expiration expiration time (call is ignored if this is in the past)
- * @return  #GNUNET_SYSERR to stop iterating (unless expiration has occurred)
- */
-static int
-check_has_addr (void *cls,
-                const struct GNUNET_HELLO_Address *address,
-                struct GNUNET_TIME_Absolute expiration)
-{
-  int *arg = cls;
-
-  if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
-  {
-    GNUNET_STATISTICS_update (stats,
-                              gettext_noop ("expired addresses encountered"),
-                              1,
-                              GNUNET_YES);
-    return GNUNET_YES;   /* ignore this address */
-  }
-  *arg = GNUNET_YES;
-  return GNUNET_SYSERR;
-}
-
-
 /**
  * Callback that processes each of the known HELLOs for the
  * hostlist response construction.
@@ -217,55 +190,62 @@ check_has_addr (void *cls,
  */
 static void
 host_processor (void *cls,
-                const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_HELLO_Message *hello,
-                const char *err_msg)
+                const struct GNUNET_PEERSTORE_Record *record,
+                const char *emsg)
 {
   size_t old;
   size_t s;
-  int has_addr;
+  struct GNUNET_MessageHeader *hello;
+  struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+  struct GNUNET_TIME_Absolute hello_exp;
 
-  if (NULL != err_msg)
+  if (NULL != emsg)
   {
-    GNUNET_assert (NULL == peer);
+    GNUNET_assert (NULL == &record->peer);
     builder->pitr = NULL;
     GNUNET_free (builder->data);
     GNUNET_free (builder);
     builder = NULL;
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ ("Error in communication with PEERINFO service: %s\n"),
-                err_msg);
+                _ ("Error in communication with PEERSTORE service: %s\n"),
+                emsg);
     return;
   }
-  if (NULL == peer)
+  if (NULL == record)
   {
     builder->pitr = NULL;
     finish_response ();
     return;
   }
-  if (NULL == hello)
-    return;
-  has_addr = GNUNET_NO;
-  GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &check_has_addr, 
&has_addr);
-  if (GNUNET_NO == has_addr)
+  else
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "HELLO for peer `%4s' has no address, not suitable for 
hostlist!\n",
-                GNUNET_i2s (peer));
-    GNUNET_STATISTICS_update (stats,
-                              gettext_noop (
-                                "HELLOs without addresses encountered 
(ignored)"),
-                              1,
-                              GNUNET_NO);
-    return;
+    hello = record->value;
+    if ((0 == record->value_size))
+    {
+      GNUNET_break (0);
+      return;
+    }
+    hello_exp = GNUNET_HELLO_builder_get_expiration_time (hello);
+    if (GNUNET_TIME_absolute_cmp (hello_exp, <, now))
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "HELLO for peer `%4s' has expired address, not suitable for 
hostlist!\n",
+                  GNUNET_i2s (&record->peer));
+      GNUNET_STATISTICS_update (stats,
+                                gettext_noop (
+                                  "Expired HELLO encountered (ignored)"),
+                                1,
+                                GNUNET_NO);
+      return;
+    }
   }
   old = builder->size;
-  s = GNUNET_HELLO_size (hello);
+  s = sizeof (hello);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received %u bytes of `%s' from peer `%s' for hostlist.\n",
               (unsigned int) s,
               "HELLO",
-              GNUNET_i2s (peer));
+              GNUNET_i2s (&record->peer));
   if ((old + s >= GNUNET_MAX_MALLOC_CHECKED) ||
       (old + s >= MAX_BYTES_PER_HOSTLISTS))
   {
@@ -279,7 +259,7 @@ host_processor (void *cls,
   }
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Adding peer `%s' to hostlist (%u bytes)\n",
-              GNUNET_i2s (peer),
+              GNUNET_i2s (&record->peer),
               (unsigned int) s);
   GNUNET_array_grow (builder->data, builder->size, old + s);
   GNUNET_memcpy (&builder->data[old], hello, s);
@@ -506,7 +486,7 @@ connect_handler (void *cls,
 
 
 /**
- * PEERINFO calls this function to let us know about a possible peer
+ * PEERSTORE calls this function to let us know about a possible peer
  * that we might want to connect to.
  *
  * @param cls closure (not used)
@@ -517,21 +497,21 @@ connect_handler (void *cls,
 static void
 process_notify (void *cls,
                 const struct GNUNET_PeerIdentity *peer,
-                const struct GNUNET_HELLO_Message *hello,
+                const struct GNUNET_MessageHeader *hello,
                 const char *err_msg)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Peerinfo is notifying us to rebuild our hostlist\n");
+              "Peerstore is notifying us to rebuild our hostlist\n");
   if (NULL != err_msg)
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ ("Error in communication with PEERINFO service: %s\n"),
+                _ ("Error in communication with PEERSTORE service: %s\n"),
                 err_msg);
   if (NULL != builder)
   {
     /* restart re-build already in progress ... */
     if (NULL != builder->pitr)
     {
-      GNUNET_PEERINFO_iterate_cancel (builder->pitr);
+      GNUNET_PEERSTORE_iterate_cancel (builder->pitr);
       builder->pitr = NULL;
     }
     GNUNET_free (builder->data);
@@ -542,9 +522,9 @@ process_notify (void *cls,
   {
     builder = GNUNET_new (struct HostSet);
   }
-  GNUNET_assert (NULL != peerinfo);
+  GNUNET_assert (NULL != peerstore);
   builder->pitr =
-    GNUNET_PEERINFO_iterate (peerinfo, GNUNET_NO, NULL, &host_processor, NULL);
+    GNUNET_PEERSTORE_iterate (peerstore, "hostlist", NULL, 
GNUNET_PEERSTORE_HELLO_KEY, &host_processor, NULL);
 }
 
 
@@ -667,11 +647,11 @@ GNUNET_HOSTLIST_server_start (const struct 
GNUNET_CONFIGURATION_Handle *c,
   }
   cfg = c;
   stats = st;
-  peerinfo = GNUNET_PEERINFO_connect (cfg);
-  if (NULL == peerinfo)
+  peerstore = GNUNET_PEERSTORE_connect (cfg);
+  if (NULL == peerstore)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ ("Could not access PEERINFO service.  Exiting.\n"));
+                _ ("Could not access PEERSTORE service.  Exiting.\n"));
     return GNUNET_SYSERR;
   }
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
@@ -837,7 +817,7 @@ GNUNET_HOSTLIST_server_start (const struct 
GNUNET_CONFIGURATION_Handle *c,
     hostlist_task_v4 = prepare_daemon (daemon_handle_v4);
   if (NULL != daemon_handle_v6)
     hostlist_task_v6 = prepare_daemon (daemon_handle_v6);
-  notify = GNUNET_PEERINFO_notify (cfg, GNUNET_NO, &process_notify, NULL);
+  peerstore_notify = GNUNET_PEERSTORE_hello_changed_notify (peerstore, 
GNUNET_NO, &process_notify, NULL);
   return GNUNET_OK;
 }
 
@@ -874,26 +854,26 @@ GNUNET_HOSTLIST_server_stop ()
     MHD_destroy_response (response);
     response = NULL;
   }
-  if (NULL != notify)
+  if (NULL != peerstore_notify)
   {
-    GNUNET_PEERINFO_notify_cancel (notify);
-    notify = NULL;
+    GNUNET_PEERSTORE_hello_changed_notify_cancel (peerstore_notify);
+    peerstore_notify = NULL;
   }
   if (NULL != builder)
   {
     if (NULL != builder->pitr)
     {
-      GNUNET_PEERINFO_iterate_cancel (builder->pitr);
+      GNUNET_PEERSTORE_iterate_cancel (builder->pitr);
       builder->pitr = NULL;
     }
     GNUNET_free (builder->data);
     GNUNET_free (builder);
     builder = NULL;
   }
-  if (NULL != peerinfo)
+  if (NULL != peerstore)
   {
-    GNUNET_PEERINFO_disconnect (peerinfo);
-    peerinfo = NULL;
+    GNUNET_PEERSTORE_disconnect (peerstore, GNUNET_YES);
+    peerstore = NULL;
   }
   cfg = NULL;
   stats = NULL;
diff --git a/src/hostlist/meson.build b/src/hostlist/meson.build
index 811e3e669..c05578334 100644
--- a/src/hostlist/meson.build
+++ b/src/hostlist/meson.build
@@ -17,9 +17,8 @@ executable ('gnunet-daemon-hostlist',
             dependencies: [libgnunetutil_dep,
                            libgnunetcore_dep,
                            libgnunethello_dep,
-                           libgnunetpeerinfo_dep,
+                           libgnunetpeerstore_dep,
                            libgnunetstatistics_dep,
-                           libgnunettransport_dep,
                            mhd_dep,
                            curl_dep],
             include_directories: [incdir, configuration_inc],
diff --git a/src/identity/Makefile.am b/src/identity/Makefile.am
index 06cfff965..fecfaea47 100644
--- a/src/identity/Makefile.am
+++ b/src/identity/Makefile.am
@@ -75,10 +75,10 @@ check_PROGRAMS = \
 check_SCRIPTS = \
   test_identity_messages.sh
 
-if ENABLE_TEST_RUN
-AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
-TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
-endif
+# if ENABLE_TEST_RUN
+# AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
+# TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
+# endif
 
 
 test_identity_SOURCES = \
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index ef18ab01b..03983eaa0 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -17,10 +17,6 @@ gnunetinclude_HEADERS = \
   gnunet_abd_service.h \
   gnunet_applications.h \
   gnunet_arm_service.h \
-  gnunet_ats_service.h \
-  gnunet_ats_application_service.h \
-  gnunet_ats_transport_service.h \
-  gnunet_ats_plugin.h \
   gnunet_bandwidth_lib.h \
   gnunet_bio_lib.h \
   gnunet_dht_block_types.h \
@@ -123,14 +119,11 @@ gnunetinclude_HEADERS = \
   gnunet_testing_ng_lib.h \
   gnunet_testing_netjail_lib.h \
   gnunet_time_lib.h \
-  gnunet_transport_service.h \
   gnunet_transport_application_service.h \
   gnunet_transport_communication_service.h \
   gnunet_transport_core_service.h \
   gnunet_transport_hello_service.h \
-  gnunet_transport_manipulation_service.h \
-  gnunet_transport_monitor_service.h \
-  gnunet_transport_plugin.h \
+  gnunet_transport_testing_ng_lib.h \
   gnunet_tun_lib.h \
   gnunet_uri_lib.h \
   gnunet_util_lib.h \
diff --git a/src/include/gnunet_ats_application_service.h 
b/src/include/gnunet_ats_application_service.h
deleted file mode 100644
index da7fd4b52..000000000
--- a/src/include/gnunet_ats_application_service.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010-2015, 2018 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @addtogroup Backbone
- * @{
- *
- * @file
- * Bandwidth allocation API for applications to interact with
- *
- * @author Christian Grothoff
- * @author Matthias Wachs
- *
- * @defgroup ats  ATS service
- * Bandwidth allocation
- *
- * @see [Documentation](https://gnunet.org/ats-subsystem)
- *
- * @{
- */
-#ifndef GNUNET_ATS_APPLICATION_SERVICE_H
-#define GNUNET_ATS_APPLICATION_SERVICE_H
-
-
-#include "gnunet_constants.h"
-#include "gnunet_util_lib.h"
-
-/**
- * Handle to the ATS subsystem for making suggestions about
- * connections the peer would like to have.
- */
-struct GNUNET_ATS_ApplicationHandle;
-
-
-/**
- * Initialize the ATS application client handle.
- *
- * @param cfg configuration to use
- * @return ats application handle, NULL on error
- */
-struct GNUNET_ATS_ApplicationHandle *
-GNUNET_ATS_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
-
-
-/**
- * Shutdown ATS application client.
- *
- * @param ch handle to destroy
- */
-void
-GNUNET_ATS_application_done (struct GNUNET_ATS_ApplicationHandle *ch);
-
-
-/**
- * Handle for suggestion requests.
- */
-struct GNUNET_ATS_ApplicationSuggestHandle;
-
-
-/**
- * An application would like to communicate with a peer.  ATS should
- * allocate bandwidth using a suitable address for requiremetns @a pk
- * to transport.
- *
- * @param ch handle
- * @param peer identity of the peer we need an address for
- * @param pk what kind of application will the application require (can be
- *         #GNUNET_MQ_PREFERENCE_NONE, we will still try to connect)
- * @param bw desired bandwidth, can be zero (we will still try to connect)
- * @return suggestion handle, NULL if request is already pending
- */
-struct GNUNET_ATS_ApplicationSuggestHandle *
-GNUNET_ATS_application_suggest (struct GNUNET_ATS_ApplicationHandle *ch,
-                                const struct GNUNET_PeerIdentity *peer,
-                                enum GNUNET_MQ_PreferenceKind pk,
-                                struct GNUNET_BANDWIDTH_Value32NBO bw);
-
-
-/**
- * We no longer care about communicating with a peer.
- *
- * @param sh handle
- */
-void
-GNUNET_ATS_application_suggest_cancel (struct
-                                       GNUNET_ATS_ApplicationSuggestHandle 
*sh);
-
-/** @} */  /* end of group */
-
-/** @} */  /* end of Backbone addition*/
-
-#endif
-/* end of file gnunet_ats_application_service.h */
diff --git a/src/include/gnunet_ats_plugin.h b/src/include/gnunet_ats_plugin.h
deleted file mode 100644
index 206f2dd52..000000000
--- a/src/include/gnunet_ats_plugin.h
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
-   This file is part of GNUnet
-   Copyright (C) 2009-2015 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @addtogroup Backbone
- * @{
- *
- * @author Christian Grothoff
- *
- * @file
- * API for the ATS solvers.
- *
- * @defgroup ats-plugin  ATS service plugin API
- * Plugin API for the ATS service.
- *
- * Specifies the struct that is given to the plugin's entry method and the 
other
- * struct that must be returned.  Note that the destructors of ATS plugins will
- * be given the value returned by the constructor and is expected to return a
- * NULL pointer.
- *
- * @{
- */
-#ifndef PLUGIN_ATS_H
-#define PLUGIN_ATS_H
-
-
-#include "gnunet_ats_service.h"
-#include "gnunet_statistics_service.h"
-
-/**
- * Representation of an address the plugin can choose from.
- */
-struct ATS_Address;
-
-/**
- * Change the preference for a peer
- *
- * @param handle the solver handle
- * @param client the client sending this request
- * @param peer the peer id
- * @param kind the preference kind to change
- * @param score the new preference score
- * @param pref_rel the normalized preference value for this kind over all 
clients
- */
-typedef void
-(*GAS_solver_address_change_preference) (void *solver,
-                                         const struct GNUNET_PeerIdentity 
*peer,
-                                         enum GNUNET_ATS_PreferenceKind kind,
-                                         double pref_rel);
-
-
-/**
- * Give feedback about the current assignment
- *
- * @param handle the solver handle
- * @param application the application sending this request
- * @param peer the peer id
- * @param scope the time interval for this feedback: [now - scope .. now]
- * @param kind the preference kind for this feedback
- * @param score the feedback score
- */
-typedef void
-(*GAS_solver_address_feedback_preference) (void *solver,
-                                           struct GNUNET_SERVICE_Client *
-                                           application,
-                                           const struct
-                                           GNUNET_PeerIdentity *peer,
-                                           const struct GNUNET_TIME_Relative
-                                           scope,
-                                           enum GNUNET_ATS_PreferenceKind kind,
-                                           double score);
-
-/**
- * Notify the solver about a bulk operation changing possibly a lot of values
- * Solver will not resolve until all bulk operations are marked as done
- *
- * @param solver the solver
- */
-typedef void
-(*GAS_solver_bulk_start) (void *solver);
-
-
-/**
- * Mark a bulk operation as done
- * Solver will resolve if values have changed
- *
- * @param solver the solver
- */
-typedef void
-(*GAS_solver_bulk_stop) (void *solver);
-
-
-/**
- * Add a single address within a network to the solver
- *
- * @param solver the solver Handle
- * @param address the address to add
- * @param network network type of this address
- */
-typedef void
-(*GAS_solver_address_add) (void *solver,
-                           struct ATS_Address *address,
-                           uint32_t network);
-
-
-/**
- * Delete an address or just the session from the solver
- *
- * @param solver the solver Handle
- * @param address the address to delete
- */
-typedef void
-(*GAS_solver_address_delete) (void *solver,
-                              struct ATS_Address *address);
-
-
-/**
- * Transport properties for this address have changed
- *
- * @param solver solver handle
- * @param address the address
- */
-typedef void
-(*GAS_solver_address_property_changed) (void *solver,
-                                        struct ATS_Address *address);
-
-
-/**
- * Get the preferred address for a peer from solver
- *
- * @param solver the solver to use
- * @param peer the peer
- */
-typedef void
-(*GAS_solver_get_preferred_address) (void *solver,
-                                     const struct GNUNET_PeerIdentity *peer);
-
-
-/**
- * Stop getting the preferred address for a peer from solver
- *
- * @param solver the solver to use
- * @param peer the peer
- */
-typedef void
-(*GAS_solver_stop_get_preferred_address) (void *solver,
-                                          const struct
-                                          GNUNET_PeerIdentity *peer);
-
-
-/**
- * Solver functions.
- *
- * Each solver is required to set up and return an instance
- * of this struct during initialization.
- */
-struct GNUNET_ATS_SolverFunctions
-{
-  /**
-   * Closure to pass to all solver functions in this struct.
-   */
-  void *cls;
-
-  /**
-   * Add a new address for a peer to the solver
-   *
-   * The address is already contained in the addresses hashmap!
-   */
-  GAS_solver_address_add s_add;
-
-  /**
-   * Update the properties of an address in the solver
-   */
-  GAS_solver_address_property_changed s_address_update_property;
-
-  /**
-   * Tell solver to notify ATS if the address to use changes for a specific
-   * peer using the bandwidth changed callback
-   *
-   * The solver must only notify about changes for peers with pending address
-   * requests!
-   */
-  GAS_solver_get_preferred_address s_get;
-
-  /**
-   * Tell solver stop notifying ATS about changes for this peers
-   *
-   * The solver must only notify about changes for peers with pending address
-   * requests!
-   */
-  GAS_solver_stop_get_preferred_address s_get_stop;
-
-  /**
-   * Delete an address in the solver
-   *
-   * The address is not contained in the address hashmap anymore!
-   */
-  GAS_solver_address_delete s_del;
-
-  /**
-   * Change relative preference for quality in solver
-   */
-  GAS_solver_address_change_preference s_pref;
-
-  /**
-   * Give feedback about the current assignment
-   */
-  GAS_solver_address_feedback_preference s_feedback;
-
-  /**
-   * Start a bulk operation
-   *
-   * Used if many values have to be updated at the same time.
-   * When a bulk operation is pending the solver does not have to resolve
-   * the problem since more updates will follow anyway
-   *
-   * For each call to bulk_start, a call to bulk_stop is required!
-   */
-  GAS_solver_bulk_start s_bulk_start;
-
-  /**
-   * Bulk operation done
-   *
-   * If no more bulk operations are pending, the solver can solve the problem
-   * with the updated values
-   */
-  GAS_solver_bulk_stop s_bulk_stop;
-};
-
-
-/**
- * Operation codes for solver information callback
- *
- * Order of calls is expected to be:
- * #GAS_OP_SOLVE_START
- * #GAS_OP_SOLVE_STOP
- * #GAS_OP_SOLVE_UPDATE_NOTIFICATION_START
- * #GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP
- *
- */
-enum GAS_Solver_Operation
-{
-  /**
-   * A solution iteration has been started
-   */
-  GAS_OP_SOLVE_START,
-
-  /**
-   * A solution iteration has been finished
-   */
-  GAS_OP_SOLVE_STOP,
-
-  /**
-   * The setup of the problem as a preparation to solve it was started
-   */
-  GAS_OP_SOLVE_SETUP_START,
-
-  /**
-   * The setup of the problem as a preparation to solve is finished
-   */
-  GAS_OP_SOLVE_SETUP_STOP,
-
-  /**
-   * Solving of the LP problem was started
-   * MLP solver only
-   */
-  GAS_OP_SOLVE_MLP_LP_START,
-
-  /**
-   * Solving of the LP problem is done
-   * MLP solver only
-   */
-  GAS_OP_SOLVE_MLP_LP_STOP,
-
-  /**
-   * Solving of the MLP problem was started
-   * MLP solver only
-   */
-  GAS_OP_SOLVE_MLP_MLP_START,
-
-  /**
-   * Solving of the MLP problem is done
-   * MLP solver only
-   */
-  GAS_OP_SOLVE_MLP_MLP_STOP,
-
-  /**
-   * After the problem was finished, start notifications about changes
-   * to addresses
-   */
-  GAS_OP_SOLVE_UPDATE_NOTIFICATION_START,
-
-  /**
-   * After the problem was finished, notifications about changes to addresses
-   * are done
-   */
-  GAS_OP_SOLVE_UPDATE_NOTIFICATION_STOP
-};
-
-
-/**
- * Status of a GAS_Solver_Operation operation
- */
-enum GAS_Solver_Status
-{
-  /**
-   * Success
-   */
-  GAS_STAT_SUCCESS,
-
-  /**
-   * Failure
-   */
-  GAS_STAT_FAIL
-};
-
-
-/**
- * Status of the operation
- */
-enum GAS_Solver_Additional_Information
-{
-  /**
-   * No more specific information
-   */
-  GAS_INFO_NONE,
-
-  /**
-   * A full solution process is performed
-   * Quite specific to the MLP solver
-   */
-  GAS_INFO_FULL,
-
-  /**
-   * An existing solution was reused
-   * Quite specific to the MLP solver
-   */
-  GAS_INFO_UPDATED,
-
-  /**
-   * The proportional solver had to recalculate for a single network
-   */
-  GAS_INFO_PROP_SINGLE,
-
-  /**
-   * The proportional solver had to recalculate for all networks
-   */
-  GAS_INFO_PROP_ALL
-};
-
-
-/**
- * Callback to call with additional information
- * Used for measurement
- *
- * @param cls the closure
- * @param op the operation
- */
-typedef void
-(*GAS_solver_information_callback) (void *cls,
-                                    enum GAS_Solver_Operation op,
-                                    enum GAS_Solver_Status stat,
-                                    enum GAS_Solver_Additional_Information);
-
-
-/**
- * Callback to call from solver when bandwidth for address has changed
- *
- * @param address the with changed bandwidth assigned
- */
-typedef void
-(*GAS_bandwidth_changed_cb) (void *cls,
-                             struct ATS_Address *address);
-
-
-/**
- * Callback to call from solver to obtain application preference
- * values for a peer.
- *
- * @param cls the cls
- * @param id the peer id
- * @return carry of double values containing the preferences with
- *      GNUNET_ATS_PreferenceCount elements
- */
-typedef const double *
-(*GAS_get_preferences) (void *cls,
-                        const struct GNUNET_PeerIdentity *id);
-
-
-/**
- * Callback to call from solver to obtain application connectivity
- * preferences for a peer.
- *
- * @param cls the cls
- * @param id the peer id
- * @return 0 if connectivity is not desired, non-null if address
- *      suggestions are requested
- */
-typedef unsigned int
-(*GAS_get_connectivity) (void *cls,
-                         const struct GNUNET_PeerIdentity *id);
-
-
-/**
- * The ATS plugin will pass a pointer to a struct
- * of this type as to the initialization function
- * of the ATS plugins.
- */
-struct GNUNET_ATS_PluginEnvironment
-{
-  /**
-   * Configuration handle to be used by the solver
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Statistics handle to be used by the solver
-   */
-  struct GNUNET_STATISTICS_Handle *stats;
-
-  /**
-   * Closure to pass to all callbacks in this struct.
-   */
-  void *cls;
-
-  /**
-   * Hashmap containing all addresses available
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *addresses;
-
-  /**
-   * ATS addresses callback to be notified about bandwidth assignment changes
-   */
-  GAS_bandwidth_changed_cb bandwidth_changed_cb;
-
-  /**
-   * ATS addresses function to obtain preference values
-   */
-  GAS_get_preferences get_preferences;
-
-  /**
-   * ATS addresses function to obtain preference values
-   */
-  GAS_get_connectivity get_connectivity;
-
-  /**
-   * Callback for solver to call with status information,
-   * can be NULL
-   */
-  GAS_solver_information_callback info_cb;
-
-  /**
-   * Number of networks available, size of the @e out_quota
-   * and @e in_quota arrays.
-   */
-  unsigned int network_count;
-
-  /**
-   * Array of configured outbound quotas
-   * Order according to networks in network array
-   */
-  unsigned long long out_quota[GNUNET_NT_COUNT];
-
-  /**
-   * Array of configured inbound quotas
-   * Order according to networks in network array
-   */
-  unsigned long long in_quota[GNUNET_NT_COUNT];
-};
-
-#endif
-
-/** @} */  /* end of group */
-
-/** @} */  /* end of group addition */
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h
deleted file mode 100644
index ce149875a..000000000
--- a/src/include/gnunet_ats_service.h
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010-2015 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @addtogroup Backbone
- * @{
- *
- * @file
- * Automatic transport selection and outbound bandwidth determination
- *
- * @author Christian Grothoff
- * @author Matthias Wachs
- *
- * @defgroup ats  ATS service
- * Automatic Transport Selection and outbound bandwidth determination
- *
- * @see [Documentation](https://gnunet.org/ats-subsystem)
- *
- * @{
- */
-#ifndef GNUNET_ATS_SERVICE_H
-#define GNUNET_ATS_SERVICE_H
-
-
-#include "gnunet_constants.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-
-
-/**
- * Default bandwidth assigned to a network : 64 KB/s
- */
-#define GNUNET_ATS_DefaultBandwidth 65536
-
-/**
- * Undefined value for an `enum GNUNET_ATS_Property`
- */
-#define GNUNET_ATS_VALUE_UNDEFINED UINT32_MAX
-
-/**
- * String representation for GNUNET_ATS_VALUE_UNDEFINED
- */
-#define GNUNET_ATS_VALUE_UNDEFINED_STR "undefined"
-
-/**
- * Maximum bandwidth assigned to a network : 4095 MB/s
- */
-#define GNUNET_ATS_MaxBandwidth UINT32_MAX
-
-/**
- * Textual equivalent for GNUNET_ATS_MaxBandwidth
- */
-#define GNUNET_ATS_MaxBandwidthString "unlimited"
-
-
-/**
- * ATS performance characteristics for an address.
- */
-struct GNUNET_ATS_Properties
-{
-  /**
-   * Delay.  Time between when the time packet is sent and the packet
-   * arrives.  FOREVER if we did not measure yet.
-   */
-  struct GNUNET_TIME_Relative delay;
-
-  /**
-   * Actual traffic on this connection from this peer to the other peer.
-   * Includes transport overhead.
-   *
-   * Unit: [bytes/second]
-   */
-  uint32_t utilization_out;
-
-  /**
-   * Actual traffic on this connection from the other peer to this peer.
-   * Includes transport overhead.
-   *
-   * Unit: [bytes/second]
-   */
-  uint32_t utilization_in;
-
-  /**
-   * Distance on network layer (required for distance-vector routing)
-   * in hops.  Zero for direct connections (e.g. plain TCP/UDP).
-   */
-  unsigned int distance;
-
-  /**
-   * Which network scope does the respective address belong to?
-   * This property does not change.
-   */
-  enum GNUNET_NetworkType scope;
-};
-
-
-/**
- * ATS performance characteristics for an address in
- * network byte order (for IPC).
- */
-struct GNUNET_ATS_PropertiesNBO
-{
-  /**
-   * Actual traffic on this connection from this peer to the other peer.
-   * Includes transport overhead.
-   *
-   * Unit: [bytes/second]
-   */
-  uint32_t utilization_out GNUNET_PACKED;
-
-  /**
-   * Actual traffic on this connection from the other peer to this peer.
-   * Includes transport overhead.
-   *
-   * Unit: [bytes/second]
-   */
-  uint32_t utilization_in GNUNET_PACKED;
-
-  /**
-   * Which network scope does the respective address belong to?
-   * This property does not change.
-   */
-  uint32_t scope GNUNET_PACKED;
-
-  /**
-   * Distance on network layer (required for distance-vector routing)
-   * in hops.  Zero for direct connections (e.g. plain TCP/UDP).
-   */
-  uint32_t distance GNUNET_PACKED;
-
-  /**
-   * Delay.  Time between when the time packet is sent and the packet
-   * arrives.  FOREVER if we did not measure yet.
-   */
-  struct GNUNET_TIME_RelativeNBO delay;
-};
-
-
-/* ********************* LAN Characterization library ************************ 
*/
-/* Note: these functions do not really communicate with the ATS service */
-
-
-/**
- * Convert ATS properties from host to network byte order.
- *
- * @param nbo[out] value written
- * @param hbo value read
- */
-void
-GNUNET_ATS_properties_hton (struct GNUNET_ATS_PropertiesNBO *nbo,
-                            const struct GNUNET_ATS_Properties *hbo);
-
-
-/**
- * Convert ATS properties from network to host byte order.
- *
- * @param hbo[out] value written
- * @param nbo value read
- */
-void
-GNUNET_ATS_properties_ntoh (struct GNUNET_ATS_Properties *hbo,
-                            const struct GNUNET_ATS_PropertiesNBO *nbo);
-
-
-/* ********************Connection Suggestion API ***************************** 
*/
-
-/**
- * Handle to the ATS subsystem for making suggestions about
- * connections the peer would like to have.
- */
-struct GNUNET_ATS_ConnectivityHandle;
-
-/**
- * Handle for address suggestion requests.
- */
-struct GNUNET_ATS_ConnectivitySuggestHandle;
-
-
-/**
- * Initialize the ATS connectivity suggestion client handle.
- *
- * @param cfg configuration to use
- * @return ats connectivity handle, NULL on error
- */
-struct GNUNET_ATS_ConnectivityHandle *
-GNUNET_ATS_connectivity_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
-
-
-/**
- * Shutdown ATS connectivity suggestion client.
- *
- * @param ch handle to destroy
- */
-void
-GNUNET_ATS_connectivity_done (struct GNUNET_ATS_ConnectivityHandle *ch);
-
-
-/**
- * We would like to establish a new connection with a peer.  ATS
- * should suggest a good address to begin with.
- *
- * @param ch handle
- * @param peer identity of the peer we need an address for
- * @param strength how urgent is the need for such a suggestion
- * @return suggestion handle, NULL if request is already pending
- */
-struct GNUNET_ATS_ConnectivitySuggestHandle *
-GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch,
-                                 const struct GNUNET_PeerIdentity *peer,
-                                 uint32_t strength);
-
-
-/**
- * We no longer care about being connected to a peer.
- *
- * @param sh handle to stop
- */
-void
-GNUNET_ATS_connectivity_suggest_cancel (struct
-                                        GNUNET_ATS_ConnectivitySuggestHandle 
*sh);
-
-
-/* ******************************** Scheduling API 
***************************** */
-
-/**
- * Handle to the ATS subsystem for bandwidth/transport scheduling information.
- */
-struct GNUNET_ATS_SchedulingHandle;
-
-/**
- * Opaque session handle, defined by plugins.  Contents not known to ATS.
- */
-struct GNUNET_ATS_Session;
-
-
-/**
- * Signature of a function called by ATS with the current bandwidth
- * and address preferences as determined by ATS.  If our connection
- * to ATS dies and thus all suggestions become invalid, this function
- * is called ONCE with all arguments (except @a cls) being NULL/0.
- *
- * @param cls closure
- * @param peer for which we suggest an address, NULL if ATS connection died
- * @param address suggested address (including peer identity of the peer),
- *             may be NULL to signal disconnect from peer
- * @param session session to use, NULL to establish a new outgoing session
- * @param bandwidth_out assigned outbound bandwidth for the connection,
- *        0 to signal disconnect
- * @param bandwidth_in assigned inbound bandwidth for the connection,
- *        0 to signal disconnect
- */
-typedef void
-(*GNUNET_ATS_AddressSuggestionCallback) (void *cls,
-                                         const struct GNUNET_PeerIdentity 
*peer,
-                                         const struct
-                                         GNUNET_HELLO_Address *address,
-                                         struct GNUNET_ATS_Session *session,
-                                         struct GNUNET_BANDWIDTH_Value32NBO
-                                         bandwidth_out,
-                                         struct GNUNET_BANDWIDTH_Value32NBO
-                                         bandwidth_in);
-
-
-/**
- * Initialize the ATS scheduling subsystem.
- *
- * @param cfg configuration to use
- * @param suggest_cb notification to call whenever the suggestation changed
- * @param suggest_cb_cls closure for @a suggest_cb
- * @return ats context
- */
-struct GNUNET_ATS_SchedulingHandle *
-GNUNET_ATS_scheduling_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                            GNUNET_ATS_AddressSuggestionCallback suggest_cb,
-                            void *suggest_cb_cls);
-
-
-/**
- * Client is done with ATS scheduling, release resources.
- *
- * @param sh handle to release
- */
-void
-GNUNET_ATS_scheduling_done (struct GNUNET_ATS_SchedulingHandle *sh);
-
-
-/**
- * Handle used within ATS to track an address.
- */
-struct GNUNET_ATS_AddressRecord;
-
-
-/**
- * We have a new address ATS should know. Addresses have to be added with this
- * function before they can be: updated, set in use and destroyed
- *
- * @param sh handle
- * @param address the address
- * @param session session handle (if available, e.g for incoming connections)
- * @param prop performance data for the address
- * @return handle to the address representation inside ATS, NULL
- *         on error (i.e. ATS knows this exact address already, or
- *         address is invalid)
- */
-struct GNUNET_ATS_AddressRecord *
-GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
-                        const struct GNUNET_HELLO_Address *address,
-                        struct GNUNET_ATS_Session *session,
-                        const struct GNUNET_ATS_Properties *prop);
-
-
-/**
- * An address was used to initiate a session.
- *
- * @param ar address record to update information for
- * @param session session handle
- */
-void
-GNUNET_ATS_address_add_session (struct GNUNET_ATS_AddressRecord *ar,
-                                struct GNUNET_ATS_Session *session);
-
-
-/**
- * A @a session was destroyed, disassociate it from the given address
- * record.  If this was an incoming address, destroys the address as
- * well.
- *
- * @param ar address record to update information for
- * @param session session handle
- * @return #GNUNET_YES if the @a ar was destroyed because
- *                     it was an incoming address,
- *         #GNUNET_NO if the @a ar was kept because we can
- *                    use it still to establish a new session
- */
-int
-GNUNET_ATS_address_del_session (struct GNUNET_ATS_AddressRecord *ar,
-                                struct GNUNET_ATS_Session *session);
-
-
-/**
- * We have updated performance statistics for a given address.  Note
- * that this function can be called for addresses that are currently
- * in use as well as addresses that are valid but not actively in use.
- * Furthermore, the peer may not even be connected to us right now (@a
- * session value of NULL used to signal disconnect, or somehow we
- * otherwise got updated on @a ats information).  Based on the
- * information provided, ATS may update bandwidth assignments and
- * suggest to switch addresses.
- *
- * @param ar address record to update information for
- * @param prop performance data for the address
- */
-void
-GNUNET_ATS_address_update (struct GNUNET_ATS_AddressRecord *ar,
-                           const struct GNUNET_ATS_Properties *prop);
-
-
-/**
- * An address got destroyed, stop using it as a valid address.
- *
- * @param ar address record to destroy, its validation has
- *           expired and ATS may no longer use it
- */
-void
-GNUNET_ATS_address_destroy (struct GNUNET_ATS_AddressRecord *ar);
-
-
-/* ******************************** Performance API 
***************************** */
-
-/**
- * ATS Handle to obtain and/or modify performance information.
- */
-struct GNUNET_ATS_PerformanceHandle;
-
-/**
- * Signature of a function that is called with QoS information about an 
address.
- *
- * @param cls closure
- * @param address the address, NULL if ATS service was disconnected or
- *        when the iteration is completed in the case of
- *        #GNUNET_ATS_performance_list_addresses()
- * @param address_active #GNUNET_YES if this address is actively used
- *        to maintain a connection to a peer;
- *        #GNUNET_NO if the address is not actively used;
- *        #GNUNET_SYSERR if this address is no longer available for ATS
- * @param bandwidth_out assigned outbound bandwidth for the connection
- * @param bandwidth_in assigned inbound bandwidth for the connection
- * @param prop performance data for the address
- */
-typedef void
-(*GNUNET_ATS_AddressInformationCallback) (void *cls,
-                                          const struct
-                                          GNUNET_HELLO_Address *address,
-                                          int address_active,
-                                          struct GNUNET_BANDWIDTH_Value32NBO
-                                          bandwidth_out,
-                                          struct GNUNET_BANDWIDTH_Value32NBO
-                                          bandwidth_in,
-                                          const struct
-                                          GNUNET_ATS_Properties *prop);
-
-
-/**
- * Handle for an address listing operation
- */
-struct GNUNET_ATS_AddressListHandle;
-
-
-/**
- * Get handle to access performance API of the ATS subsystem.
- *
- * @param cfg configuration to use
- * @param addr_info_cb callback called when performance characteristics for
- *      an address change
- * @param addr_info_cb_cls closure for @a addr_info_cb
- * @return ats performance context
- */
-struct GNUNET_ATS_PerformanceHandle *
-GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                             GNUNET_ATS_AddressInformationCallback 
addr_info_cb,
-                             void *addr_info_cb_cls);
-
-
-/**
- * Get information about addresses known to the ATS subsystem.
- *
- * @param ph the performance handle to use
- * @param peer peer idm can be NULL for all peers
- * @param all #GNUNET_YES to get information about all addresses or #GNUNET_NO 
to
- *        get only address currently used
- * @param infocb callback to call with the addresses,
- *        will callback with address == NULL when done
- * @param infocb_cls closure for @a infocb
- * @return handle to abort the operation
- */
-struct GNUNET_ATS_AddressListHandle *
-GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *ph,
-                                       const struct GNUNET_PeerIdentity *peer,
-                                       int all,
-                                       GNUNET_ATS_AddressInformationCallback
-                                       infocb,
-                                       void *infocb_cls);
-
-
-/**
- * Cancel a pending address listing operation
- *
- * @param alh the `struct GNUNET_ATS_AddressListHandle` handle to cancel
- */
-void
-GNUNET_ATS_performance_list_addresses_cancel (struct
-                                              GNUNET_ATS_AddressListHandle 
*alh);
-
-
-/**
- * Client is done using the ATS performance subsystem, release resources.
- *
- * @param ph handle
- */
-void
-GNUNET_ATS_performance_done (struct GNUNET_ATS_PerformanceHandle *ph);
-
-
-/**
- * Function called with reservation result.
- *
- * @param cls closure
- * @param peer identifies the peer
- * @param amount set to the amount that was actually reserved or unreserved;
- *               either the full requested amount or zero (no partial 
reservations)
- * @param res_delay if the reservation could not be satisfied (amount was 0), 
how
- *        long should the client wait until re-trying?
- */
-typedef void
-(*GNUNET_ATS_ReservationCallback) (void *cls,
-                                   const struct GNUNET_PeerIdentity *peer,
-                                   int32_t amount,
-                                   struct GNUNET_TIME_Relative res_delay);
-
-
-/**
- * Context that can be used to cancel a peer information request.
- */
-struct GNUNET_ATS_ReservationContext;
-
-
-/**
- * Reserve inbound bandwidth from the given peer.  ATS will look at
- * the current amount of traffic we receive from the peer and ensure
- * that the peer could add 'amount' of data to its stream.
- *
- * @param ph performance handle
- * @param peer identifies the peer
- * @param amount reserve N bytes for receiving, negative
- *                amounts can be used to undo a (recent) reservation;
- * @param rcb function to call with the resulting reservation information
- * @param rcb_cls closure for @a rcb
- * @return NULL on error
- * @deprecated will be replaced soon
- */
-struct GNUNET_ATS_ReservationContext *
-GNUNET_ATS_reserve_bandwidth (struct GNUNET_ATS_PerformanceHandle *ph,
-                              const struct GNUNET_PeerIdentity *peer,
-                              int32_t amount,
-                              GNUNET_ATS_ReservationCallback rcb,
-                              void *rcb_cls);
-
-
-/**
- * Cancel request for reserving bandwidth.
- *
- * @param rc context returned by the original #GNUNET_ATS_reserve_bandwidth() 
call
- */
-void
-GNUNET_ATS_reserve_bandwidth_cancel (struct GNUNET_ATS_ReservationContext *rc);
-
-
-/**
- * ATS preference types as array initializer
- */
-#define GNUNET_ATS_PreferenceType { GNUNET_ATS_PREFERENCE_BANDWIDTH, \
-                                    GNUNET_ATS_PREFERENCE_LATENCY, \
-                                    GNUNET_ATS_PREFERENCE_END }
-
-/**
- * ATS preference types as string array initializer
- */
-#define GNUNET_ATS_PreferenceTypeString { "BANDWIDTH", "LATENCY", "END" }
-
-/**
- * Enum defining all known preference categories.
- */
-enum GNUNET_ATS_PreferenceKind
-{
-  /**
-   * Change the peer's bandwidth value (value per byte of bandwidth in
-   * the goal function) to the given amount.  The argument is followed
-   * by a double value giving the desired value (can be negative).
-   * Preference changes are forgotten if peers disconnect.
-   */
-  GNUNET_ATS_PREFERENCE_BANDWIDTH = 0,
-
-  /**
-   * Change the peer's latency value to the given amount.  The
-   * argument is followed by a double value giving the desired value
-   * (can be negative).  The absolute score in the goal function is
-   * the inverse of the latency in microseconds (minimum: 1
-   * microsecond) multiplied by the latency preferences.
-   */
-  GNUNET_ATS_PREFERENCE_LATENCY = 1,
-
-  /**
-   * End of preference list.
-   */
-  GNUNET_ATS_PREFERENCE_END = 2
-};
-
-
-/**
- * Convert an `enum GNUNET_ATS_PreferenceType` to a string
- *
- * @param type the preference type
- * @return a string or NULL if invalid
- */
-const char *
-GNUNET_ATS_print_preference_type (enum GNUNET_ATS_PreferenceKind type);
-
-
-/**
- * Change preferences for the given peer. Preference changes are 
- * forgotten if peers disconnect.
- *
- * @param ph performance handle 
- * @param peer identifies the peer
- * @param ... #GNUNET_ATS_PREFERENCE_END-terminated specification of the
- *            desired changes
- */
-void
-GNUNET_ATS_performance_change_preference (struct
-                                          GNUNET_ATS_PerformanceHandle *ph,
-                                          const struct
-                                          GNUNET_PeerIdentity *peer,
-                                          ...);
-
-
-/**
- * Application feedback on how good preference requirements are fulfilled
- * for the preferences included in the given time scope [now - scope .. now]
- *
- * An application notifies ATS if (and only if) it has feedback information
- * for specific properties. This values are valid until the feedback scores are
- * updated by the application.
- *
- * If the application has no feedback for this preference kind the application
- * will not explicitly call for this property and will not include it in this
- * function call.
- *
- * @param ph performance handle
- * @param scope the time interval this valid for: [now - scope .. now]
- * @param peer identifies the peer
- * @param ... #GNUNET_ATS_PREFERENCE_END-terminated specification of the 
desired changes
- */
-void
-GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph,
-                                      const struct GNUNET_PeerIdentity *peer,
-                                      const struct GNUNET_TIME_Relative scope,
-                                      ...);
-
-#endif
-
-/** @} */  /* end of group */
-
-/** @} */  /* end of Backbone addition */
-
-/* end of file gnunet-service-transport_ats.h */
diff --git a/src/include/gnunet_ats_transport_service.h 
b/src/include/gnunet_ats_transport_service.h
deleted file mode 100644
index b6c7b15ae..000000000
--- a/src/include/gnunet_ats_transport_service.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010-2015, 2018 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file
- * Bandwidth allocation API for the transport service
- *
- * @author Christian Grothoff
- * @author Matthias Wachs
- *
- * @defgroup ats  ATS service
- * Bandwidth allocation for transport service
- *
- * @see [Documentation](https://gnunet.org/ats-subsystem)
- *
- * @{
- */
-#ifndef GNUNET_ATS_TRANSPORT_SERVICE_H
-#define GNUNET_ATS_TRANSPORT_SERVICE_H
-
-
-#include "gnunet_constants.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_nt_lib.h"
-#include "gnunet_transport_communication_service.h"
-
-
-/**
- * ATS performance characteristics for a session.
- */
-struct GNUNET_ATS_Properties
-{
-  /**
-   * Delay.  Time between when the time packet is sent and the packet
-   * arrives.  FOREVER if we did not (successfully) measure yet.
-   */
-  struct GNUNET_TIME_Relative delay;
-
-  /**
-   * Confirmed successful payload on this connection from this peer to
-   * the other peer.
-   *
-   * Unit: [bytes/second]
-   */
-  uint32_t goodput_out;
-
-  /**
-   * Confirmed useful payload on this connection to this peer from
-   * the other peer.
-   *
-   * Unit: [bytes/second]
-   */
-  uint32_t goodput_in;
-
-  /**
-   * Actual traffic on this connection from this peer to the other peer.
-   * Includes transport overhead.
-   *
-   * Unit: [bytes/second]
-   */
-  uint32_t utilization_out;
-
-  /**
-   * Actual traffic on this connection from the other peer to this peer.
-   * Includes transport overhead.
-   *
-   * Unit: [bytes/second]
-   */
-  uint32_t utilization_in;
-
-  /**
-   * Distance on network layer (required for distance-vector routing)
-   * in hops.  Zero for direct connections (e.g. plain TCP/UDP).
-   */
-  uint32_t distance;
-
-  /**
-   * MTU of the network layer, UINT32_MAX for no MTU (stream).
-   *
-   * Unit: [bytes]
-   */
-  uint32_t mtu;
-
-  /**
-   * Which network scope does the respective address belong to?
-   */
-  enum GNUNET_NetworkType nt;
-
-  /**
-   * What characteristics does this communicator have?
-   */
-  enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc;
-};
-
-
-/* ******************************** Transport API 
***************************** */
-
-/**
- * Handle to the ATS subsystem for bandwidth/transport transport information.
- */
-struct GNUNET_ATS_TransportHandle;
-
-/**
- * Opaque session handle, to be defined by transport.  Contents not known to 
ATS.
- */
-struct GNUNET_ATS_Session;
-
-
-/**
- * Signature of a function called by ATS with the current bandwidth
- * allocation to be used as determined by ATS.
- *
- * @param cls closure
- * @param session session this is about
- * @param bandwidth_out assigned outbound bandwidth for the connection,
- *        0 to signal disconnect
- * @param bandwidth_in assigned inbound bandwidth for the connection,
- *        0 to signal disconnect
- */
-typedef void
-(*GNUNET_ATS_AllocationCallback) (void *cls,
-                                  struct GNUNET_ATS_Session *session,
-                                  struct GNUNET_BANDWIDTH_Value32NBO
-                                  bandwidth_out,
-                                  struct GNUNET_BANDWIDTH_Value32NBO
-                                  bandwidth_in);
-
-
-/**
- * Signature of a function called by ATS suggesting transport to
- * try connecting with a particular address.
- *
- * @param cls closure
- * @param pid target peer
- * @param address the address to try
- */
-typedef void
-(*GNUNET_ATS_SuggestionCallback) (void *cls,
-                                  const struct GNUNET_PeerIdentity *pid,
-                                  const char *address);
-
-
-/**
- * Initialize the ATS transport subsystem.
- *
- * @param cfg configuration to use
- * @param alloc_cb notification to call whenever the allocation changed
- * @param alloc_cb_cls closure for @a alloc_cb
- * @param suggest_cb notification to call whenever the suggestation is made
- * @param suggest_cb_cls closure for @a suggest_cb
- * @return ats context
- */
-struct GNUNET_ATS_TransportHandle *
-GNUNET_ATS_transport_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                           GNUNET_ATS_AllocationCallback alloc_cb,
-                           void *alloc_cb_cls,
-                           GNUNET_ATS_SuggestionCallback suggest_cb,
-                           void *suggest_cb_cls);
-
-
-/**
- * Client is done with ATS transport, release resources.
- *
- * @param ath handle to release
- */
-void
-GNUNET_ATS_transport_done (struct GNUNET_ATS_TransportHandle *ath);
-
-
-/**
- * Handle used within ATS to track an session.
- */
-struct GNUNET_ATS_SessionRecord;
-
-
-/**
- * We have a new session ATS should know. Sessiones have to be added with this
- * function before they can be: updated, set in use and destroyed
- *
- * @param ath handle
- * @param pid peer we connected to
- * @param address the address (human readable version),
- * @param session transport-internal handle for the session/queue, NULL if
- *        the session is inbound-only
- * @param prop performance data for the session
- * @return handle to the session representation inside ATS, NULL
- *         on error (i.e. ATS knows this exact session already, or
- *         session is invalid)
- */
-struct GNUNET_ATS_SessionRecord *
-GNUNET_ATS_session_add (struct GNUNET_ATS_TransportHandle *ath,
-                        const struct GNUNET_PeerIdentity *pid,
-                        const char *address,
-                        struct GNUNET_ATS_Session *session,
-                        const struct GNUNET_ATS_Properties *prop);
-
-
-/**
- * We have updated performance statistics for a given session.  Based
- * on the information provided, ATS may update bandwidth assignments.
- *
- * @param ar session record to update information for
- * @param prop performance data for the session
- */
-void
-GNUNET_ATS_session_update (struct GNUNET_ATS_SessionRecord *ar,
-                           const struct GNUNET_ATS_Properties *prop);
-
-
-/**
- * A session was destroyed, ATS should now schedule and
- * allocate under the assumption that this @a ar is no
- * longer in use.
- *
- * @param ar session record to drop
- */
-void
-GNUNET_ATS_session_del (struct GNUNET_ATS_SessionRecord *ar);
-
-
-#endif
-
-/** @} */  /* end of group */
-
-/* end of file gnunet-service-transport_ats.h */
diff --git a/src/include/gnunet_cadet_service.h 
b/src/include/gnunet_cadet_service.h
index acc7bb330..ab53d2bd8 100644
--- a/src/include/gnunet_cadet_service.h
+++ b/src/include/gnunet_cadet_service.h
@@ -47,7 +47,6 @@ extern "C" {
 
 
 #include "gnunet_util_lib.h"
-#include "gnunet_transport_service.h"
 
 /**
  * Version number of GNUnet-cadet API.
@@ -636,4 +635,3 @@ GNUNET_CADET_list_tunnels_cancel (struct 
GNUNET_CADET_ListTunnels *lt);
 /** @} */ /* end of group addition */
 
 /* end of gnunet_cadet_service.h */
-
diff --git a/src/include/gnunet_core_service.h 
b/src/include/gnunet_core_service.h
index 4e188df87..c3069be81 100644
--- a/src/include/gnunet_core_service.h
+++ b/src/include/gnunet_core_service.h
@@ -45,7 +45,6 @@ extern "C" {
 
 
 #include "gnunet_util_lib.h"
-#include "gnunet_transport_service.h"
 
 /**
  * Version number of GNUnet-core API.
diff --git a/src/include/gnunet_hello_uri_lib.h 
b/src/include/gnunet_hello_uri_lib.h
index bba7078e6..858b60793 100644
--- a/src/include/gnunet_hello_uri_lib.h
+++ b/src/include/gnunet_hello_uri_lib.h
@@ -69,6 +69,13 @@ struct GNUNET_HELLO_Builder *
 GNUNET_HELLO_builder_new (const struct GNUNET_PeerIdentity *pid);
 
 
+/**
+ * Get the PeerIdentity for this builder.
+ */
+struct GNUNET_PeerIdentity *
+GNUNET_HELLO_builder_get_id (struct GNUNET_HELLO_Builder *builder);
+
+
 /**
  * Release resources of a @a builder.
  *
@@ -110,6 +117,17 @@ struct GNUNET_HELLO_Builder *
 GNUNET_HELLO_builder_from_url (const char *url);
 
 
+/**
+ * Get the expiration time for this HELLO.
+ *
+ * @param  msg The hello msg.
+ * @return The expiration time.
+ */
+struct GNUNET_TIME_Absolute
+GNUNET_HELLO_builder_get_expiration_time (const struct
+                                          GNUNET_MessageHeader *msg);
+
+
 /**
  * Generate envelope with GNUnet HELLO message (including
  * peer ID) from a @a builder
@@ -120,7 +138,8 @@ GNUNET_HELLO_builder_from_url (const char *url);
  */
 struct GNUNET_MQ_Envelope *
 GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder,
-                             const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
+                             const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
+                             struct GNUNET_TIME_Relative expiration_time);
 
 
 /**
@@ -133,7 +152,8 @@ GNUNET_HELLO_builder_to_env (const struct 
GNUNET_HELLO_Builder *builder,
 struct GNUNET_MessageHeader *
 GNUNET_HELLO_builder_to_dht_hello_msg (
   const struct GNUNET_HELLO_Builder *builder,
-  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv);
+  const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
+  struct GNUNET_TIME_Relative expiration_time);
 
 
 /**
@@ -162,7 +182,8 @@ enum GNUNET_GenericReturnValue
 GNUNET_HELLO_builder_to_block (const struct GNUNET_HELLO_Builder *builder,
                                const struct GNUNET_CRYPTO_EddsaPrivateKey 
*priv,
                                void *block,
-                               size_t *block_size);
+                               size_t *block_size,
+                               struct GNUNET_TIME_Relative expiration_time);
 
 
 /**
diff --git a/src/include/gnunet_peerstore_service.h 
b/src/include/gnunet_peerstore_service.h
index c4000c680..1cb60cb04 100644
--- a/src/include/gnunet_peerstore_service.h
+++ b/src/include/gnunet_peerstore_service.h
@@ -46,6 +46,10 @@ extern "C" {
 #endif
 #endif
 
+/**
+ * Key used for storing HELLO in the peerstore
+ */
+#define GNUNET_PEERSTORE_HELLO_KEY "peerstore-peer-hello-uri"
 
 /**
  * Key used for storing addresses in URL format in the peerstore
@@ -117,6 +121,11 @@ struct GNUNET_PEERSTORE_Handle;
  */
 struct GNUNET_PEERSTORE_StoreContext;
 
+/**
+ * Context for the info handler.
+ */
+struct GNUNET_PEERSTORE_NotifyContext;
+
 /**
  * Single PEERSTORE record
  */
@@ -181,6 +190,75 @@ typedef void (*GNUNET_PEERSTORE_Processor) (
   const struct GNUNET_PEERSTORE_Record *record,
   const char *emsg);
 
+/**
+ * Function called by PEERSTORE when notifying a client about a changed hello.
+ *
+ * @param cls closure
+ * @param hello_uri Hello uri.
+ */
+typedef void (*GNUNET_PEERSTORE_hello_notify_cb) (
+  void *cls,
+  const struct GNUNET_PeerIdentity *peer,
+  const struct GNUNET_MessageHeader *hello,
+  const char *err_msg);
+
+/**
+ * Call a method whenever our known information about peers
+ * changes.  Initially calls the given function for all known
+ * peers and then only signals changes.
+ *
+ * If @a include_friend_only is set to #GNUNET_YES peerinfo will include HELLO
+ * messages which are intended for friend to friend mode and which do not
+ * have to be gossiped. Otherwise these messages are skipped. //FIXME Not 
implemented atm!
+ *
+ * @param h Handle to the PEERSTORE service
+ * @param include_friend_only include HELLO messages for friends only (not 
used at the moment)
+ * @param callback the method to call for getting the hello.
+ * @param callback_cls closure for @a callback
+ * @return NULL on error
+ */
+struct GNUNET_PEERSTORE_NotifyContext *
+GNUNET_PEERSTORE_hello_changed_notify (struct GNUNET_PEERSTORE_Handle *h,
+                                       int include_friend_only,
+                                       GNUNET_PEERSTORE_hello_notify_cb 
callback,
+                                       void *callback_cls);
+
+
+/**
+ * Stop notifying about changes.
+ *
+ * @param nc context to stop notifying
+ */
+void
+GNUNET_PEERSTORE_hello_changed_notify_cancel (struct
+                                              GNUNET_PEERSTORE_NotifyContext 
*nc);
+
+
+/**
+ * Add hello to peerstore.
+ *
+ * @param h handle for peerstore.
+ * @param msg The hello to add.
+ * @param cont The continuation function to execute after storing.
+ * @param cont_cls The continuation function closure.
+ * @return The context for storing.
+ */
+struct GNUNET_PEERSTORE_StoreHelloContext *
+GNUNET_PEERSTORE_hello_add (struct GNUNET_PEERSTORE_Handle *h,
+                            const struct GNUNET_MessageHeader *msg,
+                            GNUNET_PEERSTORE_Continuation cont,
+                            void *cont_cls);
+
+
+/**
+ * Cancel the request to add a hello.
+ *
+ * @param huc The context for storing a hello.
+ */
+void
+GNUNET_PEERSTORE_hello_add_cancel (struct
+                                   GNUNET_PEERSTORE_StoreHelloContext *huc);
+
 
 /**
  * Connect to the PEERSTORE service.
@@ -273,7 +351,8 @@ GNUNET_PEERSTORE_iterate_cancel (struct 
GNUNET_PEERSTORE_IterateContext *ic);
 
 /**
  * Request watching a given key
- * User will be notified with any new values added to key.
+ * User will be notified with any new values added to key,
+ * all existing entries are supplied beforehand.
  *
  * @param h handle to the PEERSTORE service
  * @param sub_system name of sub system
diff --git a/src/include/gnunet_testing_netjail_lib.h 
b/src/include/gnunet_testing_netjail_lib.h
index 1d6f114eb..9d016b33a 100644
--- a/src/include/gnunet_testing_netjail_lib.h
+++ b/src/include/gnunet_testing_netjail_lib.h
@@ -343,6 +343,7 @@ GNUNET_TESTING_calculate_num (struct
                               GNUNET_TESTING_NodeConnection *node_connection,
                               struct GNUNET_TESTING_NetjailTopology *topology);
 
+
 /**
  * Struct with information for callbacks.
  *
@@ -507,6 +508,26 @@ GNUNET_TESTING_cmd_local_test_prepared (const char *label,
                                         write_message);
 
 
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param system_label Label of the cmd to setup a test environment.
+ * @param no Decimal number representing the last byte of the IP address of 
this peer.
+ * @param node_ip The IP address of this node.
+ * @param cfgname Configuration file name for this peer.
+ * @param broadcast Flag indicating, if broadcast should be switched on.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_start_peer (const char *label,
+                                 const char *system_label,
+                                 uint32_t no,
+                                 const char *node_ip,
+                                 const char *cfgname,
+                                 unsigned int broadcast);
+
+
 /* ***** Netjail trait support ***** */
 
 
diff --git a/src/include/gnunet_testing_ng_lib.h 
b/src/include/gnunet_testing_ng_lib.h
index 5c9079fdf..07cdac962 100644
--- a/src/include/gnunet_testing_ng_lib.h
+++ b/src/include/gnunet_testing_ng_lib.h
@@ -31,7 +31,13 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_testing_lib.h"
 
-
+/**
+ * Stringify operator.
+ *
+ * @param a some expression to stringify. Must NOT be a macro.
+ * @return same expression as a constant string.
+ */
+#define GNUNET_S(a) #a
 
 /**
  * Maximum length of label in command
@@ -520,6 +526,20 @@ struct GNUNET_TESTING_Timer
   unsigned int num_retries;
 };
 
+/**
+ * Command to execute a script synchronously.
+ *
+ * @param label Label of the command.
+ * @param script The name of the script.
+ * @param script_argv The arguments of the script. 
+*/
+const struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_exec_bash_script (const char *label,
+                                     const char *script,
+                                     char *const script_argv[],
+                                     int argc,
+                                     GNUNET_ChildCompletedCallback cb);
+
 
 /**
  * Retrieve peer identity from the test system with the unique node id.
@@ -530,7 +550,7 @@ struct GNUNET_TESTING_Timer
  */
 struct GNUNET_PeerIdentity *
 GNUNET_TESTING_get_peer (unsigned int num,
-                            const struct GNUNET_TESTING_System *tl_system);
+                         const struct GNUNET_TESTING_System *tl_system);
 
 
 /**
@@ -546,12 +566,12 @@ GNUNET_TESTING_cmd_stat (struct GNUNET_TESTING_Timer 
*timers);
 /* *** Generic trait logic for implementing traits ********* */
 
 /**
- * A struct GNUNET_TESTING_Trait can be used to exchange data between cmds. 
+ * A struct GNUNET_TESTING_Trait can be used to exchange data between cmds.
  *
  * Therefor the cmd which like to provide data to other cmds has to implement
- * the trait function, where an array of traits is defined with the help of 
the 
+ * the trait function, where an array of traits is defined with the help of the
  * GNUNET_TESTING_make_trait_ macro. The data can be retrieved with the help 
of the
- * GNUNET_TESTING_get_trait_ macro. Traits name and type must be defined to 
make 
+ * GNUNET_TESTING_get_trait_ macro. Traits name and type must be defined to 
make
  * use of the macros.
  */
 struct GNUNET_TESTING_Trait
@@ -604,6 +624,277 @@ GNUNET_TESTING_get_trait (const struct 
GNUNET_TESTING_Trait *traits,
 /* ****** Specific traits supported by this component ******* */
 
 
+typedef void *
+(*GNUNET_TESTING_notify_connect_cb) (struct GNUNET_TESTING_Interpreter *is,
+                                       const struct GNUNET_PeerIdentity *peer);
+
+/**
+ * Struct to store information needed in callbacks.
+ *
+ */
+struct GNUNET_TESTING_ConnectPeersState
+{
+  /**
+   * Receive callback
+   */
+  struct GNUNET_MQ_MessageHandler *handlers;
+
+  /**
+   * A map with struct GNUNET_MQ_Handle values for each peer this peer
+   * is connected to.
+   */
+  struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
+
+  /**
+   * Handle for transport.
+   */
+  struct GNUNET_TRANSPORT_ApplicationHandle *ah;
+
+  /**
+   * Core handle.
+   */
+  struct GNUNET_TRANSPORT_CoreHandle *th;
+
+  /**
+   * Context for our asynchronous completion.
+   */
+  struct GNUNET_TESTING_AsyncContext ac;
+
+  /**
+   * The testing system of this node.
+   */
+  const struct GNUNET_TESTING_System *tl_system;
+
+  // Label of the cmd which started the test system.
+  const char *create_label;
+
+  /**
+   * Number globally identifying the node.
+   *
+   */
+  uint32_t num;
+
+  /**
+   * Label of the cmd to start a peer.
+   *
+   */
+  const char *start_peer_label;
+
+  /**
+   * The topology of the test setup.
+   */
+  struct GNUNET_TESTING_NetjailTopology *topology;
+
+  /**
+   * Connections to other peers.
+   */
+  struct GNUNET_TESTING_NodeConnection *node_connections_head;
+
+  struct GNUNET_TESTING_Interpreter *is;
+
+  /**
+   * Number of connections.
+   */
+  unsigned int con_num;
+
+  /**
+   * Number of additional connects this cmd will wait for not triggered by 
this cmd.
+   */
+  unsigned int additional_connects;
+
+  /**
+ * Number of connections we already have a notification for.
+ */
+  unsigned int con_num_notified;
+
+  /**
+   * Number of additional connects this cmd will wait for not triggered by 
this cmd we already have a notification for.
+   */
+  unsigned int additional_connects_notified;
+
+  /**
+   * Flag indicating, whether the command is waiting for peers to connect that 
are configured to connect.
+   */
+  unsigned int wait_for_connect;
+};
+
+/**
+ * Struct to store information needed in callbacks.
+ *
+ */
+struct ConnectPeersState
+{
+  /**
+   * Context for our asynchronous completion.
+   */
+  struct GNUNET_TESTING_AsyncContext ac;
+
+  GNUNET_TESTING_notify_connect_cb notify_connect;
+
+  /**
+   * The testing system of this node.
+   */
+  const struct GNUNET_TESTING_System *tl_system;
+
+  // Label of the cmd which started the test system.
+  const char *create_label;
+
+  /**
+   * Number globally identifying the node.
+   *
+   */
+  uint32_t num;
+
+  /**
+   * Label of the cmd to start a peer.
+   *
+   */
+  const char *start_peer_label;
+
+  /**
+   * The topology of the test setup.
+   */
+  struct GNUNET_TESTING_NetjailTopology *topology;
+
+  /**
+   * Connections to other peers.
+   */
+  struct GNUNET_TESTING_NodeConnection *node_connections_head;
+
+  struct GNUNET_TESTING_Interpreter *is;
+
+  /**
+   * Number of connections.
+   */
+  unsigned int con_num;
+
+  /**
+   * Number of additional connects this cmd will wait for not triggered by 
this cmd.
+   */
+  unsigned int additional_connects;
+
+  /**
+ * Number of connections we already have a notification for.
+ */
+  unsigned int con_num_notified;
+
+  /**
+   * Number of additional connects this cmd will wait for not triggered by 
this cmd we already have a notification for.
+   */
+  unsigned int additional_connects_notified;
+
+  /**
+   * Flag indicating, whether the command is waiting for peers to connect that 
are configured to connect.
+   */
+  unsigned int wait_for_connect;
+};
+
+
+struct GNUNET_TESTING_StartPeerState
+{
+  /**
+   * Context for our asynchronous completion.
+   */
+  struct GNUNET_TESTING_AsyncContext ac;
+
+  /**
+   * The ip of a node.
+   */
+  char *node_ip;
+
+  /**
+   * Receive callback
+   */
+  struct GNUNET_MQ_MessageHandler *handlers;
+
+  /**
+   * GNUnet configuration file used to start a peer.
+   */
+  char *cfgname;
+
+  /**
+   * Peer's configuration
+   */
+  struct GNUNET_CONFIGURATION_Handle *cfg;
+
+  /**
+   * struct GNUNET_TESTING_Peer returned by GNUNET_TESTING_peer_configure.
+   */
+  struct GNUNET_TESTING_Peer *peer;
+
+  /**
+   * Peer identity
+   */
+  struct GNUNET_PeerIdentity id;
+
+  /**
+   * Peer's transport service handle
+   */
+  struct GNUNET_TRANSPORT_CoreHandle *th;
+
+  /**
+   * Application handle
+   */
+  struct GNUNET_TRANSPORT_ApplicationHandle *ah;
+
+  /**
+   * Peer's PEERSTORE Handle
+   */
+  struct GNUNET_PEERSTORE_Handle *ph;
+
+  /**
+   * Hello get task
+   */
+  struct GNUNET_SCHEDULER_Task *rh_task;
+
+  /**
+   * Peer's transport get hello handle to retrieve peer's HELLO message
+   */
+  struct GNUNET_PEERSTORE_IterateContext *pic;
+
+  /**
+   * Hello
+   */
+  char *hello;
+
+  /**
+   * Hello size
+   */
+  size_t hello_size;
+
+  /**
+   * The label of the command which was started by calling 
GNUNET_TESTING_cmd_system_create.
+   */
+  char *system_label;
+
+  /**
+   * An unique number to identify the peer
+   */
+  unsigned int no;
+
+  /**
+   * A map with struct GNUNET_MQ_Handle values for each peer this peer
+   * is connected to.
+   */
+  struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
+
+  /**
+   * Test setup for this peer.
+   */
+  const struct GNUNET_TESTING_System *tl_system;
+
+  /**
+   * Callback which is called on neighbour connect events.
+   */
+  GNUNET_TESTING_notify_connect_cb notify_connect;
+
+  /**
+   * Flag indicating, if udp broadcast should be switched on.
+   */
+  enum GNUNET_GenericReturnValue broadcast;
+};
+
+
 /**
  * Create headers for a trait with name @a name for
  * statically allocated data of type @a type.
@@ -698,7 +989,15 @@ GNUNET_TESTING_get_trait (const struct 
GNUNET_TESTING_Trait *traits,
  */
 #define GNUNET_TESTING_SIMPLE_TRAITS(op) \
   op (batch_cmds, struct GNUNET_TESTING_Command *) \
-  op (process, struct GNUNET_OS_Process *)
+  op (process, struct GNUNET_OS_Process *) \
+  op (peer_id, const struct GNUNET_PeerIdentity) \
+  op (connected_peers_map, const struct GNUNET_CONTAINER_MultiShortmap) \
+  op (hello_size, const size_t) \
+  op (hello, const char) \
+  op (application_handle, const struct GNUNET_TRANSPORT_ApplicationHandle) \
+  op (connect_peer_state, const struct GNUNET_TESTING_ConnectPeersState) \
+  op (state, const struct GNUNET_TESTING_StartPeerState) \
+  op (broadcast, const enum GNUNET_GenericReturnValue)
 
 
 /**
diff --git a/src/include/gnunet_testing_plugin.h 
b/src/include/gnunet_testing_plugin.h
index 12fbd7b75..d6a3560ef 100644
--- a/src/include/gnunet_testing_plugin.h
+++ b/src/include/gnunet_testing_plugin.h
@@ -40,6 +40,7 @@ extern "C"
 
 struct GNUNET_TESTING_Barrier;
 
+
 /**
  * Callback function to write messages from the helper process running on a 
netjail node to the master process.
  *
@@ -48,7 +49,7 @@ struct GNUNET_TESTING_Barrier;
  */
 typedef void
 (*GNUNET_TESTING_cmd_helper_write_cb) (struct GNUNET_MessageHeader *message,
-                                size_t msg_length);
+                                       size_t msg_length);
 
 /**
  * Callback function which writes a message from the helper process running on 
a netjail node to the master process * signaling that the test case running on 
the netjail node finished.
@@ -70,7 +71,7 @@ typedef void
  *        the topology configuration.
  * @param read_file If read_file is GNUNET_YES this string is the filename for 
the topology configuration,
  *        if read_file is GNUNET_NO the string contains the topology 
configuration.
- * @param finish_cb Callback function which writes a message from the helper 
process running on a netjail 
+ * @param finish_cb Callback function which writes a message from the helper 
process running on a netjail
  *                  node to the master process * signaling that the test case 
running on the netjail node finished.
  * @return Returns The struct GNUNET_TESTING_Interpreter of the command loop 
running on this netjail node.
  */
@@ -84,7 +85,8 @@ typedef struct GNUNET_TESTING_Interpreter *
                                         const char *local_m,
                                         const char *topology_data,
                                         unsigned int *read_file,
-                                        GNUNET_TESTING_cmd_helper_finish_cb 
finish_cb);
+                                        GNUNET_TESTING_cmd_helper_finish_cb
+                                        finish_cb);
 
 /**
  * DEPRECATED
diff --git a/src/include/gnunet_transport_hello_service.h 
b/src/include/gnunet_transport_hello_service.h
index 03305ec27..34d3c8e4a 100644
--- a/src/include/gnunet_transport_hello_service.h
+++ b/src/include/gnunet_transport_hello_service.h
@@ -146,7 +146,7 @@ struct GNUNET_TRANSPORT_HelloGetHandle *
 GNUNET_TRANSPORT_hello_get (const struct GNUNET_CONFIGURATION_Handle *cfg,
                             enum GNUNET_TRANSPORT_AddressClass ac,
                             GNUNET_TRANSPORT_HelloUpdateCallback rec,
-                            void *rec_cls);
+                            void *rec_cls) __attribute__((deprecated));
 
 
 /**
@@ -155,7 +155,9 @@ GNUNET_TRANSPORT_hello_get (const struct 
GNUNET_CONFIGURATION_Handle *cfg,
  * @param ghh handle to cancel
  */
 void
-GNUNET_TRANSPORT_hello_get_cancel (struct GNUNET_TRANSPORT_HelloGetHandle 
*ghh);
+GNUNET_TRANSPORT_hello_get_cancel (struct
+                                   GNUNET_TRANSPORT_HelloGetHandle *ghh)
+__attribute__((deprecated));
 
 
 /**
@@ -167,12 +169,12 @@ GNUNET_TRANSPORT_hello_get_cancel (struct 
GNUNET_TRANSPORT_HelloGetHandle *ghh);
  * @param nt network type of the address
  * @param expiration when does this address expire?
  */
-typedef void (*GNUNET_TRANSPORT_AddressCallback) (
+typedef void (*GNUNET_TRANSPORT_AddressCallback)(
   void *cls,
   const struct GNUNET_PeerIdentity *peer,
   const char *address,
   enum GNUNET_NetworkType nt,
-  struct GNUNET_TIME_Absolute expiration);
+  struct GNUNET_TIME_Absolute expiration) __attribute__((deprecated));
 
 
 /**
@@ -187,7 +189,7 @@ typedef void (*GNUNET_TRANSPORT_AddressCallback) (
 int
 GNUNET_TRANSPORT_hello_parse (const struct GNUNET_MessageHeader *hello,
                               GNUNET_TRANSPORT_AddressCallback cb,
-                              void *cb_cls);
+                              void *cb_cls) __attribute__((deprecated));
 
 
 #if 0 /* keep Emacsens' auto-indent happy */
diff --git a/src/include/gnunet_transport_manipulation_service.h 
b/src/include/gnunet_transport_manipulation_service.h
deleted file mode 100644
index 694ca7dca..000000000
--- a/src/include/gnunet_transport_manipulation_service.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009-2014, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @addtogroup Backbone
- * @{
- *
- * @author Christian Grothoff
- *
- * @file
- * Low-level P2P IO
- *
- * @defgroup transport  Transport service
- * Low-level P2P IO
- *
- * @see [Documentation](https://gnunet.org/transport-service)
- *
- * @{
- */
-
-#ifndef GNUNET_TRANSPORT_MANIPULATION_SERVICE_H
-#define GNUNET_TRANSPORT_MANIPULATION_SERVICE_H
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#if 0                           /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
-
-#include "gnunet_util_lib.h"
-#include "gnunet_ats_service.h"
-
-/**
- * Version number of the transport API.
- */
-#define GNUNET_TRANSPORT_MANIPULATION_VERSION 0x00000003
-
-/**
- * Handle for transport manipulation.
- */
-struct GNUNET_TRANSPORT_ManipulationHandle;
-
-
-/**
- * Connect to the transport service.  Note that the connection may
- * complete (or fail) asynchronously.
- *
- * @param cfg configuration to use
- * @return NULL on error
- */
-struct GNUNET_TRANSPORT_ManipulationHandle *
-GNUNET_TRANSPORT_manipulation_connect (const struct
-                                       GNUNET_CONFIGURATION_Handle *cfg);
-
-
-/**
- * Disconnect from the transport service.
- *
- * @param handle handle returned from connect
- */
-void
-GNUNET_TRANSPORT_manipulation_disconnect (struct
-                                          GNUNET_TRANSPORT_ManipulationHandle *
-                                          handle);
-
-
-/**
- * Set transport metrics for a peer and a direction
- *
- * @param handle transport handle
- * @param peer the peer to set the metric for
- * @param prop the performance metrics to set
- * @param delay_in inbound delay to introduce
- * @param delay_out outbound delay to introduce
- *
- * Note: Delay restrictions in receiving direction will be enforced
- * with one message delay.
- */
-void
-GNUNET_TRANSPORT_manipulation_set (struct
-                                   GNUNET_TRANSPORT_ManipulationHandle *handle,
-                                   const struct GNUNET_PeerIdentity *peer,
-                                   const struct GNUNET_ATS_Properties *prop,
-                                   struct GNUNET_TIME_Relative delay_in,
-                                   struct GNUNET_TIME_Relative delay_out);
-
-
-#if 0                           /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-/* ifndef GNUNET_TRANSPORT_MANIPULATION_SERVICE_H */
-#endif
-
-/** @} */  /* end of group */
-
-/** @} */ /* end of group addition */
-
-/* end of gnunet_transport_manipulation_service.h */
diff --git a/src/include/gnunet_transport_monitor_service.h 
b/src/include/gnunet_transport_monitor_service.h
index 6b9eb8076..7c586b51e 100644
--- a/src/include/gnunet_transport_monitor_service.h
+++ b/src/include/gnunet_transport_monitor_service.h
@@ -47,7 +47,6 @@ extern "C"
 
 
 #include "gnunet_util_lib.h"
-#include "gnunet_ats_transport_service.h"
 #include "gnunet_transport_communication_service.h"
 
 
diff --git a/src/include/gnunet_transport_plugin.h 
b/src/include/gnunet_transport_plugin.h
deleted file mode 100644
index 0ab4a995c..000000000
--- a/src/include/gnunet_transport_plugin.h
+++ /dev/null
@@ -1,733 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2009-2014 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @addtogroup Backbone
- * @{
- *
- * @author Christian Grothoff
- *
- * @file
- * Transport service plugin API
- *
- * @defgroup transport-plugin  Transport Service plugin API
- *
- * Specifies the struct that is given to the plugin's entry method and the 
other
- * struct that must be returned.  Note that the destructors of transport 
plugins
- * will be given the value returned by the constructor and is expected to 
return
- * a NULL pointer.
- *
- * @{
- */
-#ifndef PLUGIN_TRANSPORT_H
-#define PLUGIN_TRANSPORT_H
-
-
-#include "gnunet_configuration_lib.h"
-#include "gnunet_scheduler_lib.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_ats_service.h"
-
-#define TRANSPORT_SESSION_INBOUND_STRING "<inbound>"
-
-/**
- * Opaque pointer that plugins can use to distinguish specific
- * connections to a given peer.  Typically used by stateful plugins to
- * allow the service to refer to specific streams instead of a more
- * general notion of "some connection" to the given peer.  This is
- * useful since sometimes (e.g. for inbound TCP connections) a
- * connection may not have an address that can be used for meaningful
- * distinction between sessions to the same peer.
- *
- * Each 'struct GNUNET_ATS_Session' MUST start with the 'struct 
GNUNET_PeerIdentity'
- * of the peer the session is for (which will be used for some error
- * checking by the ATS code).
- */
-struct GNUNET_ATS_Session;
-
-
-/**
- * Function that will be called whenever the plugin internally
- * cleans up a session pointer and hence the service needs to
- * discard all of those sessions as well.  Plugins that do not
- * use sessions can simply omit calling this function and always
- * use NULL wherever a session pointer is needed.  This function
- * should be called BEFORE a potential "TransmitContinuation"
- * from the "TransmitFunction".
- *
- * @param cls closure
- * @param peer which peer was the session for
- * @param session which session is being destroyed
- */
-typedef void
-(*GNUNET_TRANSPORT_SessionEnd) (void *cls,
-                                const struct GNUNET_HELLO_Address *address,
-                                struct GNUNET_ATS_Session *session);
-
-
-/**
- * Plugin tells transport service about a new inbound session
- *
- * @param cls unused
- * @param address the address
- * @param session the new session
- * @param net network information
- */
-typedef void
-(*GNUNET_TRANSPORT_SessionStart) (void *cls,
-                                  const struct GNUNET_HELLO_Address *address,
-                                  struct GNUNET_ATS_Session *session,
-                                  enum GNUNET_NetworkType net);
-
-
-/**
- * Function called by the transport for each received message.
- * This function should also be called with "NULL" for the
- * message to signal that the other peer disconnected.
- *
- * @param cls closure
- * @param peer (claimed) identity of the other peer
- * @param message the message, NULL if we only care about
- *                learning about the delay until we should receive again
- * @param session identifier used for this session (NULL for plugins
- *                that do not offer bi-directional communication to the sender
- *                using the same "connection")
- * @param sender_address binary address of the sender (if we established the
- *                connection or are otherwise sure of it; should be NULL
- *                for inbound TCP/UDP connections since it it not clear
- *                that we could establish ourselves a connection to that
- *                IP address and get the same system)
- * @param sender_address_len number of bytes in @a sender_address
- * @return how long the plugin should wait until receiving more data;
- *         returning #GNUNET_TIME_UNIT_FOREVER_REL means that the
- *         connection should be closed
- */
-typedef struct GNUNET_TIME_Relative
-(*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls,
-                                           const struct
-                                           GNUNET_HELLO_Address *address,
-                                           struct GNUNET_ATS_Session *session,
-                                           const struct
-                                           GNUNET_MessageHeader *message);
-
-
-/**
- * Function that can be called by plugins to figure if an address is
- * an loopback, LAN or WAN address.   Ultimately invokes
- * #GNUNET_ATS_address_get_type().
- *
- * @param cls closure
- * @param addr binary address
- * @param addrlen length of the @a addr
- * @return type of the network the address belongs to
- */
-typedef enum GNUNET_NetworkType
-(*GNUNET_TRANSPORT_AddressToType)(void *cls,
-                                  const struct sockaddr *addr,
-                                  size_t addrlen);
-
-
-/**
- * Function called when distance of an address changes.
- *
- * @param cls closure
- * @param peer peer
- * @param distance new distance
- */
-typedef void
-(*GNUNET_TRANSPORT_UpdateAddressDistance) (void *cls,
-                                           const struct
-                                           GNUNET_HELLO_Address *address,
-                                           uint32_t distance);
-
-
-/**
- * Function that will be called for each address the transport
- * is aware that it might be reachable under.
- *
- * @param cls closure
- * @param add_remove should the address added (#GNUNET_YES) or removed 
(#GNUNET_NO) from the
- *                   set of valid addresses?
- * @param address the address to add or remove
- */
-typedef void
-(*GNUNET_TRANSPORT_AddressNotification) (void *cls,
-                                         int add_remove,
-                                         const struct
-                                         GNUNET_HELLO_Address *address);
-
-
-/**
- * Function that will be called whenever the plugin receives data over
- * the network and wants to determine how long it should wait until
- * the next time it reads from the given peer.  Note that some plugins
- * (such as UDP) may not be able to wait (for a particular peer), so
- * the waiting part is optional.  Plugins that can wait should call
- * this function, sleep the given amount of time, and call it again
- * (with zero bytes read) UNTIL it returns zero and only then read.
- *
- * @param cls closure
- * @param peer which peer did we read data from
- * @param amount_recved number of bytes read (can be zero)
- * @return how long to wait until reading more from this peer
- *         (to enforce inbound quotas); returning #GNUNET_TIME_UNIT_FOREVER_REL
- *         means that the connection should be closed
- */
-typedef struct GNUNET_TIME_Relative
-(*GNUNET_TRANSPORT_TrafficReport) (void *cls,
-                                   const struct GNUNET_PeerIdentity *peer,
-                                   size_t amount_recved);
-
-
-/**
- * Function that returns a HELLO message.
- *
- * @return HELLO message (FIXME with what?)
- */
-typedef const struct GNUNET_MessageHeader *
-(*GNUNET_TRANSPORT_GetHelloCallback) (void);
-
-
-/**
- * The transport service will pass a pointer to a struct
- * of this type as the first and only argument to the
- * entry point of each transport plugin.
- */
-struct GNUNET_TRANSPORT_PluginEnvironment
-{
-  /**
-   * Configuration to use.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Identity of this peer.
-   */
-  const struct GNUNET_PeerIdentity *my_identity;
-
-  /**
-   * Closure for the various callbacks.
-   */
-  void *cls;
-
-  /**
-   * Handle for reporting statistics.
-   */
-  struct GNUNET_STATISTICS_Handle *stats;
-
-  /**
-   * Function that should be called by the transport plugin
-   * whenever a message is received.  If this field is "NULL",
-   * the plugin should load in 'stub' mode and NOT fully
-   * initialize and instead only return an API with the
-   * @e address_pretty_printer, @e address_to_string and
-   * @e string_to_address functions.
-   */
-  GNUNET_TRANSPORT_PluginReceiveCallback receive;
-
-  /**
-   * Function that returns our HELLO.
-   */
-  GNUNET_TRANSPORT_GetHelloCallback get_our_hello;
-
-  /**
-   * Function that must be called by each plugin to notify the
-   * transport service about the addresses under which the transport
-   * provided by the plugin can be reached.
-   */
-  GNUNET_TRANSPORT_AddressNotification notify_address;
-
-  /**
-   * Function that must be called by the plugin when a non-NULL
-   * session handle stops being valid (is destroyed).
-   */
-  GNUNET_TRANSPORT_SessionEnd session_end;
-
-  /**
-   * Function called by the plugin when a new (incoming) session was created
-   * not explicitly created using the the get_session function
-   */
-  GNUNET_TRANSPORT_SessionStart session_start;
-
-  /**
-   * Function that will be called to figure if an address is an loopback,
-   * LAN, WAN etc. address
-   */
-  GNUNET_TRANSPORT_AddressToType get_address_type;
-
-  /**
-   * Function that will be called by DV to update distance for
-   * an address.
-   */
-  GNUNET_TRANSPORT_UpdateAddressDistance update_address_distance;
-
-  /**
-   * What is the maximum number of connections that this transport
-   * should allow?  Transports that do not have sessions (such as
-   * UDP) can ignore this value.
-   */
-  uint32_t max_connections;
-};
-
-
-/**
- * Function called by the #GNUNET_TRANSPORT_TransmitFunction
- * upon "completion".  In the case that a peer disconnects,
- * this function must be called for each pending request
- * (with a 'failure' indication) AFTER notifying the service
- * about the disconnect event (so that the service won't try
- * to transmit more messages, believing the connection still
- * exists...).
- *
- * @param cls closure
- * @param target who was the recipient of the message?
- * @param result #GNUNET_OK on success
- *               #GNUNET_SYSERR if the target disconnected;
- *               disconnect will ALSO be signalled using
- *               the ReceiveCallback.
- * @param size_payload bytes of payload from transport service in message
- * @param size_on_wire bytes required on wire for transmission,
- *               0 if result == #GNUNET_SYSERR
- */
-typedef void
-(*GNUNET_TRANSPORT_TransmitContinuation) (void *cls,
-                                          const struct
-                                          GNUNET_PeerIdentity *target,
-                                          int result,
-                                          size_t size_payload,
-                                          size_t size_on_wire);
-
-
-/**
- * The new send function with just the session and no address
- *
- * Function that can be used by the transport service to transmit
- * a message using the plugin.   Note that in the case of a
- * peer disconnecting, the continuation MUST be called
- * prior to the disconnect notification itself.  This function
- * will be called with this peer's HELLO message to initiate
- * a fresh connection to another peer.
- *
- * @param cls closure
- * @param session which session must be used
- * @param msgbuf the message to transmit
- * @param msgbuf_size number of bytes in @a msgbuf
- * @param priority how important is the message (most plugins will
- *                 ignore message priority and just FIFO)
- * @param to how long to wait at most for the transmission (does not
- *                require plugins to discard the message after the timeout,
- *                just advisory for the desired delay; most plugins will ignore
- *                this as well)
- * @param cont continuation to call once the message has
- *        been transmitted (or if the transport is ready
- *        for the next transmission call; or if the
- *        peer disconnected...); can be NULL
- * @param cont_cls closure for @a cont
- * @return number of bytes used (on the physical network, with overheads);
- *         -1 on hard errors (i.e. address invalid); 0 is a legal value
- *         and does NOT mean that the message was not transmitted (DV)
- */
-typedef ssize_t
-(*GNUNET_TRANSPORT_TransmitFunction) (void *cls,
-                                      struct GNUNET_ATS_Session *session,
-                                      const char *msgbuf,
-                                      size_t msgbuf_size,
-                                      unsigned int priority,
-                                      struct GNUNET_TIME_Relative to,
-                                      GNUNET_TRANSPORT_TransmitContinuation 
cont,
-                                      void *cont_cls);
-
-
-/**
- * Function that can be called to force a disconnect from the
- * specified neighbour for the given session only.  .  This should
- * also cancel all previously scheduled transmissions for this
- * session.  Obviously the transmission may have been partially
- * completed already, which is OK.  The plugin is supposed to close
- * the connection (if applicable).
- *
- * @param cls closure with the `struct Plugin`
- * @param session session to destroy
- * @return #GNUNET_OK on success
- */
-typedef int
-(*GNUNET_TRANSPORT_DisconnectSessionFunction) (void *cls,
-                                               struct GNUNET_ATS_Session *
-                                               session);
-
-
-/**
- * Function that is called to get the keepalive factor.
- * #GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
- * calculate the interval between keepalive packets.
- *
- * @param cls closure with the `struct Plugin`
- * @return keepalive factor
- */
-typedef unsigned int
-(*GNUNET_TRANSPORT_QueryKeepaliveFactorFunction) (void *cls);
-
-
-/**
- * Function that can be called to force a disconnect from the
- * specified neighbour.  This should also cancel all previously
- * scheduled transmissions.  Obviously the transmission may have been
- * partially completed already, which is OK.  The plugin is supposed
- * to close the connection (if applicable) and no longer call the
- * transmit continuation(s).
- *
- * @param cls closure
- * @param target peer for which the last transmission is
- *        to be cancelled
- */
-typedef void
-(*GNUNET_TRANSPORT_DisconnectPeerFunction) (void *cls,
-                                            const struct
-                                            GNUNET_PeerIdentity *target);
-
-
-/**
- * Function called by the pretty printer for the resolved address for
- * each human-readable address obtained.  The callback can be called
- * several times. The last invocation must be with a @a address of
- * NULL and a @a res of #GNUNET_OK.  Thus, to indicate conversion
- * errors, the callback might be called first with @a address NULL and
- * @a res being #GNUNET_SYSERR.  In that case, there must still be a
- * subsequent call later with @a address NULL and @a res #GNUNET_OK.
- *
- * @param cls closure
- * @param address one of the names for the host, NULL on last callback
- * @param res #GNUNET_OK if conversion was successful, #GNUNET_SYSERR on 
failure,
- *      #GNUNET_OK on last callback
- */
-typedef void
-(*GNUNET_TRANSPORT_AddressStringCallback) (void *cls,
-                                           const char *address,
-                                           int res);
-
-
-/**
- * Convert the transports address to a nice, human-readable
- * format.
- *
- * @param cls closure
- * @param type name of the transport that generated the address
- * @param addr one of the addresses of the host, NULL for the last address
- *        the specific address format depends on the transport
- * @param addrlen length of the @a addr
- * @param numeric should (IP) addresses be displayed in numeric form?
- * @param timeout after how long should we give up?
- * @param asc function to call on each string
- * @param asc_cls closure for @a asc
- */
-typedef void
-(*GNUNET_TRANSPORT_AddressPrettyPrinter) (void *cls,
-                                          const char *type,
-                                          const void *addr,
-                                          size_t addrlen,
-                                          int numeric,
-                                          struct GNUNET_TIME_Relative timeout,
-                                          
GNUNET_TRANSPORT_AddressStringCallback
-                                          asc,
-                                          void *asc_cls);
-
-
-/**
- * Another peer has suggested an address for this peer and transport
- * plugin.  Check that this could be a valid address.  This function
- * is not expected to 'validate' the address in the sense of trying to
- * connect to it but simply to see if the binary format is technically
- * legal for establishing a connection to this peer (and make sure that
- * the address really corresponds to our network connection/settings
- * and not some potential man-in-the-middle).
- *
- * @param addr pointer to the address
- * @param addrlen length of @a addr
- * @return #GNUNET_OK if this is a plausible address for this peer
- *         and transport, #GNUNET_SYSERR if not
- */
-typedef int
-(*GNUNET_TRANSPORT_CheckAddress) (void *cls,
-                                  const void *addr,
-                                  size_t addrlen);
-
-
-/**
- * Create a new session to transmit data to the target
- * This session will used to send data to this peer and the plugin will
- * notify us by calling the env->session_end function
- *
- * @param cls the plugin
- * @param address the hello address
- * @return the session if the address is valid, NULL otherwise
- */
-typedef struct GNUNET_ATS_Session *
-(*GNUNET_TRANSPORT_CreateSession) (void *cls,
-                                   const struct GNUNET_HELLO_Address *address);
-
-
-/**
- * Function that will be called whenever the transport service wants to
- * notify the plugin that a session is still active and in use and
- * therefore the session timeout for this session has to be updated
- *
- * @param cls closure
- * @param peer which peer was the session for
- * @param session which session is being updated
- */
-typedef void
-(*GNUNET_TRANSPORT_UpdateSessionTimeout) (void *cls,
-                                          const struct
-                                          GNUNET_PeerIdentity *peer,
-                                          struct GNUNET_ATS_Session *session);
-
-
-/**
- * Function that will be called whenever the transport service wants to
- * notify the plugin that the inbound quota changed and that the plugin
- * should update it's delay for the next receive value
- *
- * @param cls closure
- * @param peer which peer was the session for
- * @param session which session is being updated
- * @param delay new delay to use for receiving
- */
-typedef void
-(*GNUNET_TRANSPORT_UpdateInboundDelay) (void *cls,
-                                        const struct GNUNET_PeerIdentity *peer,
-                                        struct GNUNET_ATS_Session *session,
-                                        struct GNUNET_TIME_Relative delay);
-
-
-/**
- * Function called for a quick conversion of the binary address to
- * a numeric address.  Note that the caller must not free the
- * address and that the next call to this function is allowed
- * to override the address again.
- *
- * @param cls closure
- * @param addr binary address
- * @param addr_len length of the @a addr
- * @return string representing the same address
- */
-typedef const char *
-(*GNUNET_TRANSPORT_AddressToString) (void *cls,
-                                     const void *addr,
-                                     size_t addrlen);
-
-
-/**
- * Function called to convert a string address to
- * a binary address.
- *
- * @param cls closure (`struct Plugin*`)
- * @param addr string address
- * @param addrlen length of the @a addr including \0 termination
- * @param buf location to store the buffer
- *        If the function returns #GNUNET_SYSERR, its contents are undefined.
- * @param added length of created address
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-typedef int
-(*GNUNET_TRANSPORT_StringToAddress) (void *cls,
-                                     const char *addr,
-                                     uint16_t addrlen,
-                                     void **buf,
-                                     size_t *added);
-
-
-/**
- * Function to obtain the network type for a session
- *
- * @param cls closure (`struct Plugin *`)
- * @param session the session
- * @return the network type
- */
-typedef enum GNUNET_NetworkType
-(*GNUNET_TRANSPORT_GetNetworkType)(void *cls,
-                                   struct GNUNET_ATS_Session *session);
-
-
-/**
- * Function to obtain the network type for an address.
- *
- * @param cls closure (`struct Plugin *`)
- * @param address the address
- * @return the network type
- */
-typedef enum GNUNET_NetworkType
-(*GNUNET_TRANSPORT_GetNetworkTypeForAddress)(void *cls,
-                                             const struct
-                                             GNUNET_HELLO_Address *address);
-
-
-/**
- * Function called by the plugin with information about the
- * current sessions managed by the plugin (for monitoring).
- *
- * @param cls closure
- * @param session session handle this information is about,
- *        NULL to indicate that we are "in sync" (initial
- *        iteration complete)
- * @param info information about the state of the session,
- *        NULL if @a session is also NULL and we are
- *        merely signalling that the initial iteration is over
- */
-typedef void
-(*GNUNET_TRANSPORT_SessionInfoCallback) (void *cls,
-                                         struct GNUNET_ATS_Session *session,
-                                         const struct
-                                         GNUNET_TRANSPORT_SessionInfo *info);
-
-
-/**
- * Begin monitoring sessions of a plugin.  There can only
- * be one active monitor per plugin (i.e. if there are
- * multiple monitors, the transport service needs to
- * multiplex the generated events over all of them).
- *
- * @param cls closure of the plugin
- * @param sic callback to invoke, NULL to disable monitor;
- *            plugin will being by iterating over all active
- *            sessions immediately and then enter monitor mode
- * @param sic_cls closure for @a sic
- */
-typedef void
-(*GNUNET_TRANSPORT_SessionMonitorSetup) (void *cls,
-                                         GNUNET_TRANSPORT_SessionInfoCallback
-                                         sic,
-                                         void *sic_cls);
-
-
-/**
- * Each plugin is required to return a pointer to a struct of this
- * type as the return value from its entry point.
- */
-struct GNUNET_TRANSPORT_PluginFunctions
-{
-  /**
-   * Closure for all of the callbacks.
-   */
-  void *cls;
-
-  /**
-   * Function that the transport service will use to transmit data to
-   * another peer.  May be NULL for plugins that only support
-   * receiving data.  After this call, the plugin call the specified
-   * continuation with success or error before notifying us about the
-   * target having disconnected.
-   */
-  GNUNET_TRANSPORT_TransmitFunction send;
-
-  /**
-   * Function that can be used to force the plugin to disconnect from
-   * the given peer and cancel all previous transmissions (and their
-   * continuations).
-   */
-  GNUNET_TRANSPORT_DisconnectPeerFunction disconnect_peer;
-
-  /**
-   * Function that can be used to force the plugin to disconnect from
-   * the given peer and cancel all previous transmissions (and their
-   * continuations).
-   */
-  GNUNET_TRANSPORT_DisconnectSessionFunction disconnect_session;
-
-  /**
-   * Function that will be called whenever the transport service wants to
-   * notify the plugin that a session is still active and in use and
-   * therefore the session timeout for this session has to be updated
-   */
-  GNUNET_TRANSPORT_UpdateSessionTimeout update_session_timeout;
-
-  /**
-   * Function that will be called whenever the transport service wants to
-   * notify the plugin that the inbound quota changed and that the plugin
-   * should update it's delay for the next receive value
-   */
-  GNUNET_TRANSPORT_UpdateInboundDelay update_inbound_delay;
-
-  /**
-   * Function that is used to query keepalive factor.
-   * #GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
-   * calculate the interval between keepalive packets.
-   */
-  GNUNET_TRANSPORT_QueryKeepaliveFactorFunction query_keepalive_factor;
-
-  /**
-   * Function to pretty-print addresses.
-   */
-  GNUNET_TRANSPORT_AddressPrettyPrinter address_pretty_printer;
-
-  /**
-   * Function that will be called to check if a binary address
-   * for this plugin is well-formed and corresponds to an
-   * address for THIS peer (as per our configuration).  Naturally,
-   * if absolutely necessary, plugins can be a bit conservative in
-   * their answer, but in general plugins should make sure that the
-   * address does not redirect traffic to a 3rd party that might
-   * try to man-in-the-middle our traffic.
-   */
-  GNUNET_TRANSPORT_CheckAddress check_address;
-
-  /**
-   * Function that will be called to convert a binary address
-   * to a string (numeric conversion only).
-   */
-  GNUNET_TRANSPORT_AddressToString address_to_string;
-
-  /**
-   * Function that will be called to convert a string address
-   * to binary (numeric conversion only).
-   */
-  GNUNET_TRANSPORT_StringToAddress string_to_address;
-
-  /**
-   * Function that will be called tell the plugin to create a session
-   * object.
-   */
-  GNUNET_TRANSPORT_CreateSession get_session;
-
-  /**
-   * Function to obtain the network type for a session
-   */
-  GNUNET_TRANSPORT_GetNetworkType get_network;
-
-  /**
-   * Function to obtain the network type for an address
-   */
-  GNUNET_TRANSPORT_GetNetworkTypeForAddress get_network_for_address;
-
-  /**
-   * Function to monitor the sessions managed by the plugin.
-   */
-  GNUNET_TRANSPORT_SessionMonitorSetup setup_monitor;
-};
-
-
-/*#ifndef PLUGIN_TRANSPORT_H*/
-#endif
-
-/** @} */  /* end of group */
-
-/** @} */ /* end of group addition */
-
-/* end of gnunet_transport_plugin.h */
diff --git a/src/include/gnunet_transport_service.h 
b/src/include/gnunet_transport_service.h
deleted file mode 100644
index 72cdbe0a7..000000000
--- a/src/include/gnunet_transport_service.h
+++ /dev/null
@@ -1,715 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009-2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @addtogroup Backbone
- * @{
- *
- * @author Christian Grothoff
- *
- * @file
- * Low-level P2P IO
- *
- * @defgroup transport  Transport service
- * Low-level P2P IO
- *
- * @see [Documentation](https://gnunet.org/transport-service)
- *
- * @{
- */
-
-#ifndef GNUNET_TRANSPORT_SERVICE_H
-#define GNUNET_TRANSPORT_SERVICE_H
-
-#ifdef __cplusplus
-extern "C" {
-#if 0 /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
-
-#include "gnunet_util_lib.h"
-#include "gnunet_ats_service.h"
-
-/**
- * Version number of the transport API.
- */
-#define GNUNET_TRANSPORT_VERSION 0x00000003
-
-
-/* *************************** HELLO *************************** */
-
-/**
- * Handle for a #GNUNET_TRANSPORT_offer_hello operation
- */
-struct GNUNET_TRANSPORT_OfferHelloHandle;
-
-
-/**
- * Offer the transport service the HELLO of another peer.  Note that
- * the transport service may just ignore this message if the HELLO is
- * malformed or useless due to our local configuration.
- *
- * @param cfg configuration
- * @param hello the hello message
- * @param cont continuation to call when HELLO has been sent,
- *      tc reason #GNUNET_SCHEDULER_REASON_TIMEOUT for fail
- *      tc reasong #GNUNET_SCHEDULER_REASON_READ_READY for success
- * @param cont_cls closure for @a cont
- * @return a `struct GNUNET_TRANSPORT_OfferHelloHandle` handle or NULL on
- * failure, in case of failure @a cont will not be called
- *
- */
-struct GNUNET_TRANSPORT_OfferHelloHandle *
-GNUNET_TRANSPORT_offer_hello (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                              const struct GNUNET_MessageHeader *hello,
-                              GNUNET_SCHEDULER_TaskCallback cont,
-                              void *cont_cls);
-
-
-/**
- * Cancel the request to transport to offer the HELLO message
- *
- * @param ohh the `struct GNUNET_TRANSPORT_OfferHelloHandle` to cancel
- */
-void
-GNUNET_TRANSPORT_offer_hello_cancel (
-  struct GNUNET_TRANSPORT_OfferHelloHandle *ohh);
-
-
-/* *********************** Address to String ******************* */
-
-/**
- * Handle to cancel a pending address lookup.
- */
-struct GNUNET_TRANSPORT_AddressToStringContext;
-
-
-/**
- * Function to call with a textual representation of an address.  This
- * function will be called several times with different possible
- * textual representations, and a last time with @a address being NULL
- * to signal the end of the iteration.  Note that @a address NULL
- * always is the last call, regardless of the value in @a res.
- *
- * @param cls closure
- * @param address NULL on end of iteration,
- *        otherwise 0-terminated printable UTF-8 string,
- *        in particular an empty string if @a res is #GNUNET_NO
- * @param res result of the address to string conversion:
- *        if #GNUNET_OK: conversion successful
- *        if #GNUNET_NO: address was invalid (or not supported)
- *        if #GNUNET_SYSERR: communication error (IPC error)
- */
-typedef void
-(*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls,
-                                             const char *address,
-                                             int res);
-
-
-/**
- * Convert a binary address into a human readable address.
- *
- * @param cfg configuration to use
- * @param address address to convert (binary format)
- * @param numeric should (IP) addresses be displayed in numeric form
- *                (otherwise do reverse DNS lookup)
- * @param timeout how long is the lookup allowed to take at most
- * @param aluc function to call with the results
- * @param aluc_cls closure for @a aluc
- * @return handle to cancel the operation, NULL on error
- */
-struct GNUNET_TRANSPORT_AddressToStringContext *
-GNUNET_TRANSPORT_address_to_string (
-  const struct GNUNET_CONFIGURATION_Handle *cfg,
-  const struct GNUNET_HELLO_Address *address,
-  int numeric,
-  struct GNUNET_TIME_Relative timeout,
-  GNUNET_TRANSPORT_AddressToStringCallback aluc,
-  void *aluc_cls);
-
-
-/**
- * Cancel request for address conversion.
- *
- * @param alc the context handle
- */
-void
-GNUNET_TRANSPORT_address_to_string_cancel (
-  struct GNUNET_TRANSPORT_AddressToStringContext *alc);
-
-
-/* *********************** Monitoring ************************** */
-
-
-/**
- * Possible state of a neighbour.  Initially, we are
- * #GNUNET_TRANSPORT_PS_NOT_CONNECTED.
- *
- * Then, there are two main paths. If we receive a SYN message, we give
- * the inbound address to ATS. After the check we ask ATS for a suggestion
- * (#GNUNET_TRANSPORT_PS_CONNECT_RECV_ATS). If ATS makes a suggestion, we
- * send our SYN_ACK and go to #GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK.
- * If we receive a ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED
- * (and notify everyone about the new connection). If the operation times out,
- * we go to #GNUNET_TRANSPORT_PS_DISCONNECT.
- *
- * The other case is where we transmit a SYN message first.  We
- * start with #GNUNET_TRANSPORT_PS_INIT_ATS.  If we get an address, we send
- * the SYN message and go to state #GNUNET_TRANSPORT_PS_CONNECT_SENT.
- * Once we receive a SYN_ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED
- * (and notify everyone about the new connection and send
- * back a ACK).  If the operation times out, we go to
- * #GNUNET_TRANSPORT_PS_DISCONNECT.
- *
- * If the session is in trouble (i.e. transport-level disconnect or
- * timeout), we go to #GNUNET_TRANSPORT_PS_RECONNECT_ATS where we ask ATS for a
- * new address (we don't notify anyone about the disconnect yet).  Once we have
- * a new address, we enter #GNUNET_TRANSPORT_PS_RECONNECT_SENT and send a SYN
- * message.  If we receive a SYN_ACK, we go to #GNUNET_TRANSPORT_PS_CONNECTED
- * and nobody noticed that we had trouble; we also send a ACK at this time just
- * in case.  If the operation times out, we go to
- * #GNUNET_TRANSPORT_PS_DISCONNECT (and notify everyone about the lost
- * connection).
- *
- * If ATS decides to switch addresses while we have a normal
- * connection, we go to #GNUNET_TRANSPORT_PS_CONNECTED_SWITCHING_SYN_SENT
- * and send a SESSION_CONNECT.  If we get a ACK back, we switch the
- * primary connection to the suggested alternative from ATS, go back
- * to #GNUNET_TRANSPORT_PS_CONNECTED and send a ACK to the other peer just to 
be
- * sure.  If the operation times out
- * we go to #GNUNET_TRANSPORT_PS_CONNECTED (and notify ATS that the given
- * alternative address is "invalid").
- *
- * Once a session is in #GNUNET_TRANSPORT_PS_DISCONNECT, it is cleaned up and
- * then goes to (#GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED).  If we receive an
- * explicit disconnect request, we can go from any state to
- * #GNUNET_TRANSPORT_PS_DISCONNECT, possibly after generating disconnect
- * notifications.
- *
- * Note that it is quite possible that while we are in any of these
- * states, we could receive a 'SYN' request from the other peer.
- * We then enter a 'weird' state where we pursue our own primary state
- * machine (as described above), but with the 'send_connect_ack' flag
- * set to 1.  If our state machine allows us to send a 'SYN_ACK'
- * (because we have an acceptable address), we send the 'SYN_ACK'
- * and set the 'send_connect_ack' to 2.  If we then receive a
- * 'ACK', we go to #GNUNET_TRANSPORT_PS_CONNECTED (and reset 'send_connect_ack'
- * to 0).
- *
- */
-enum GNUNET_TRANSPORT_PeerState
-{
-  /**
-   * Fresh peer or completely disconnected
-   */
-  GNUNET_TRANSPORT_PS_NOT_CONNECTED = 0,
-
-  /**
-   * Asked to initiate connection, trying to get address from ATS
-   */
-  GNUNET_TRANSPORT_PS_INIT_ATS,
-
-  /**
-   * Sent SYN message to other peer, waiting for SYN_ACK
-   */
-  GNUNET_TRANSPORT_PS_SYN_SENT,
-
-  /**
-   * Received a SYN, asking ATS about address suggestions.
-   */
-  GNUNET_TRANSPORT_PS_SYN_RECV_ATS,
-
-  /**
-   * SYN request from other peer was SYN_ACK'ed, waiting for ACK.
-   */
-  GNUNET_TRANSPORT_PS_SYN_RECV_ACK,
-
-  /**
-   * Got our SYN_ACK/ACK, connection is up.
-   */
-  GNUNET_TRANSPORT_PS_CONNECTED,
-
-  /**
-   * Connection got into trouble, rest of the system still believes
-   * it to be up, but we're getting a new address from ATS.
-   */
-  GNUNET_TRANSPORT_PS_RECONNECT_ATS,
-
-  /**
-   * Sent SYN over new address (either by ATS telling us to switch
-   * addresses or from RECONNECT_ATS); if this fails, we need to tell
-   * the rest of the system about a disconnect.
-   */
-  GNUNET_TRANSPORT_PS_RECONNECT_SENT,
-
-  /**
-   * We have some primary connection, but ATS suggested we switch
-   * to some alternative; we now sent a SYN message for the
-   * alternative session to the other peer and waiting for a
-   * SYN_ACK to make this our primary connection.
-   */
-  GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT,
-
-  /**
-   * Disconnect in progress (we're sending the DISCONNECT message to the
-   * other peer; after that is finished, the state will be cleaned up).
-   */
-  GNUNET_TRANSPORT_PS_DISCONNECT,
-
-  /**
-   * We're finished with the disconnect; and are cleaning up the state
-   * now!  We put the struct into this state when we are really in the
-   * task that calls 'free' on it and are about to remove the record
-   * from the map.  We should never find a 'struct NeighbourMapEntry'
-   * in this state in the map.  Accessing a 'struct NeighbourMapEntry'
-   * in this state virtually always means using memory that has been
-   * freed (the exception being the cleanup code in #free_neighbour()).
-   */
-  GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED
-};
-
-
-/**
- * Convert a transport state to a human readable string.
- *
- * @param state the state
- */
-const char *
-GNUNET_TRANSPORT_ps2s (enum GNUNET_TRANSPORT_PeerState state);
-
-
-/**
- * Check if a state is defined as connected
- *
- * @param state the state value
- * @return #GNUNET_YES or #GNUNET_NO
- */
-int
-GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state);
-
-
-/**
- * Handle for a #GNUNET_TRANSPORT_monitor_peers operation.
- */
-struct GNUNET_TRANSPORT_PeerMonitoringContext;
-
-
-/**
- * Function to call with information about a peer
- *
- * If one_shot was set to #GNUNET_YES to iterate over all peers once,
- * a final call with NULL for peer and address will follow when done.
- * In this case state and timeout do not contain valid values.
- *
- * The #GNUNET_TRANSPORT_monitor_peers_cancel() call MUST not be called from
- * within this function!
- *
- *
- * @param cls closure
- * @param peer peer this update is about,
- *      NULL if this is the final last callback for a iteration operation
- * @param address address, NULL if this is the final callback for iteration op
- * @param state current state this peer is in
- * @param state_timeout timeout for the current state of the peer
- */
-typedef void
-(*GNUNET_TRANSPORT_PeerIterateCallback) (
-  void *cls,
-  const struct GNUNET_PeerIdentity *peer,
-  const struct GNUNET_HELLO_Address *address,
-  enum GNUNET_TRANSPORT_PeerState state,
-  struct GNUNET_TIME_Absolute state_timeout);
-
-
-/**
- * Return information about a specific peer or all peers currently known to
- * transport service once or in monitoring mode. To obtain information about
- * a specific peer, a peer identity can be passed. To obtain information about
- * all peers currently known to transport service, NULL can be passed as peer
- * identity.
- *
- * For each peer, the callback is called with information about the address 
used
- * to communicate with this peer, the state this peer is currently in and the
- * the current timeout for this state.
- *
- * Upon completion, the #GNUNET_TRANSPORT_PeerIterateCallback is called one
- * more time with `NULL`. After this, the operation must no longer be
- * explicitly canceled.
- *
- * The #GNUNET_TRANSPORT_monitor_peers_cancel call MUST not be called in the
- * the peer_callback!
- *
- * @param cfg configuration to use
- * @param peer a specific peer identity to obtain information for,
- *      NULL for all peers
- * @param one_shot #GNUNET_YES to return the current state and 
- *                 then end (with NULL+NULL), 
- *                 #GNUNET_NO to monitor peers continuously
- * @param peer_callback function to call with the results
- * @param peer_callback_cls closure for @a peer_callback
- */
-struct GNUNET_TRANSPORT_PeerMonitoringContext *
-GNUNET_TRANSPORT_monitor_peers (
-  const struct GNUNET_CONFIGURATION_Handle *cfg,
-  const struct GNUNET_PeerIdentity *peer,
-  int one_shot,
-  GNUNET_TRANSPORT_PeerIterateCallback peer_callback,
-  void *peer_callback_cls);
-
-
-/**
- * Cancel request to monitor peers
- *
- * @param pic handle for the request to cancel
- */
-void
-GNUNET_TRANSPORT_monitor_peers_cancel (
-  struct GNUNET_TRANSPORT_PeerMonitoringContext *pic);
-
-
-/* *********************** Blacklisting ************************ */
-
-/**
- * Handle for blacklisting peers.
- */
-struct GNUNET_TRANSPORT_Blacklist;
-
-
-/**
- * Function that decides if a connection is acceptable or not.
- *
- * @param cls closure
- * @param pid peer to approve or disapproave
- * @return #GNUNET_OK if the connection is allowed, #GNUNET_SYSERR if not
- */
-typedef int
-(*GNUNET_TRANSPORT_BlacklistCallback) (
-  void *cls,
-  const struct GNUNET_PeerIdentity *pid);
-
-
-/**
- * Install a blacklist callback.  The service will be queried for all
- * existing connections as well as any fresh connections to check if
- * they are permitted.  If the blacklisting callback is unregistered,
- * all hosts that were denied in the past will automatically be
- * whitelisted again.  Cancelling the blacklist handle is also the
- * only way to re-enable connections from peers that were previously
- * blacklisted.
- *
- * @param cfg configuration to use
- * @param cb callback to invoke to check if connections are allowed
- * @param cb_cls closure for @a cb
- * @return NULL on error, otherwise handle for cancellation
- */
-struct GNUNET_TRANSPORT_Blacklist *
-GNUNET_TRANSPORT_blacklist (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                            GNUNET_TRANSPORT_BlacklistCallback cb,
-                            void *cb_cls);
-
-
-/**
- * Abort the blacklist.  Note that this function is the only way for
- * removing a peer from the blacklist.
- *
- * @param br handle of the request that is to be cancelled
- */
-void
-GNUNET_TRANSPORT_blacklist_cancel (struct GNUNET_TRANSPORT_Blacklist *br);
-
-
-/**
- * Handle for a plugin session state monitor.
- */
-struct GNUNET_TRANSPORT_PluginMonitor;
-
-/**
- * Abstract representation of a plugin's session.
- * Corresponds to the `struct GNUNET_ATS_Session` within the TRANSPORT service.
- */
-struct GNUNET_TRANSPORT_PluginSession;
-
-
-/**
- * Possible states of a session in a plugin.
- */
-enum GNUNET_TRANSPORT_SessionState
-{
-  /**
-   * The session was created (first call for each session object).
-   */
-  GNUNET_TRANSPORT_SS_INIT,
-
-  /**
-   * Initial session handshake is in progress.
-   */
-  GNUNET_TRANSPORT_SS_HANDSHAKE,
-
-  /**
-   * Session is fully UP.
-   */
-  GNUNET_TRANSPORT_SS_UP,
-
-  /**
-   * This is just an update about the session,
-   * the state did not change.
-   */
-  GNUNET_TRANSPORT_SS_UPDATE,
-
-  /**
-   * Session is being torn down and about to disappear.
-   * Last call for each session object.
-   */
-  GNUNET_TRANSPORT_SS_DONE
-};
-
-
-/**
- * Information about a plugin's session.
- */
-struct GNUNET_TRANSPORT_SessionInfo
-{
-  /**
-   * New state of the session.
-   */
-  enum GNUNET_TRANSPORT_SessionState state;
-
-  /**
-   * #GNUNET_YES if this is an inbound connection,
-   * #GNUNET_NO if this is an outbound connection,
-   * #GNUNET_SYSERR if connections of this plugin
-   *             are so fundamentally bidirectional
-   *             that they have no 'initiator'
-   */
-  int is_inbound;
-
-  /**
-   * Number of messages pending transmission for this session.
-   */
-  uint32_t num_msg_pending;
-
-  /**
-   * Number of bytes pending transmission for this session.
-   */
-  uint32_t num_bytes_pending;
-
-  /**
-   * Until when does this plugin refuse to receive to manage
-   * staying within the inbound quota?  ZERO if receive is
-   * active.
-   */
-  struct GNUNET_TIME_Absolute receive_delay;
-
-  /**
-   * At what time will this session timeout (unless activity
-   * happens)?
-   */
-  struct GNUNET_TIME_Absolute session_timeout;
-
-  /**
-   * Address used by the session.  Can be NULL if none is available.
-   */
-  const struct GNUNET_HELLO_Address *address;
-};
-
-
-/**
- * Function called by the plugin with information about the
- * current sessions managed by the plugin (for monitoring).
- *
- * @param cls closure
- * @param session session handle this information is about,
- *        NULL to indicate that we are "in sync" (initial
- *        iteration complete)
- * @param session_ctx storage location where the application
- *        can store data; will point to NULL on #GNUNET_TRANSPORT_SS_INIT,
- *        and must be reset to NULL on #GNUNET_TRANSPORT_SS_DONE
- * @param info information about the state of the session,
- *        NULL if @a session is also NULL and we are
- *        merely signalling that the initial iteration is over;
- *        NULL with @a session being non-NULL if the monitor
- *        was being cancelled while sessions were active
- */
-typedef void
-(*GNUNET_TRANSPORT_SessionMonitorCallback) (
-  void *cls,
-  struct GNUNET_TRANSPORT_PluginSession *session,
-  void **session_ctx,
-  const struct GNUNET_TRANSPORT_SessionInfo *info);
-
-
-/**
- * Install a plugin session state monitor callback.  The callback
- * will be notified whenever the session changes.
- *
- * @param cfg configuration to use
- * @param cb callback to invoke on events
- * @param cb_cls closure for @a cb
- * @return NULL on error, otherwise handle for cancellation
- */
-struct GNUNET_TRANSPORT_PluginMonitor *
-GNUNET_TRANSPORT_monitor_plugins (const struct GNUNET_CONFIGURATION_Handle 
*cfg,
-                                  GNUNET_TRANSPORT_SessionMonitorCallback cb,
-                                  void *cb_cls);
-
-
-/**
- * Cancel monitoring the plugin session state.  The callback will be
- * called once for each session that is up with the "info" argument
- * being NULL (this is just to enable client-side cleanup).
- *
- * @param pm handle of the request that is to be cancelled
- */
-void
-GNUNET_TRANSPORT_monitor_plugins_cancel (
-  struct GNUNET_TRANSPORT_PluginMonitor *pm);
-
-
-/**
- * Opaque handle to the service.
- */
-struct GNUNET_TRANSPORT_CoreHandle;
-
-
-/**
- * Function called to notify transport users that another
- * peer connected to us.
- *
- * @param cls closure
- * @param peer the identity of the peer that connected; this
- *        pointer will remain valid until the disconnect, hence
- *        applications do not necessarily have to make a copy
- *        of the value if they only need it until disconnect
- * @param mq message queue to use to transmit to @a peer
- * @return closure to use in MQ handlers
- */
-typedef void *
-(*GNUNET_TRANSPORT_NotifyConnect) (
-  void *cls,
-  const struct GNUNET_PeerIdentity *peer,
-  struct GNUNET_MQ_Handle *mq);
-
-
-/**
- * Function called to notify transport users that another peer
- * disconnected from us.  The message queue that was given to the
- * connect notification will be destroyed and must not be used
- * henceforth.
- *
- * @param cls closure from #GNUNET_TRANSPORT_core_connect
- * @param peer the peer that disconnected
- * @param handlers_cls closure of the handlers, was returned from the
- *                    connect notification callback
- */
-typedef void
-(*GNUNET_TRANSPORT_NotifyDisconnect) (
-  void *cls,
-  const struct GNUNET_PeerIdentity *peer,
-  void *handler_cls);
-
-
-/**
- * Function called if we have "excess" bandwidth to a peer.
- * The notification will happen the first time we have excess
- * bandwidth, and then only again after the client has performed
- * some transmission to the peer.
- *
- * Excess bandwidth is defined as being allowed (by ATS) to send
- * more data, and us reaching the limit of the capacity build-up
- * (which, if we go past it, means we don't use available bandwidth).
- * See also the "max carry" in `struct GNUNET_BANDWIDTH_Tracker`.
- *
- * @param cls the closure
- * @param neighbour peer that we have excess bandwidth to
- * @param handlers_cls closure of the handlers, was returned from the
- *                    connect notification callback
- */
-typedef void
-(*GNUNET_TRANSPORT_NotifyExcessBandwidth) (
-  void *cls,
-  const struct GNUNET_PeerIdentity *neighbour,
-  void *handlers_cls);
-
-
-/**
- * Connect to the transport service.  Note that the connection may
- * complete (or fail) asynchronously.
- *
- * @param cfg configuration to use
- * @param self our own identity (API should check that it matches
- *             the identity found by transport), or NULL (no check)
- * @param handlers array of message handlers; note that the
- *                 closures provided will be ignored and replaced
- *                 with the respective return value from @a nc
- * @param handlers array with handlers to call when we receive messages, or 
NULL
- * @param cls closure for the @a nc, @a nd and @a neb callbacks
- * @param nc function to call on connect events, or NULL
- * @param nd function to call on disconnect events, or NULL
- * @param neb function to call if we have excess bandwidth to a peer, or NULL
- * @return NULL on error
- */
-struct GNUNET_TRANSPORT_CoreHandle *
-GNUNET_TRANSPORT_core_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                               const struct GNUNET_PeerIdentity *self,
-                               const struct GNUNET_MQ_MessageHandler *handlers,
-                               void *cls,
-                               GNUNET_TRANSPORT_NotifyConnect nc,
-                               GNUNET_TRANSPORT_NotifyDisconnect nd,
-                               GNUNET_TRANSPORT_NotifyExcessBandwidth neb);
-
-
-/**
- * Disconnect from the transport service.
- *
- * @param handle handle returned from connect
- */
-void
-GNUNET_TRANSPORT_core_disconnect (struct GNUNET_TRANSPORT_CoreHandle *handle);
-
-
-/**
- * Checks if a given peer is connected to us and get the message queue.
- *
- * @param handle connection to transport service
- * @param peer the peer to check
- * @return NULL if disconnected, otherwise message queue for @a peer
- */
-struct GNUNET_MQ_Handle *
-GNUNET_TRANSPORT_core_get_mq (struct GNUNET_TRANSPORT_CoreHandle *handle,
-                              const struct GNUNET_PeerIdentity *peer);
-
-
-#if 0 /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-/* ifndef GNUNET_TRANSPORT_SERVICE_H */
-#endif
-
-/** @} */ /* end of group */
-
-/** @} */ /* end of group addition */
-
-/* end of gnunet_transport_service.h */
diff --git a/src/include/gnunet_transport_testing_ng_lib.h 
b/src/include/gnunet_transport_testing_ng_lib.h
new file mode 100644
index 000000000..72ec11eaf
--- /dev/null
+++ b/src/include/gnunet_transport_testing_ng_lib.h
@@ -0,0 +1,81 @@
+/*
+      This file is part of GNUnet
+      Copyright (C) 2021-2023 GNUnet e.V.
+
+      GNUnet is free software: you can redistribute it and/or modify it
+      under the terms of the GNU Affero General Public License as published
+      by the Free Software Foundation, either version 3 of the License,
+      or (at your option) any later version.
+
+      GNUnet is distributed in the hope that it will be useful, but
+      WITHOUT ANY WARRANTY; without even the implied warranty of
+      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+      Affero General Public License for more details.
+
+      You should have received a copy of the GNU Affero General Public License
+      along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
+ */
+
+/**
+ * @brief API for cmds working with transport sub system.
+ * @author t3sserakt
+ */
+#ifndef GNUNET_TRANSPORT_TESTING_NG_LIB_H
+#define GNUNET_TRANSPORT_TESTING_NG_LIB_H
+
+
+#include "gnunet_util_lib.h"
+#include "gnunet_testing_lib.h"
+
+
+/**
+ * Create command.
+ *
+ * @param label name for command.
+ * @param system_label Label of the cmd to setup a test environment.
+ * @param no Decimal number representing the last byte of the IP address of 
this peer.
+ * @param node_ip The IP address of this node.
+ * @param cfgname Configuration file name for this peer.
+ * @param broadcast Flag indicating, if broadcast should be switched on.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_start_peer (const char *label,
+                               const char *system_label,
+                               uint32_t no,
+                               const char *node_ip,
+                               const char *cfgname,
+                               unsigned int broadcast);
+
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_stop_peer (const char *label,
+                                const char *start_label);
+
+
+/**
+ * Create command
+ *
+ * @param label name for command
+ * @param start_peer_label Label of the cmd to start a peer.
+ * @param create_label Label of the cmd which started the test system.
+ * @param num Number globally identifying the node.
+ * @param topology The topology for the test setup.
+ * @param additional_connects Number of additional connects this cmd will wait 
for not triggered by this cmd.
+ * @return command.
+ */
+struct GNUNET_TESTING_Command
+GNUNET_CORE_cmd_connect_peers (
+  const char *label,
+  const char *start_peer_label,
+  const char *create_label,
+  uint32_t num,
+  struct GNUNET_TESTING_NetjailTopology *topology,
+  unsigned int additional_connects,
+  unsigned int wait_for_connect,
+  struct GNUNET_MQ_MessageHandler *handlers);
+
+
+#endif
diff --git a/src/integration-tests/Makefile.am 
b/src/integration-tests/Makefile.am
index 33c6a3832..59daff4f6 100644
--- a/src/integration-tests/Makefile.am
+++ b/src/integration-tests/Makefile.am
@@ -12,11 +12,11 @@ noinst_SCRIPTS = \
 
 if HAVE_PYTHON
 check_SCRIPTS = \
-  test_integration_bootstrap_and_connect.py \
-  test_integration_disconnect.py \
-  test_integration_disconnect_nat.py \
-  test_integration_reconnect.py \
-  test_integration_reconnect_nat.py
+  # test_integration_bootstrap_and_connect.py \
+  # test_integration_disconnect.py \
+  # test_integration_disconnect_nat.py \
+  # test_integration_reconnect.py \
+  # test_integration_reconnect_nat.py
 #  test_integration_clique.py
 endif
 
diff --git a/src/meson.build b/src/meson.build
index 41d6dae73..f903d0111 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -17,22 +17,23 @@ subdir('curl', if_found : [curl_dep])
 if get_option('monolith') == false
   subdir('rest')
 endif
-subdir('peerinfo')
+#subdir('peerinfo')
 subdir('sq', if_found : [sqlite_dep])
 subdir('pq', if_found : [pq_dep])
 subdir('datacache')
 subdir('datastore')
 #subdir('template')
 subdir('peerstore')
-subdir('ats')
+#subdir('ats')
 subdir('nat')
 subdir('nat-auto')
 subdir('fragmentation')
 subdir('transport')
-subdir('ats-tool')
+#subdir('ats-tool')
 subdir('core')
-subdir('testbed-logger')
-subdir('testbed')
+# Testbed needs old transport
+#subdir('testbed-logger')
+#subdir('testbed')
 subdir('nse')
 subdir('dhtu')
 subdir('dht')
@@ -44,7 +45,7 @@ subdir('identity')
 subdir('gnsrecord')
 subdir('namecache')
 subdir('namestore')
-subdir('peerinfo-tool')
+#subdir('peerinfo-tool')
 subdir('cadet')
 subdir('set')
 subdir('seti')
diff --git a/src/messenger/Makefile.am b/src/messenger/Makefile.am
index 4be11f3aa..4a63494bc 100644
--- a/src/messenger/Makefile.am
+++ b/src/messenger/Makefile.am
@@ -97,19 +97,18 @@ gnunet_service_messenger_LDADD = \
   $(top_builddir)/src/identity/libgnunetidentity.la \
   $(GN_LIBINTL)
 
-check_PROGRAMS = \
-  test_messenger_api \
-  test_messenger_anonymous \
-  test_messenger_sync_client \
-  test_messenger_async_client \
-  test_messenger_worst_client \
-  test_messenger_sync_p2p \
-  test_messenger_async_p2p \
-  test_messenger_worst_p2p \
-  test_messenger_server \
-  test_messenger_growth \
-  test_messenger_ring \
-  test_messenger_adapt
+check_PROGRAMS = test_messenger_anonymous \
+  # test_messenger_api \
+  # test_messenger_sync_client \
+  # test_messenger_async_client \
+  # test_messenger_worst_client \
+  # test_messenger_sync_p2p \
+  # test_messenger_async_p2p \
+  # test_messenger_worst_p2p \
+  # test_messenger_server \
+  # test_messenger_growth \
+  # test_messenger_ring \
+  # test_messenger_adapt
 
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
diff --git a/src/nse/Makefile.am b/src/nse/Makefile.am
index 0c6182e61..460e68e02 100644
--- a/src/nse/Makefile.am
+++ b/src/nse/Makefile.am
@@ -36,18 +36,19 @@ libgnunetnse_la_LDFLAGS = \
 libexec_PROGRAMS = \
  gnunet-service-nse
 
-noinst_PROGRAMS = \
- gnunet-nse-profiler
-
-gnunet_nse_profiler_SOURCES = \
- gnunet-nse-profiler.c
-gnunet_nse_profiler_LDADD = -lm \
-  libgnunetnse.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  $(GN_LIBINTL)
+#noinst_PROGRAMS = \
+# gnunet-nse-profiler
+
+# FIXME no testbed in TNG
+#gnunet_nse_profiler_SOURCES = \
+# gnunet-nse-profiler.c
+#gnunet_nse_profiler_LDADD = -lm \
+#  libgnunetnse.la \
+#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(top_builddir)/src/statistics/libgnunetstatistics.la \
+#  $(top_builddir)/src/testing/libgnunettesting.la \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  $(GN_LIBINTL)
 
 gnunet_service_nse_SOURCES = \
  gnunet-service-nse.c
diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c
index 23daa7f12..7f3e03b98 100644
--- a/src/nse/nse_api.c
+++ b/src/nse/nse_api.c
@@ -26,7 +26,6 @@
 #include "platform.h"
 #include "gnunet_constants.h"
 #include "gnunet_arm_service.h"
-#include "gnunet_hello_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_nse_service.h"
diff --git a/src/peerinfo-tool/.gitignore b/src/peerinfo-tool/.gitignore
deleted file mode 100644
index d4ed4f801..000000000
--- a/src/peerinfo-tool/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-gnunet-peerinfo
-test_gnunet_peerinfo.py
diff --git a/src/peerinfo-tool/Makefile.am b/src/peerinfo-tool/Makefile.am
deleted file mode 100644
index 825ad5452..000000000
--- a/src/peerinfo-tool/Makefile.am
+++ /dev/null
@@ -1,64 +0,0 @@
-# This Makefile.am is in the public domain
-AM_CPPFLAGS = -I$(top_srcdir)/src/include
-
-if USE_COVERAGE
-  AM_CFLAGS = --coverage -O0
-  XLIB = -lgcov
-endif
-
-REST_PLUGIN = libgnunet_plugin_rest_peerinfo.la
-
-plugindir = $(libdir)/gnunet
-
-plugin_LTLIBRARIES = $(REST_PLUGIN)
-
-bin_PROGRAMS = \
- gnunet-peerinfo
-
-libgnunet_plugin_rest_peerinfo_la_SOURCES = \
-  plugin_rest_peerinfo.c
-libgnunet_plugin_rest_peerinfo_la_LIBADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  $(top_builddir)/src/transport/libgnunettransport.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
-  $(top_builddir)/src/rest/libgnunetrest.la \
-  $(top_builddir)/src/json/libgnunetjson.la \
-  $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
-  $(LTLIBINTL) -ljansson $(MHD_LIBS)
-libgnunet_plugin_rest_peerinfo_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS)
-libgnunet_plugin_rest_peerinfo_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
-
-
-gnunet_peerinfo_SOURCES = \
- gnunet-peerinfo.c \
- gnunet-peerinfo_plugins.c gnunet-peerinfo_plugins.h
-gnunet_peerinfo_LDADD = \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  $(top_builddir)/src/transport/libgnunettransport.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
-gnunet_peerinfo_LDFLAGS = \
-  $(GN_LIBINTL)
-
-if HAVE_PYTHON
-check_SCRIPTS = \
- test_gnunet_peerinfo.py
-endif
-
-if ENABLE_TEST_RUN
-AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
-TESTS = $(check_SCRIPTS)
-endif
-
-test_gnunet_peerinfo.py: test_gnunet_peerinfo.py.in Makefile
-       $(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" 
-v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v 
pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/bin/dosubst.awk < 
$(srcdir)/test_gnunet_peerinfo.py.in > test_gnunet_peerinfo.py
-       chmod +x test_gnunet_peerinfo.py
-
-EXTRA_DIST = \
-  test_gnunet_peerinfo.py.in \
-  test_gnunet_peerinfo_data.conf
-
-CLEANFILES = $(check_SCRIPTS)
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c 
b/src/peerinfo-tool/gnunet-peerinfo.c
deleted file mode 100644
index 8b149c98e..000000000
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ /dev/null
@@ -1,864 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2001-2014, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo-tool/gnunet-peerinfo.c
- * @brief Print information about other known peers.
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_transport_hello_service.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet-peerinfo_plugins.h"
-
-/**
- * How long until we time out during address lookup?
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
-
-/**
- * Structure we use to collect printable address information.
- */
-struct PrintContext;
-
-/**
- * Record we keep for each printable address.
- */
-struct AddressRecord
-{
-  /**
-   * Current address-to-string context (if active, otherwise NULL).
-   */
-  struct GNUNET_TRANSPORT_AddressToStringContext *atsc;
-
-  /**
-   * Address expiration time
-   */
-  struct GNUNET_TIME_Absolute expiration;
-
-  /**
-   * Printable address.
-   */
-  char *result;
-
-  /**
-   * Print context this address record belongs to.
-   */
-  struct PrintContext *pc;
-};
-
-
-/**
- * Structure we use to collect printable address information.
- */
-struct PrintContext
-{
-  /**
-   * Kept in DLL.
-   */
-  struct PrintContext *next;
-
-  /**
-   * Kept in DLL.
-   */
-  struct PrintContext *prev;
-
-  /**
-   * Identity of the peer.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * List of printable addresses.
-   */
-  struct AddressRecord *address_list;
-
-  /**
-   * Number of completed addresses in @e address_list.
-   */
-  unsigned int num_addresses;
-
-  /**
-   * Number of addresses allocated in @e address_list.
-   */
-  unsigned int address_list_size;
-
-  /**
-   * Current offset in @e address_list (counted down).
-   */
-  unsigned int off;
-
-  /**
-   * Hello was friend only, #GNUNET_YES or #GNUNET_NO
-   */
-  int friend_only;
-};
-
-
-/**
- * Option '-n'
- */
-static int no_resolve;
-
-/**
- * Option '-q'
- */
-static int be_quiet;
-
-/**
- * Option '-f'
- */
-static int include_friend_only;
-
-/**
- * Option '-s'
- */
-static int get_self;
-
-/**
- * Option
- */
-static int get_uri;
-
-/**
- * Option
- */
-static int default_operation;
-
-/**
- * Option '-i'
- */
-static int get_info;
-
-/**
- * Option
- */
-static char *put_uri;
-
-/**
- * Option -d
- */
-static char *dump_hello;
-
-/**
- * Handle to peerinfo service.
- */
-static struct GNUNET_PEERINFO_Handle *peerinfo;
-
-/**
- * Configuration handle.
- */
-static const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-/**
- * Main state machine task (if active).
- */
-static struct GNUNET_SCHEDULER_Task *tt;
-
-/**
- * Pending #GNUNET_TRANSPORT_hello_get() operation.
- */
-static struct GNUNET_TRANSPORT_HelloGetHandle *gh;
-
-/**
- * Current iterator context (if active, otherwise NULL).
- */
-static struct GNUNET_PEERINFO_IteratorContext *pic;
-
-/**
- * My peer identity.
- */
-static struct GNUNET_PeerIdentity my_peer_identity;
-
-/**
- * Head of list of print contexts.
- */
-static struct PrintContext *pc_head;
-
-/**
- * Tail of list of print contexts.
- */
-static struct PrintContext *pc_tail;
-
-/**
- * Handle to current #GNUNET_PEERINFO_add_peer() operation.
- */
-static struct GNUNET_MQ_Envelope *ac;
-
-/**
- * Hello of this peer (if initialized).
- */
-static struct GNUNET_HELLO_Message *my_hello;
-
-
-/**
- * Main state machine that goes over all options and
- * runs the next requested function.
- *
- * @param cls unused
- */
-static void
-state_machine (void *cls);
-
-
-/* ********************* 'get_info' ******************* */
-
-/**
- * Print the collected address information to the console and free @a pc.
- *
- * @param pc printing context
- */
-static void
-dump_pc (struct PrintContext *pc)
-{
-  unsigned int i;
-
-  printf (_ ("%sPeer `%s'\n"),
-          (GNUNET_YES == pc->friend_only) ? "F2F: " : "",
-          GNUNET_i2s_full (&pc->peer));
-  for (i = 0; i < pc->num_addresses; i++)
-  {
-    if (NULL != pc->address_list[i].result)
-    {
-      printf (_ ("\tExpires: %s \t %s\n"),
-              GNUNET_STRINGS_absolute_time_to_string (
-                pc->address_list[i].expiration),
-              pc->address_list[i].result);
-      GNUNET_free (pc->address_list[i].result);
-    }
-  }
-  printf ("\n");
-  GNUNET_free (pc->address_list);
-  GNUNET_CONTAINER_DLL_remove (pc_head, pc_tail, pc);
-  GNUNET_free (pc);
-  if ((NULL == pc_head) && (NULL == pic))
-    tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
-}
-
-
-/* ************************* list all known addresses **************** */
-
-
-/**
- * Function to call with a human-readable format of an address
- *
- * @param cls closure
- * @param address NULL on error, otherwise 0-terminated printable UTF-8 string
- * @param res result of the address to string conversion:
- *        if #GNUNET_OK: address was valid (conversion to
- *                       string might still have failed)
- *        if #GNUNET_SYSERR: address is invalid
- */
-static void
-process_resolved_address (void *cls, const char *address, int res)
-{
-  struct AddressRecord *ar = cls;
-  struct PrintContext *pc = ar->pc;
-
-  if (NULL != address)
-  {
-    if (0 != strlen (address))
-    {
-      if (NULL != ar->result)
-        GNUNET_free (ar->result);
-      ar->result = GNUNET_strdup (address);
-    }
-    return;
-  }
-  ar->atsc = NULL;
-  if (GNUNET_SYSERR == res)
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ ("Failure: Cannot convert address to string for peer 
`%s'\n"),
-                GNUNET_i2s (&ar->pc->peer));
-  pc->num_addresses++;
-  if (pc->num_addresses == pc->address_list_size)
-    dump_pc (pc);
-}
-
-
-/**
- * Iterator callback to go over all addresses and count them.
- *
- * @param cls `struct PrintContext *` with `off` to increment
- * @param address the address
- * @param expiration expiration time
- * @return #GNUNET_OK to keep the address and continue
- */
-static int
-count_address (void *cls,
-               const struct GNUNET_HELLO_Address *address,
-               struct GNUNET_TIME_Absolute expiration)
-{
-  struct PrintContext *pc = cls;
-
-  pc->off++;
-  return GNUNET_OK;
-}
-
-
-/**
- * Iterator callback to go over all addresses.
- *
- * @param cls closure
- * @param address the address
- * @param expiration expiration time
- * @return #GNUNET_OK to keep the address and continue
- */
-static int
-print_address (void *cls,
-               const struct GNUNET_HELLO_Address *address,
-               struct GNUNET_TIME_Absolute expiration)
-{
-  struct PrintContext *pc = cls;
-  struct AddressRecord *ar;
-
-  GNUNET_assert (0 < pc->off);
-  ar = &pc->address_list[--pc->off];
-  ar->pc = pc;
-  ar->expiration = expiration;
-  GNUNET_asprintf (&ar->result,
-                   "%s:%lu:%u",
-                   address->transport_name,
-                   (unsigned long) address->address_length,
-                   address->local_info);
-  ar->atsc = GNUNET_TRANSPORT_address_to_string (cfg,
-                                                 address,
-                                                 no_resolve,
-                                                 TIMEOUT,
-                                                 &process_resolved_address,
-                                                 ar);
-  return GNUNET_OK;
-}
-
-
-/**
- * Print information about the peer.  Currently prints the `struct
- * GNUNET_PeerIdentity` and the transport address.
- *
- * @param cls the `struct PrintContext *`
- * @param peer identity of the peer
- * @param hello addresses of the peer
- * @param err_msg error message
- */
-static void
-print_peer_info (void *cls,
-                 const struct GNUNET_PeerIdentity *peer,
-                 const struct GNUNET_HELLO_Message *hello,
-                 const char *err_msg)
-{
-  struct PrintContext *pc;
-  int friend_only;
-
-  if (NULL == peer)
-  {
-    pic = NULL;   /* end of iteration */
-    if (NULL != err_msg)
-    {
-      fprintf (stderr,
-               _ ("Error in communication with PEERINFO service: %s\n"),
-               err_msg);
-    }
-    if (NULL == pc_head)
-      tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
-    return;
-  }
-  friend_only = GNUNET_NO;
-  if (NULL != hello)
-    friend_only = GNUNET_HELLO_is_friend_only (hello);
-  if ((GNUNET_YES == be_quiet) || (NULL == hello))
-  {
-    printf ("%s%s\n",
-            (GNUNET_YES == friend_only) ? "F2F: " : "",
-            GNUNET_i2s_full (peer));
-    return;
-  }
-  pc = GNUNET_new (struct PrintContext);
-  GNUNET_CONTAINER_DLL_insert (pc_head, pc_tail, pc);
-  pc->peer = *peer;
-  pc->friend_only = friend_only;
-  GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &count_address, pc);
-  if (0 == pc->off)
-  {
-    dump_pc (pc);
-    return;
-  }
-  pc->address_list_size = pc->off;
-  pc->address_list = GNUNET_malloc (sizeof(struct AddressRecord) * pc->off);
-  GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &print_address, pc);
-}
-
-
-/* ************************* DUMP Hello  ************************** */
-
-/**
- * Count the number of addresses in the HELLO.
- *
- * @param cls pointer to an `int *` used for the counter
- * @param address an address to count
- * @param expiration (unused)
- * @return #GNUNET_OK
- */
-static int
-count_addr (void *cls,
-            const struct GNUNET_HELLO_Address *address,
-            struct GNUNET_TIME_Absolute expiration)
-{
-  int *c = cls;
-
-  (*c)++;
-  return GNUNET_OK;
-}
-
-
-/**
- * Write HELLO of my peer to a file.
- *
- * @param cls the `struct GetUriContext *`
- * @param peer identity of the peer (unused)
- * @param hello addresses of the peer
- * @param err_msg error message
- */
-static void
-dump_my_hello ()
-{
-  unsigned int size;
-  unsigned int c_addr;
-
-  size = GNUNET_HELLO_size (my_hello);
-  if (0 == size)
-  {
-    fprintf (stderr, _ ("Failure: Received invalid %s\n"), "HELLO");
-    return;
-  }
-  if (GNUNET_SYSERR ==
-      GNUNET_DISK_fn_write (dump_hello,
-                            my_hello,
-                            size,
-                            GNUNET_DISK_PERM_USER_READ
-                            | GNUNET_DISK_PERM_USER_WRITE
-                            | GNUNET_DISK_PERM_GROUP_READ
-                            | GNUNET_DISK_PERM_OTHER_READ))
-  {
-    fprintf (stderr,
-             _ ("Failed to write HELLO with %u bytes to file `%s'\n"),
-             size,
-             dump_hello);
-    if (0 != unlink (dump_hello))
-      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING
-                                | GNUNET_ERROR_TYPE_BULK,
-                                "unlink",
-                                dump_hello);
-  }
-  c_addr = 0;
-  GNUNET_HELLO_iterate_addresses (my_hello, GNUNET_NO, count_addr, &c_addr);
-
-  if (! be_quiet)
-  {
-    fprintf (
-      stderr,
-      _ ("Wrote %s HELLO containing %u addresses with %u bytes to file 
`%s'\n"),
-      (GNUNET_YES == GNUNET_HELLO_is_friend_only (my_hello)) ? "friend-only"
-      : "public",
-      c_addr,
-      size,
-      dump_hello);
-  }
-  GNUNET_free (dump_hello);
-  dump_hello = NULL;
-}
-
-
-/* ************************* GET URI ************************** */
-
-
-/**
- * Print URI of the peer.
- *
- * @param cls the `struct GetUriContext *`
- * @param peer identity of the peer (unused)
- * @param hello addresses of the peer
- * @param err_msg error message
- */
-static void
-print_my_uri (void *cls,
-              const struct GNUNET_PeerIdentity *peer,
-              const struct GNUNET_HELLO_Message *hello,
-              const char *err_msg)
-{
-  char *uri;
-
-  if (NULL == peer)
-  {
-    pic = NULL;
-    if (NULL != err_msg)
-      fprintf (stderr,
-               _ ("Error in communication with PEERINFO service: %s\n"),
-               err_msg);
-    tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
-    return;
-  }
-
-  if (NULL == hello)
-    return;
-  uri = GNUNET_HELLO_compose_uri (hello, &GPI_plugins_find);
-  if (NULL != uri)
-  {
-    printf ("%s\n", (const char *) uri);
-    GNUNET_free (uri);
-  }
-}
-
-
-/* ************************* import HELLO by URI ********************* */
-
-
-/**
- * Continuation called from #GNUNET_PEERINFO_add_peer()
- *
- * @param cls closure, NULL
- */
-static void
-add_continuation (void *cls)
-{
-  ac = NULL;
-  tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
-}
-
-
-/**
- * Parse the PUT URI given at the command line and add it to our peerinfo
- * database.
- *
- * @param put_uri URI string to parse
- * @return #GNUNET_OK on success,
- *         #GNUNET_SYSERR if the URI was invalid,
- *         #GNUNET_NO on other errors
- */
-static int
-parse_hello_uri (const char *put_uri)
-{
-  struct GNUNET_HELLO_Message *hello = NULL;
-
-  int ret = GNUNET_HELLO_parse_uri (put_uri,
-                                    &my_peer_identity.public_key,
-                                    &hello,
-                                    &GPI_plugins_find);
-
-  if (NULL != hello)
-  {
-    /* WARNING: this adds the address from URI WITHOUT verification! */
-    if (GNUNET_OK == ret)
-      ac = GNUNET_PEERINFO_add_peer (peerinfo, hello, &add_continuation, NULL);
-    else
-      tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
-    GNUNET_free (hello);
-  }
-  return ret;
-}
-
-
-/* ************************ Main state machine ********************* */
-
-
-/**
- * Main state machine that goes over all options and
- * runs the next requested function.
- *
- * @param cls unused
- */
-static void
-shutdown_task (void *cls)
-{
-  struct PrintContext *pc;
-  struct AddressRecord *ar;
-  unsigned int i;
-
-  if (NULL != ac)
-  {
-    GNUNET_MQ_send_cancel (ac);
-    ac = NULL;
-  }
-  if (NULL != tt)
-  {
-    GNUNET_SCHEDULER_cancel (tt);
-    tt = NULL;
-  }
-  if (NULL != pic)
-  {
-    GNUNET_PEERINFO_iterate_cancel (pic);
-    pic = NULL;
-  }
-  if (NULL != gh)
-  {
-    GNUNET_TRANSPORT_hello_get_cancel (gh);
-    gh = NULL;
-  }
-  while (NULL != (pc = pc_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (pc_head, pc_tail, pc);
-    for (i = 0; i < pc->address_list_size; i++)
-    {
-      ar = &pc->address_list[i];
-      GNUNET_free (ar->result);
-      if (NULL != ar->atsc)
-      {
-        GNUNET_TRANSPORT_address_to_string_cancel (ar->atsc);
-        ar->atsc = NULL;
-      }
-    }
-    GNUNET_free (pc->address_list);
-    GNUNET_free (pc);
-  }
-  GPI_plugins_unload ();
-  if (NULL != peerinfo)
-  {
-    GNUNET_PEERINFO_disconnect (peerinfo);
-    peerinfo = NULL;
-  }
-  if (NULL != my_hello)
-  {
-    GNUNET_free (my_hello);
-    my_hello = NULL;
-  }
-}
-
-
-/**
- * Function called with our peer's HELLO message.
- * Used to obtain our peer's public key.
- *
- * @param cls NULL
- * @param hello the HELLO message
- */
-static void
-hello_callback (void *cls, const struct GNUNET_MessageHeader *hello)
-{
-  if (NULL == hello)
-  {
-    fprintf (stderr, "Failed to get my own HELLO from this peer!\n");
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-  my_hello = (struct GNUNET_HELLO_Message *) GNUNET_copy_message (hello);
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_HELLO_get_id (my_hello, &my_peer_identity));
-  GNUNET_TRANSPORT_hello_get_cancel (gh);
-  gh = NULL;
-  if (NULL != dump_hello)
-    dump_my_hello ();
-  tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
-}
-
-
-/**
- * Main function that will be run by the scheduler.
- *
- * @param cls closure
- * @param args remaining command-line arguments
- * @param cfgfile name of the configuration file used (for saving, can be 
NULL!)
- * @param c configuration
- */
-static void
-run (void *cls,
-     char *const *args,
-     const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *c)
-{
-  cfg = c;
-  if ((NULL != args[0]) && (NULL == put_uri) &&
-      (args[0] == strcasestr (args[0], "gnunet://hello/")))
-  {
-    put_uri = GNUNET_strdup (args[0]);
-    args++;
-  }
-  if (NULL != args[0])
-  {
-    fprintf (stderr, _ ("Invalid command line argument `%s'\n"), args[0]);
-    return;
-  }
-  if (NULL == (peerinfo = GNUNET_PEERINFO_connect (cfg)))
-  {
-    fprintf (stderr, "%s", "Could not access PEERINFO service.  Exiting.\n");
-    return;
-  }
-  if ((GNUNET_YES == get_self) || (GNUNET_YES == get_uri) ||
-      (NULL != dump_hello))
-  {
-    gh = GNUNET_TRANSPORT_hello_get (cfg,
-                                     GNUNET_TRANSPORT_AC_ANY,
-                                     &hello_callback,
-                                     NULL);
-  }
-  else
-  {
-    tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
-  }
-  GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
-}
-
-
-/**
- * Main state machine that goes over all options and
- * runs the next requested function.
- *
- * @param cls unused
- */
-static void
-state_machine (void *cls)
-{
-  tt = NULL;
-
-  if (NULL != put_uri)
-  {
-    GPI_plugins_load (cfg);
-    if (GNUNET_SYSERR == parse_hello_uri (put_uri))
-    {
-      fprintf (stderr, _ ("Invalid URI `%s'\n"), put_uri);
-      GNUNET_SCHEDULER_shutdown ();
-    }
-    GNUNET_free (put_uri);
-    put_uri = NULL;
-  }
-  else if (GNUNET_YES == get_info)
-  {
-    get_info = GNUNET_NO;
-    GPI_plugins_load (cfg);
-    pic = GNUNET_PEERINFO_iterate (peerinfo,
-                                   include_friend_only,
-                                   NULL,
-                                   &print_peer_info,
-                                   NULL);
-  }
-  else if (GNUNET_YES == get_self)
-  {
-    get_self = GNUNET_NO;
-    if (be_quiet)
-      printf ("%s\n", GNUNET_i2s_full (&my_peer_identity));
-    else
-      printf (_ ("I am peer `%s'.\n"), GNUNET_i2s_full (&my_peer_identity));
-    tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
-  }
-  else if (GNUNET_YES == get_uri)
-  {
-    GPI_plugins_load (cfg);
-    pic = GNUNET_PEERINFO_iterate (peerinfo,
-                                   include_friend_only,
-                                   &my_peer_identity,
-                                   &print_my_uri,
-                                   NULL);
-    get_uri = GNUNET_NO;
-  }
-  else if (GNUNET_YES == default_operation)
-  {
-    /* default operation list all */
-    default_operation = GNUNET_NO;
-    get_info = GNUNET_YES;
-    tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
-  }
-  else
-  {
-    GNUNET_SCHEDULER_shutdown ();
-  }
-  default_operation = GNUNET_NO;
-}
-
-
-/**
- * The main function to obtain peer information.
- *
- * @param argc number of arguments from the command line
- * @param argv command line arguments
- * @return 0 ok, 1 on error
- */
-int
-main (int argc, char *const *argv)
-{
-  struct GNUNET_GETOPT_CommandLineOption options[] =
-  { GNUNET_GETOPT_option_flag ('n',
-                               "numeric",
-                               gettext_noop ("don't resolve host names"),
-                               &no_resolve),
-
-    GNUNET_GETOPT_option_flag ('q',
-                               "quiet",
-                               gettext_noop (
-                                 "output only the identity strings"),
-                               &be_quiet),
-    GNUNET_GETOPT_option_flag ('f',
-                               "friends",
-                               gettext_noop (
-                                 "include friend-only information"),
-                               &include_friend_only),
-
-    GNUNET_GETOPT_option_flag ('s',
-                               "self",
-                               gettext_noop ("output our own identity only"),
-                               &get_self),
-
-    GNUNET_GETOPT_option_flag ('i',
-                               "info",
-                               gettext_noop ("list all known peers"),
-                               &get_info),
-
-    GNUNET_GETOPT_option_string ('d',
-                                 "dump-hello",
-                                 NULL,
-                                 gettext_noop ("dump hello to file"),
-                                 &dump_hello),
-
-    GNUNET_GETOPT_option_flag ('g',
-                               "get-hello",
-                               gettext_noop ("also output HELLO uri(s)"),
-                               &get_uri),
-
-    GNUNET_GETOPT_option_string ('p',
-                                 "put-hello",
-                                 "HELLO",
-                                 gettext_noop (
-                                   "add given HELLO uri to the database"),
-                                 &put_uri),
-
-    GNUNET_GETOPT_OPTION_END };
-  int ret;
-
-  default_operation = GNUNET_YES;
-  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
-    return 2;
-
-  ret = (GNUNET_OK ==
-         GNUNET_PROGRAM_run (argc,
-                             argv,
-                             "gnunet-peerinfo",
-                             gettext_noop ("Print information about peers."),
-                             options,
-                             &run,
-                             NULL))
-        ? 0
-        : 1;
-  GNUNET_free_nz ((void *) argv);
-  return ret;
-}
-
-
-/* end of gnunet-peerinfo.c */
diff --git a/src/peerinfo-tool/gnunet-peerinfo_plugins.c 
b/src/peerinfo-tool/gnunet-peerinfo_plugins.c
deleted file mode 100644
index e196ec58a..000000000
--- a/src/peerinfo-tool/gnunet-peerinfo_plugins.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010,2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo-tool/gnunet-peerinfo_plugins.c
- * @brief plugin management
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet-peerinfo_plugins.h"
-#include "gnunet_transport_plugin.h"
-#include "gnunet_hello_lib.h"
-
-/**
- * Entry in doubly-linked list of all of our plugins.
- */
-struct TransportPlugin
-{
-  /**
-   * This is a doubly-linked list.
-   */
-  struct TransportPlugin *next;
-
-  /**
-   * This is a doubly-linked list.
-   */
-  struct TransportPlugin *prev;
-
-  /**
-   * API of the transport as returned by the plugin's
-   * initialization function.
-   */
-  struct GNUNET_TRANSPORT_PluginFunctions *api;
-
-  /**
-   * Short name for the plugin (e.g. "tcp").
-   */
-  char *short_name;
-
-  /**
-   * Name of the library (e.g. "gnunet_plugin_transport_tcp").
-   */
-  char *lib_name;
-
-  /**
-   * Environment this transport service is using
-   * for this plugin.
-   */
-  struct GNUNET_TRANSPORT_PluginEnvironment env;
-};
-
-/**
- * Head of DLL of all loaded plugins.
- */
-static struct TransportPlugin *plugins_head;
-
-/**
- * Head of DLL of all loaded plugins.
- */
-static struct TransportPlugin *plugins_tail;
-
-
-/**
- * Load and initialize all plugins.  The respective functions will be
- * invoked by the plugins when the respective events happen.  The
- * closure will be set to a 'const char*' containing the name of the
- * plugin that caused the call.
- *
- * @param cfg configuration to use
- */
-void
-GPI_plugins_load (const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  struct TransportPlugin *plug;
-  struct TransportPlugin *next;
-  char *libname;
-  char *plugs;
-  char *pos;
-
-  if (NULL != plugins_head)
-    return; /* already loaded */
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_string (cfg, "TRANSPORT", "PLUGINS",
-                                             &plugs))
-    return;
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("Starting transport plugins `%s'\n"),
-              plugs);
-  for (pos = strtok (plugs, " "); pos != NULL; pos = strtok (NULL, " "))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("Loading `%s' transport plugin\n"),
-                pos);
-    GNUNET_asprintf (&libname, "libgnunet_plugin_transport_%s", pos);
-    plug = GNUNET_new (struct TransportPlugin);
-    plug->short_name = GNUNET_strdup (pos);
-    plug->lib_name = libname;
-    plug->env.cfg = cfg;
-    plug->env.cls = plug->short_name;
-    GNUNET_CONTAINER_DLL_insert (plugins_head, plugins_tail, plug);
-  }
-  GNUNET_free (plugs);
-  next = plugins_head;
-  while (next != NULL)
-  {
-    plug = next;
-    next = plug->next;
-    plug->api = GNUNET_PLUGIN_load (plug->lib_name, &plug->env);
-    if (plug->api == NULL)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Failed to load transport plugin for `%s'\n"),
-                  plug->lib_name);
-      GNUNET_CONTAINER_DLL_remove (plugins_head, plugins_tail, plug);
-      GNUNET_free (plug->short_name);
-      GNUNET_free (plug->lib_name);
-      GNUNET_free (plug);
-    }
-  }
-}
-
-
-/**
- * Unload all plugins
- */
-void
-GPI_plugins_unload ()
-{
-  struct TransportPlugin *plug;
-
-  while (NULL != (plug = plugins_head))
-  {
-    GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api));
-    GNUNET_free (plug->lib_name);
-    GNUNET_free (plug->short_name);
-    GNUNET_CONTAINER_DLL_remove (plugins_head, plugins_tail, plug);
-    GNUNET_free (plug);
-  }
-}
-
-
-/**
- * Obtain the plugin API based on a plugin name.
- *
- * @param name name of the plugin
- * @return the plugin's API, NULL if the plugin is not loaded
- */
-struct GNUNET_TRANSPORT_PluginFunctions *
-GPI_plugins_find (const char *name)
-{
-  struct TransportPlugin *head = plugins_head;
-
-  char *stripped = GNUNET_strdup (name);
-  char *head_stripped;
-  char *sep = strchr (stripped, '_');
-
-  if (NULL != sep)
-    sep[0] = '\0';
-
-  while (head != NULL)
-  {
-    head_stripped = GNUNET_strdup (head->short_name);
-    char *head_sep = strchr (head_stripped, '_');
-    if (NULL != head_sep)
-      head_sep[0] = '\0';
-    if (0 == strcmp (head_stripped, stripped))
-    {
-      GNUNET_free (head_stripped);
-      break;
-    }
-    GNUNET_free (head_stripped);
-    head = head->next;
-  }
-  GNUNET_free (stripped);
-  if (NULL == head)
-    return NULL;
-  return head->api;
-}
-
-
-/* end of file gnunet-peerinfo_plugins.c */
diff --git a/src/peerinfo-tool/gnunet-peerinfo_plugins.h 
b/src/peerinfo-tool/gnunet-peerinfo_plugins.h
deleted file mode 100644
index ed8da87d5..000000000
--- a/src/peerinfo-tool/gnunet-peerinfo_plugins.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010,2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo-tool/gnunet-peerinfo_plugins.h
- * @brief plugin management API
- * @author Christian Grothoff
- */
-#ifndef GNUNET_PEERINFO_PLUGINS_H
-#define GNUNET_PEERINFO_PLUGINS_H
-
-#include "gnunet_util_lib.h"
-
-/**
- * Load transport plugins.
- *
- * @param cfg configuration to use
- */
-void
-GPI_plugins_load (const struct GNUNET_CONFIGURATION_Handle *cfg);
-
-
-/**
- * Unload all plugins
- */
-void
-GPI_plugins_unload (void);
-
-
-/**
- * Obtain the plugin API based on a plugin name.
- *
- * @param name name of the plugin
- * @return the plugin's API, NULL if the plugin is not loaded
- */
-struct GNUNET_TRANSPORT_PluginFunctions *
-GPI_plugins_find (const char *name);
-
-
-#endif
-/* end of file gnunet-peerinfo_plugins.h */
diff --git a/src/peerinfo-tool/meson.build b/src/peerinfo-tool/meson.build
deleted file mode 100644
index 2d5386eba..000000000
--- a/src/peerinfo-tool/meson.build
+++ /dev/null
@@ -1,31 +0,0 @@
-gnunetpeerinfotool_src = ['gnunet-peerinfo.c', 'gnunet-peerinfo_plugins.c']
-
-
-if get_option('monolith')
-  subdir_done()
-endif
-
-shared_module('gnunet_plugin_rest_peerinfo',
-              ['plugin_rest_peerinfo.c'],
-              dependencies: [libgnunetrest_dep,
-                             libgnunetpeerinfo_dep,
-                             libgnunettransport_dep,
-                             libgnunethello_dep,
-                             libgnunetutil_dep,
-                             json_dep,
-                             mhd_dep],
-              include_directories: [incdir, configuration_inc],
-              install: true,
-              install_dir: get_option('libdir') / 'gnunet')
-
-
-executable ('gnunet-peerinfo',
-            gnunetpeerinfotool_src,
-            dependencies: [libgnunetutil_dep,
-                           libgnunetpeerinfo_dep,
-                           libgnunettransport_dep,
-                           libgnunethello_dep,
-                           libgnunetstatistics_dep],
-            include_directories: [incdir, configuration_inc],
-            install: true,
-            install_dir: get_option('bindir'))
diff --git a/src/peerinfo-tool/plugin_rest_peerinfo.c 
b/src/peerinfo-tool/plugin_rest_peerinfo.c
deleted file mode 100644
index 13e2e863b..000000000
--- a/src/peerinfo-tool/plugin_rest_peerinfo.c
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2012-2015 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @author Martin Schanzenbach
- * @author Philippe Buschmann
- * @file peerinfo/plugin_rest_peerinfo.c
- * @brief GNUnet Peerinfo REST plugin
- */
-
-#include "platform.h"
-#include "gnunet_rest_plugin.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_rest_lib.h"
-#include "gnunet_json_lib.h"
-#include "microhttpd.h"
-#include <jansson.h>
-
-/**
- * Peerinfo Namespace
- */
-#define GNUNET_REST_API_NS_PEERINFO "/peerinfo"
-
-/**
- * Peerinfo parameter peer
- */
-#define GNUNET_REST_PEERINFO_PEER "peer"
-
-/**
- * Peerinfo parameter friend
- */
-#define GNUNET_REST_PEERINFO_FRIEND "friend"
-
-/**
- * Peerinfo parameter array
- */
-#define GNUNET_REST_PEERINFO_ARRAY "array"
-
-/**
- * Error message Unknown Error
- */
-#define GNUNET_REST_PEERINFO_ERROR_UNKNOWN "Unknown Error"
-
-/**
- * How long until we time out during address lookup?
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
-/**
- * The configuration handle
- */
-const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-/**
- * HTTP methods allows for this plugin
- */
-static char *allow_methods;
-
-/**
- * Handle to PEERINFO
- */
-static struct GNUNET_PEERINFO_Handle *peerinfo_handle;
-
-/**
- * @brief struct returned by the initialization function of the plugin
- */
-struct Plugin
-{
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-};
-
-
-/**
- * Record we keep for each printable address.
- */
-struct AddressRecord
-{
-  /**
-   * Current address-to-string context (if active, otherwise NULL).
-   */
-  struct GNUNET_TRANSPORT_AddressToStringContext *atsc;
-
-  /**
-   * Address expiration time
-   */
-  struct GNUNET_TIME_Absolute expiration;
-
-  /**
-   * Printable address.
-   */
-  char *result;
-
-  /**
-   * Print context this address record belongs to.
-   */
-  struct PrintContext *pc;
-};
-
-
-/**
- * Structure we use to collect printable address information.
- */
-struct PrintContext
-{
-  /**
-   * Kept in DLL.
-   */
-  struct PrintContext *next;
-
-  /**
-   * Kept in DLL.
-   */
-  struct PrintContext *prev;
-
-  /**
-   * Identity of the peer.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * List of printable addresses.
-   */
-  struct AddressRecord *address_list;
-
-  /**
-   * Number of completed addresses in @e address_list.
-   */
-  unsigned int num_addresses;
-
-  /**
-   * Number of addresses allocated in @e address_list.
-   */
-  unsigned int address_list_size;
-
-  /**
-   * Current offset in @e address_list (counted down).
-   */
-  unsigned int off;
-
-  /**
-   * Hello was friend only, #GNUNET_YES or #GNUNET_NO
-   */
-  int friend_only;
-
-  /**
-   * RequestHandle
-   */
-  struct RequestHandle *handle;
-};
-
-/**
- * Head of list of print contexts.
- */
-static struct PrintContext *pc_head;
-
-/**
- * Tail of list of print contexts.
- */
-static struct PrintContext *pc_tail;
-
-/**
- * The request handle
- */
-struct RequestHandle
-{
-  /**
-   * DLL
-   */
-  struct RequestHandle *next;
-
-  /**
-   * DLL
-   */
-  struct RequestHandle *prev;
-
-  /**
-   * JSON temporary array
-   */
-  json_t *temp_array;
-
-  /**
-   * Expiration time string
-   */
-  char *expiration_str;
-
-  /**
-   * Address string
-   */
-  const char *address;
-
-  /**
-   * Iteration peer public key
-   */
-  char *pubkey;
-
-  /**
-   * JSON response
-   */
-  json_t *response;
-
-  /**
-   * Handle to PEERINFO it
-   */
-  struct GNUNET_PEERINFO_IteratorContext *list_it;
-
-
-  /**
-   * Rest connection
-   */
-  struct GNUNET_REST_RequestHandle *rest_handle;
-
-  /**
-   * Desired timeout for the lookup (default is no timeout).
-   */
-  struct GNUNET_TIME_Relative timeout;
-
-  /**
-   * ID of a task associated with the resolution process.
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * The plugin result processor
-   */
-  GNUNET_REST_ResultProcessor proc;
-
-  /**
-   * The closure of the result processor
-   */
-  void *proc_cls;
-
-  /**
-   * The url
-   */
-  char *url;
-
-  /**
-   * Error response message
-   */
-  char *emsg;
-
-  /**
-   * Response code
-   */
-  int response_code;
-};
-
-/**
- * DLL
- */
-static struct RequestHandle *requests_head;
-
-/**
- * DLL
- */
-static struct RequestHandle *requests_tail;
-
-/**
- * Cleanup lookup handle
- * @param handle Handle to clean up
- */
-static void
-cleanup_handle (void *cls)
-{
-  struct RequestHandle *handle = cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Cleaning up\n");
-  if (NULL != handle->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (handle->timeout_task);
-    handle->timeout_task = NULL;
-  }
-  if (NULL != handle->url)
-    GNUNET_free (handle->url);
-  if (NULL != handle->emsg)
-    GNUNET_free (handle->emsg);
-  if (NULL != handle->address)
-    GNUNET_free_nz ((char *) handle->address);
-  if (NULL != handle->expiration_str)
-    GNUNET_free (handle->expiration_str);
-  if (NULL != handle->pubkey)
-    GNUNET_free (handle->pubkey);
-
-  if (NULL != handle->temp_array)
-  {
-    json_decref (handle->temp_array);
-    handle->temp_array = NULL;
-  }
-  if (NULL != handle->response)
-  {
-    json_decref (handle->response);
-    handle->response = NULL;
-  }
-
-  if (NULL != handle->list_it)
-  {
-    GNUNET_PEERINFO_iterate_cancel (handle->list_it);
-    handle->list_it = NULL;
-  }
-  if (NULL != peerinfo_handle)
-  {
-    GNUNET_PEERINFO_disconnect (peerinfo_handle);
-    peerinfo_handle = NULL;
-  }
-  GNUNET_CONTAINER_DLL_remove (requests_head,
-                               requests_tail,
-                               handle);
-  GNUNET_free (handle);
-}
-
-
-/**
- * Task run on errors.  Reports an error and cleans up everything.
- *
- * @param cls the `struct RequestHandle`
- */
-static void
-do_error (void *cls)
-{
-  struct RequestHandle *handle = cls;
-  struct MHD_Response *resp;
-  json_t *json_error = json_object ();
-  char *response;
-
-  if (NULL == handle->emsg)
-    handle->emsg = GNUNET_strdup (GNUNET_REST_PEERINFO_ERROR_UNKNOWN);
-
-  json_object_set_new (json_error, "error", json_string (handle->emsg));
-
-  if (0 == handle->response_code)
-    handle->response_code = MHD_HTTP_OK;
-  response = json_dumps (json_error, 0);
-  resp = GNUNET_REST_create_response (response);
-  MHD_add_response_header (resp, "Content-Type", "application/json");
-  handle->proc (handle->proc_cls, resp, handle->response_code);
-  json_decref (json_error);
-  GNUNET_free (response);
-  GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
-}
-
-
-/**
- * Function that assembles the response.
- *
- * @param cls the `struct RequestHandle`
- */
-static void
-peerinfo_list_finished (void *cls)
-{
-  struct RequestHandle *handle = cls;
-  char *result_str;
-  struct MHD_Response *resp;
-
-  if (NULL == handle->response)
-  {
-    handle->response_code = MHD_HTTP_NOT_FOUND;
-    handle->emsg = GNUNET_strdup ("No peers found");
-    GNUNET_SCHEDULER_add_now (&do_error, handle);
-    return;
-  }
-
-  result_str = json_dumps (handle->response, 0);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
-  resp = GNUNET_REST_create_response (result_str);
-  GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
-                                                    "Content-Type",
-                                                    "application/json"));
-  handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
-  GNUNET_free (result_str);
-  GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
-}
-
-
-/**
- * Iterator callback to go over all addresses and count them.
- *
- * @param cls `struct PrintContext *` with `off` to increment
- * @param address the address
- * @param expiration expiration time
- * @return #GNUNET_OK to keep the address and continue
- */
-static int
-count_address (void *cls,
-               const struct GNUNET_HELLO_Address *address,
-               struct GNUNET_TIME_Absolute expiration)
-{
-  struct PrintContext *pc = cls;
-
-  if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
-  {
-    return GNUNET_OK;          /* ignore expired address */
-  }
-
-  pc->off++;
-  return GNUNET_OK;
-}
-
-
-/**
- * Print the collected address information to the console and free @a pc.
- *
- * @param pc printing context
- */
-static void
-dump_pc (struct PrintContext *pc)
-{
-  struct RequestHandle *handle;
-  unsigned int i;
-  json_t *response_entry;
-  json_t *temp_array;
-  json_t *object;
-  json_t *address;
-  json_t *expires;
-  json_t *friend_and_peer_json;
-  char *friend_and_peer;
-
-  temp_array = json_array ();
-  response_entry = json_object ();
-
-  for (i = 0; i < pc->num_addresses; i++)
-  {
-    if (NULL != pc->address_list[i].result)
-    {
-      object = json_object ();
-      address = json_string (pc->address_list[i].result);
-      expires = json_string (
-        GNUNET_STRINGS_absolute_time_to_string (
-          pc->address_list[i].expiration));
-      json_object_set (object, "address", address);
-      json_object_set (object, "expires", expires);
-
-      json_decref (address);
-      json_decref (expires);
-
-      json_array_append (temp_array, object);
-      json_decref (object);
-      GNUNET_free (pc->address_list[i].result);
-    }
-  }
-
-  if (0 < json_array_size (temp_array))
-  {
-    GNUNET_asprintf (&friend_and_peer,
-                     "%s%s",
-                     (GNUNET_YES == pc->friend_only) ? "F2F:" : "",
-                     GNUNET_i2s_full (&pc->peer));
-    friend_and_peer_json = json_string (friend_and_peer);
-    json_object_set (response_entry,
-                     GNUNET_REST_PEERINFO_PEER,
-                     friend_and_peer_json);
-    json_object_set (response_entry,
-                     GNUNET_REST_PEERINFO_ARRAY,
-                     temp_array);
-    json_array_append (pc->handle->response, response_entry);
-    json_decref (friend_and_peer_json);
-    GNUNET_free (friend_and_peer);
-  }
-
-  json_decref (temp_array);
-  json_decref (response_entry);
-
-  GNUNET_free (pc->address_list);
-  GNUNET_CONTAINER_DLL_remove (pc_head,
-                               pc_tail,
-                               pc);
-  handle = pc->handle;
-  GNUNET_free (pc);
-
-  if ((NULL == pc_head) &&
-      (NULL == handle->list_it))
-  {
-    GNUNET_SCHEDULER_add_now (&peerinfo_list_finished, handle);
-  }
-}
-
-
-/**
- * Function to call with a human-readable format of an address
- *
- * @param cls closure
- * @param address NULL on error, otherwise 0-terminated printable UTF-8 string
- * @param res result of the address to string conversion:
- *        if #GNUNET_OK: address was valid (conversion to
- *                       string might still have failed)
- *        if #GNUNET_SYSERR: address is invalid
- */
-static void
-process_resolved_address (void *cls,
-                          const char *address,
-                          int res)
-{
-  struct AddressRecord *ar = cls;
-  struct PrintContext *pc = ar->pc;
-
-  if (NULL != address)
-  {
-    if (0 != strlen (address))
-    {
-      if (NULL != ar->result)
-        GNUNET_free (ar->result);
-      ar->result = GNUNET_strdup (address);
-    }
-    return;
-  }
-  ar->atsc = NULL;
-  if (GNUNET_SYSERR == res)
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ ("Failure: Cannot convert address to string for peer 
`%s'\n"),
-                GNUNET_i2s (&ar->pc->peer));
-  pc->num_addresses++;
-  if (pc->num_addresses == pc->address_list_size)
-    dump_pc (ar->pc);
-}
-
-
-/**
- * Iterator callback to go over all addresses.
- *
- * @param cls closure
- * @param address the address
- * @param expiration expiration time
- * @return #GNUNET_OK to keep the address and continue
- */
-static int
-print_address (void *cls,
-               const struct GNUNET_HELLO_Address *address,
-               struct GNUNET_TIME_Absolute expiration)
-{
-  struct PrintContext *pc = cls;
-  struct AddressRecord *ar;
-
-  if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
-  {
-    return GNUNET_OK;          /* ignore expired address */
-  }
-
-  GNUNET_assert (0 < pc->off);
-  ar = &pc->address_list[--pc->off];
-  ar->pc = pc;
-  ar->expiration = expiration;
-  GNUNET_asprintf (&ar->result,
-                   "%s:%lu:%u",
-                   address->transport_name,
-                   (unsigned long) address->address_length,
-                   address->local_info);
-  ar->atsc = GNUNET_TRANSPORT_address_to_string (cfg,
-                                                 address,
-                                                 GNUNET_NO,
-                                                 TIMEOUT,
-                                                 &process_resolved_address,
-                                                 ar);
-  return GNUNET_OK;
-}
-
-
-/**
- * Callback that processes each of the known HELLOs for the
- * iteration response construction.
- *
- * @param cls closure, NULL
- * @param peer id of the peer, NULL for last call
- * @param hello hello message for the peer (can be NULL)
- * @param err_msg message
- */
-void
-peerinfo_list_iteration (void *cls,
-                         const struct GNUNET_PeerIdentity *peer,
-                         const struct GNUNET_HELLO_Message *hello,
-                         const char *err_msg)
-{
-  struct RequestHandle *handle = cls;
-  struct PrintContext *pc;
-  int friend_only;
-
-  if (NULL == handle->response)
-  {
-    handle->response = json_array ();
-  }
-
-  if (NULL == peer)
-  {
-    handle->list_it = NULL;
-    handle->emsg = GNUNET_strdup ("Error in communication with peerinfo");
-    if (NULL != err_msg)
-    {
-      GNUNET_free (handle->emsg);
-      handle->emsg = GNUNET_strdup (err_msg);
-      handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
-    }
-    if (NULL == pc_head)
-      GNUNET_SCHEDULER_add_now (&do_error, handle);
-    return;
-  }
-  if (NULL == hello)
-    return;
-
-  friend_only = GNUNET_NO;
-  if (NULL != hello)
-    friend_only = GNUNET_HELLO_is_friend_only (hello);
-
-  pc = GNUNET_new (struct PrintContext);
-  GNUNET_CONTAINER_DLL_insert (pc_head,
-                               pc_tail,
-                               pc);
-  pc->peer = *peer;
-  pc->friend_only = friend_only;
-  pc->handle = handle;
-  GNUNET_HELLO_iterate_addresses (hello,
-                                  GNUNET_NO,
-                                  &count_address,
-                                  pc);
-  if (0 == pc->off)
-  {
-    dump_pc (pc);
-    return;
-  }
-  pc->address_list_size = pc->off;
-  pc->address_list = GNUNET_malloc (
-    sizeof(struct AddressRecord) * pc->off);
-  GNUNET_HELLO_iterate_addresses (hello,
-                                  GNUNET_NO,
-                                  &print_address,
-                                  pc);
-}
-
-
-/**
- * Handle peerinfo GET request
- *
- * @param con_handle the connection handle
- * @param url the url
- * @param cls the RequestHandle
- */
-void
-peerinfo_get (struct GNUNET_REST_RequestHandle *con_handle,
-              const char*url,
-              void *cls)
-{
-  struct RequestHandle *handle = cls;
-  struct GNUNET_HashCode key;
-  const struct GNUNET_PeerIdentity *specific_peer;
-  // GNUNET_PEER_Id peer_id;
-  int include_friend_only;
-  char*include_friend_only_str;
-
-  include_friend_only = GNUNET_NO;
-  GNUNET_CRYPTO_hash (GNUNET_REST_PEERINFO_FRIEND,
-                      strlen (GNUNET_REST_PEERINFO_FRIEND),
-                      &key);
-  if (GNUNET_YES
-      == GNUNET_CONTAINER_multihashmap_contains (con_handle->url_param_map,
-                                                 &key))
-  {
-    include_friend_only_str = GNUNET_CONTAINER_multihashmap_get (
-      con_handle->url_param_map, &key);
-    if (0 == strcmp (include_friend_only_str, "yes"))
-    {
-      include_friend_only = GNUNET_YES;
-    }
-  }
-
-  specific_peer = NULL;
-  GNUNET_CRYPTO_hash (GNUNET_REST_PEERINFO_PEER,
-                      strlen (GNUNET_REST_PEERINFO_PEER),
-                      &key);
-  if (GNUNET_YES
-      == GNUNET_CONTAINER_multihashmap_contains (con_handle->url_param_map,
-                                                 &key))
-  {
-    // peer_id = *(unsigned int*)GNUNET_CONTAINER_multihashmap_get 
(con_handle->url_param_map, &key);
-    // specific_peer = GNUNET_PEER_resolve2(peer_id);
-  }
-
-  handle->list_it = GNUNET_PEERINFO_iterate (peerinfo_handle,
-                                             include_friend_only,
-                                             specific_peer,
-                                             &peerinfo_list_iteration,
-                                             handle);
-}
-
-
-/**
- * Respond to OPTIONS request
- *
- * @param con_handle the connection handle
- * @param url the url
- * @param cls the RequestHandle
- */
-static void
-options_cont (struct GNUNET_REST_RequestHandle *con_handle,
-              const char*url,
-              void *cls)
-{
-  struct MHD_Response *resp;
-  struct RequestHandle *handle = cls;
-
-  // independent of path return all options
-  resp = GNUNET_REST_create_response (NULL);
-  MHD_add_response_header (resp,
-                           "Access-Control-Allow-Methods",
-                           allow_methods);
-  handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
-  GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
-  return;
-}
-
-
-/**
- * Function processing the REST call
- *
- * @param method HTTP method
- * @param url URL of the HTTP request
- * @param data body of the HTTP request (optional)
- * @param data_size length of the body
- * @param proc callback function for the result
- * @param proc_cls closure for callback function
- * @return GNUNET_OK if request accepted
- */
-static enum GNUNET_GenericReturnValue
-rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle,
-                      GNUNET_REST_ResultProcessor proc,
-                      void *proc_cls)
-{
-  struct RequestHandle *handle = GNUNET_new (struct RequestHandle);
-  struct GNUNET_REST_RequestHandlerError err;
-  static const struct GNUNET_REST_RequestHandler handlers[] = {
-    { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_PEERINFO, &peerinfo_get },
-    { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_PEERINFO, &options_cont },
-    GNUNET_REST_HANDLER_END
-  };
-
-  handle->response_code = 0;
-  handle->timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
-                                                   60);
-  handle->proc_cls = proc_cls;
-  handle->proc = proc;
-  handle->rest_handle = rest_handle;
-
-  handle->url = GNUNET_strdup (rest_handle->url);
-  if (handle->url[strlen (handle->url) - 1] == '/')
-    handle->url[strlen (handle->url) - 1] = '\0';
-  handle->timeout_task =
-    GNUNET_SCHEDULER_add_delayed (handle->timeout,
-                                  &do_error,
-                                  handle);
-  GNUNET_CONTAINER_DLL_insert (requests_head,
-                               requests_tail,
-                               handle);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting...\n");
-  if (GNUNET_NO == GNUNET_REST_handle_request (handle->rest_handle,
-                                               handlers,
-                                               &err,
-                                               handle))
-  {
-    cleanup_handle (handle);
-    return GNUNET_NO;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected\n");
-  return GNUNET_YES;
-}
-
-
-/**
- * Entry point for the plugin.
- *
- * @param cls Config info
- * @return NULL on error, otherwise the plugin context
- */
-void *
-libgnunet_plugin_rest_peerinfo_init (void *cls)
-{
-  static struct Plugin plugin;
-  struct GNUNET_REST_Plugin *api;
-
-  cfg = cls;
-  if (NULL != plugin.cfg)
-    return NULL;                /* can only initialize once! */
-  memset (&plugin, 0, sizeof(struct Plugin));
-  plugin.cfg = cfg;
-  api = GNUNET_new (struct GNUNET_REST_Plugin);
-  api->cls = &plugin;
-  api->name = GNUNET_REST_API_NS_PEERINFO;
-  api->process_request = &rest_process_request;
-  GNUNET_asprintf (&allow_methods,
-                   "%s, %s, %s, %s, %s",
-                   MHD_HTTP_METHOD_GET,
-                   MHD_HTTP_METHOD_POST,
-                   MHD_HTTP_METHOD_PUT,
-                   MHD_HTTP_METHOD_DELETE,
-                   MHD_HTTP_METHOD_OPTIONS);
-  peerinfo_handle = GNUNET_PEERINFO_connect (cfg);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              _ ("Peerinfo REST API initialized\n"));
-  return api;
-}
-
-
-/**
- * Exit point from the plugin.
- *
- * @param cls the plugin context (as returned by "init")
- * @return always NULL
- */
-void *
-libgnunet_plugin_rest_peerinfo_done (void *cls)
-{
-  struct GNUNET_REST_Plugin *api = cls;
-  struct Plugin *plugin = api->cls;
-
-  plugin->cfg = NULL;
-  while (NULL != requests_head)
-    cleanup_handle (requests_head);
-  if (NULL != peerinfo_handle)
-    GNUNET_PEERINFO_disconnect (peerinfo_handle);
-
-  GNUNET_free (allow_methods);
-  GNUNET_free (api);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Peerinfo REST plugin is finished\n");
-  return NULL;
-}
-
-
-/* end of plugin_rest_peerinfo.c */
diff --git a/src/peerinfo-tool/test_gnunet_peerinfo.py.in 
b/src/peerinfo-tool/test_gnunet_peerinfo.py.in
deleted file mode 100755
index 709556f70..000000000
--- a/src/peerinfo-tool/test_gnunet_peerinfo.py.in
+++ /dev/null
@@ -1,143 +0,0 @@
-#!@PYTHONEXE@
-#    This file is part of GNUnet.
-#    (C) 2010, 2018 Christian Grothoff (and other contributing authors)
-#
-#    GNUnet is free software: you can redistribute it and/or modify it
-#    under the terms of the GNU Affero General Public License as published
-#    by the Free Software Foundation, either version 3 of the License,
-#    or (at your option) any later version.
-#
-#    GNUnet is distributed in the hope that it will be useful, but
-#    WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#    Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-#    SPDX-License-Identifier: AGPL3.0-or-later
-#
-# Testcase for gnunet-peerinfo
-import sys
-import os
-import subprocess
-import re
-import shutil
-import time
-
-srcdir = "../.."
-gnunet_pyexpect_dir = os.path.join(srcdir, "contrib/scripts")
-if gnunet_pyexpect_dir not in sys.path:
-    sys.path.append(gnunet_pyexpect_dir)
-
-from gnunet_pyexpect import pexpect
-
-#save LANG and set it to C
-mylang = os.environ.get('LANG')
-os.environ['LANG'] = 'C'
-
-if os.name == 'posix':
-    peerinfo = './gnunet-peerinfo'
-    gnunetarm = 'gnunet-arm'
-    gnunettesting = 'gnunet-testing'
-elif os.name == 'nt':
-    peerinfo = './gnunet-peerinfo.exe'
-    gnunetarm = 'gnunet-arm.exe'
-    gnunettesting = 'gnunet-testing.exe'
-
-pinfo = pexpect()
-
-if os.name == "nt":
-    shutil.rmtree(os.path.join(os.getenv("TEMP"), "gnunet-test-peerinfo"), 
True)
-else:
-    shutil.rmtree("/tmp/gnunet-test-peerinfo", True)
-
-# create hostkey via testing lib  # FIXME: The /tmp/ location needs to be 
adjusted to the TMP variable!
-hkk = subprocess.Popen([
-    gnunettesting, '-n', '1', '-c', 'test_gnunet_peerinfo_data.conf', '-k',
-    '/tmp/gnunet-test-peerinfo/.hostkey'
-])
-hkk.communicate()
-
-arm = subprocess.Popen([
-    gnunetarm, '-sq', '-c', 'test_gnunet_peerinfo_data.conf'
-])
-arm.communicate()
-
-try:
-    pinfo.spawn(
-        None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-s'],
-        stdout=subprocess.PIPE,
-        stderr=subprocess.STDOUT
-    )
-    pinfo.expect("stdout", re.compile(r'I am peer `.*\'.\r?\n'))
-
-    pinfo.spawn(
-        None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-qs'],
-        stdout=subprocess.PIPE,
-        stderr=subprocess.STDOUT
-    )
-    pinfo.expect(
-        "stdout",
-        re.
-        compile(r'....................................................\r?\n')
-    )
-
-    pinfo.spawn(
-        None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', 'invalid'],
-        stdout=subprocess.PIPE,
-        stderr=subprocess.STDOUT
-    )
-    pinfo.expect(
-        "stdout", re.compile(r'Invalid command line argument `invalid\'\r?\n')
-    )
-
-    arm = subprocess.Popen([
-        gnunetarm, '-q', '-i', 'transport', '-c',
-        'test_gnunet_peerinfo_data.conf'
-    ])
-    arm.communicate()
-    time.sleep(1)
-
-    pinfo.spawn(
-        None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf'],
-        stdout=subprocess.PIPE,
-        stderr=subprocess.STDOUT
-    )
-    pinfo.expect("stdout", re.compile("Peer `.*'\r?\n"))
-    m = pinfo.expect("stdout", re.compile("\s.*:24357\r?\n"))
-    while len(m.group(0)) > 0:
-        m = pinfo.expect("stdout", re.compile("(\s.*:24357\r?\n|\r?\n|)"))
-
-    pinfo.spawn(
-        None, [peerinfo, '-i', '-c', 'test_gnunet_peerinfo_data.conf', '-n'],
-        stdout=subprocess.PIPE,
-        stderr=subprocess.STDOUT
-    )
-    pinfo.expect("stdout", re.compile("Peer `.*'\r?\n"))
-    m = pinfo.expect("stdout", re.compile("\s.*:24357\r?\n"))
-    while len(m.group(0)) > 0:
-        m = pinfo.expect("stdout", re.compile("(\s.*:24357\r?\n|\r?\n|)"))
-
-    pinfo.spawn(
-        None, [peerinfo, '-c', 'test_gnunet_peerinfo_data.conf', '-qs'],
-        stdout=subprocess.PIPE,
-        stderr=subprocess.STDOUT
-    )
-    pid = pinfo.read("stdout")
-    pid.strip()
-
-finally:
-    arm = subprocess.Popen([
-        gnunetarm, '-eq', '-c', 'test_gnunet_peerinfo_data.conf'
-    ])
-    arm.communicate()
-    if os.name == "nt":
-        shutil.rmtree(
-            os.path.join(os.getenv("TEMP"), "gnunet-test-peerinfo"), True
-        )
-    else:
-        shutil.rmtree("/tmp/gnunet-test-peerinfo", True)
-    #Reset LANG
-    if type(mylang) == str:
-      os.environ['LANG'] = mylang
diff --git a/src/peerinfo-tool/test_gnunet_peerinfo_data.conf 
b/src/peerinfo-tool/test_gnunet_peerinfo_data.conf
deleted file mode 100644
index d18d3cf96..000000000
--- a/src/peerinfo-tool/test_gnunet_peerinfo_data.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-@INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf
-
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/gnunet-test-peerinfo/
-
-[transport]
-plugins = tcp
-
-[nat]
-RETURN_LOCAL_ADDRESSES = YES
-
-[transport-tcp]
-PORT = 24357
diff --git a/src/peerinfo/.gitignore b/src/peerinfo/.gitignore
deleted file mode 100644
index 152ca2916..000000000
--- a/src/peerinfo/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-gnunet-service-peerinfo
-test_peerinfo_api
-test_peerinfo_api_friend_only
-test_peerinfo_api_notify_friend_only
-test_peerinfo_shipped_hellos
-perf_peerinfo_api
diff --git a/src/peerinfo/Makefile.am b/src/peerinfo/Makefile.am
deleted file mode 100644
index cdab22a9d..000000000
--- a/src/peerinfo/Makefile.am
+++ /dev/null
@@ -1,105 +0,0 @@
-# This Makefile.am is in the public domain
-AM_CPPFLAGS = -I$(top_srcdir)/src/include
-
-pkgcfgdir= $(pkgdatadir)/config.d/
-
-libexecdir= $(pkglibdir)/libexec/
-
-plugindir = $(libdir)/gnunet
-
-pkgcfg_DATA = \
-  peerinfo.conf
-
-if USE_COVERAGE
-  AM_CFLAGS = --coverage -O0
-  XLIB = -lgcov
-endif
-
-lib_LTLIBRARIES = libgnunetpeerinfo.la
-
-
-libgnunetpeerinfo_la_SOURCES = \
-  peerinfo_api.c peerinfo.h \
-  peerinfo_api_notify.c
-libgnunetpeerinfo_la_LIBADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(XLIB) \
-  $(LTLIBINTL)
-libgnunetpeerinfo_la_LDFLAGS = \
-  $(GN_LIB_LDFLAGS)  \
-  -version-info 0:0:0
-
-
-libexec_PROGRAMS = \
- gnunet-service-peerinfo
-
-gnunet_service_peerinfo_SOURCES = \
-  gnunet-service-peerinfo.c
-gnunet_service_peerinfo_LDADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
-gnunet_service_peerinfo_LDFLAGS = \
-  $(GN_LIBINTL)
-
-if HAVE_BENCHMARKS
- PEERINFO_BENCHMARKS = \
- perf_peerinfo_api
-endif
-
-check_PROGRAMS = \
- test_peerinfo_shipped_hellos \
- test_peerinfo_api \
- test_peerinfo_api_friend_only \
- test_peerinfo_api_notify_friend_only \
- $(PEERINFO_BENCHMARKS)
-
-
-if ENABLE_TEST_RUN
-AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
-TESTS = $(check_PROGRAMS)
-endif
-
-test_peerinfo_shipped_hellos_SOURCES = \
- test_peerinfo_shipped_hellos.c
-test_peerinfo_shipped_hellos_LDADD = \
- $(top_builddir)/src/hello/libgnunethello.la \
- libgnunetpeerinfo.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-test_peerinfo_api_SOURCES = \
- test_peerinfo_api.c
-test_peerinfo_api_LDADD = \
- $(top_builddir)/src/hello/libgnunethello.la \
- libgnunetpeerinfo.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-test_peerinfo_api_friend_only_SOURCES = \
- test_peerinfo_api_friend_only.c
-test_peerinfo_api_friend_only_LDADD = \
- $(top_builddir)/src/hello/libgnunethello.la \
- libgnunetpeerinfo.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-test_peerinfo_api_notify_friend_only_SOURCES = \
- test_peerinfo_api_notify_friend_only.c
-test_peerinfo_api_notify_friend_only_LDADD = \
- $(top_builddir)/src/hello/libgnunethello.la \
- libgnunetpeerinfo.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-perf_peerinfo_api_SOURCES = \
- perf_peerinfo_api.c
-perf_peerinfo_api_LDADD = \
- $(top_builddir)/src/hello/libgnunethello.la \
- libgnunetpeerinfo.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-EXTRA_DIST = \
-  test_peerinfo_api_data.conf
diff --git a/src/peerinfo/gnunet-service-peerinfo.c 
b/src/peerinfo/gnunet-service-peerinfo.c
deleted file mode 100644
index 1b1232ecb..000000000
--- a/src/peerinfo/gnunet-service-peerinfo.c
+++ /dev/null
@@ -1,1370 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2001-2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo/gnunet-service-peerinfo.c
- * @brief maintains list of known peers
- *
- * Code to maintain the list of currently known hosts (in memory
- * structure of data/hosts/).
- *
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_statistics_service.h"
-#include "peerinfo.h"
-
-/**
- * How often do we scan the HOST_DIR for new entries?
- */
-#define DATA_HOST_FREQ \
-  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15)
-
-/**
- * How often do we discard old entries in data/hosts/?
- */
-#define DATA_HOST_CLEAN_FREQ \
-  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 60)
-
-
-/**
- * In-memory cache of known hosts.
- */
-struct HostEntry
-{
-  /**
-   * Identity of the peer.
-   */
-  struct GNUNET_PeerIdentity identity;
-
-  /**
-   * Hello for the peer (can be NULL)
-   */
-  struct GNUNET_HELLO_Message *hello;
-
-  /**
-   * Friend only hello for the peer (can be NULL)
-   */
-  struct GNUNET_HELLO_Message *friend_only_hello;
-};
-
-
-/**
- * Result of reading a file
- */
-struct ReadHostFileContext
-{
-  /**
-   * Hello for the peer (can be NULL)
-   */
-  struct GNUNET_HELLO_Message *hello;
-
-  /**
-   * Friend only hello for the peer (can be NULL)
-   */
-  struct GNUNET_HELLO_Message *friend_only_hello;
-};
-
-
-/**
- * The in-memory list of known hosts, mapping of
- * host IDs to 'struct HostEntry*' values.
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *hostmap;
-
-/**
- * Clients to immediately notify about all changes.
- */
-static struct GNUNET_NotificationContext *notify_list;
-
-/**
- * Clients to immediately notify about all changes,
- * even for friend-only HELLOs.
- */
-static struct GNUNET_NotificationContext *notify_friend_only_list;
-
-/**
- * Directory where the hellos are stored in (peerinfo/)
- */
-static char *networkIdDirectory;
-
-/**
- * Handle for reporting statistics.
- */
-static struct GNUNET_STATISTICS_Handle *stats;
-
-/**
- * Handle for task to run #cron_clean_data_hosts()
- */
-static struct GNUNET_SCHEDULER_Task *cron_clean;
-
-/**
- * Handle for task to run #cron_scan_directory_data_hosts()
- */
-static struct GNUNET_SCHEDULER_Task *cron_scan;
-
-
-/**
- * Notify all clients in the notify list about the
- * given host entry changing.
- *
- * @param he entry of the host for which we generate a notification
- * @param include_friend_only create public of friend-only message
- * @return generated notification message
- */
-static struct InfoMessage *
-make_info_message (const struct HostEntry *he, int include_friend_only)
-{
-  struct InfoMessage *im;
-  struct GNUNET_HELLO_Message *src;
-  size_t hs;
-
-  if (GNUNET_YES == include_friend_only)
-    src = he->friend_only_hello;
-  else
-    src = he->hello;
-  hs = (NULL == src) ? 0 : GNUNET_HELLO_size (src);
-  im = GNUNET_malloc (sizeof(struct InfoMessage) + hs);
-  im->header.size = htons (hs + sizeof(struct InfoMessage));
-  im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
-  im->peer = he->identity;
-  GNUNET_memcpy (&im[1], src, hs);
-  return im;
-}
-
-
-/**
- * Address iterator that causes expired entries to be discarded.
- *
- * @param cls pointer to the current time
- * @param address the address
- * @param expiration expiration time for the address
- * @return #GNUNET_NO if expiration smaller than the current time
- */
-static int
-discard_expired (void *cls,
-                 const struct GNUNET_HELLO_Address *address,
-                 struct GNUNET_TIME_Absolute expiration)
-{
-  const struct GNUNET_TIME_Absolute *now = cls;
-
-  if (now->abs_value_us > expiration.abs_value_us)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ ("Removing expired address of transport `%s'\n"),
-                address->transport_name);
-    return GNUNET_NO;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Address iterator that counts the remaining addresses.
- *
- * @param cls pointer to the counter
- * @param address the address
- * @param expiration expiration time for the address
- * @return #GNUNET_OK (always)
- */
-static int
-count_addresses (void *cls,
-                 const struct GNUNET_HELLO_Address *address,
-                 struct GNUNET_TIME_Absolute expiration)
-{
-  unsigned int *cnt = cls;
-
-  (void) address;
-  (void) expiration;
-  (*cnt)++;
-  return GNUNET_OK;
-}
-
-
-/**
- * Get the filename under which we would store the GNUNET_HELLO_Message
- * for the given host and protocol.
- *
- * @param id peer for which we need the filename for the HELLO
- * @return filename of the form DIRECTORY/HOSTID
- */
-static char *
-get_host_filename (const struct GNUNET_PeerIdentity *id)
-{
-  char *fn;
-
-  if (NULL == networkIdDirectory)
-    return NULL;
-  GNUNET_asprintf (&fn,
-                   "%s%s%s",
-                   networkIdDirectory,
-                   DIR_SEPARATOR_STR,
-                   GNUNET_i2s_full (id));
-  return fn;
-}
-
-
-/**
- * Broadcast information about the given entry to all
- * clients that care.
- *
- * @param entry entry to broadcast about
- */
-static void
-notify_all (struct HostEntry *entry)
-{
-  struct InfoMessage *msg_pub;
-  struct InfoMessage *msg_friend;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Notifying all clients about peer `%s'\n",
-              GNUNET_i2s (&entry->identity));
-  msg_pub = make_info_message (entry, GNUNET_NO);
-  GNUNET_notification_context_broadcast (notify_list,
-                                         &msg_pub->header,
-                                         GNUNET_NO);
-  GNUNET_free (msg_pub);
-  msg_friend = make_info_message (entry, GNUNET_YES);
-  GNUNET_notification_context_broadcast (notify_friend_only_list,
-                                         &msg_friend->header,
-                                         GNUNET_NO);
-  GNUNET_free (msg_friend);
-}
-
-
-/**
- * Bind a host address (hello) to a hostId.
- *
- * @param peer the peer for which this is a hello
- * @param hello the verified (!) hello message
- */
-static void
-update_hello (const struct GNUNET_PeerIdentity *peer,
-              const struct GNUNET_HELLO_Message *hello);
-
-
-/**
- * Try to read the HELLOs in the given filename and discard expired
- * addresses.  Removes the file if one the HELLO is malformed.  If all
- * addresses are expired, the HELLO is also removed (but the HELLO
- * with the public key is still returned if it was found and valid).
- * The file can contain multiple HELLO messages.
- *
- * @param fn name of the file
- * @param unlink_garbage if #GNUNET_YES, try to remove useless files
- * @param r ReadHostFileContext to store the resutl
- */
-static void
-read_host_file (const char *fn,
-                int unlink_garbage,
-                struct ReadHostFileContext *r)
-{
-  char buffer[GNUNET_MAX_MESSAGE_SIZE - 1] GNUNET_ALIGN;
-  ssize_t size_total;
-  struct GNUNET_TIME_Absolute now;
-  unsigned int left;
-  const struct GNUNET_HELLO_Message *hello;
-  struct GNUNET_HELLO_Message *hello_clean;
-  size_t read_pos;
-  uint16_t size_hello;
-
-  r->friend_only_hello = NULL;
-  r->hello = NULL;
-
-  if (GNUNET_YES != GNUNET_DISK_file_test (fn))
-    return;
-  size_total = GNUNET_DISK_fn_read (fn, buffer, sizeof(buffer));
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Read %d bytes from `%s'\n",
-              (int) size_total,
-              fn);
-  if ((size_total < 0) ||
-      (((size_t) size_total) < sizeof(struct GNUNET_MessageHeader)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ ("Failed to parse HELLO in file `%s': %s\n"),
-                fn,
-                "File has invalid size");
-    if ((GNUNET_YES == unlink_garbage) && (0 != unlink (fn)) &&
-        (ENOENT != errno))
-      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
-    return;
-  }
-
-  read_pos = 0;
-  while (read_pos < (size_t) size_total)
-  {
-    hello = (const struct GNUNET_HELLO_Message *) &buffer[read_pos];
-    size_hello = GNUNET_HELLO_size (hello);
-    if ((0 == size_hello) || (((size_t) size_total) - read_pos < size_hello))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Failed to parse HELLO in file `%s'\n"),
-                  fn);
-      if (0 == read_pos)
-      {
-        if ((GNUNET_YES == unlink_garbage) && (0 != unlink (fn)) &&
-            (ENOENT != errno))
-          GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
-      }
-      else
-      {
-        if ((GNUNET_YES == unlink_garbage) && (0 != truncate (fn, read_pos)) &&
-            (ENOENT != errno))
-          GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "truncate", fn);
-      }
-      return;
-    }
-
-    now = GNUNET_TIME_absolute_get ();
-    hello_clean = GNUNET_HELLO_iterate_addresses (hello,
-                                                  GNUNET_YES,
-                                                  &discard_expired,
-                                                  &now);
-    if (NULL == hello_clean)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Failed to parse HELLO in file `%s'\n"),
-                  fn);
-      if ((GNUNET_YES == unlink_garbage) && (0 != unlink (fn)) &&
-          (ENOENT != errno))
-        GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
-      return;
-    }
-    left = 0;
-    (void) GNUNET_HELLO_iterate_addresses (hello_clean,
-                                           GNUNET_NO,
-                                           &count_addresses,
-                                           &left);
-
-    if (0 == left)
-    {
-      GNUNET_free (hello_clean);
-      break;
-    }
-
-    if (GNUNET_NO == GNUNET_HELLO_is_friend_only (hello_clean))
-    {
-      if (NULL == r->hello)
-        r->hello = hello_clean;
-      else
-      {
-        GNUNET_break (0);
-        GNUNET_free (r->hello);
-        r->hello = hello_clean;
-      }
-    }
-    else
-    {
-      if (NULL == r->friend_only_hello)
-        r->friend_only_hello = hello_clean;
-      else
-      {
-        GNUNET_break (0);
-        GNUNET_free (r->friend_only_hello);
-        r->friend_only_hello = hello_clean;
-      }
-    }
-    read_pos += size_hello;
-  }
-
-  if (0 == left)
-  {
-    /* no addresses left, remove from disk */
-    if ((GNUNET_YES == unlink_garbage) && (0 != unlink (fn)))
-      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Found `%s' and `%s' HELLO message in file\n",
-              (NULL != r->hello) ? "public" : "NON-public",
-              (NULL != r->friend_only_hello) ? "friend only"
-              : "NO friend only");
-}
-
-
-/**
- * Add a host to the list and notify clients about this event
- *
- * @param identity the identity of the host
- * @return the HostEntry
- */
-static struct HostEntry *
-add_host_to_known_hosts (const struct GNUNET_PeerIdentity *identity)
-{
-  struct HostEntry *entry;
-  struct ReadHostFileContext r;
-  char *fn;
-
-  entry = GNUNET_CONTAINER_multipeermap_get (hostmap, identity);
-  if (NULL == entry)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Adding new peer `%s'\n",
-                GNUNET_i2s (identity));
-    GNUNET_STATISTICS_update (stats,
-                              gettext_noop ("# peers known"),
-                              1,
-                              GNUNET_NO);
-    entry = GNUNET_new (struct HostEntry);
-    entry->identity = *identity;
-    GNUNET_assert (GNUNET_OK ==
-                   GNUNET_CONTAINER_multipeermap_put (
-                     hostmap,
-                     &entry->identity,
-                     entry,
-                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-    notify_all (entry);
-    fn = get_host_filename (identity);
-    if (NULL != fn)
-    {
-      read_host_file (fn, GNUNET_YES, &r);
-      if (NULL != r.hello)
-        update_hello (identity, r.hello);
-      if (NULL != r.friend_only_hello)
-        update_hello (identity, r.friend_only_hello);
-      GNUNET_free (r.hello);
-      GNUNET_free (r.friend_only_hello);
-      GNUNET_free (fn);
-    }
-  }
-  return entry;
-}
-
-
-/**
- * Remove a file that should not be there.  LOG
- * success or failure.
- *
- * @param fullname name of the file to remove
- */
-static void
-remove_garbage (const char *fullname)
-{
-  if (0 == unlink (fullname))
-    GNUNET_log (
-      GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
-      _ (
-        "File `%s' in directory `%s' does not match naming convention. 
Removed.\n"),
-      fullname,
-      networkIdDirectory);
-  else
-    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
-                              "unlink",
-                              fullname);
-}
-
-
-/**
- * Closure for #hosts_directory_scan_callback().
- */
-struct DirScanContext
-{
-  /**
-   * #GNUNET_YES if we should remove files that are broken,
-   * #GNUNET_NO if the directory we are iterating over should
-   * be treated as read-only by us.
-   */
-  int remove_files;
-
-  /**
-   * Counter for the number of (valid) entries found, incremented
-   * by one for each match.
-   */
-  unsigned int matched;
-};
-
-
-/**
- * Function that is called on each HELLO file in a particular directory.
- * Try to parse the file and add the HELLO to our list.
- *
- * @param cls pointer to 'unsigned int' to increment for each file, or NULL
- *            if the file is from a read-only, read-once resource directory
- * @param fullname name of the file to parse
- * @return #GNUNET_OK (continue iteration)
- */
-static int
-hosts_directory_scan_callback (void *cls, const char *fullname)
-{
-  struct DirScanContext *dsc = cls;
-  struct GNUNET_PeerIdentity identity;
-  struct ReadHostFileContext r;
-  const char *filename;
-  struct GNUNET_PeerIdentity id_public;
-  struct GNUNET_PeerIdentity id_friend;
-  struct GNUNET_PeerIdentity id;
-
-  if (GNUNET_YES != GNUNET_DISK_file_test (fullname))
-    return GNUNET_OK; /* ignore non-files */
-
-  filename = strrchr (fullname, DIR_SEPARATOR);
-  if ((NULL == filename) || (1 > strlen (filename)))
-    filename = fullname;
-  else
-    filename++;
-
-  read_host_file (fullname, dsc->remove_files, &r);
-  if ((NULL == r.hello) && (NULL == r.friend_only_hello))
-    return GNUNET_OK;
-  if (NULL != r.friend_only_hello)
-  {
-    if (GNUNET_OK != GNUNET_HELLO_get_id (r.friend_only_hello, &id_friend))
-    {
-      if (GNUNET_YES == dsc->remove_files)
-        remove_garbage (fullname);
-      return GNUNET_OK;
-    }
-    id = id_friend;
-  }
-  if (NULL != r.hello)
-  {
-    if (GNUNET_OK != GNUNET_HELLO_get_id (r.hello, &id_public))
-    {
-      if (GNUNET_YES == dsc->remove_files)
-        remove_garbage (fullname);
-      return GNUNET_OK;
-    }
-    id = id_public;
-  }
-
-  if ((NULL != r.hello) && (NULL != r.friend_only_hello) &&
-      (0 != GNUNET_memcmp (&id_friend, &id_public)))
-  {
-    /* HELLOs are not for the same peer */
-    GNUNET_break (0);
-    if (GNUNET_YES == dsc->remove_files)
-      remove_garbage (fullname);
-    return GNUNET_OK;
-  }
-  if (GNUNET_OK ==
-      GNUNET_CRYPTO_eddsa_public_key_from_string (filename,
-                                                  strlen (filename),
-                                                  &identity.public_key))
-  {
-    if (0 != GNUNET_memcmp (&id, &identity))
-    {
-      /* HELLOs are not for the same peer */
-      GNUNET_break (0);
-      if (GNUNET_YES == dsc->remove_files)
-        remove_garbage (fullname);
-      return GNUNET_OK;
-    }
-  }
-
-  /* ok, found something valid, remember HELLO */
-  add_host_to_known_hosts (&id);
-  if (NULL != r.hello)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Updating peer `%s' public HELLO \n",
-                GNUNET_i2s (&id));
-    update_hello (&id, r.hello);
-    GNUNET_free (r.hello);
-  }
-  if (NULL != r.friend_only_hello)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Updating peer `%s' friend only HELLO \n",
-                GNUNET_i2s (&id));
-    update_hello (&id, r.friend_only_hello);
-    GNUNET_free (r.friend_only_hello);
-  }
-  dsc->matched++;
-  return GNUNET_OK;
-}
-
-
-/**
- * Call this method periodically to scan data/hosts for new hosts.
- *
- * @param cls unused
- */
-static void
-cron_scan_directory_data_hosts (void *cls)
-{
-  static unsigned int retries;
-  struct DirScanContext dsc;
-
-  (void) cls;
-  cron_scan = NULL;
-  if (GNUNET_SYSERR == GNUNET_DISK_directory_create (networkIdDirectory))
-  {
-    cron_scan =
-      GNUNET_SCHEDULER_add_delayed_with_priority (DATA_HOST_FREQ,
-                                                  
GNUNET_SCHEDULER_PRIORITY_IDLE,
-                                                  &
-                                                  
cron_scan_directory_data_hosts,
-                                                  NULL);
-    return;
-  }
-  dsc.matched = 0;
-  dsc.remove_files = GNUNET_YES;
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK,
-              _ ("Scanning directory `%s'\n"),
-              networkIdDirectory);
-  GNUNET_DISK_directory_scan (networkIdDirectory,
-                              &hosts_directory_scan_callback,
-                              &dsc);
-  if ((0 == dsc.matched) && (0 == (++retries & 31)))
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
-                _ ("Still no peers found in `%s'!\n"),
-                networkIdDirectory);
-  cron_scan =
-    GNUNET_SCHEDULER_add_delayed_with_priority (DATA_HOST_FREQ,
-                                                GNUNET_SCHEDULER_PRIORITY_IDLE,
-                                                
&cron_scan_directory_data_hosts,
-                                                NULL);
-}
-
-
-/**
- * Update the HELLO of a friend by merging the addresses.
- *
- * @param hello original hello
- * @param friend_hello hello with additional addresses
- * @return merged HELLO
- */
-static struct GNUNET_HELLO_Message *
-update_friend_hello (const struct GNUNET_HELLO_Message *hello,
-                     const struct GNUNET_HELLO_Message *friend_hello)
-{
-  struct GNUNET_HELLO_Message *res;
-  struct GNUNET_HELLO_Message *tmp;
-  struct GNUNET_PeerIdentity pid;
-
-  if (NULL != friend_hello)
-  {
-    res = GNUNET_HELLO_merge (hello, friend_hello);
-    GNUNET_assert (GNUNET_YES == GNUNET_HELLO_is_friend_only (res));
-    return res;
-  }
-
-  if (GNUNET_OK != GNUNET_HELLO_get_id (hello, &pid))
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  tmp = GNUNET_HELLO_create (&pid.public_key, NULL, NULL, GNUNET_YES);
-  res = GNUNET_HELLO_merge (hello, tmp);
-  GNUNET_free (tmp);
-  GNUNET_assert (GNUNET_YES == GNUNET_HELLO_is_friend_only (res));
-  return res;
-}
-
-
-/**
- * Bind a host address (hello) to a hostId.
- *
- * @param peer the peer for which this is a hello
- * @param hello the verified (!) hello message
- */
-static void
-update_hello (const struct GNUNET_PeerIdentity *peer,
-              const struct GNUNET_HELLO_Message *hello)
-{
-  char *fn;
-  struct HostEntry *host;
-  struct GNUNET_HELLO_Message *mrg;
-  struct GNUNET_HELLO_Message **dest;
-  struct GNUNET_TIME_Absolute delta;
-  unsigned int cnt;
-  unsigned int size;
-  int friend_hello_type;
-  int store_hello;
-  int store_friend_hello;
-  unsigned int pos;
-  char *buffer;
-
-  host = GNUNET_CONTAINER_multipeermap_get (hostmap, peer);
-  GNUNET_assert (NULL != host);
-
-  friend_hello_type = GNUNET_HELLO_is_friend_only (hello);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Updating %s HELLO for `%s'\n",
-              (GNUNET_YES == friend_hello_type) ? "friend-only" : "public",
-              GNUNET_i2s (peer));
-
-  dest = NULL;
-  if (GNUNET_YES == friend_hello_type)
-  {
-    dest = &host->friend_only_hello;
-  }
-  else
-  {
-    dest = &host->hello;
-  }
-
-  if (NULL == (*dest))
-  {
-    (*dest) = GNUNET_malloc (GNUNET_HELLO_size (hello));
-    GNUNET_memcpy ((*dest), hello, GNUNET_HELLO_size (hello));
-  }
-  else
-  {
-    mrg = GNUNET_HELLO_merge ((*dest), hello);
-    delta = GNUNET_HELLO_equals (mrg, (*dest), GNUNET_TIME_absolute_get ());
-    if (delta.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us)
-    {
-      /* no differences, just ignore the update */
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "No change in %s HELLO for `%s'\n",
-                  (GNUNET_YES == friend_hello_type) ? "friend-only" : "public",
-                  GNUNET_i2s (peer));
-      GNUNET_free (mrg);
-      return;
-    }
-    GNUNET_free ((*dest));
-    (*dest) = mrg;
-  }
-
-  if ((NULL != (host->hello)) && (GNUNET_NO == friend_hello_type))
-  {
-    /* Update friend only hello */
-    mrg = update_friend_hello (host->hello, host->friend_only_hello);
-    if (NULL != host->friend_only_hello)
-      GNUNET_free (host->friend_only_hello);
-    host->friend_only_hello = mrg;
-  }
-
-  if (NULL != host->hello)
-    GNUNET_assert ((GNUNET_NO == GNUNET_HELLO_is_friend_only (host->hello)));
-  if (NULL != host->friend_only_hello)
-    GNUNET_assert (
-      (GNUNET_YES == GNUNET_HELLO_is_friend_only (host->friend_only_hello)));
-
-  fn = get_host_filename (peer);
-  if ((NULL != fn) && (GNUNET_OK == GNUNET_DISK_directory_create_for_file 
(fn)))
-  {
-    store_hello = GNUNET_NO;
-    size = 0;
-    cnt = 0;
-    if (NULL != host->hello)
-      (void) GNUNET_HELLO_iterate_addresses (host->hello,
-                                             GNUNET_NO,
-                                             &count_addresses,
-                                             &cnt);
-    if (cnt > 0)
-    {
-      store_hello = GNUNET_YES;
-      size += GNUNET_HELLO_size (host->hello);
-    }
-    cnt = 0;
-    if (NULL != host->friend_only_hello)
-      (void) GNUNET_HELLO_iterate_addresses (host->friend_only_hello,
-                                             GNUNET_NO,
-                                             &count_addresses,
-                                             &cnt);
-    store_friend_hello = GNUNET_NO;
-    if (0 < cnt)
-    {
-      store_friend_hello = GNUNET_YES;
-      size += GNUNET_HELLO_size (host->friend_only_hello);
-    }
-
-    if ((GNUNET_NO == store_hello) && (GNUNET_NO == store_friend_hello))
-    {
-      /* no valid addresses, don't put HELLO on disk; in fact,
-         if one exists on disk, remove it */
-      (void) unlink (fn);
-    }
-    else
-    {
-      buffer = GNUNET_malloc (size);
-      pos = 0;
-
-      if (GNUNET_YES == store_hello)
-      {
-        GNUNET_memcpy (buffer, host->hello, GNUNET_HELLO_size (host->hello));
-        pos += GNUNET_HELLO_size (host->hello);
-      }
-      if (GNUNET_YES == store_friend_hello)
-      {
-        GNUNET_memcpy (&buffer[pos],
-                       host->friend_only_hello,
-                       GNUNET_HELLO_size (host->friend_only_hello));
-        pos += GNUNET_HELLO_size (host->friend_only_hello);
-      }
-      GNUNET_assert (pos == size);
-
-      if (GNUNET_SYSERR ==
-          GNUNET_DISK_fn_write (fn,
-                                buffer,
-                                size,
-                                GNUNET_DISK_PERM_USER_READ
-                                | GNUNET_DISK_PERM_USER_WRITE
-                                | GNUNET_DISK_PERM_GROUP_READ
-                                | GNUNET_DISK_PERM_OTHER_READ))
-        GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "write", fn);
-      else
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Stored %s %s HELLO in %s  with total size %u\n",
-                    (GNUNET_YES == store_friend_hello) ? "friend-only" : "",
-                    (GNUNET_YES == store_hello) ? "public" : "",
-                    fn,
-                    size);
-      GNUNET_free (buffer);
-    }
-  }
-  GNUNET_free (fn);
-  notify_all (host);
-}
-
-
-/**
- * Closure for #add_to_tc()
- */
-struct TransmitContext
-{
-  /**
-   * Client to transmit to
-   */
-  struct GNUNET_SERVICE_Client *client;
-
-  /**
-   * Include friend only HELLOs #GNUNET_YES or #GNUNET_NO
-   */
-  int friend_only;
-};
-
-
-/**
- * Do transmit info about peer to given host.
- *
- * @param cls NULL to hit all hosts, otherwise specifies a particular target
- * @param key hostID
- * @param value information to transmit
- * @return #GNUNET_YES (continue to iterate)
- */
-static int
-add_to_tc (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
-{
-  struct TransmitContext *tc = cls;
-  struct HostEntry *pos = value;
-  struct InfoMessage *im;
-  uint16_t hs;
-  struct GNUNET_MQ_Envelope *env;
-
-  hs = 0;
-
-  if ((NULL != pos->hello) && (GNUNET_NO == tc->friend_only))
-  {
-    /* Copy public HELLO */
-    hs = GNUNET_HELLO_size (pos->hello);
-    GNUNET_assert (hs < GNUNET_MAX_MESSAGE_SIZE - sizeof(struct InfoMessage));
-    env = GNUNET_MQ_msg_extra (im, hs, GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
-    GNUNET_memcpy (&im[1], pos->hello, hs);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Sending public HELLO with size %u for peer `%s'\n",
-                hs,
-                GNUNET_i2s (key));
-  }
-  else if ((NULL != pos->friend_only_hello) && (GNUNET_YES == tc->friend_only))
-  {
-    /* Copy friend only HELLO */
-    hs = GNUNET_HELLO_size (pos->friend_only_hello);
-    GNUNET_assert (hs < GNUNET_MAX_MESSAGE_SIZE - sizeof(struct InfoMessage));
-    env = GNUNET_MQ_msg_extra (im, hs, GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
-    GNUNET_memcpy (&im[1], pos->friend_only_hello, hs);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Sending friend-only HELLO with size %u for peer `%s'\n",
-                hs,
-                GNUNET_i2s (key));
-  }
-  else
-  {
-    env = GNUNET_MQ_msg (im, GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Adding no HELLO for peer `%s'\n",
-                GNUNET_i2s (key));
-  }
-  im->peer = pos->identity;
-  GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (tc->client), env);
-  return GNUNET_YES;
-}
-
-
-/**
- * @brief delete expired HELLO entries in directory
- *
- * @param cls pointer to current time (`struct GNUNET_TIME_Absolute *`)
- * @param fn filename to test to see if the HELLO expired
- * @return #GNUNET_OK (continue iteration)
- */
-static int
-discard_hosts_helper (void *cls, const char *fn)
-{
-  struct GNUNET_TIME_Absolute *now = cls;
-  char buffer[GNUNET_MAX_MESSAGE_SIZE - 1] GNUNET_ALIGN;
-  const struct GNUNET_HELLO_Message *hello;
-  struct GNUNET_HELLO_Message *new_hello;
-  int read_size;
-  unsigned int cur_hello_size;
-  unsigned int new_hello_size;
-  int read_pos;
-  int write_pos;
-  unsigned int cnt;
-  char *writebuffer;
-  uint64_t fsize;
-
-  if (GNUNET_OK != GNUNET_DISK_file_size (fn, &fsize, GNUNET_YES, GNUNET_YES))
-  {
-    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING
-                              | GNUNET_ERROR_TYPE_BULK,
-                              "fstat",
-                              fn);
-    return GNUNET_OK;
-  }
-  read_size = GNUNET_DISK_fn_read (fn, buffer, sizeof(buffer));
-
-  if ((read_size < (int) sizeof(struct GNUNET_MessageHeader)) ||
-      (fsize > GNUNET_MAX_MESSAGE_SIZE))
-  {
-    if (0 != unlink (fn))
-      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING
-                                | GNUNET_ERROR_TYPE_BULK,
-                                "unlink",
-                                fn);
-    return GNUNET_OK;
-  }
-
-  writebuffer = GNUNET_malloc (read_size);
-  read_pos = 0;
-  write_pos = 0;
-  while (read_pos < read_size)
-  {
-    /* Check each HELLO */
-    hello = (const struct GNUNET_HELLO_Message *) &buffer[read_pos];
-    cur_hello_size = GNUNET_HELLO_size (hello);
-    if (0 == cur_hello_size)
-    {
-      /* Invalid data, discard */
-      if (0 != unlink (fn))
-        GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING
-                                  | GNUNET_ERROR_TYPE_BULK,
-                                  "unlink",
-                                  fn);
-      GNUNET_free (writebuffer);
-      return GNUNET_OK;
-    }
-    new_hello =
-      GNUNET_HELLO_iterate_addresses (hello, GNUNET_YES, &discard_expired, 
now);
-    cnt = 0;
-    if (NULL != new_hello)
-      (void) GNUNET_HELLO_iterate_addresses (hello,
-                                             GNUNET_NO,
-                                             &count_addresses,
-                                             &cnt);
-    if ((NULL != new_hello) && (0 < cnt))
-    {
-      /* Store new HELLO to write it when done */
-      new_hello_size = GNUNET_HELLO_size (new_hello);
-      GNUNET_memcpy (&writebuffer[write_pos], new_hello, new_hello_size);
-      write_pos += new_hello_size;
-    }
-    read_pos += cur_hello_size;
-    GNUNET_free (new_hello);
-  }
-
-  if (0 < write_pos)
-  {
-    (void) GNUNET_DISK_directory_remove (fn);
-    GNUNET_assert (GNUNET_OK ==
-                   GNUNET_DISK_fn_write (fn,
-                                         writebuffer,
-                                         write_pos,
-                                         GNUNET_DISK_PERM_USER_READ
-                                         | GNUNET_DISK_PERM_USER_WRITE
-                                         | GNUNET_DISK_PERM_GROUP_READ
-                                         | GNUNET_DISK_PERM_OTHER_READ));
-  }
-  else if (0 != unlink (fn))
-    GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING
-                              | GNUNET_ERROR_TYPE_BULK,
-                              "unlink",
-                              fn);
-
-  GNUNET_free (writebuffer);
-  return GNUNET_OK;
-}
-
-
-/**
- * Call this method periodically to scan peerinfo/ for ancient
- * HELLOs to expire.
- *
- * @param cls unused
- */
-static void
-cron_clean_data_hosts (void *cls)
-{
-  struct GNUNET_TIME_Absolute now;
-
-  (void) cls;
-  cron_clean = NULL;
-  now = GNUNET_TIME_absolute_get ();
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK,
-              _ ("Cleaning up directory `%s'\n"),
-              networkIdDirectory);
-  GNUNET_DISK_directory_scan (networkIdDirectory, &discard_hosts_helper, &now);
-  cron_clean = GNUNET_SCHEDULER_add_delayed (DATA_HOST_CLEAN_FREQ,
-                                             &cron_clean_data_hosts,
-                                             NULL);
-}
-
-
-/**
- * Check HELLO-message.
- *
- * @param cls identification of the client
- * @param hello the actual message
- * @return #GNUNET_OK if @a hello is well-formed
- */
-static int
-check_hello (void *cls, const struct GNUNET_HELLO_Message *hello)
-{
-  struct GNUNET_PeerIdentity pid;
-
-  (void) cls;
-  if (GNUNET_OK != GNUNET_HELLO_get_id (hello, &pid))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Handle HELLO-message.
- *
- * @param cls identification of the client
- * @param hello the actual message
- */
-static void
-handle_hello (void *cls, const struct GNUNET_HELLO_Message *hello)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-  struct GNUNET_PeerIdentity pid;
-
-  GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_id (hello, &pid));
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "HELLO message received for peer `%s'\n",
-              GNUNET_i2s (&pid));
-  add_host_to_known_hosts (&pid);
-  update_hello (&pid, hello);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Handle GET-message.
- *
- * @param cls identification of the client
- * @param lpm the actual message
- */
-static void
-handle_get (void *cls, const struct ListPeerMessage *lpm)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-  struct TransmitContext tcx;
-  struct GNUNET_MessageHeader *msg;
-  struct GNUNET_MQ_Envelope *env;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "GET message received for peer `%s'\n",
-              GNUNET_i2s (&lpm->peer));
-  tcx.friend_only = ntohl (lpm->include_friend_only);
-  tcx.client = client;
-  GNUNET_CONTAINER_multipeermap_get_multiple (hostmap,
-                                              &lpm->peer,
-                                              &add_to_tc,
-                                              &tcx);
-  env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END);
-  GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Handle GET-ALL-message.
- *
- * @param cls identification of the client
- * @param lapm the actual message
- */
-static void
-handle_get_all (void *cls, const struct ListAllPeersMessage *lapm)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-  struct TransmitContext tcx;
-  struct GNUNET_MQ_Envelope *env;
-  struct GNUNET_MessageHeader *msg;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GET_ALL message received\n");
-  tcx.friend_only = ntohl (lapm->include_friend_only);
-  tcx.client = client;
-  GNUNET_CONTAINER_multipeermap_iterate (hostmap, &add_to_tc, &tcx);
-  env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END);
-  GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Handle NOTIFY-message.
- *
- * @param cls identification of the client
- * @param nm the actual message
- */
-static void
-handle_notify (void *cls, const struct NotifyMessage *nm)
-{
-  struct GNUNET_SERVICE_Client *client = cls;
-  struct GNUNET_MQ_Handle *mq;
-  struct TransmitContext tcx;
-  struct GNUNET_MQ_Envelope *env;
-  struct GNUNET_MessageHeader *msg;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "NOTIFY message received\n");
-  mq = GNUNET_SERVICE_client_get_mq (client);
-  GNUNET_SERVICE_client_mark_monitor (client);
-  if (ntohl (nm->include_friend_only))
-    GNUNET_notification_context_add (notify_friend_only_list, mq);
-  else
-    GNUNET_notification_context_add (notify_list, mq);
-  tcx.friend_only = ntohl (nm->include_friend_only);
-  tcx.client = client;
-  GNUNET_CONTAINER_multipeermap_iterate (hostmap, &add_to_tc, &tcx);
-  env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END);
-  GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
-  GNUNET_SERVICE_client_continue (client);
-}
-
-
-/**
- * Client connect callback
- *
- * @param cls unused
- * @param client server client
- * @param mq for @a client
- * @return @a client
- */
-static void *
-client_connect_cb (void *cls,
-                   struct GNUNET_SERVICE_Client *client,
-                   struct GNUNET_MQ_Handle *mq)
-{
-  (void) cls;
-  (void) mq;
-  return client;
-}
-
-
-/**
- * Client disconnect callback
- *
- * @param cls unused
- * @param client server client
- * @param app_ctx should be @a client
- */
-static void
-client_disconnect_cb (void *cls,
-                      struct GNUNET_SERVICE_Client *client,
-                      void *app_ctx)
-{
-  (void) cls;
-  GNUNET_assert (app_ctx == client);
-}
-
-
-/**
- * Release memory taken by a host entry.
- *
- * @param cls NULL
- * @param key key of the host entry
- * @param value the `struct HostEntry` to free
- * @return #GNUNET_YES (continue to iterate)
- */
-static int
-free_host_entry (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
-{
-  struct HostEntry *he = value;
-
-  (void) cls;
-  (void) key;
-  GNUNET_free (he->hello);
-  GNUNET_free (he->friend_only_hello);
-  GNUNET_free (he);
-  return GNUNET_YES;
-}
-
-
-/**
- * Clean up our state.  Called during shutdown.
- *
- * @param cls unused
- */
-static void
-shutdown_task (void *cls)
-{
-  (void) cls;
-  GNUNET_notification_context_destroy (notify_list);
-  notify_list = NULL;
-  GNUNET_notification_context_destroy (notify_friend_only_list);
-  notify_friend_only_list = NULL;
-
-  GNUNET_CONTAINER_multipeermap_iterate (hostmap, &free_host_entry, NULL);
-  GNUNET_CONTAINER_multipeermap_destroy (hostmap);
-  if (NULL != stats)
-  {
-    GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
-    stats = NULL;
-  }
-  if (NULL != cron_clean)
-  {
-    GNUNET_SCHEDULER_cancel (cron_clean);
-    cron_clean = NULL;
-  }
-  if (NULL != cron_scan)
-  {
-    GNUNET_SCHEDULER_cancel (cron_scan);
-    cron_scan = NULL;
-  }
-  if (NULL != networkIdDirectory)
-  {
-    GNUNET_free (networkIdDirectory);
-    networkIdDirectory = NULL;
-  }
-}
-
-
-/**
- * Start up peerinfo service.
- *
- * @param cls closure
- * @param cfg configuration to use
- * @param service the initialized service
- */
-static void
-run (void *cls,
-     const struct GNUNET_CONFIGURATION_Handle *cfg,
-     struct GNUNET_SERVICE_Handle *service)
-{
-  char *peerdir;
-  char *ip;
-  struct DirScanContext dsc;
-  int noio;
-  int use_included;
-
-  (void) cls;
-  (void) service;
-  hostmap = GNUNET_CONTAINER_multipeermap_create (1024, GNUNET_YES);
-  stats = GNUNET_STATISTICS_create ("peerinfo", cfg);
-  notify_list = GNUNET_notification_context_create (0);
-  notify_friend_only_list = GNUNET_notification_context_create (0);
-  noio = GNUNET_CONFIGURATION_get_value_yesno (cfg, "peerinfo", "NO_IO");
-  use_included = GNUNET_CONFIGURATION_get_value_yesno (cfg,
-                                                       "peerinfo",
-                                                       "USE_INCLUDED_HELLOS");
-  if (GNUNET_SYSERR == use_included)
-    use_included = GNUNET_NO;
-  GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
-  if (GNUNET_YES != noio)
-  {
-    GNUNET_assert (
-      GNUNET_OK ==
-      GNUNET_CONFIGURATION_get_value_filename (cfg,
-                                               "peerinfo",
-                                               "HOSTS",
-                                               &networkIdDirectory));
-    if (GNUNET_OK != GNUNET_DISK_directory_create (networkIdDirectory))
-    {
-      GNUNET_SCHEDULER_shutdown ();
-      return;
-    }
-
-    cron_scan =
-      GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
-                                          &cron_scan_directory_data_hosts,
-                                          NULL);
-
-    cron_clean =
-      GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
-                                          &cron_clean_data_hosts,
-                                          NULL);
-    if (GNUNET_YES == use_included)
-    {
-      ip = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
-      GNUNET_asprintf (&peerdir, "%shellos", ip);
-      GNUNET_free (ip);
-
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  _ ("Importing HELLOs from `%s'\n"),
-                  peerdir);
-      dsc.matched = 0;
-      dsc.remove_files = GNUNET_NO;
-
-      GNUNET_DISK_directory_scan (peerdir,
-                                  &hosts_directory_scan_callback,
-                                  &dsc);
-      GNUNET_free (peerdir);
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  _ ("Skipping import of included HELLOs\n"));
-    }
-  }
-}
-
-
-/**
- * Define "main" method using service macro.
- */
-GNUNET_SERVICE_MAIN (
-  "peerinfo",
-  GNUNET_SERVICE_OPTION_NONE,
-  &run,
-  &client_connect_cb,
-  &client_disconnect_cb,
-  NULL,
-  GNUNET_MQ_hd_var_size (hello,
-                         GNUNET_MESSAGE_TYPE_HELLO,
-                         struct GNUNET_HELLO_Message,
-                         NULL),
-  GNUNET_MQ_hd_fixed_size (get,
-                           GNUNET_MESSAGE_TYPE_PEERINFO_GET,
-                           struct ListPeerMessage,
-                           NULL),
-  GNUNET_MQ_hd_fixed_size (get_all,
-                           GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL,
-                           struct ListAllPeersMessage,
-                           NULL),
-  GNUNET_MQ_hd_fixed_size (notify,
-                           GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY,
-                           struct NotifyMessage,
-                           NULL),
-  GNUNET_MQ_handler_end ());
-
-
-/* end of gnunet-service-peerinfo.c */
diff --git a/src/peerinfo/meson.build b/src/peerinfo/meson.build
deleted file mode 100644
index ea9aaa331..000000000
--- a/src/peerinfo/meson.build
+++ /dev/null
@@ -1,41 +0,0 @@
-libgnunetpeerinfo_src = ['peerinfo_api.c',
-                         'peerinfo_api_notify.c']
-
-gnunetservicepeerinfo_src = ['gnunet-service-peerinfo.c']
-
-configure_file(input : 'peerinfo.conf.in',
-               output : 'peerinfo.conf',
-               configuration : cdata,
-               install: true,
-               install_dir: pkgcfgdir)
-
-
-if get_option('monolith')
-  foreach p : libgnunetpeerinfo_src + gnunetservicepeerinfo_src
-    gnunet_src += 'peerinfo/' + p
-  endforeach
-  subdir_done()
-endif
-
-libgnunetpeerinfo = library('gnunetpeerinfo',
-        libgnunetpeerinfo_src,
-        soversion: '0',
-        version: '0.0.0',
-        dependencies: [libgnunetutil_dep, libgnunethello_dep],
-        include_directories: [incdir, configuration_inc],
-        install: true,
-        install_dir: get_option('libdir'))
-libgnunetpeerinfo_dep = declare_dependency(link_with : libgnunetpeerinfo)
-pkg.generate(libgnunetpeerinfo, url: 'https://www.gnunet.org',
-             description : 'Provides API for accessing the peerinfo service')
-
-executable ('gnunet-service-peerinfo',
-            gnunetservicepeerinfo_src,
-            dependencies: [libgnunetpeerinfo_dep,
-                           libgnunetutil_dep,
-                           libgnunetstatistics_dep,
-                           libgnunethello_dep],
-            include_directories: [incdir, configuration_inc],
-            install: true,
-            install_dir: get_option('libdir') / 'gnunet' / 'libexec')
-
diff --git a/src/peerinfo/peerinfo.conf.in b/src/peerinfo/peerinfo.conf.in
deleted file mode 100644
index 14a41655b..000000000
--- a/src/peerinfo/peerinfo.conf.in
+++ /dev/null
@@ -1,31 +0,0 @@
-[peerinfo]
-START_ON_DEMAND = @START_ON_DEMAND@
-@JAVAPORT@PORT = 2090
-HOSTNAME = localhost
-BINARY = gnunet-service-peerinfo
-ACCEPT_FROM = 127.0.0.1;
-ACCEPT_FROM6 = ::1;
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-peerinfo.sock
-UNIX_MATCH_UID = NO
-UNIX_MATCH_GID = YES
-# DISABLE_SOCKET_FORWARDING = NO
-# USERNAME =
-# MAXBUF =
-# TIMEOUT =
-# DISABLEV6 =
-# BINDTO =
-# REJECT_FROM =
-# REJECT_FROM6 =
-# PREFIX =
-HOSTS = $GNUNET_DATA_HOME/peerinfo/hosts/
-
-# Option to disable all disk IO; only useful for testbed runs
-# (large-scale experiments); disables persistence of HELLOs!
-NO_IO = NO
-
-# Load HELLOs shipped with GNUnet
-USE_INCLUDED_HELLOS = YES
-
-[uri]
-hello = gnunet-peerinfo
-friend-hello = gnunet-peerinfo
diff --git a/src/peerinfo/peerinfo.h b/src/peerinfo/peerinfo.h
deleted file mode 100644
index 9968733f0..000000000
--- a/src/peerinfo/peerinfo.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo/peerinfo.h
- * @brief common internal definitions for peerinfo service
- * @author Christian Grothoff
- */
-
-#ifndef PEERINFO_H
-#define PEERINFO_H
-
-#include "gnunet_util_lib.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_time_lib.h"
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * Message requesting a listing of peers,
- * restricted to the specified peer identity.
- */
-struct ListPeerMessage
-{
-  /**
-   * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_GET
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Include friend only HELLOs and peers in callbacks
-   */
-  uint32_t include_friend_only GNUNET_PACKED;
-
-  /**
-   * Restrict to peers with this identity (optional
-   * field, check header.size!).
-   */
-  struct GNUNET_PeerIdentity peer;
-};
-
-/**
- * Message requesting a listing of all peers,
- * restricted to the specified peer identity.
- */
-struct ListAllPeersMessage
-{
-  /**
-   * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Include friend only HELLOs and peers in callbacks
-   */
-  uint32_t include_friend_only GNUNET_PACKED;
-};
-
-
-/**
- * Header for all communications.
- */
-struct NotifyMessage
-{
-  /**
-   * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Include friend only HELLOs and peers in callbacks
-   */
-  uint32_t include_friend_only GNUNET_PACKED;
-};
-
-
-/**
- * Message used to inform the client about
- * a particular peer; this message is optionally followed
- * by a HELLO message for the respective peer (if available).
- * Check the header.size field to see if a HELLO is
- * present.
- */
-struct InfoMessage
-{
-  /**
-   * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_INFO
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Always zero.
-   */
-  uint32_t reserved GNUNET_PACKED;
-
-  /**
-   * About which peer are we talking here?
-   */
-  struct GNUNET_PeerIdentity peer;
-};
-GNUNET_NETWORK_STRUCT_END
-
-/*#ifndef PEERINFO_H*/
-#endif
-/* end of peerinfo.h */
diff --git a/src/peerinfo/peerinfo_api.c b/src/peerinfo/peerinfo_api.c
deleted file mode 100644
index 65e429bef..000000000
--- a/src/peerinfo/peerinfo_api.c
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2001-2014 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo/peerinfo_api.c
- * @brief API to access peerinfo service
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_protocols.h"
-#include "peerinfo.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "peerinfo-api", __VA_ARGS__)
-
-
-/**
- * Context for an iteration request.
- */
-struct GNUNET_PEERINFO_IteratorContext
-{
-  /**
-   * Kept in a DLL.
-   */
-  struct GNUNET_PEERINFO_IteratorContext *next;
-
-  /**
-   * Kept in a DLL.
-   */
-  struct GNUNET_PEERINFO_IteratorContext *prev;
-
-  /**
-   * Handle to the PEERINFO service.
-   */
-  struct GNUNET_PEERINFO_Handle *h;
-
-  /**
-   * Function to call with the results.
-   */
-  GNUNET_PEERINFO_Processor callback;
-
-  /**
-   * Closure for @e callback.
-   */
-  void *callback_cls;
-
-  /**
-   * Peer we are interested in (only valid if iteration was restricted to one 
peer).
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Is @e peer set?
-   */
-  int have_peer;
-
-  /**
-   * Only include friends in reply?
-   */
-  int include_friend_only;
-};
-
-
-/**
- * Handle to the peerinfo service.
- */
-struct GNUNET_PEERINFO_Handle
-{
-  /**
-   * Our configuration.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Connection to the service.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Head of iterator DLL.
-   */
-  struct GNUNET_PEERINFO_IteratorContext *ic_head;
-
-  /**
-   * Tail of iterator DLL.
-   */
-  struct GNUNET_PEERINFO_IteratorContext *ic_tail;
-
-  /**
-   * ID for a reconnect task.
-   */
-  struct GNUNET_SCHEDULER_Task *r_task;
-};
-
-
-/**
- * Close the existing connection to PEERINFO and reconnect.
- *
- * @param h handle to the service
- */
-static void
-reconnect (struct GNUNET_PEERINFO_Handle *h);
-
-
-struct GNUNET_PEERINFO_Handle *
-GNUNET_PEERINFO_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  struct GNUNET_PEERINFO_Handle *h;
-
-  h = GNUNET_new (struct GNUNET_PEERINFO_Handle);
-  h->cfg = cfg;
-  reconnect (h);
-  if (NULL == h->mq)
-  {
-    GNUNET_free (h);
-    return NULL;
-  }
-  return h;
-}
-
-
-/**
- * Disconnect from the peerinfo service.  Note that all iterators must
- * have completed or have been cancelled by the time this function is
- * called (otherwise, calling this function is a serious error).
- * Furthermore, if #GNUNET_PEERINFO_add_peer() operations are still
- * pending, they will be cancelled silently on disconnect.
- *
- * @param h handle to disconnect
- */
-void
-GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h)
-{
-  struct GNUNET_PEERINFO_IteratorContext *ic;
-
-  while (NULL != (ic = h->ic_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (h->ic_head,
-                                 h->ic_tail,
-                                 ic);
-    GNUNET_free (ic);
-  }
-  if (NULL != h->mq)
-  {
-    GNUNET_MQ_destroy (h->mq);
-    h->mq = NULL;
-  }
-  if (NULL != h->r_task)
-  {
-    GNUNET_SCHEDULER_cancel (h->r_task);
-    h->r_task = NULL;
-  }
-  GNUNET_free (h);
-}
-
-
-/**
- * Task scheduled to re-try connecting to the peerinfo service.
- *
- * @param cls the `struct GNUNET_PEERINFO_Handle *`
- */
-static void
-reconnect_task (void *cls)
-{
-  struct GNUNET_PEERINFO_Handle *h = cls;
-
-  h->r_task = NULL;
-  reconnect (h);
-}
-
-
-/**
- * We encountered an error, reconnect to the PEERINFO service.
- *
- * @param h handle to reconnect
- */
-static void
-do_reconnect (struct GNUNET_PEERINFO_Handle *h)
-{
-  struct GNUNET_PEERINFO_IteratorContext *ic = h->ic_head;
-
-  GNUNET_MQ_destroy (h->mq);
-  h->mq = NULL;
-  if (NULL != ic)
-  {
-    GNUNET_CONTAINER_DLL_remove (h->ic_head,
-                                 h->ic_tail,
-                                 ic);
-    if (NULL != ic->callback)
-      ic->callback (ic->callback_cls,
-                    NULL,
-                    NULL,
-                    _ ("Failed to receive response from `PEERINFO' service."));
-    GNUNET_free (ic);
-  }
-  h->r_task = GNUNET_SCHEDULER_add_now (&reconnect_task,
-                                        h);
-}
-
-
-/**
- * We got a disconnect after asking regex to do the announcement.
- * Retry.
- *
- * @param cls the `struct GNUNET_PEERINFO_Handle` to retry
- * @param error error code
- */
-static void
-mq_error_handler (void *cls,
-                  enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_PEERINFO_Handle *h = cls;
-
-  do_reconnect (h);
-}
-
-
-/**
- * Function called when we receive an info message. Check it is
- * well-formed.
- *
- * @param cls closure
- * @param im message received
- * @return #GNUNET_OK if the message is OK
- */
-static int
-check_info (void *cls,
-            const struct InfoMessage *im)
-{
-  struct GNUNET_PEERINFO_Handle *h = cls;
-  struct GNUNET_PEERINFO_IteratorContext *ic = h->ic_head;
-  uint16_t ms = ntohs (im->header.size) - sizeof(*im);
-
-  if (0 != ntohl (im->reserved))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if (NULL == ic)
-  {
-    /* didn't expect a response, bad */
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if ((GNUNET_YES == ic->have_peer) &&
-      (0 != GNUNET_memcmp (&ic->peer,
-                           &im->peer)))
-  {
-    /* bogus message (from a different iteration call?); out of sequence! */
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Received HELLO for peer `%s', expected peer `%s'\n",
-         GNUNET_i2s (&im->peer),
-         GNUNET_i2s (&ic->peer));
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if (ms > sizeof(struct GNUNET_MessageHeader))
-  {
-    const struct GNUNET_HELLO_Message *hello;
-    struct GNUNET_PeerIdentity id;
-
-    hello = (const struct GNUNET_HELLO_Message *) &im[1];
-    if (ms != GNUNET_HELLO_size (hello))
-    {
-      /* malformed message */
-      GNUNET_break (0);
-      return GNUNET_SYSERR;
-    }
-    if (GNUNET_OK !=
-        GNUNET_HELLO_get_id (hello,
-                             &id))
-    {
-      /* malformed message */
-      GNUNET_break (0);
-      return GNUNET_SYSERR;
-    }
-    if (0 != GNUNET_memcmp (&im->peer,
-                            &id))
-    {
-      /* malformed message */
-      GNUNET_break (0);
-      return GNUNET_SYSERR;
-    }
-  }
-  else if (0 != ms)
-  {
-    /* malformed message */
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Handle info message.
- *
- * @param cls closure
- * @param im message received
- */
-static void
-handle_info (void *cls,
-             const struct InfoMessage *im)
-{
-  struct GNUNET_PEERINFO_Handle *h = cls;
-  struct GNUNET_PEERINFO_IteratorContext *ic = h->ic_head;
-  const struct GNUNET_HELLO_Message *hello = NULL;
-  uint16_t ms;
-
-  ms = ntohs (im->header.size);
-  if (ms > sizeof(struct InfoMessage))
-    hello = (const struct GNUNET_HELLO_Message *) &im[1];
-  if (NULL != ic->callback)
-    ic->callback (ic->callback_cls,
-                  &im->peer,
-                  hello,
-                  NULL);
-}
-
-
-/**
- * Send the next IC request at the head of the queue.
- *
- * @param h handle
- */
-static void
-send_ic_request (struct GNUNET_PEERINFO_Handle *h)
-{
-  struct GNUNET_PEERINFO_IteratorContext *ic = h->ic_head;
-  struct GNUNET_MQ_Envelope *env;
-  struct ListAllPeersMessage *lapm;
-  struct ListPeerMessage *lpm;
-
-  if (NULL == ic)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if (NULL == h->mq)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if (GNUNET_NO == ic->have_peer)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Requesting list of peers from PEERINFO service\n");
-    env = GNUNET_MQ_msg (lapm,
-                         GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL);
-    lapm->include_friend_only = htonl (ic->include_friend_only);
-  }
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Requesting information on peer `%s' from PEERINFO service\n",
-         GNUNET_i2s (&ic->peer));
-    env = GNUNET_MQ_msg (lpm,
-                         GNUNET_MESSAGE_TYPE_PEERINFO_GET);
-    lpm->include_friend_only = htonl (ic->include_friend_only);
-    lpm->peer = ic->peer;
-  }
-  GNUNET_MQ_send (h->mq,
-                  env);
-}
-
-
-/**
- * Type of a function to call when we receive a message from the
- * service.  Call the iterator with the result and (if applicable)
- * continue to receive more messages or trigger processing the next
- * event (if applicable).
- *
- * @param cls closure
- * @param msg message received, NULL on timeout or fatal error
- */
-static void
-handle_end_iteration (void *cls,
-                      const struct GNUNET_MessageHeader *msg)
-{
-  struct GNUNET_PEERINFO_Handle *h = cls;
-  struct GNUNET_PEERINFO_IteratorContext *ic = h->ic_head;
-
-  if (NULL == ic)
-  {
-    /* didn't expect a response, reconnect */
-    GNUNET_break (0);
-    reconnect (h);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Received end of list of peers from PEERINFO service\n");
-  GNUNET_CONTAINER_DLL_remove (h->ic_head,
-                               h->ic_tail,
-                               ic);
-  if (NULL != h->ic_head)
-    send_ic_request (h);
-  if (NULL != ic->callback)
-    ic->callback (ic->callback_cls,
-                  NULL,
-                  NULL,
-                  NULL);
-  GNUNET_free (ic);
-}
-
-
-/**
- * Close the existing connection to PEERINFO and reconnect.
- *
- * @param h handle to the service
- */
-static void
-reconnect (struct GNUNET_PEERINFO_Handle *h)
-{
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_var_size (info,
-                           GNUNET_MESSAGE_TYPE_PEERINFO_INFO,
-                           struct InfoMessage,
-                           h),
-    GNUNET_MQ_hd_fixed_size (end_iteration,
-                             GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END,
-                             struct GNUNET_MessageHeader,
-                             h),
-    GNUNET_MQ_handler_end ()
-  };
-
-  if (NULL != h->r_task)
-  {
-    GNUNET_SCHEDULER_cancel (h->r_task);
-    h->r_task = NULL;
-  }
-  if (NULL != h->mq)
-  {
-    GNUNET_MQ_destroy (h->mq);
-    h->mq = NULL;
-  }
-  h->mq = GNUNET_CLIENT_connect (h->cfg,
-                                 "peerinfo",
-                                 handlers,
-                                 &mq_error_handler,
-                                 h);
-  if (NULL != h->ic_head)
-    send_ic_request (h);
-}
-
-
-struct GNUNET_PEERINFO_IteratorContext *
-GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h,
-                         int include_friend_only,
-                         const struct GNUNET_PeerIdentity *peer,
-                         GNUNET_PEERINFO_Processor callback,
-                         void *callback_cls)
-{
-  struct GNUNET_PEERINFO_IteratorContext *ic;
-
-  ic = GNUNET_new (struct GNUNET_PEERINFO_IteratorContext);
-  ic->h = h;
-  ic->include_friend_only = include_friend_only;
-  ic->callback = callback;
-  ic->callback_cls = callback_cls;
-  if (NULL != peer)
-  {
-    ic->have_peer = GNUNET_YES;
-    ic->peer = *peer;
-  }
-  GNUNET_CONTAINER_DLL_insert_tail (h->ic_head,
-                                    h->ic_tail,
-                                    ic);
-  if (h->ic_head == ic)
-    send_ic_request (h);
-  return ic;
-}
-
-
-/**
- * Cancel an iteration over peer information.
- *
- * @param ic context of the iterator to cancel
- */
-void
-GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic)
-{
-  struct GNUNET_PEERINFO_Handle *h = ic->h;
-
-  ic->callback = NULL;
-  if (ic == h->ic_head)
-    return;
-  GNUNET_CONTAINER_DLL_remove (h->ic_head,
-                               h->ic_tail,
-                               ic);
-  GNUNET_free (ic);
-}
-
-
-/**
- * Add a host to the persistent list.  This method operates in
- * semi-reliable mode: if the transmission is not completed by
- * the time #GNUNET_PEERINFO_disconnect() is called, it will be
- * aborted.  Furthermore, if a second HELLO is added for the
- * same peer before the first one was transmitted, PEERINFO may
- * merge the two HELLOs prior to transmission to the service.
- *
- * @param h handle to the peerinfo service
- * @param hello the verified (!) HELLO message
- * @param cont continuation to call when done, NULL is allowed
- * @param cont_cls closure for @a cont
- * @return handle to cancel add operation; all pending
- *         'add' operations will be cancelled automatically
- *        on disconnect, so it is not necessary to keep this
- *        handle (unless @a cont is NULL and at some point
- *        calling @a cont must be prevented)
- */
-struct GNUNET_MQ_Envelope *
-GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h,
-                          const struct GNUNET_HELLO_Message *hello,
-                          GNUNET_SCHEDULER_TaskCallback cont,
-                          void *cont_cls)
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct GNUNET_PeerIdentity peer;
-
-  if (NULL == h->mq)
-    return NULL;
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_HELLO_get_id (hello,
-                                      &peer));
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Adding peer `%s' to PEERINFO database\n",
-       GNUNET_i2s (&peer));
-  env = GNUNET_MQ_msg_copy ((const struct GNUNET_MessageHeader *) hello);
-  if (NULL != cont)
-    GNUNET_MQ_notify_sent (env,
-                           cont,
-                           cont_cls);
-  GNUNET_MQ_send (h->mq,
-                  env);
-  return env;
-}
-
-
-/* end of peerinfo_api.c */
diff --git a/src/peerinfo/peerinfo_api_notify.c 
b/src/peerinfo/peerinfo_api_notify.c
deleted file mode 100644
index 5f4c123ff..000000000
--- a/src/peerinfo/peerinfo_api_notify.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2001, 2002, 2004, 2005, 2007, 2009, 2010 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo/peerinfo_api_notify.c
- * @brief notify API to access peerinfo service
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_protocols.h"
-#include "peerinfo.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "peerinfo-api", __VA_ARGS__)
-
-/**
- * Context for the info handler.
- */
-struct GNUNET_PEERINFO_NotifyContext
-{
-  /**
-   * Our connection to the PEERINFO service.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Function to call with information.
-   */
-  GNUNET_PEERINFO_Processor callback;
-
-  /**
-   * Closure for @e callback.
-   */
-  void *callback_cls;
-
-  /**
-   * Configuration.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Tasked used for delayed re-connection attempt.
-   */
-  struct GNUNET_SCHEDULER_Task *task;
-
-  /**
-   * Include friend only HELLOs in callbacks
-   */
-  int include_friend_only;
-};
-
-
-/**
- * Task to re-try connecting to peerinfo.
- *
- * @param cls the `struct GNUNET_PEERINFO_NotifyContext *`
- */
-static void
-reconnect (void *cls);
-
-
-/**
- * We encountered an error, reconnect to the service.
- *
- * @param nc context to reconnect
- */
-static void
-do_reconnect (struct GNUNET_PEERINFO_NotifyContext *nc)
-{
-  GNUNET_MQ_destroy (nc->mq);
-  nc->mq = NULL;
-  nc->task = GNUNET_SCHEDULER_add_now (&reconnect,
-                                       nc);
-}
-
-
-/**
- * We got a disconnect after asking regex to do the announcement.
- * Retry.
- *
- * @param cls the `struct GNUNET_PEERINFO_NotifyContext` to retry
- * @param error error code
- */
-static void
-mq_error_handler (void *cls,
-                  enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_PEERINFO_NotifyContext *nc = cls;
-
-  do_reconnect (nc);
-}
-
-
-/**
- * Check that a peerinfo information message is well-formed.
- *
- * @param cls closure
- * @param im message received
- * @return #GNUNET_OK if the message is well-formed
- */
-static int
-check_notification (void *cls,
-                    const struct InfoMessage *im)
-{
-  uint16_t ms = ntohs (im->header.size) - sizeof(*im);
-
-  if (ms >= sizeof(struct GNUNET_MessageHeader))
-  {
-    const struct GNUNET_HELLO_Message *hello;
-
-    hello = (const struct GNUNET_HELLO_Message *) &im[1];
-    if (ms != GNUNET_HELLO_size (hello))
-    {
-      GNUNET_break (0);
-      return GNUNET_SYSERR;
-    }
-    return GNUNET_OK;
-  }
-  if (0 != ms)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;  /* odd... */
-}
-
-
-/**
- * Receive a peerinfo information message, process it.
- *
- * @param cls closure
- * @param im message received
- */
-static void
-handle_notification (void *cls,
-                     const struct InfoMessage *im)
-{
-  struct GNUNET_PEERINFO_NotifyContext *nc = cls;
-  const struct GNUNET_HELLO_Message *hello;
-  uint16_t ms = ntohs (im->header.size) - sizeof(struct InfoMessage);
-
-  if (0 == ms)
-    return;
-  hello = (const struct GNUNET_HELLO_Message *) &im[1];
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Received information about peer `%s' from peerinfo database\n",
-       GNUNET_i2s (&im->peer));
-  nc->callback (nc->callback_cls,
-                &im->peer,
-                hello,
-                NULL);
-}
-
-
-/**
- * Type of a function to call when we receive a message from the
- * service.  Call the iterator with the result and (if applicable)
- * continue to receive more messages or trigger processing the next
- * event (if applicable).
- *
- * @param cls closure
- * @param msg message received, NULL on timeout or fatal error
- */
-static void
-handle_end_iteration (void *cls,
-                      const struct GNUNET_MessageHeader *msg)
-{
-  /* these are ignored by the notify API */
-}
-
-
-/**
- * Task to re-try connecting to peerinfo.
- *
- * @param cls the `struct GNUNET_PEERINFO_NotifyContext *`
- */
-static void
-reconnect (void *cls)
-{
-  struct GNUNET_PEERINFO_NotifyContext *nc = cls;
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_var_size (notification,
-                           GNUNET_MESSAGE_TYPE_PEERINFO_INFO,
-                           struct InfoMessage,
-                           nc),
-    GNUNET_MQ_hd_fixed_size (end_iteration,
-                             GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END,
-                             struct GNUNET_MessageHeader,
-                             nc),
-    GNUNET_MQ_handler_end ()
-  };
-  struct GNUNET_MQ_Envelope *env;
-  struct NotifyMessage *nm;
-
-  nc->task = NULL;
-  nc->mq = GNUNET_CLIENT_connect (nc->cfg,
-                                  "peerinfo",
-                                  handlers,
-                                  &mq_error_handler,
-                                  nc);
-  if (NULL == nc->mq)
-    return;
-  env = GNUNET_MQ_msg (nm,
-                       GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY);
-  nm->include_friend_only = htonl (nc->include_friend_only);
-  GNUNET_MQ_send (nc->mq,
-                  env);
-}
-
-
-/**
- * Call a method whenever our known information about peers
- * changes.  Initially calls the given function for all known
- * peers and then only signals changes.
- *
- * If @a include_friend_only is set to #GNUNET_YES peerinfo will include HELLO
- * messages which are intended for friend to friend mode and which do not
- * have to be gossiped. Otherwise these messages are skipped.
- *
- * @param cfg configuration to use
- * @param include_friend_only include HELLO messages for friends only
- * @param callback the method to call for each peer
- * @param callback_cls closure for @a callback
- * @return NULL on error
- */
-struct GNUNET_PEERINFO_NotifyContext *
-GNUNET_PEERINFO_notify (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                        int include_friend_only,
-                        GNUNET_PEERINFO_Processor callback,
-                        void *callback_cls)
-{
-  struct GNUNET_PEERINFO_NotifyContext *nc;
-
-  nc = GNUNET_new (struct GNUNET_PEERINFO_NotifyContext);
-  nc->cfg = cfg;
-  nc->callback = callback;
-  nc->callback_cls = callback_cls;
-  nc->include_friend_only = include_friend_only;
-  reconnect (nc);
-  if (NULL == nc->mq)
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         "Could not connect to PEERINFO service.\n");
-    GNUNET_free (nc);
-    return NULL;
-  }
-  return nc;
-}
-
-
-/**
- * Stop notifying about changes.
- *
- * @param nc context to stop notifying
- */
-void
-GNUNET_PEERINFO_notify_cancel (struct GNUNET_PEERINFO_NotifyContext *nc)
-{
-  if (NULL != nc->mq)
-  {
-    GNUNET_MQ_destroy (nc->mq);
-    nc->mq = NULL;
-  }
-  if (NULL != nc->task)
-  {
-    GNUNET_SCHEDULER_cancel (nc->task);
-    nc->task = NULL;
-  }
-  GNUNET_free (nc);
-}
-
-
-/* end of peerinfo_api_notify.c */
diff --git a/src/peerinfo/perf_peerinfo_api.c b/src/peerinfo/perf_peerinfo_api.c
deleted file mode 100644
index 055388d43..000000000
--- a/src/peerinfo/perf_peerinfo_api.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2004, 2009, 2010, 2017 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo/perf_peerinfo_api.c
- * @brief testcase for peerinfo_api.c, hopefully hammer the peerinfo service,
- * this performance test adds up to 5000 peers with one address each and checks
- * over how many peers it can iterate before receiving a timeout after 5 
seconds
- * @author Nathan Evans
- */
-
-#include "platform.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_testing_lib.h"
-#include "gnunet_peerinfo_service.h"
-#include "peerinfo.h"
-#include <gauger.h>
-
-#define NUM_REQUESTS 5000
-
-static struct GNUNET_PEERINFO_IteratorContext *ic[NUM_REQUESTS];
-
-static struct GNUNET_PEERINFO_Handle *h;
-
-static unsigned int numpeers;
-
-static struct GNUNET_PeerIdentity pid;
-
-static struct GNUNET_SCHEDULER_Task *tt;
-
-
-static void
-do_shutdown (void *cls)
-{
-  if (NULL != tt)
-  {
-    GNUNET_SCHEDULER_cancel (tt);
-    tt = NULL;
-  }
-  for (unsigned int i = 0; i < NUM_REQUESTS; i++)
-    if (NULL != ic[i])
-      GNUNET_PEERINFO_iterate_cancel (ic[i]);
-  GNUNET_PEERINFO_disconnect (h);
-  h = NULL;
-}
-
-
-static void
-do_timeout (void *cls)
-{
-  tt = NULL;
-  GNUNET_SCHEDULER_shutdown ();
-}
-
-
-static int
-check_it (void *cls,
-          const struct GNUNET_HELLO_Address *address,
-          struct GNUNET_TIME_Absolute expiration)
-{
-  return GNUNET_OK;
-}
-
-
-static ssize_t
-address_generator (void *cls, size_t max, void *buf)
-{
-  size_t *agc = cls;
-  ssize_t ret;
-  char *caddress;
-  struct GNUNET_HELLO_Address address;
-
-  if (*agc == 0)
-    return GNUNET_SYSERR; /* Done */
-
-  GNUNET_asprintf (&caddress, "Address%d", *agc);
-  address.peer = pid;
-  address.address_length = strlen (caddress) + 1;
-  address.address = caddress;
-  address.transport_name = "peerinfotest";
-  ret =
-    GNUNET_HELLO_add_address (&address,
-                              GNUNET_TIME_relative_to_absolute
-                                (GNUNET_TIME_UNIT_HOURS), buf, max);
-  GNUNET_free (caddress);
-  *agc = 0;
-  return ret;
-}
-
-
-static void
-add_peer (size_t i)
-{
-  struct GNUNET_HELLO_Message *h2;
-
-  memset (&pid, i, sizeof(pid));
-  h2 = GNUNET_HELLO_create (&pid.public_key,
-                            &address_generator,
-                            &i,
-                            GNUNET_NO);
-  GNUNET_PEERINFO_add_peer (h, h2, NULL, NULL);
-  GNUNET_free (h2);
-}
-
-
-static void
-process (void *cls,
-         const struct GNUNET_PeerIdentity *peer,
-         const struct GNUNET_HELLO_Message *hello,
-         const char *err_msg)
-{
-  struct GNUNET_PEERINFO_IteratorContext **icp = cls;
-
-  if (NULL == peer)
-  {
-    *icp = NULL;
-    return;
-  }
-  numpeers++;
-  if (0 && (NULL != hello))
-    GNUNET_HELLO_iterate_addresses (hello,
-                                    GNUNET_NO,
-                                    &check_it,
-                                    NULL);
-}
-
-
-static void
-run (void *cls,
-     const struct GNUNET_CONFIGURATION_Handle *cfg,
-     struct GNUNET_TESTING_Peer *peer)
-{
-  h = GNUNET_PEERINFO_connect (cfg);
-  GNUNET_assert (h != NULL);
-  for (unsigned int i = 0; i < NUM_REQUESTS; i++)
-  {
-    add_peer (i);
-    ic[i] = GNUNET_PEERINFO_iterate (h,
-                                     GNUNET_YES,
-                                     NULL,
-                                     &process,
-                                     &ic[i]);
-  }
-  tt = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (
-                                       GNUNET_TIME_UNIT_SECONDS,
-                                       5),
-                                     &do_timeout,
-                                     NULL);
-  GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
-                                 NULL);
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  if (0 != GNUNET_TESTING_service_run ("perf-gnunet-peerinfo",
-                                       "peerinfo",
-                                       "test_peerinfo_api_data.conf",
-                                       &run, NULL))
-    return 1;
-  fprintf (stderr,
-           "Received %u/%u calls before timeout\n",
-           numpeers,
-           NUM_REQUESTS * NUM_REQUESTS / 2);
-  GAUGER ("PEERINFO",
-          "Peerinfo lookups",
-          numpeers / 5,
-          "peers/s");
-  return 0;
-}
-
-
-/* end of perf_peerinfo_api.c */
diff --git a/src/peerinfo/test_peerinfo_api.c b/src/peerinfo/test_peerinfo_api.c
deleted file mode 100644
index 27df6e37b..000000000
--- a/src/peerinfo/test_peerinfo_api.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2004, 2009 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo/test_peerinfo_api.c
- * @brief testcase for peerinfo_api.c
- * @author Christian Grothoff
- *
- * TODO:
- * - test merging of HELLOs (add same peer twice...)
- */
-#include "platform.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_testing_lib.h"
-#include "peerinfo.h"
-
-static struct GNUNET_PEERINFO_IteratorContext *ic;
-
-static struct GNUNET_PEERINFO_Handle *h;
-
-static unsigned int retries;
-
-static int global_ret;
-
-
-static int
-check_it (void *cls, const struct GNUNET_HELLO_Address *address,
-          struct GNUNET_TIME_Absolute expiration)
-{
-  unsigned int *agc = cls;
-
-  if (address != NULL)
-  {
-    GNUNET_assert (0 == strcmp ("peerinfotest", address->transport_name));
-    GNUNET_assert (0 ==
-                   strncmp ("Address", address->address,
-                            address->address_length));
-    (*agc) -= (1 << (address->address_length - 1));
-  }
-  return GNUNET_OK;
-}
-
-
-static ssize_t
-address_generator (void *cls, size_t max, void *buf)
-{
-  size_t *agc = cls;
-  ssize_t ret;
-  struct GNUNET_HELLO_Address address;
-
-  if (0 == *agc)
-    return GNUNET_SYSERR; /* Done */
-  memset (&address.peer, 0, sizeof(struct GNUNET_PeerIdentity));
-  address.address = "Address";
-  address.transport_name = "peerinfotest";
-  address.address_length = *agc;
-  ret =
-    GNUNET_HELLO_add_address (&address,
-                              GNUNET_TIME_relative_to_absolute
-                                (GNUNET_TIME_UNIT_HOURS), buf, max);
-  (*agc)--;
-  return ret;
-}
-
-
-struct GNUNET_PeerIdentity pid;
-
-static void
-add_peer ()
-{
-  struct GNUNET_HELLO_Message *h2;
-  size_t agc;
-
-  agc = 2;
-  memset (&pid, 32, sizeof(pid));
-  h2 = GNUNET_HELLO_create (&pid.public_key, &address_generator, &agc,
-                            GNUNET_NO);
-  GNUNET_PEERINFO_add_peer (h, h2, NULL, NULL);
-  GNUNET_free (h2);
-}
-
-
-static void
-process (void *cls, const struct GNUNET_PeerIdentity *peer,
-         const struct GNUNET_HELLO_Message *hello, const char *err_msg)
-{
-  unsigned int agc;
-
-  if (err_msg != NULL)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ ("Error in communication with PEERINFO service\n"));
-  }
-
-  if (peer == NULL)
-  {
-    ic = NULL;
-    if ((3 == global_ret) && (retries < 50))
-    {
-      /* try again */
-      retries++;
-      add_peer ();
-      ic = GNUNET_PEERINFO_iterate (h, GNUNET_NO, NULL,
-                                    &process,
-                                    cls);
-      return;
-    }
-    GNUNET_assert (peer == NULL);
-    GNUNET_assert (2 == global_ret);
-    GNUNET_PEERINFO_disconnect (h);
-    h = NULL;
-    global_ret = 0;
-    return;
-  }
-  if (hello != NULL)
-  {
-    GNUNET_assert (3 == global_ret);
-    agc = 3;
-    GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO,
-                                    &check_it, &agc);
-    GNUNET_assert (agc == 0);
-    global_ret = 2;
-  }
-}
-
-
-static void
-run (void *cls,
-     const struct GNUNET_CONFIGURATION_Handle *cfg,
-     struct GNUNET_TESTING_Peer *peer)
-{
-  h = GNUNET_PEERINFO_connect (cfg);
-  GNUNET_assert (NULL != h);
-  add_peer ();
-  ic = GNUNET_PEERINFO_iterate (h, GNUNET_NO, &pid,
-                                &process, cls);
-}
-
-
-int
-main (int argc, char *argv[])
-{
-  global_ret = 3;
-  if (0 != GNUNET_TESTING_service_run ("test-gnunet-peerinfo",
-                                       "peerinfo",
-                                       "test_peerinfo_api_data.conf",
-                                       &run, NULL))
-    return 1;
-  return global_ret;
-}
-
-
-/* end of test_peerinfo_api.c */
diff --git a/src/peerinfo/test_peerinfo_api_data.conf 
b/src/peerinfo/test_peerinfo_api_data.conf
deleted file mode 100644
index e632c341f..000000000
--- a/src/peerinfo/test_peerinfo_api_data.conf
+++ /dev/null
@@ -1,15 +0,0 @@
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-peerinfo/
-
-[peerinfo]
-PORT = 22354
-
-[dns]
-START_ON_DEMAND = NO
-
-
-
-[nse]
-START_ON_DEMAND = NO
-
-
diff --git a/src/peerinfo/test_peerinfo_api_friend_only.c 
b/src/peerinfo/test_peerinfo_api_friend_only.c
deleted file mode 100644
index a5414e701..000000000
--- a/src/peerinfo/test_peerinfo_api_friend_only.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2004, 2009 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo/test_peerinfo_api_friend_only.c
- * @brief testcase friend only HELLO restrictions in for peerinfo
- * @author Christian Grothoff
- * @author Matthias Wachs
- *
- * TODO:
- * - test merging of HELLOs (add same peer twice...)
- */
-#include "platform.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_testing_lib.h"
-
-
-static struct GNUNET_PEERINFO_IteratorContext *ic;
-
-static struct GNUNET_PEERINFO_Handle *h;
-
-static struct GNUNET_PeerIdentity pid;
-
-static unsigned int retries;
-
-static int global_ret;
-
-
-static ssize_t
-address_generator (void *cls,
-                   size_t max,
-                   void *buf)
-{
-  size_t *agc = cls;
-  ssize_t ret;
-  struct GNUNET_HELLO_Address address;
-
-  if (0 == *agc)
-    return GNUNET_SYSERR; /* Done */
-  memset (&address.peer,
-          0,
-          sizeof(struct GNUNET_PeerIdentity));
-  address.address = "Address";
-  address.transport_name = "peerinfotest";
-  address.address_length = *agc;
-  ret = GNUNET_HELLO_add_address (&address,
-                                  GNUNET_TIME_relative_to_absolute (
-                                    GNUNET_TIME_UNIT_HOURS),
-                                  buf,
-                                  max);
-  (*agc)--;
-  return ret;
-}
-
-
-static void
-add_peer ()
-{
-  struct GNUNET_HELLO_Message *h2;
-  size_t agc;
-
-  agc = 2;
-  memset (&pid, 32, sizeof(pid));
-  h2 = GNUNET_HELLO_create (&pid.public_key,
-                            &address_generator,
-                            &agc,
-                            GNUNET_YES);
-  GNUNET_PEERINFO_add_peer (h,
-                            h2,
-                            NULL,
-                            NULL);
-  GNUNET_free (h2);
-}
-
-
-static void
-process (void *cls,
-         const struct GNUNET_PeerIdentity *peer,
-         const struct GNUNET_HELLO_Message *hello,
-         const char *err_msg)
-{
-  if (NULL != err_msg)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Error in communication with PEERINFO service: %s\n",
-                err_msg);
-  }
-  if (NULL == peer)
-  {
-    ic = NULL;
-    if ((3 == global_ret) && (retries < 50))
-    {
-      /* try again */
-      retries++;
-      add_peer ();
-      ic = GNUNET_PEERINFO_iterate (h,
-                                    GNUNET_NO,
-                                    NULL,
-                                    &process,
-                                    cls);
-      return;
-    }
-    GNUNET_assert (peer == NULL);
-    GNUNET_PEERINFO_disconnect (h);
-    h = NULL;
-    global_ret = 0;
-    return;
-  }
-
-  if ((NULL != hello) &&
-      (GNUNET_YES == GNUNET_HELLO_is_friend_only (hello)))
-  {
-    fprintf (stderr,
-             "Received friend-only HELLO\n");
-    global_ret = 1;
-    GNUNET_PEERINFO_disconnect (h);
-    h = NULL;
-    return;
-  }
-}
-
-
-static void
-run (void *cls,
-     const struct GNUNET_CONFIGURATION_Handle *cfg,
-     struct GNUNET_TESTING_Peer *peer)
-{
-  h = GNUNET_PEERINFO_connect (cfg);
-  GNUNET_assert (NULL != h);
-  add_peer ();
-  ic = GNUNET_PEERINFO_iterate (h,
-                                GNUNET_NO,
-                                &pid,
-                                &process,
-                                NULL);
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  global_ret = 3;
-  if (0 != GNUNET_TESTING_service_run ("test-peerinfo-api-friend-only",
-                                       "peerinfo",
-                                       "test_peerinfo_api_data.conf",
-                                       &run, NULL))
-    return 1;
-  return global_ret;
-}
-
-
-/* end of test_peerinfo_api_friend_only */
diff --git a/src/peerinfo/test_peerinfo_api_notify_friend_only.c 
b/src/peerinfo/test_peerinfo_api_notify_friend_only.c
deleted file mode 100644
index 6d5793dcf..000000000
--- a/src/peerinfo/test_peerinfo_api_notify_friend_only.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2004, 2009 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo/test_peerinfo_api_notify_friend_only.c
- * @brief testcase friend only HELLO restrictions in for peerinfo
- * @author Christian Grothoff
- * @author Matthias Wachs
- *
- * TODO:
- * - test merging of HELLOs (add same peer twice...)
- */
-#include "platform.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_testing_lib.h"
-#include "peerinfo.h"
-
-#define TIMEOUT  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
-
-static struct GNUNET_PEERINFO_Handle *h;
-static struct GNUNET_PEERINFO_NotifyContext *pnc_w_fo;
-static struct GNUNET_PEERINFO_NotifyContext *pnc_wo_fo;
-
-static const struct GNUNET_CONFIGURATION_Handle *mycfg;
-
-static int global_ret;
-
-/**
- * Did we get a HELLO callback for notification handle with friend HELLOS
- * (expected)
- */
-static int res_cb_w_fo;
-
-/**
- * Did we get a HELLO callback for notification handle without friend HELLOS
- * (not expected)
- */
-static int res_cb_wo_fo;
-
-struct GNUNET_PeerIdentity pid;
-
-struct GNUNET_SCHEDULER_Task *timeout_task;
-
-static void
-end_badly (void *cls)
-{
-  timeout_task = NULL;
-  GNUNET_break (0);
-  if (NULL != pnc_wo_fo)
-  {
-    GNUNET_PEERINFO_notify_cancel (pnc_wo_fo);
-    pnc_wo_fo = NULL;
-  }
-  if (NULL != pnc_w_fo)
-  {
-    GNUNET_PEERINFO_notify_cancel (pnc_w_fo);
-    pnc_w_fo = NULL;
-  }
-  if (NULL != h)
-  {
-    GNUNET_PEERINFO_disconnect (h);
-    h = NULL;
-  }
-  global_ret = 255;
-}
-
-
-static void
-done (void *cls)
-{
-  if (NULL != pnc_w_fo)
-    GNUNET_PEERINFO_notify_cancel (pnc_w_fo);
-  pnc_w_fo = NULL;
-  if (NULL != pnc_wo_fo)
-    GNUNET_PEERINFO_notify_cancel (pnc_wo_fo);
-  pnc_wo_fo = NULL;
-  GNUNET_PEERINFO_disconnect (h);
-  h = NULL;
-
-  if (NULL != timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (timeout_task);
-    timeout_task = NULL;
-  }
-
-  if ((GNUNET_YES == res_cb_w_fo) && (GNUNET_NO == res_cb_wo_fo))
-    global_ret = 0;
-  else
-    GNUNET_break (0);
-}
-
-
-static ssize_t
-address_generator (void *cls, size_t max, void *buf)
-{
-  size_t *agc = cls;
-  ssize_t ret;
-  struct GNUNET_HELLO_Address address;
-
-  if (0 == *agc)
-    return GNUNET_SYSERR; /* Done */
-  memset (&address.peer, 0, sizeof(struct GNUNET_PeerIdentity));
-  address.address = "Address";
-  address.transport_name = "peerinfotest";
-  address.address_length = *agc;
-  ret = GNUNET_HELLO_add_address (&address,
-                                  GNUNET_TIME_relative_to_absolute (
-                                    GNUNET_TIME_UNIT_HOURS), buf, max);
-  (*agc)--;
-  return ret;
-}
-
-
-static void
-process_w_fo (void *cls,
-              const struct GNUNET_PeerIdentity *peer,
-              const struct GNUNET_HELLO_Message *hello,
-              const char *err_msg)
-{
-  if (err_msg != NULL)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ ("Error in communication with PEERINFO service\n"));
-    GNUNET_SCHEDULER_add_now (&done, NULL);
-    return;
-  }
-
-  if (NULL != peer)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Received callback for peer `%s' %s HELLO\n", GNUNET_i2s 
(peer),
-                (NULL != hello) ? "with" : "without");
-
-    if (NULL == hello)
-      return;
-
-    if (GNUNET_NO == GNUNET_HELLO_is_friend_only (hello))
-    {
-      GNUNET_break (0);
-      return;
-    }
-
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received %s HELLO for peer `%s'\n",
-                (GNUNET_YES == GNUNET_HELLO_is_friend_only (hello)) ?
-                "friend only" : "public",
-                GNUNET_i2s (peer));
-    if (0 == GNUNET_memcmp (&pid, peer))
-    {
-      res_cb_w_fo = GNUNET_YES;
-      GNUNET_SCHEDULER_add_now (&done, NULL);
-    }
-    return;
-  }
-}
-
-
-static void
-process_wo_fo (void *cls, const struct GNUNET_PeerIdentity *peer,
-               const struct GNUNET_HELLO_Message *hello, const char *err_msg)
-{
-  if (err_msg != NULL)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ ("Error in communication with PEERINFO service\n"));
-    GNUNET_SCHEDULER_add_now (&done, NULL);
-    return;
-  }
-
-  if (NULL != peer)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Received callback for peer `%s' %s HELLO\n", GNUNET_i2s 
(peer),
-                (NULL != hello) ? "with" : "without");
-
-    if (NULL == hello)
-      return;
-
-    if (GNUNET_YES == GNUNET_HELLO_is_friend_only (hello))
-    {
-      GNUNET_break (0);
-      return;
-    }
-
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received %s HELLO for peer `%s'\n",
-                (GNUNET_YES == GNUNET_HELLO_is_friend_only (hello)) ?
-                "friend only" : "public",
-                GNUNET_i2s (peer));
-    if (0 == GNUNET_memcmp (&pid, peer))
-    {
-      GNUNET_break (0);
-      res_cb_wo_fo = GNUNET_YES;
-    }
-  }
-}
-
-
-static void
-add_peer ()
-{
-  struct GNUNET_HELLO_Message *h2;
-  size_t agc;
-
-  agc = 2;
-  memset (&pid, 32, sizeof(pid));
-  h2 = GNUNET_HELLO_create (&pid.public_key, &address_generator, &agc,
-                            GNUNET_YES);
-  GNUNET_PEERINFO_add_peer (h, h2, NULL, NULL);
-  GNUNET_free (h2);
-}
-
-
-static void
-run (void *cls,
-     const struct GNUNET_CONFIGURATION_Handle *cfg,
-     struct GNUNET_TESTING_Peer *peer)
-{
-  timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
-  mycfg = cfg;
-  pnc_w_fo = GNUNET_PEERINFO_notify (mycfg, GNUNET_YES, &process_w_fo, NULL);
-  pnc_wo_fo = GNUNET_PEERINFO_notify (mycfg, GNUNET_NO, &process_wo_fo, NULL);
-  h = GNUNET_PEERINFO_connect (cfg);
-  GNUNET_assert (NULL != h);
-  add_peer ();
-}
-
-
-int
-main (int argc, char *argv[])
-{
-  res_cb_w_fo = GNUNET_NO;
-  res_cb_wo_fo = GNUNET_NO;
-  global_ret = 3;
-  if (0 != GNUNET_TESTING_service_run ("test-peerinfo-api-friend-only",
-                                       "peerinfo",
-                                       "test_peerinfo_api_data.conf",
-                                       &run, NULL))
-    return 1;
-  return global_ret;
-}
-
-
-/* end of test_peerinfo_api_notify_friend_only.c */
diff --git a/src/peerinfo/test_peerinfo_shipped_hellos.c 
b/src/peerinfo/test_peerinfo_shipped_hellos.c
deleted file mode 100644
index 45ea73be6..000000000
--- a/src/peerinfo/test_peerinfo_shipped_hellos.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2004, 2009 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file peerinfo/test_peerinfo_shipped_hellos.c
- * @brief testcase for shipped HELLOs getting parsed
- * @author Christian Grothoff
- * @author Matthias Wachs
- *
- */
-#include "platform.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_testing_lib.h"
-#include "peerinfo.h"
-
-static struct GNUNET_PEERINFO_IteratorContext *ic;
-
-static struct GNUNET_PEERINFO_Handle *h;
-
-static int global_ret;
-
-
-static int
-addr_cb (void *cls,
-         const struct GNUNET_HELLO_Address *address,
-         struct GNUNET_TIME_Absolute expiration)
-{
-  unsigned int *addr = cls;
-
-  (*addr)++;
-  return GNUNET_OK;
-}
-
-
-static void
-process (void *cls,
-         const struct GNUNET_PeerIdentity *peer,
-         const struct GNUNET_HELLO_Message *hello,
-         const char *err_msg)
-{
-  static unsigned int calls = 0;
-  unsigned int addr;
-
-  if (NULL != err_msg)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Error in communication with PEERINFO service: %s\n",
-                err_msg);
-  }
-  if (NULL != peer)
-  {
-    addr = 0;
-    if (NULL != hello)
-    {
-      GNUNET_HELLO_iterate_addresses (hello,
-                                      GNUNET_NO,
-                                      &addr_cb,
-                                      &addr);
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Got information about peer %s with %u addresses\n",
-                  GNUNET_i2s (peer),
-                  addr);
-      calls++;
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Got no HELLP for peer %s\n",
-                  GNUNET_i2s (peer));
-    }
-  }
-  else
-  {
-    if (0 == calls)
-    {
-      fprintf (stderr,
-               "Failed: got no callbacks!\n");
-      global_ret = 1;
-      GNUNET_PEERINFO_disconnect (h);
-      h = NULL;
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Got %u HELLOs in total\n",
-                  calls);
-      global_ret = 0;
-      GNUNET_PEERINFO_disconnect (h);
-      h = NULL;
-    }
-  }
-}
-
-
-static void
-run (void *cls,
-     const struct GNUNET_CONFIGURATION_Handle *cfg,
-     struct GNUNET_TESTING_Peer *peer)
-{
-  h = GNUNET_PEERINFO_connect (cfg);
-  GNUNET_assert (NULL != h);
-  ic = GNUNET_PEERINFO_iterate (h,
-                                GNUNET_YES,
-                                NULL,
-                                &process,
-                                cls);
-  GNUNET_assert (NULL != ic);
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  global_ret = 3;
-  if (0 != GNUNET_TESTING_service_run ("test_peerinfo_shipped_hellos",
-                                       "peerinfo",
-                                       "test_peerinfo_api_data.conf",
-                                       &run, NULL))
-    return 1;
-  return global_ret;
-}
-
-
-/* end of test_peerinfo_shipped_hellos.c */
diff --git a/src/peerstore/Makefile.am b/src/peerstore/Makefile.am
index 41fa18b98..7220492f2 100644
--- a/src/peerstore/Makefile.am
+++ b/src/peerstore/Makefile.am
@@ -38,13 +38,15 @@ gnunet_service_peerstore_SOURCES = \
 gnunet_service_peerstore_CFLAGS = $(AM_CFLAGS)
 gnunet_service_peerstore_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/hello/libgnunethello.la \
   $(GN_LIBINTL)
 
 libgnunetpeerstore_la_SOURCES = \
   peerstore_api.c \
   peerstore_common.c
 libgnunetpeerstore_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/hello/libgnunethello.la
 libgnunetpeerstore_la_LDFLAGS = \
   $(GN_LIBINTL) \
   $(GN_LIB_LDFLAGS)
diff --git a/src/peerstore/gnunet-service-peerstore.c 
b/src/peerstore/gnunet-service-peerstore.c
index 959d088f9..4c05a14fc 100644
--- a/src/peerstore/gnunet-service-peerstore.c
+++ b/src/peerstore/gnunet-service-peerstore.c
@@ -28,6 +28,7 @@
 #include "peerstore.h"
 #include "gnunet_peerstore_plugin.h"
 #include "peerstore_common.h"
+#include "gnunet_hello_uri_lib.h"
 
 
 /**
@@ -532,6 +533,89 @@ handle_store (void *cls, const struct StoreRecordMessage 
*srm)
   }
 }
 
+static void
+store_hello_continuation (void *cls, int success)
+{
+  (void) cls;
+
+  if (GNUNET_OK != success)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Error storing bootstrap hello!\n");
+    GNUNET_break (0);
+  }
+}
+
+
+static int
+hosts_directory_scan_callback (void *cls, const char *fullname)
+{
+  (void) cls;
+  const char *filename;
+  ssize_t size_total;
+  char buffer[GNUNET_MAX_MESSAGE_SIZE - 1] GNUNET_ALIGN;
+  const struct GNUNET_MessageHeader *hello;
+  struct GNUNET_HELLO_Builder *builder;
+  struct GNUNET_PeerIdentity *pid;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "1 hosts_directory_scan_callback filename %s\n",
+              fullname);
+
+  if (GNUNET_YES != GNUNET_DISK_file_test (fullname))
+    return GNUNET_OK; /* ignore non-files */
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "2 hosts_directory_scan_callback filename %s\n",
+              fullname);
+
+  /* filename = strrchr (fullname, DIR_SEPARATOR); */
+  /* if ((NULL == filename) || (1 > strlen (filename))) */
+  /*   filename = fullname; */
+  /* else */
+  /*   filename++; */
+
+  /* GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, */
+  /*             "3 hosts_directory_scan_callback filename %s\n", */
+  /*             filename); */
+
+  /* if (GNUNET_YES != GNUNET_DISK_file_test (filename)) */
+  /*   return GNUNET_OK; */
+  size_total = GNUNET_DISK_fn_read (fullname, buffer, sizeof(buffer));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Read %d bytes from `%s'\n",
+              (int) size_total,
+              fullname);
+  if ((size_total < 0) ||
+      (((size_t) size_total) < sizeof(struct GNUNET_MessageHeader)))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                _ ("Failed to parse HELLO in file `%s': %s\n"),
+                fullname,
+                "File has invalid size");
+    return GNUNET_OK;
+  }
+  hello = (const struct GNUNET_MessageHeader *) &buffer[0];
+  builder = GNUNET_HELLO_builder_from_msg (hello);
+  pid = GNUNET_HELLO_builder_get_id (builder);
+
+  if (GNUNET_OK != db->store_record (db->cls,
+                                     "peerstore",
+                                     pid,
+                                     "",
+                                     hello,
+                                     size_total,
+                                     GNUNET_TIME_UNIT_FOREVER_ABS,
+                                     GNUNET_PEERSTORE_STOREOPTION_REPLACE,
+                                     &store_hello_continuation,
+                                     NULL))
+  {
+    GNUNET_break (0);
+  }
+  GNUNET_HELLO_builder_free (builder);
+  return GNUNET_OK;
+}
+
 
 /**
  * Peerstore service runner.
@@ -546,10 +630,14 @@ run (void *cls,
      struct GNUNET_SERVICE_Handle *service)
 {
   char *database;
+  int use_included;
+  char *ip;
+  char *peerdir;
 
   in_shutdown = GNUNET_NO;
   num_clients = 0;
   cfg = c;
+
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg,
                                                           "peerstore",
                                                           "DATABASE",
@@ -574,6 +662,33 @@ run (void *cls,
   }
   watchers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
   expire_task = GNUNET_SCHEDULER_add_now (&cleanup_expired_records, NULL);
+
+  use_included = GNUNET_CONFIGURATION_get_value_yesno (cfg,
+                                                       "peerstore",
+                                                       "USE_INCLUDED_HELLOS");
+  if (GNUNET_SYSERR == use_included)
+    use_included = GNUNET_NO;
+  if (GNUNET_YES == use_included)
+  {
+    ip = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
+    GNUNET_asprintf (&peerdir, "%shellos", ip);
+    GNUNET_free (ip);
+
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                _ ("Importing HELLOs from `%s'\n"),
+                peerdir);
+
+    GNUNET_DISK_directory_scan (peerdir,
+                                &hosts_directory_scan_callback,
+                                NULL);
+    GNUNET_free (peerdir);
+  }
+  else
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                _ ("Skipping import of included HELLOs\n"));
+  }
+
   GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
 }
 
diff --git a/src/peerstore/meson.build b/src/peerstore/meson.build
index 7fcbf284b..6c9853852 100644
--- a/src/peerstore/meson.build
+++ b/src/peerstore/meson.build
@@ -21,7 +21,7 @@ libgnunetpeerstore = library('gnunetpeerstore',
         libgnunetpeerstore_src,
         soversion: '0',
         version: '0.0.0',
-        dependencies: libgnunetutil_dep,
+        dependencies: [libgnunetutil_dep, libgnunethello_dep],
         include_directories: [incdir, configuration_inc],
         install: true,
         install_dir: get_option('libdir'))
@@ -41,7 +41,9 @@ shared_module('gnunet_plugin_peerstore_sqlite',
 
 executable ('gnunet-service-peerstore',
             gnunetservicepeerstore_src,
-            dependencies: [libgnunetpeerstore_dep, libgnunetutil_dep],
+            dependencies: [libgnunetpeerstore_dep,
+                           libgnunetutil_dep,
+                           libgnunethello_dep],
             include_directories: [incdir, configuration_inc],
             install: true,
             install_dir: get_option('libdir') / 'gnunet' / 'libexec')
diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c
index 1c13369cf..e2ed06d28 100644
--- a/src/peerstore/peerstore_api.c
+++ b/src/peerstore/peerstore_api.c
@@ -25,8 +25,10 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
+#include "gnunet_hello_uri_lib.h"
 #include "peerstore.h"
 #include "peerstore_common.h"
+#include "gnunet_peerstore_service.h"
 
 #define LOG(kind, ...) GNUNET_log_from (kind, "peerstore-api", __VA_ARGS__)
 
@@ -156,6 +158,22 @@ struct GNUNET_PEERSTORE_StoreContext
   enum GNUNET_PEERSTORE_StoreOption options;
 };
 
+/**
+ * Closure for store callback when storing hello uris.
+ */
+struct StoreHelloCls
+{
+  /**
+   * The corresponding store context.
+   */
+  struct GNUNET_PEERSTORE_StoreContext *sc;
+
+  /**
+   * The corresponding hello uri add request.
+   */
+  struct GNUNET_PEERSTORE_StoreHelloContext *huc;
+};
+
 /**
  * Context for a iterate request
  */
@@ -241,6 +259,103 @@ struct GNUNET_PEERSTORE_WatchContext
    * Hash of the combined key
    */
   struct GNUNET_HashCode keyhash;
+
+  /**
+   * The iteration context to deliver the actual values for the key.
+   */
+  struct GNUNET_PEERSTORE_IterateContext *ic;
+
+  /**
+   * The peer we are watching for values.
+   */
+  const struct GNUNET_PeerIdentity *peer;
+
+  /**
+   * The key we like to watch for values.
+   */
+  const char *key;
+
+  /**
+   * The sub system requested the watch.
+   */
+  const char *sub_system;
+};
+
+/**
+ * Context for the info handler.
+ */
+struct GNUNET_PEERSTORE_NotifyContext
+{
+  /**
+   * Peerstore handle.
+   */
+  struct GNUNET_PEERSTORE_Handle *h;
+
+  /**
+   * Function to call with information.
+   */
+  GNUNET_PEERSTORE_hello_notify_cb callback;
+
+  /**
+   * Closure for @e callback.
+   */
+  void *callback_cls;
+
+  /**
+   * The watch for this context.
+   */
+  struct GNUNET_PEERSTORE_WatchContext *wc;
+
+  /**
+   * Is this request canceled.
+   */
+  unsigned int canceled;
+};
+
+/**
+ * Context for a add hello uri request.
+ */
+struct GNUNET_PEERSTORE_StoreHelloContext
+{
+  /**
+   * Peerstore handle.
+   */
+  struct GNUNET_PEERSTORE_Handle *h;
+
+  /**
+   * Function to call with information.
+   */
+  GNUNET_PEERSTORE_Continuation cont;
+
+  /**
+   * Closure for @e callback.
+   */
+  void *cont_cls;
+
+  /**
+   * Map with all store contexts started during adding hello.
+   */
+  struct GNUNET_CONTAINER_MultiPeerMap *store_context_map;
+
+  /**
+   * Active watch to be notified about conflicting hello uri add requests.
+   */
+  struct GNUNET_PEERSTORE_WatchContext *wc;
+
+  /**
+   * Hello uri which was request for storing.
+   */
+  struct GNUNET_MessageHeader *hello;
+
+  /**
+   * The peer id for the hello.
+   */
+  struct GNUNET_PeerIdentity *pid;
+
+  /**
+   * Was this request successful.
+   */
+  int success;
 };
 
 
/******************************************************************************/
@@ -877,6 +992,13 @@ GNUNET_PEERSTORE_watch_cancel (struct 
GNUNET_PEERSTORE_WatchContext *wc)
   struct StoreKeyHashMessage *hm;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Canceling watch.\n");
+  if (NULL != wc->ic)
+  {
+    GNUNET_PEERSTORE_iterate_cancel (wc->ic);
+    GNUNET_free (wc);
+    return;
+  }
+
   ev = GNUNET_MQ_msg (hm, GNUNET_MESSAGE_TYPE_PEERSTORE_WATCH_CANCEL);
   hm->keyhash = wc->keyhash;
   GNUNET_MQ_send (h->mq, ev);
@@ -887,9 +1009,66 @@ GNUNET_PEERSTORE_watch_cancel (struct 
GNUNET_PEERSTORE_WatchContext *wc)
 }
 
 
+static void
+watch_iterate (void *cls,
+           const struct GNUNET_PEERSTORE_Record *record,
+           const char *emsg)
+{
+  struct GNUNET_PEERSTORE_WatchContext *wc = cls;
+  struct GNUNET_PEERSTORE_Handle *h = wc->h;
+  struct StoreKeyHashMessage *hm;
+
+  if (NULL != emsg)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Got failure from PEERSTORE: %s\n",
+                emsg);
+    wc->callback (wc->callback_cls, NULL, emsg);
+    return;
+  }
+  if (NULL == record)
+  {
+    struct GNUNET_MQ_Envelope *ev;
+    const struct GNUNET_PeerIdentity *peer;
+
+    if (NULL == wc->peer)
+      peer = GNUNET_new (struct GNUNET_PeerIdentity);
+    else
+      peer = wc->peer;
+    ev = GNUNET_MQ_msg (hm, GNUNET_MESSAGE_TYPE_PEERSTORE_WATCH);
+    PEERSTORE_hash_key (wc->sub_system, peer, wc->key, &hm->keyhash);
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Hash key we watch for %s\n",
+         GNUNET_h2s_full (&hm->keyhash));
+    wc->keyhash = hm->keyhash;
+    if (NULL == h->watches)
+      h->watches = GNUNET_CONTAINER_multihashmap_create (5, GNUNET_NO);
+    GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (
+                     h->watches,
+                     &wc->keyhash,
+                     wc,
+                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Sending a watch request for subsystem `%s', peer `%s', key `%s'.\n",
+         wc->sub_system,
+         GNUNET_i2s (peer),
+         wc->key);
+    GNUNET_MQ_send (h->mq, ev);
+    wc->ic = NULL;
+    if (NULL != wc->callback)
+      wc->callback (wc->callback_cls, record, NULL);
+    return;
+  }
+
+  if (NULL != wc->callback)
+    wc->callback (wc->callback_cls, record, NULL);
+}
+
+
 /**
  * Request watching a given key
- * User will be notified with any new values added to key
+ * User will be notified with any new values added to key,
+ * all existing entries are supplied beforehand.
  *
  * @param h handle to the PEERSTORE service
  * @param sub_system name of sub system
@@ -907,32 +1086,315 @@ GNUNET_PEERSTORE_watch (struct GNUNET_PEERSTORE_Handle 
*h,
                         GNUNET_PEERSTORE_Processor callback,
                         void *callback_cls)
 {
-  struct GNUNET_MQ_Envelope *ev;
-  struct StoreKeyHashMessage *hm;
+  struct GNUNET_PEERSTORE_IterateContext *ic;
   struct GNUNET_PEERSTORE_WatchContext *wc;
 
-  ev = GNUNET_MQ_msg (hm, GNUNET_MESSAGE_TYPE_PEERSTORE_WATCH);
-  PEERSTORE_hash_key (sub_system, peer, key, &hm->keyhash);
   wc = GNUNET_new (struct GNUNET_PEERSTORE_WatchContext);
   wc->callback = callback;
   wc->callback_cls = callback_cls;
   wc->h = h;
-  wc->keyhash = hm->keyhash;
-  if (NULL == h->watches)
-    h->watches = GNUNET_CONTAINER_multihashmap_create (5, GNUNET_NO);
-  GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (
-                   h->watches,
-                   &wc->keyhash,
-                   wc,
-                   GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Sending a watch request for subsystem `%s', peer `%s', key `%s'.\n",
-       sub_system,
-       GNUNET_i2s (peer),
-       key);
-  GNUNET_MQ_send (h->mq, ev);
+  wc->ic = ic;
+  wc->key = key;
+  wc->peer = peer;
+  wc->sub_system = sub_system;
+
+  ic = GNUNET_PEERSTORE_iterate (h,
+                                 sub_system,
+                                 peer,
+                                 key,
+                                 &watch_iterate,
+                                 wc);
+
   return wc;
 }
 
 
+/******************************************************************************/
+/*******************            HELLO FUNCTIONS           
*********************/
+/******************************************************************************/
+
+
+static void
+hello_updated (void *cls,
+               const struct GNUNET_PEERSTORE_Record *record,
+               const char *emsg)
+{
+  struct GNUNET_PEERSTORE_NotifyContext *nc = cls;
+  struct GNUNET_PEERSTORE_Handle *h = nc->h;
+  const struct GNUNET_MessageHeader *hello;
+  struct GNUNET_HELLO_Builder *builder;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "hello_updated\n");
+  if (NULL != emsg)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Got failure from PEERSTORE: %s\n",
+                emsg);
+    nc->callback (nc->callback_cls, NULL, NULL, emsg);
+    return;
+  }
+  if (NULL == record)
+    return;
+  hello = record->value;
+  builder = GNUNET_HELLO_builder_from_msg (hello);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "hello_updated with expired %s and size %u for peer %s\n",
+              GNUNET_STRINGS_absolute_time_to_string 
(GNUNET_HELLO_builder_get_expiration_time (hello)),
+              ntohs (hello->size),
+              GNUNET_i2s (&record->peer));
+  if ((0 == record->value_size))
+  {
+    GNUNET_break (0);
+    return;
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "hello_updated call callback\n");
+  nc->callback (nc->callback_cls, &record->peer, hello, NULL);
+}
+
+
+struct GNUNET_PEERSTORE_NotifyContext *
+GNUNET_PEERSTORE_hello_changed_notify (struct GNUNET_PEERSTORE_Handle *h,
+                                       int include_friend_only,
+                                       GNUNET_PEERSTORE_hello_notify_cb 
callback,
+                                       void *callback_cls)
+{
+  struct GNUNET_PEERSTORE_NotifyContext *nc;
+
+  nc = GNUNET_new (struct GNUNET_PEERSTORE_NotifyContext);
+  nc->callback = callback;
+  nc->callback_cls = callback_cls;
+  nc->h = h;
+
+  nc->wc = GNUNET_PEERSTORE_watch (h,
+                               "peerstore",
+                               NULL,
+                               GNUNET_PEERSTORE_HELLO_KEY,
+                               &hello_updated,
+                               nc);
+
+  return nc;
+}
+
+
+/**
+ * Stop notifying about changes.
+ *
+ * @param nc context to stop notifying
+ */
+void
+GNUNET_PEERSTORE_hello_changed_notify_cancel (struct
+                                              GNUNET_PEERSTORE_NotifyContext 
*nc)
+{
+  struct GNUNET_PEERSTORE_IterateContext *ic;
+  struct GNUNET_PEERSTORE_Handle *h = nc->h;
+
+  if (NULL != nc->wc)
+  {
+    GNUNET_PEERSTORE_watch_cancel (nc->wc);
+    nc->wc = NULL;
+  }
+}
+
+
+static void
+merge_success (void *cls, int success)
+{
+  struct StoreHelloCls *shu_cls = cls;
+  struct GNUNET_PEERSTORE_StoreHelloContext *huc = shu_cls->huc;
+  struct GNUNET_PEERSTORE_Handle *h = huc->h;
+
+  if (GNUNET_OK != success)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Storing hello uri failed\n");
+    huc->cont (huc->cont_cls, success);
+    GNUNET_free (huc->hello);
+    GNUNET_free (huc->pid);
+    GNUNET_free (huc);
+    return;
+  }
+  GNUNET_CONTAINER_multipeermap_remove (huc->store_context_map, huc->pid, 
shu_cls->sc);
+  if (0 == GNUNET_CONTAINER_multipeermap_size (huc->store_context_map))
+  {
+    GNUNET_PEERSTORE_watch_cancel (huc->wc);
+    huc->wc = NULL;
+    huc->cont (huc->cont_cls, GNUNET_OK);
+    huc->success = GNUNET_OK;
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Storing hello uri succeeded for peer %s!\n",
+                GNUNET_i2s (huc->pid));
+    GNUNET_free (huc->hello);
+    GNUNET_free (huc->pid);
+    GNUNET_free (huc);
+    return;
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Got notified during storing hello uri for peer %s!\n",
+              GNUNET_i2s (huc->pid));
+}
+
+
+static void
+store_hello (struct GNUNET_PEERSTORE_StoreHelloContext *huc,
+             const struct GNUNET_MessageHeader *hello)
+{
+  struct GNUNET_PEERSTORE_Handle *h = huc->h;
+  struct GNUNET_PeerIdentity *pid;
+  struct GNUNET_PEERSTORE_StoreContext *sc;
+  struct StoreHelloCls *shu_cls = GNUNET_new (struct StoreHelloCls);
+  struct GNUNET_TIME_Absolute hello_exp;
+
+  shu_cls->huc = huc;
+  hello_exp = GNUNET_HELLO_builder_get_expiration_time (hello);
+  sc = GNUNET_PEERSTORE_store (h,
+                               "peerstore",
+                               huc->pid,
+                               GNUNET_PEERSTORE_HELLO_KEY,
+                               hello,
+                               ntohs (hello->size),
+                               hello_exp,
+                               GNUNET_PEERSTORE_STOREOPTION_MULTIPLE,
+                               merge_success,
+                               shu_cls);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "store_hello with expiration %s\n",
+              GNUNET_STRINGS_absolute_time_to_string (hello_exp));
+  GNUNET_CONTAINER_multipeermap_put (huc->store_context_map,
+                                     huc->pid,
+                                     sc,
+                                     
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+  shu_cls->sc = sc;
+}
+
+
+static void
+merge_uri  (void *cls,
+            const struct GNUNET_PEERSTORE_Record *record,
+            const char *emsg)
+{
+  struct GNUNET_PEERSTORE_StoreHelloContext *huc = cls;
+  struct GNUNET_PEERSTORE_Handle *h = huc->h;
+  struct GNUNET_PEERSTORE_WatchContext *wc;
+  struct GNUNET_MessageHeader *hello;
+  struct GNUNET_TIME_Absolute huc_hello_exp_time;
+  struct GNUNET_TIME_Absolute record_hello_exp_time;
+  const char *val;
+
+  if (NULL != emsg)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Got failure from PEERSTORE: %s\n",
+                emsg);
+    return;
+  }
+
+  if (NULL == record && GNUNET_NO == huc->success)
+  {
+    huc_hello_exp_time = GNUNET_HELLO_builder_get_expiration_time (huc->hello);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "merge_uri just store for peer %s with expiration %s\n",
+                GNUNET_i2s (huc->pid),
+                GNUNET_STRINGS_absolute_time_to_string (huc_hello_exp_time));
+    store_hello (huc, huc->hello);
+  }
+  else if (GNUNET_NO == huc->success && 0 == GNUNET_memcmp (huc->pid, 
&record->peer))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "merge_uri record for peer %s\n",
+              GNUNET_i2s (&record->peer));
+    hello = record->value;
+    if ((0 == record->value_size))
+    {
+      GNUNET_break (0);
+      return;
+    }
+
+    huc_hello_exp_time = GNUNET_HELLO_builder_get_expiration_time (huc->hello);
+    record_hello_exp_time = GNUNET_HELLO_builder_get_expiration_time (hello);
+
+    if (GNUNET_TIME_absolute_cmp (huc_hello_exp_time, >, 
record_hello_exp_time))
+      store_hello (huc, huc->hello);
+  }
+}
+
+
+struct GNUNET_PEERSTORE_StoreHelloContext *
+GNUNET_PEERSTORE_hello_add (struct GNUNET_PEERSTORE_Handle *h,
+                            const struct GNUNET_MessageHeader *msg,
+                            GNUNET_PEERSTORE_Continuation cont,
+                            void *cont_cls)
+{
+  struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (msg);
+  struct GNUNET_PEERSTORE_StoreHelloContext *huc;
+  struct GNUNET_PeerIdentity *pid;
+  struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+  struct GNUNET_TIME_Absolute hello_exp =
+    GNUNET_HELLO_builder_get_expiration_time (msg);
+  struct GNUNET_TIME_Absolute huc_exp;
+  uint16_t pid_size;
+  uint16_t size_msg = ntohs (msg->size);
+
+  if (NULL == builder)
+    return NULL;
+  if (GNUNET_TIME_absolute_cmp (hello_exp, <, now))
+    return NULL;
+
+  huc = GNUNET_new (struct GNUNET_PEERSTORE_StoreHelloContext);
+  huc->store_context_map = GNUNET_CONTAINER_multipeermap_create (1, GNUNET_NO);
+  huc->h = h;
+  huc->cont = cont;
+  huc->cont_cls = cont_cls;
+  huc->hello = GNUNET_malloc (size_msg);
+  GNUNET_memcpy (huc->hello, msg, size_msg);
+  huc_exp =
+    GNUNET_HELLO_builder_get_expiration_time (huc->hello);
+  pid = GNUNET_HELLO_builder_get_id (builder);
+  pid_size = sizeof (struct GNUNET_PeerIdentity);
+  huc->pid = GNUNET_malloc (pid_size);
+  GNUNET_memcpy (huc->pid, pid, pid_size);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Adding hello for peer %s with expiration %s msg size %u\n",
+       GNUNET_i2s (huc->pid),
+       GNUNET_STRINGS_absolute_time_to_string (huc_exp),
+       size_msg);
+  huc->wc = GNUNET_PEERSTORE_watch (h,
+                               "peerstore",
+                               NULL,
+                               GNUNET_PEERSTORE_HELLO_KEY,
+                               &merge_uri,
+                               huc);
+  GNUNET_HELLO_builder_free (builder);
+
+  return huc;
+}
+
+
+static enum GNUNET_GenericReturnValue
+free_store_context(void *cls,
+                   const struct GNUNET_PeerIdentity *key,
+                   void *value)
+{
+  (void) cls;
+
+  GNUNET_PEERSTORE_store_cancel ((struct GNUNET_PEERSTORE_StoreContext *) 
value);
+  return GNUNET_YES; // FIXME why is this a map anyway
+}
+
+
+void
+GNUNET_PEERSTORE_hello_add_cancel (struct
+                                   GNUNET_PEERSTORE_StoreHelloContext *huc)
+{
+  GNUNET_PEERSTORE_watch_cancel (huc->wc);
+  GNUNET_CONTAINER_multipeermap_iterate (huc->store_context_map,
+                                         free_store_context,
+                                         NULL);
+  GNUNET_free (huc->hello);
+  GNUNET_free (huc->pid);
+  GNUNET_free (huc);
+}
+
+
 /* end of peerstore_api.c */
diff --git a/src/regex/Makefile.am b/src/regex/Makefile.am
index b7d14bc41..b526a0c8c 100644
--- a/src/regex/Makefile.am
+++ b/src/regex/Makefile.am
@@ -94,8 +94,7 @@ libgnunet_plugin_block_regex_la_LDFLAGS = \
 #endif
 
 noinst_PROGRAMS = $(noinst_mysql_progs) \
-  perf-regex \
-  gnunet-regex-profiler
+  perf-regex
 
 perf_regex_SOURCES = \
   $(REGEX_INTERNAL_TEST) perf-regex.c
@@ -107,19 +106,6 @@ perf_regex_LDADD = -lm \
 perf_regex_LDFLAGS = \
   $(GN_LIBINTL)
 
-gnunet_regex_profiler_SOURCES = \
-  $(REGEX_INTERNAL_TEST) gnunet-regex-profiler.c
-gnunet_regex_profiler_LDADD = -lm \
-  $(top_builddir)/src/arm/libgnunetarm.la \
-  $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  $(top_builddir)/src/dht/libgnunetdht.la \
-  libgnunetregexblock.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la
-gnunet_regex_profiler_LDFLAGS = \
-  $(GN_LIBINTL)
-
 gnunet_daemon_regexprofiler_SOURCES = \
   $(REGEX_INTERNAL_TEST) gnunet-daemon-regexprofiler.c
 gnunet_daemon_regexprofiler_LDADD = -lm \
diff --git a/src/revocation/Makefile.am b/src/revocation/Makefile.am
index 71f30aab2..a375b7587 100644
--- a/src/revocation/Makefile.am
+++ b/src/revocation/Makefile.am
@@ -99,11 +99,11 @@ test_revocation_LDADD = \
  $(top_builddir)/src/testbed/libgnunettestbed.la
 
 check_PROGRAMS = \
- test_revocation \
- test_revocation_lsd0001testvectors
+ #test_revocation \
+ #test_revocation_lsd0001testvectors
 
 check_SCRIPTS = \
-  test_local_revocation.py
+ #test_local_revocation.py
 
 if ENABLE_TEST_RUN
  AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
diff --git a/src/rps/Makefile.am b/src/rps/Makefile.am
index b5e8c0617..8f7c104f9 100644
--- a/src/rps/Makefile.am
+++ b/src/rps/Makefile.am
@@ -61,9 +61,8 @@ gnunet_service_rps_SOURCES = \
 gnunet_service_rps_LDADD = \
   libgnunetrps.la \
   $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
+  $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
   $(top_builddir)/src/nse/libgnunetnse.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/core/libgnunetcore.la \
@@ -76,12 +75,12 @@ check_PROGRAMS = \
  test_service_rps_view \
  test_service_rps_custommap \
  test_service_rps_sampler_elem \
- test_rps_single_req \
  test_rps_req_cancel \
- test_rps_sub \
- test_rps_seed_request \
- test_rps_seed_big \
- test_rps_churn
+ test_rps_seed_big 
+ # test_rps_single_req \
+ # test_rps_churn
+ # test_rps_sub \
+ # test_rps_seed_request 
 if ENABLE_MALICIOUS
 check_PROGRAMS += \
  test_rps_malicious_1 \
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index be9324af9..76e33c87b 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -28,7 +28,7 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_cadet_service.h"
 #include "gnunet_core_service.h"
-#include "gnunet_peerinfo_service.h"
+#include "gnunet_peerstore_service.h"
 #include "gnunet_nse_service.h"
 #include "gnunet_statistics_service.h"
 #include "rps.h"
@@ -36,6 +36,7 @@
 #include "gnunet-service-rps_sampler.h"
 #include "gnunet-service-rps_custommap.h"
 #include "gnunet-service-rps_view.h"
+#include "gnunet_constants.h"
 
 #include <math.h>
 #include <inttypes.h>
@@ -498,14 +499,15 @@ static float beta;
 static struct GNUNET_NSE_Handle *nse;
 
 /**
- * Handler to PEERINFO.
+ * Handle to the PEERSTORE service.
  */
-static struct GNUNET_PEERINFO_Handle *peerinfo_handle;
+static struct GNUNET_PEERSTORE_Handle *peerstore;
 
 /**
- * Handle for cancellation of iteration over peers.
+ * Our peerstore notification context.  We use notification
+ * to instantly learn about new peers as they are discovered.
  */
-static struct GNUNET_PEERINFO_NotifyContext *peerinfo_notify_handle;
+static struct GNUNET_PEERSTORE_NotifyContext *peerstore_notify;
 
 
 #if ENABLE_MALICIOUS
@@ -4696,13 +4698,13 @@ valid_peers_iterator (void *cls,
 void
 process_peerinfo_peers (void *cls,
                         const struct GNUNET_PeerIdentity *peer,
-                        const struct GNUNET_HELLO_Message *hello,
-                        const char *err_msg)
+                        const struct GNUNET_MessageHeader *hello,
+                        const char *emsg)
 {
   struct Sub *sub = cls;
 
   (void) hello;
-  (void) err_msg;
+  (void) emsg;
 
   if (NULL != peer)
   {
@@ -4742,9 +4744,9 @@ shutdown_task (void *cls)
   }
 
   /* Disconnect from other services */
-  GNUNET_PEERINFO_notify_cancel (peerinfo_notify_handle);
-  GNUNET_PEERINFO_disconnect (peerinfo_handle);
-  peerinfo_handle = NULL;
+  GNUNET_PEERSTORE_hello_changed_notify_cancel (peerstore_notify);
+  GNUNET_PEERSTORE_disconnect (peerstore, GNUNET_YES);
+  peerstore = NULL;
   GNUNET_NSE_disconnect (nse);
   if (NULL != map_single_hop)
   {
@@ -4934,7 +4936,7 @@ run (void *cls,
                   round_interval);
 
 
-  peerinfo_handle = GNUNET_PEERINFO_connect (cfg);
+  peerstore = GNUNET_PEERSTORE_connect (cfg);
 
   /* connect to NSE */
   nse = GNUNET_NSE_connect (cfg, nse_callback, NULL);
@@ -4946,10 +4948,10 @@ run (void *cls,
   restore_valid_peers (msub);
   get_valid_peers (msub->valid_peers, valid_peers_iterator, msub);
 
-  peerinfo_notify_handle = GNUNET_PEERINFO_notify (cfg,
-                                                   GNUNET_NO,
-                                                   process_peerinfo_peers,
-                                                   msub);
+  peerstore_notify = GNUNET_PEERSTORE_hello_changed_notify (peerstore,
+                                                            GNUNET_NO,
+                                                            
process_peerinfo_peers,
+                                                            msub);
 
   LOG (GNUNET_ERROR_TYPE_INFO, "Ready to receive requests from clients\n");
 
diff --git a/src/scalarproduct/Makefile.am b/src/scalarproduct/Makefile.am
index cf05e8377..8b3b160c6 100644
--- a/src/scalarproduct/Makefile.am
+++ b/src/scalarproduct/Makefile.am
@@ -101,7 +101,7 @@ check_SCRIPTS = \
   test_scalarproduct_negativezero.sh
 
 check_PROGRAMS = \
-  test_ecc_scalarproduct
+  # test_ecc_scalarproduct
 
 if ENABLE_TEST_RUN
   AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c 
b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
index c43a7e854..b8bac0803 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
@@ -35,6 +35,7 @@
 #include "gnunet_seti_service.h"
 #include "scalarproduct.h"
 #include "gnunet-service-scalarproduct-ecc.h"
+#include "gnunet_constants.h"
 
 #define LOG(kind, ...) \
   GNUNET_log_from (kind, "scalarproduct-alice", __VA_ARGS__)
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_alice.c 
b/src/scalarproduct/gnunet-service-scalarproduct_alice.c
index 59c3c6f6c..0149f45ba 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct_alice.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct_alice.c
@@ -35,6 +35,7 @@
 #include "gnunet_seti_service.h"
 #include "scalarproduct.h"
 #include "gnunet-service-scalarproduct.h"
+#include "gnunet_constants.h"
 
 #define LOG(kind, ...) \
   GNUNET_log_from (kind, "scalarproduct-alice", __VA_ARGS__)
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_bob.c 
b/src/scalarproduct/gnunet-service-scalarproduct_bob.c
index 15ad3038e..65e732675 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct_bob.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct_bob.c
@@ -35,6 +35,7 @@
 #include "gnunet_seti_service.h"
 #include "scalarproduct.h"
 #include "gnunet-service-scalarproduct.h"
+#include "gnunet_constants.h"
 
 #define LOG(kind, ...) GNUNET_log_from (kind, "scalarproduct-bob", __VA_ARGS__)
 
diff --git a/src/secretsharing/Makefile.am b/src/secretsharing/Makefile.am
index 5f49947bc..3a86236cd 100644
--- a/src/secretsharing/Makefile.am
+++ b/src/secretsharing/Makefile.am
@@ -16,21 +16,22 @@ endif
 libexec_PROGRAMS = \
  gnunet-service-secretsharing
 
-noinst_PROGRAMS = \
- gnunet-secretsharing-profiler
+#noinst_PROGRAMS = \
+# gnunet-secretsharing-profiler
 
 lib_LTLIBRARIES = \
   libgnunetsecretsharing.la
 
 
-gnunet_secretsharing_profiler_SOURCES = \
- gnunet-secretsharing-profiler.c
-gnunet_secretsharing_profiler_LDADD = \
-  libgnunetsecretsharing.la \
-  $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/testbed/libgnunettestbed.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(GN_LIBINTL)
+# TNG
+#gnunet_secretsharing_profiler_SOURCES = \
+# gnunet-secretsharing-profiler.c
+#gnunet_secretsharing_profiler_LDADD = \
+#  libgnunetsecretsharing.la \
+#  $(top_builddir)/src/testing/libgnunettesting.la \
+#  $(top_builddir)/src/testbed/libgnunettestbed.la \
+#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(GN_LIBINTL)
 
 gnunet_service_secretsharing_SOURCES = \
  gnunet-service-secretsharing.c \
@@ -55,7 +56,7 @@ libgnunetsecretsharing_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)
 
 check_PROGRAMS = \
- test_secretsharing_api
+ # test_secretsharing_api
 
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
diff --git a/src/set/Makefile.am b/src/set/Makefile.am
index bf4c8229c..a9e39a728 100644
--- a/src/set/Makefile.am
+++ b/src/set/Makefile.am
@@ -66,9 +66,9 @@ libgnunetset_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)
 
 check_PROGRAMS = \
- test_set_api \
- test_set_union_result_symmetric \
- test_set_intersection_result_full \
+ # test_set_api \
+ # test_set_union_result_symmetric \
+ # test_set_intersection_result_full \
  test_set_union_copy
 
 if ENABLE_TEST_RUN
diff --git a/src/seti/Makefile.am b/src/seti/Makefile.am
index 37484b51f..6b0df430b 100644
--- a/src/seti/Makefile.am
+++ b/src/seti/Makefile.am
@@ -54,7 +54,7 @@ libgnunetseti_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)
 
 check_PROGRAMS = \
- test_seti_api
+ # test_seti_api
 
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
diff --git a/src/setu/Makefile.am b/src/setu/Makefile.am
index 5c33148cd..377fe82c3 100644
--- a/src/setu/Makefile.am
+++ b/src/setu/Makefile.am
@@ -64,8 +64,8 @@ libgnunetsetu_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)
 
 check_PROGRAMS = \
- test_setu_api \
- perf_setu_api
+ # test_setu_api \
+ # perf_setu_api
 
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
diff --git a/src/sq/sq.c b/src/sq/sq.c
index 557ec2771..96d1d333d 100644
--- a/src/sq/sq.c
+++ b/src/sq/sq.c
@@ -22,7 +22,6 @@
  * @brief helper functions for Sqlite3 DB interactions
  * @author Christian Grothoff
  */
-#include "gnunet_common.h"
 #include "platform.h"
 #include "gnunet_sq_lib.h"
 
diff --git a/src/sq/sq_prepare.c b/src/sq/sq_prepare.c
index 1df564bfb..d1ca0e8bd 100644
--- a/src/sq/sq_prepare.c
+++ b/src/sq/sq_prepare.c
@@ -22,7 +22,6 @@
  * @brief helper functions for executing SQL statements
  * @author Christian Grothoff
  */
-#include "gnunet_common.h"
 #include "platform.h"
 #include "gnunet_sq_lib.h"
 
diff --git a/src/testbed/meson.build b/src/testbed/meson.build
index 9d254d54a..b7f12b824 100644
--- a/src/testbed/meson.build
+++ b/src/testbed/meson.build
@@ -37,7 +37,7 @@ libgnunettestbed = library('gnunettestbed',
                        libgnunetstatistics_dep,
                        libgnunethello_dep,
                        libgnunettesting_dep,
-                       libgnunettransport_dep,
+                       #libgnunettransport_dep,
                        libgnunetarm_dep],
         include_directories: [incdir, configuration_inc],
         install: true,
@@ -52,11 +52,11 @@ executable ('gnunet-helper-testbed',
             dependencies: [libgnunetutil_dep,
                            libgnunetcore_dep,
                            libgnunethello_dep,
-                           libgnunetpeerinfo_dep,
+                           libgnunetpeerstore_dep,
                            libgnunetstatistics_dep,
                            libgnunettestbed_dep,
                            libgnunettesting_dep,
-                           libgnunettransport_dep,
+                           #libgnunettransport_dep,
                            zlib_dep],
             include_directories: [incdir, configuration_inc],
             install:true,
@@ -66,9 +66,10 @@ executable ('gnunet-daemon-testbed-blacklist',
             dependencies: [libgnunetutil_dep,
                            libgnunetcore_dep,
                            libgnunethello_dep,
-                           libgnunetpeerinfo_dep,
+                           libgnunetpeerstore_dep,
                            libgnunetstatistics_dep,
-                           libgnunettransport_dep],
+                           #libgnunettransport_dep
+                           ],
             include_directories: [incdir, configuration_inc],
             install:true,
             install_dir: get_option('libdir')/'gnunet'/'libexec')
@@ -78,9 +79,9 @@ executable ('gnunet-daemon-testbed-underlay',
             dependencies: [libgnunetutil_dep,
                            libgnunetcore_dep,
                            libgnunethello_dep,
-                           libgnunetpeerinfo_dep,
+                           libgnunetpeerstore_dep,
                            libgnunetstatistics_dep,
-                           libgnunettransport_dep,
+                           #libgnunettransport_dep,
                            sqlite_dep],
             include_directories: [incdir, configuration_inc],
             install:true,
@@ -89,7 +90,7 @@ executable ('gnunet-daemon-testbed-underlay',
 executable ('gnunet-testbed-profiler',
             ['gnunet-testbed-profiler.c'],
             dependencies: [libgnunetutil_dep,
-                           libgnunetats_dep,
+              #libgnunetats_dep,
                            libgnunettestbed_dep],
             include_directories: [incdir, configuration_inc],
             install:true,
@@ -106,22 +107,23 @@ executable ('gnunet-service-testbed',
              'gnunet-service-testbed_connectionpool.c'],
             dependencies: [libgnunetutil_dep,
                            libgnunetcore_dep,
-                           libgnunetats_dep,
+                           #             libgnunetats_dep,
                            libgnunetarm_dep,
                            libgnunethello_dep,
                            libgnunettestbed_dep,
                            libgnunettesting_dep,
-                           libgnunettransport_dep,
+                           #libgnunettransport_dep,
                            zlib_dep],
             include_directories: [incdir, configuration_inc],
             install:true,
             install_dir: get_option('libdir')/'gnunet'/'libexec')
 
-executable ('gnunet-daemon-latency-logger',
-            ['gnunet-daemon-latency-logger.c'],
-            dependencies: [libgnunetutil_dep,
-                           libgnunetats_dep,
-                           sqlite_dep],
-            include_directories: [incdir, configuration_inc],
-            install:true,
-            install_dir: get_option('libdir')/'gnunet'/'libexec')
+# Needs ATS
+#executable ('gnunet-daemon-latency-logger',
+#            ['gnunet-daemon-latency-logger.c'],
+#            dependencies: [libgnunetutil_dep,
+#              #libgnunetats_dep,
+#                           sqlite_dep],
+#            include_directories: [incdir, configuration_inc],
+#            install:true,
+#            install_dir: get_option('libdir')/'gnunet'/'libexec')
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 649128d4d..0c55b8aea 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -14,6 +14,7 @@ dist_pkgcfg_DATA = \
   testing.conf
 
 libexec_PROGRAMS = \
+ test_testing_start_with_config \
   gnunet-cmds-helper
 
 plugindir = $(libdir)/gnunet
@@ -29,6 +30,9 @@ gnunet_cmds_helper_LDADD = $(XLIB) \
  $(LTLIBINTL) $(Z_LIBS)
 
 libgnunettesting_la_SOURCES = \
+  testing_api_cmd_stop_peer.c \
+  testing_api_cmd_start_peer.c \
+  testing_api_cmd_exec_bash_script.c \
   testing_api_cmd_barrier.c \
   testing_api_cmd_barrier_reached.c \
   testing_api_cmd_finish.c \
@@ -80,14 +84,21 @@ check_PROGRAMS = \
  test_testing_peerstartup2 \
  test_testing_sharedservices
 
-if ENABLE_TEST_RUN
-AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
-TESTS = \
- test_testing_portreservation \
- test_testing_peerstartup \
- test_testing_peerstartup2 \
- test_testing_servicestartup
-endif
+# if ENABLE_TEST_RUN_TESTING
+# AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
+# TESTS = \
+#  test_testing_portreservation \
+#  test_testing_peerstartup \
+#  test_testing_peerstartup2 \
+#  test_testing_servicestartup
+# endif
+
+test_testing_start_with_config_SOURCES = \
+ test_testing_start_with_config.c
+test_testing_start_with_config_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/hello/libgnunethello.la 
 
 test_testing_portreservation_SOURCES = \
  test_testing_portreservation.c
diff --git a/src/transport/test_transport_start_with_config.c 
b/src/testing/test_testing_start_with_config.c
similarity index 89%
copy from src/transport/test_transport_start_with_config.c
copy to src/testing/test_testing_start_with_config.c
index 9a8b5ee05..a2c692dbc 100644
--- a/src/transport/test_transport_start_with_config.c
+++ b/src/testing/test_testing_start_with_config.c
@@ -26,7 +26,6 @@
 #include "platform.h"
 #include "gnunet_testing_ng_lib.h"
 #include "gnunet_testing_netjail_lib.h"
-#include "transport-testing-cmds.h"
 #include "gnunet_util_lib.h"
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
@@ -95,13 +94,13 @@ main (int argc,
                                       topology_data_script,
                                       &read_file),
     GNUNET_TESTING_cmd_netjail_start_cmds_helper ("netjail-start-testbed",
-                                                  topology,
-                                                  &read_file,
-                                                  topology_data_script,
-                                                  TIMEOUT),
+                                                     topology,
+                                                     &read_file,
+                                                     topology_data_script,
+                                                     TIMEOUT),
     GNUNET_TESTING_cmd_stop_cmds_helper ("stop-testbed",
-                                         "netjail-start-testbed",
-                                         topology),
+                                            "netjail-start-testbed",
+                                            topology),
     GNUNET_TESTING_cmd_netjail_stop ("netjail-stop",
                                      topology_data_script,
                                      &read_file),
diff --git a/src/testing/testing_api_cmd_barrier_reached.c 
b/src/testing/testing_api_cmd_barrier_reached.c
index 0075f8ef0..161240d4d 100644
--- a/src/testing/testing_api_cmd_barrier_reached.c
+++ b/src/testing/testing_api_cmd_barrier_reached.c
@@ -181,7 +181,7 @@ barrier_reached_traits (void *cls,
   struct GNUNET_TESTING_AsyncContext *ac = &brs->ac;
 
   struct GNUNET_TESTING_Trait traits[] = {
-    GNUNET_TESTING_make_trait_async_context ((const void *) ac),
+    GNUNET_TESTING_make_trait_async_context (ac),
     GNUNET_TESTING_trait_end ()
   };
 
diff --git a/src/testing/testing_api_cmd_block_until_external_trigger.c 
b/src/testing/testing_api_cmd_block_until_external_trigger.c
index 58f095842..6a3b00e51 100644
--- a/src/testing/testing_api_cmd_block_until_external_trigger.c
+++ b/src/testing/testing_api_cmd_block_until_external_trigger.c
@@ -58,8 +58,8 @@ block_until_external_trigger_traits (void *cls,
   struct GNUNET_TESTING_BlockState *bs = cls;
   struct GNUNET_TESTING_AsyncContext *ac = &bs->ac;
   struct GNUNET_TESTING_Trait traits[] = {
-    GNUNET_TESTING_make_trait_async_context ((const void *) ac),
-    GNUNET_TESTING_make_trait_block_state ((const void *) bs),
+    GNUNET_TESTING_make_trait_async_context (ac),
+    GNUNET_TESTING_make_trait_block_state (bs),
     GNUNET_TESTING_trait_end ()
   };
 
diff --git a/src/testing/testing_api_cmd_netjail_start.c 
b/src/testing/testing_api_cmd_exec_bash_script.c
similarity index 50%
copy from src/testing/testing_api_cmd_netjail_start.c
copy to src/testing/testing_api_cmd_exec_bash_script.c
index f45ab939b..7e7aafb69 100644
--- a/src/testing/testing_api_cmd_netjail_start.c
+++ b/src/testing/testing_api_cmd_exec_bash_script.c
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      Copyright (C) 2021 GNUnet e.V.
+      Copyright (C) 2023 GNUnet e.V.
 
       GNUnet is free software: you can redistribute it and/or modify it
       under the terms of the GNU Affero General Public License as published
@@ -19,87 +19,85 @@
  */
 
 /**
- * @file testing/testing_api_cmd_netjail_start.c
- * @brief Command to start the netjail script.
+ * @file testing_api_cmd_local_test_prepared.c
+ * @brief cmd to block the interpreter loop until all peers started.
  * @author t3sserakt
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_testing_ng_lib.h"
-#include "gnunet_testing_plugin.h"
-#include "gnunet_testing_barrier.h"
-#include "gnunet_testing_netjail_lib.h"
-
-#define NETJAIL_START_SCRIPT "netjail_start.sh"
 
 #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
 
-/**
- * Struct to hold information for callbacks.
- *
- */
-struct NetJailState
+struct BashScriptState
 {
   /**
    * Context for our asynchronous completion.
    */
   struct GNUNET_TESTING_AsyncContext ac;
 
+  /**
+   * Callback handed over to the command, which should
+   * be called upon death or completion of the script.
+   */
+  GNUNET_ChildCompletedCallback cb;
+
   // Child Wait handle
   struct GNUNET_ChildWaitHandle *cwh;
 
-  /**
-   * The process id of the start script.
+   /**
+   * The process id of the script.
    */
   struct GNUNET_OS_Process *start_proc;
 
   /**
-   * Configuration file for the test topology.
+   * Script this cmd will execute.
    */
-  char *topology_config;
+  const char *script;
+
 
   /**
-   * Shall we read the topology from file, or from a string.
+   * Arguments for the script
    */
-  unsigned int *read_file;
-};
+  char **script_argv;
 
+  /**
+   * Size of script_argv.
+   */
+  int argc;
+};
 
 /**
  * The cleanup function of this cmd frees resources the cmd allocated.
  *
  */
 static void
-netjail_start_cleanup (void *cls)
+exec_bash_script_cleanup (void *cls)
 {
-  struct NetJailState *ns = cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "netjail_start_cleanup!\n");
+  struct BashScriptState *bss = cls;
 
-  if (NULL != ns->cwh)
+  if (NULL != bss->cwh)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Cancel child\n");
-    GNUNET_wait_child_cancel (ns->cwh);
-    ns->cwh = NULL;
+    GNUNET_wait_child_cancel (bss->cwh);
+    bss->cwh = NULL;
   }
-  if (NULL != ns->start_proc)
+  if (NULL != bss->start_proc)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Kill process\n");
     GNUNET_assert (0 ==
-                   GNUNET_OS_process_kill (ns->start_proc,
+                   GNUNET_OS_process_kill (bss->start_proc,
                                            SIGKILL));
     GNUNET_assert (GNUNET_OK ==
-                   GNUNET_OS_process_wait (ns->start_proc));
-    GNUNET_OS_process_destroy (ns->start_proc);
-    ns->start_proc = NULL;
+                   GNUNET_OS_process_wait (bss->start_proc));
+    GNUNET_OS_process_destroy (bss->start_proc);
+    bss->start_proc = NULL;
   }
-  GNUNET_free (ns);
+  GNUNET_free (bss);
 }
 
-
 /**
  * Callback which will be called if the setup script finished.
  *
@@ -109,45 +107,45 @@ child_completed_callback (void *cls,
                           enum GNUNET_OS_ProcessStatusType type,
                           long unsigned int exit_code)
 {
-  struct NetJailState *ns = cls;
+  struct BashScriptState *bss = cls;
 
-  GNUNET_OS_process_destroy (ns->start_proc);
-  ns->start_proc = NULL;
-  ns->cwh = NULL;
+  GNUNET_OS_process_destroy (bss->start_proc);
+  bss->start_proc = NULL;
+  bss->cwh = NULL;
   if (0 == exit_code)
   {
-    GNUNET_TESTING_async_finish (&ns->ac);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Child succeeded!\n");
+    GNUNET_TESTING_async_finish (&bss->ac);
   }
   else
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Child failed with error %lu!\n",
                 exit_code);
-    GNUNET_TESTING_async_fail (&ns->ac);
+    GNUNET_TESTING_async_fail (&bss->ac);
   }
+  bss->cb (cls, type, exit_code);
 }
 
-
 /**
-* The run method starts the script which setup the network namespaces.
-*
-* @param cls closure.
-* @param is interpreter state.
-*/
+ * Run method of the command created by the interpreter to wait for another
+ * command to finish.
+ *
+ */
 static void
-netjail_start_run (void *cls,
-                   struct GNUNET_TESTING_Interpreter *is)
+exec_bash_script_run (void *cls,
+            struct GNUNET_TESTING_Interpreter *is)
 {
-  struct NetJailState *ns = cls;
-  char pid[15];
+  struct BashScriptState *bss = cls;
   enum GNUNET_GenericReturnValue helper_check;
+  char *argv[bss->argc + 2];
+
   char *data_dir;
   char *script_name;
-  char *read_file;
 
   data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
-  GNUNET_asprintf (&script_name, "%s%s", data_dir, NETJAIL_START_SCRIPT);
-  GNUNET_asprintf (&read_file, "%u", *(ns->read_file));
+  GNUNET_asprintf (&script_name, "%s%s", data_dir, bss->script);
 
   helper_check = GNUNET_OS_check_helper_binary (
     script_name,
@@ -174,58 +172,45 @@ netjail_start_run (void *cls,
     GNUNET_TESTING_interpreter_fail (is);
     return;
   }
-
-  GNUNET_snprintf (pid,
-                   sizeof (pid),
-                   "%u",
-                   getpid ());
+  argv[0] = script_name;
+  if (NULL != bss->script_argv)
   {
-    char *const script_argv[] = {
-      script_name,
-      ns->topology_config,
-      pid,
-      read_file,
-      NULL
-    };
-
-    ns->start_proc
-      = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
+    for (int i = 0; i < bss->argc;i++)
+      argv[i + 1] = bss->script_argv[i];
+  }
+  argv[bss->argc] = NULL;
+
+  bss->start_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
                                      NULL,
                                      NULL,
                                      NULL,
                                      script_name,
-                                     script_argv);
-
-  }
-  ns->cwh = GNUNET_wait_child (ns->start_proc,
+                                     argv);
+  bss->cwh = GNUNET_wait_child (bss->start_proc,
                                &child_completed_callback,
-                               ns);
-  GNUNET_break (NULL != ns->cwh);
-  GNUNET_free (read_file);
-  GNUNET_free (script_name);
-  GNUNET_free (data_dir);
+                               bss);
+  GNUNET_break (NULL != bss->cwh);
 }
 
-
-/**
- * Create command.
- *
- * @param label name for command.
- * @param topology_config Configuration file for the test topology.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_start (const char *label,
-                                  char *topology_config,
-                                  unsigned int *read_file)
+const struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_exec_bash_script (const char *label,
+                                     const char *script,
+                                     char *const script_argv[],
+                                    int argc,
+                                    GNUNET_ChildCompletedCallback cb)
 {
-  struct NetJailState *ns;
-
-  ns = GNUNET_new (struct NetJailState);
-  ns->topology_config = topology_config;
-  ns->read_file = read_file;
-  return GNUNET_TESTING_command_new (ns, label,
-                                     &netjail_start_run,
-                                     &netjail_start_cleanup,
-                                     NULL, &ns->ac);
+  struct BashScriptState *bss;
+
+  bss = GNUNET_new (struct BashScriptState);
+  bss->script = script;
+  bss->script_argv = script_argv; // FIXME this is not just a cast to fix
+  bss->argc = argc;
+  bss->cb = cb;
+
+  return GNUNET_TESTING_command_new (bss,
+                                    label,
+                                     &exec_bash_script_run,
+                                     &exec_bash_script_cleanup,
+                                     NULL,
+                                     &bss->ac);
 }
diff --git a/src/transport/transport_api_cmd_start_peer.c 
b/src/testing/testing_api_cmd_start_peer.c
similarity index 59%
copy from src/transport/transport_api_cmd_start_peer.c
copy to src/testing/testing_api_cmd_start_peer.c
index 244f8d79b..e2a2c0fbf 100644
--- a/src/transport/transport_api_cmd_start_peer.c
+++ b/src/testing/testing_api_cmd_start_peer.c
@@ -25,12 +25,9 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
+#include "testing_cmds.h"
 #include "gnunet_testing_ng_lib.h"
 #include "gnunet_testing_netjail_lib.h"
-#include "gnunet_peerstore_service.h"
-#include "gnunet_transport_core_service.h"
-#include "gnunet_transport_application_service.h"
-#include "transport-testing-cmds.h"
 
 /**
  * Generic logging shortcut
@@ -38,128 +35,6 @@
 #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
 
 
-static void
-retrieve_hello (void *cls);
-
-
-/**
- * Callback delivering the hello of this peer from peerstore.
- *
- */
-static void
-hello_iter_cb (void *cb_cls,
-               const struct GNUNET_PEERSTORE_Record *record,
-               const char *emsg)
-{
-  struct StartPeerState *sps = cb_cls;
-  if (NULL == record)
-  {
-    sps->pic = NULL;
-    sps->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, sps);
-    return;
-  }
-  // Check record type et al?
-  sps->hello_size = record->value_size;
-  sps->hello = GNUNET_malloc (sps->hello_size);
-  memcpy (sps->hello, record->value, sps->hello_size);
-  sps->hello[sps->hello_size - 1] = '\0';
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Our hello %s\n",
-       sps->hello);
-  GNUNET_PEERSTORE_iterate_cancel (sps->pic);
-  sps->pic = NULL;
-  GNUNET_TESTING_async_finish (&sps->ac);
-}
-
-
-/**
- * Function to start the retrieval task to retrieve the hello of this peer
- * from the peerstore.
- *
- */
-static void
-retrieve_hello (void *cls)
-{
-  struct StartPeerState *sps = cls;
-  sps->rh_task = NULL;
-  sps->pic = GNUNET_PEERSTORE_iterate (sps->ph,
-                                       "transport",
-                                       &sps->id,
-                                       GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY,
-                                       hello_iter_cb,
-                                       sps);
-
-}
-
-
-/**
- * Disconnect callback for the connection to the core service.
- *
- */
-static void
-notify_disconnect (void *cls,
-                   const struct GNUNET_PeerIdentity *peer,
-                   void *handler_cls)
-{
-  struct StartPeerState *sps = cls;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Peer %s disconnected from peer %u (`%s')\n",
-       GNUNET_i2s (peer),
-       sps->no,
-       GNUNET_i2s (&sps->id));
-
-}
-
-
-/**
- * Connect callback for the connection to the core service.
- *
- */
-static void *
-notify_connect (void *cls,
-                const struct GNUNET_PeerIdentity *peer,
-                struct GNUNET_MQ_Handle *mq)
-{
-  struct StartPeerState *sps = cls;
-  struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode);
-  struct GNUNET_HashCode hc;
-  struct GNUNET_CRYPTO_EddsaPublicKey public_key = peer->public_key;
-
-  void *ret = (struct GNUNET_PeerIdentity *) peer;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "This Peer %s \n",
-       GNUNET_i2s (&sps->id));
-
-
-  GNUNET_CRYPTO_hash (&public_key, sizeof(public_key), &hc);
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Peer %s connected to peer number %u with mq %p\n",
-       GNUNET_i2s (peer),
-       sps->no,
-       mq);
-
-
-  memcpy (key,
-          &hc,
-          sizeof (*key));
-  GNUNET_CONTAINER_multishortmap_put (sps->connected_peers_map,
-                                      key,
-                                      mq,
-                                      
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-
-  GNUNET_free (key);
-
-  sps->notify_connect (sps->ac.is,
-                       peer);
-
-  return ret;
-}
-
-
 /**
  * The run method of this cmd will start all services of a peer to test the 
transport service.
  *
@@ -168,7 +43,7 @@ static void
 start_peer_run (void *cls,
                 struct GNUNET_TESTING_Interpreter *is)
 {
-  struct StartPeerState *sps = cls;
+  struct GNUNET_TESTING_StartPeerState *sps = cls;
   char *emsg = NULL;
   struct GNUNET_PeerIdentity dummy;
   const struct GNUNET_TESTING_Command *system_cmd;
@@ -321,47 +196,6 @@ start_peer_run (void *cls,
        sps->no,
        GNUNET_i2s_full (&sps->id));
 
-  sps->th = GNUNET_TRANSPORT_core_connect (sps->cfg,
-                                           NULL,
-                                           sps->handlers,
-                                           sps,
-                                           &notify_connect,
-                                           &notify_disconnect);
-  if (NULL == sps->th)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Failed to connect to transport service for peer `%s': `%s'\n",
-         sps->cfgname,
-         emsg);
-    GNUNET_free (emsg);
-    GNUNET_TESTING_interpreter_fail (is);
-    return;
-  }
-
-  sps->ph = GNUNET_PEERSTORE_connect (sps->cfg);
-  if (NULL == sps->th)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Failed to connect to peerstore service for peer `%s': `%s'\n",
-         sps->cfgname,
-         emsg);
-    GNUNET_free (emsg);
-    GNUNET_TESTING_interpreter_fail (is);
-    return;
-  }
-
-  sps->ah = GNUNET_TRANSPORT_application_init (sps->cfg);
-  if (NULL == sps->ah)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Failed to initialize the TRANSPORT application suggestion client 
handle for peer `%s': `%s'\n",
-         sps->cfgname,
-         emsg);
-    GNUNET_free (emsg);
-    GNUNET_TESTING_interpreter_fail (is);
-    return;
-  }
-  sps->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, sps);
   GNUNET_free (home);
   GNUNET_free (transport_unix_path);
   GNUNET_free (tcp_communicator_unix_path);
@@ -378,14 +212,9 @@ start_peer_run (void *cls,
 static void
 start_peer_cleanup (void *cls)
 {
-  struct StartPeerState *sps = cls;
+  struct GNUNET_TESTING_StartPeerState *sps = cls;
 
-  if (NULL != sps->handlers)
-  {
-    GNUNET_free (sps->handlers);
-    sps->handlers = NULL;
-  }
-  // TODO Investigate why this caused problems during shutdown.
+  //TODO Investigate why this caused problems during shutdown.
   /*if (NULL != sps->cfg)
   {
     GNUNET_CONFIGURATION_destroy (sps->cfg);
@@ -410,7 +239,7 @@ start_peer_traits (void *cls,
                    const char *trait,
                    unsigned int index)
 {
-  struct StartPeerState *sps = cls;
+  struct GNUNET_TESTING_StartPeerState *sps = cls;
   struct GNUNET_TRANSPORT_ApplicationHandle *ah = sps->ah;
   struct GNUNET_PeerIdentity *id = &sps->id;
   struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map =
@@ -420,15 +249,15 @@ start_peer_traits (void *cls,
 
 
   struct GNUNET_TESTING_Trait traits[] = {
-    GNUNET_TRANSPORT_make_trait_application_handle ((const void *) ah),
-    GNUNET_TRANSPORT_make_trait_peer_id ((const void *) id),
-    GNUNET_TRANSPORT_make_trait_connected_peers_map ((const
+    GNUNET_TESTING_make_trait_application_handle ((const void *) ah),
+    GNUNET_TESTING_make_trait_peer_id ((const void *) id),
+    GNUNET_TESTING_make_trait_connected_peers_map ((const
                                                       void *)
                                                      connected_peers_map),
-    GNUNET_TRANSPORT_make_trait_hello ((const void *) hello),
-    GNUNET_TRANSPORT_make_trait_hello_size ((const void *) hello_size),
-    GNUNET_TRANSPORT_make_trait_state ((const void *) sps),
-    GNUNET_TRANSPORT_make_trait_broadcast ((const void *) &sps->broadcast),
+    GNUNET_TESTING_make_trait_hello ((const void *) hello),
+    GNUNET_TESTING_make_trait_hello_size ((const void *) hello_size),
+    GNUNET_TESTING_make_trait_state ((const void *) sps),
+    GNUNET_TESTING_make_trait_broadcast ((const void *) &sps->broadcast),
     GNUNET_TESTING_trait_end ()
   };
 
@@ -440,44 +269,30 @@ start_peer_traits (void *cls,
 
 
 struct GNUNET_TESTING_Command
-GNUNET_TRANSPORT_cmd_start_peer (const char *label,
+GNUNET_TESTING_cmd_start_peer (const char *label,
                                  const char *system_label,
                                  uint32_t no,
                                  const char *node_ip,
-                                 struct GNUNET_MQ_MessageHandler *handlers,
                                  const char *cfgname,
-                                 GNUNET_TRANSPORT_notify_connect_cb
-                                 notify_connect,
                                  unsigned int broadcast)
 {
-  struct StartPeerState *sps;
+  struct GNUNET_TESTING_StartPeerState *sps;
   struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map =
     GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
   unsigned int i;
 
-  sps = GNUNET_new (struct StartPeerState);
+  sps = GNUNET_new (struct GNUNET_TESTING_StartPeerState);
   sps->no = no;
   sps->system_label = GNUNET_strdup (system_label);
   sps->connected_peers_map = connected_peers_map;
   sps->cfgname = GNUNET_strdup (cfgname);
   sps->node_ip = GNUNET_strdup (node_ip);
-  sps->notify_connect = notify_connect;
   sps->broadcast = broadcast;
 
-  if (NULL != handlers)
-  {
-    for (i = 0; NULL != handlers[i].cb; i++)
-      ;
-    sps->handlers = GNUNET_new_array (i + 1,
-                                      struct GNUNET_MQ_MessageHandler);
-    GNUNET_memcpy (sps->handlers,
-                   handlers,
-                   i * sizeof(struct GNUNET_MQ_MessageHandler));
-  }
   return GNUNET_TESTING_command_new (sps,
                                      label,
                                      &start_peer_run,
                                      &start_peer_cleanup,
                                      &start_peer_traits,
-                                     &sps->ac);
+                                     NULL);
 }
diff --git a/src/transport/transport_api_cmd_stop_peer.c 
b/src/testing/testing_api_cmd_stop_peer.c
similarity index 79%
copy from src/transport/transport_api_cmd_stop_peer.c
copy to src/testing/testing_api_cmd_stop_peer.c
index a80742b5f..2cbf978c6 100644
--- a/src/transport/transport_api_cmd_stop_peer.c
+++ b/src/testing/testing_api_cmd_stop_peer.c
@@ -27,10 +27,6 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_testing_ng_lib.h"
 #include "gnunet_testing_netjail_lib.h"
-#include "gnunet_peerstore_service.h"
-#include "gnunet_transport_core_service.h"
-#include "gnunet_transport_application_service.h"
-#include "transport-testing-cmds.h"
 
 /**
  * Generic logging shortcut
@@ -58,34 +54,14 @@ stop_peer_run (void *cls,
                struct GNUNET_TESTING_Interpreter *is)
 {
   struct StopPeerState *stop_ps = cls;
-  const struct StartPeerState *sps;
+  const struct GNUNET_TESTING_StartPeerState *sps;
   const struct GNUNET_TESTING_Command *start_cmd;
 
   start_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
                                                          stop_ps->start_label);
-  GNUNET_TRANSPORT_get_trait_state (start_cmd,
+  GNUNET_TESTING_get_trait_state (start_cmd,
                                     &sps);
-
-  if (NULL != sps->pic)
-  {
-    GNUNET_PEERSTORE_iterate_cancel (sps->pic);
-  }
-  if (NULL != sps->th)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Disconnecting from TRANSPORT service\n");
-    GNUNET_TRANSPORT_core_disconnect (sps->th);
-  }
-  if (NULL != sps->ah)
-  {
-    GNUNET_TRANSPORT_application_done (sps->ah);
-  }
-  if (NULL != sps->ph)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Disconnecting from PEERSTORE service\n");
-    GNUNET_PEERSTORE_disconnect (sps->ph, GNUNET_NO);
-  }
+  
   if (NULL != sps->peer)
   {
     if (GNUNET_OK !=
@@ -138,7 +114,7 @@ stop_peer_traits (void *cls,
  * @return command.
  */
 struct GNUNET_TESTING_Command
-GNUNET_TRANSPORT_cmd_stop_peer (const char *label,
+GNUNET_TESTING_cmd_stop_peer (const char *label,
                                 const char *start_label)
 {
   struct StopPeerState *sps;
diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am
index e5920116b..aeb05eec7 100644
--- a/src/topology/Makefile.am
+++ b/src/topology/Makefile.am
@@ -33,10 +33,9 @@ gnunet_daemon_topology_SOURCES = \
 gnunet_daemon_topology_LDADD = \
   libgnunetfriends.la \
   $(top_builddir)/src/core/libgnunetcore.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
+  $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/transport/libgnunettransport.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
+  $(top_builddir)/src/transport/libgnunettransportapplication.la \
   $(top_builddir)/src/hello/libgnunethello.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(GN_LIBINTL)
@@ -45,10 +44,10 @@ gnunet_daemon_topology_LDADD = \
 check_PROGRAMS = \
  test_gnunet_daemon_topology
 
-if ENABLE_TEST_RUN
-AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
-TESTS = $(check_PROGRAMS)
-endif
+# if ENABLE_TEST_RUN
+# AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
+# TESTS = $(check_PROGRAMS)
+# endif
 
 test_gnunet_daemon_topology_SOURCES = \
  test_gnunet_daemon_topology.c
diff --git a/src/topology/gnunet-daemon-topology.c 
b/src/topology/gnunet-daemon-topology.c
index b380c0bd4..ca4df0911 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -38,14 +38,17 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
+#include "gnunet_hello_uri_lib.h"
 #include "gnunet_friends_lib.h"
 #include "gnunet_constants.h"
 #include "gnunet_core_service.h"
 #include "gnunet_protocols.h"
-#include "gnunet_peerinfo_service.h"
+#include "gnunet_peerstore_service.h"
 #include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_ats_service.h"
+#include "gnunet_transport_application_service.h"
+
+
+// TODO Remove all occurrencies of friends_only and minimum_friend_count.
 
 
 /**
@@ -78,9 +81,9 @@ struct Peer
   struct GNUNET_MQ_Handle *mq;
 
   /**
-   * Pointer to the HELLO message of this peer; can be NULL.
+   * Pointer to the hello uri of this peer; can be NULL.
    */
-  struct GNUNET_HELLO_Message *hello;
+  struct GNUNET_MessageHeader *hello;
 
   /**
    * Bloom filter used to mark which peers already got the HELLO
@@ -105,9 +108,9 @@ struct Peer
   struct GNUNET_SCHEDULER_Task *hello_delay_task;
 
   /**
-   * Handle for our connectivity suggestion for this peer.
+   * Transport suggest handle.
    */
-  struct GNUNET_ATS_ConnectivitySuggestHandle *sh;
+  struct GNUNET_TRANSPORT_ApplicationSuggestHandle *ash;
 
   /**
    * How much would we like to connect to this peer?
@@ -122,10 +125,17 @@ struct Peer
 
 
 /**
- * Our peerinfo notification context.  We use notification
+ * The task to delayed start the notification process intially.
+ * We like to give transport some time to give us our hello to distribute it.
+ */
+struct GNUNET_SCHEDULER_Task *peerstore_notify_task;
+
+
+/**
+ * Our peerstore notification context.  We use notification
  * to instantly learn about new peers as they are discovered.
  */
-static struct GNUNET_PEERINFO_NotifyContext *peerinfo_notify;
+static struct GNUNET_PEERSTORE_NotifyContext *peerstore_notify;
 
 /**
  * Our configuration.
@@ -138,20 +148,25 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
 static struct GNUNET_CORE_Handle *handle;
 
 /**
- * Handle to the PEERINFO service.
+ * Handle to the PEERSTORE service.
  */
-static struct GNUNET_PEERINFO_Handle *pi;
+static struct GNUNET_PEERSTORE_Handle *ps;
 
 /**
- * Handle to the ATS service.
- */
-static struct GNUNET_ATS_ConnectivityHandle *ats;
+   * Handle to Transport service.
+   */
+struct GNUNET_TRANSPORT_ApplicationHandle *transport;
 
 /**
  * Identity of this peer.
  */
 static struct GNUNET_PeerIdentity my_identity;
 
+/**
+ * Our private key.
+ */
+static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
+
 /**
  * All of our friends, all of our current neighbours and all peers for
  * which we have HELLOs.  So pretty much everyone.  Maps peer identities
@@ -164,11 +179,6 @@ static struct GNUNET_CONTAINER_MultiPeerMap *peers;
  */
 static struct GNUNET_STATISTICS_Handle *stats;
 
-/**
- * Blacklist (NULL if we have none).
- */
-static struct GNUNET_TRANSPORT_Blacklist *blacklist;
-
 /**
  * Task scheduled to asynchronously reconsider adding/removing
  * peer connectivity suggestions.
@@ -232,21 +242,6 @@ blacklist_check (void *cls, const struct 
GNUNET_PeerIdentity *pid)
 }
 
 
-/**
- * Whitelist all peers that we blacklisted; we've passed
- * the minimum number of friends.
- */
-static void
-whitelist_peers ()
-{
-  if (NULL != blacklist)
-  {
-    GNUNET_TRANSPORT_blacklist_cancel (blacklist);
-    blacklist = NULL;
-  }
-}
-
-
 /**
  * Free all resources associated with the given peer.
  *
@@ -268,10 +263,10 @@ free_peer (void *cls, const struct GNUNET_PeerIdentity 
*pid, void *value)
     GNUNET_SCHEDULER_cancel (pos->hello_delay_task);
     pos->hello_delay_task = NULL;
   }
-  if (NULL != pos->sh)
+  if (NULL != pos->ash)
   {
-    GNUNET_ATS_connectivity_suggest_cancel (pos->sh);
-    pos->sh = NULL;
+    GNUNET_TRANSPORT_application_suggest_cancel (pos->ash);
+    pos->ash = NULL;
   }
   if (NULL != pos->hello)
   {
@@ -298,6 +293,7 @@ static void
 attempt_connect (struct Peer *pos)
 {
   uint32_t strength;
+  struct GNUNET_BANDWIDTH_Value32NBO bw;
 
   if (0 == GNUNET_memcmp (&my_identity, &pos->pid))
     return; /* This is myself, nothing to do. */
@@ -318,10 +314,10 @@ attempt_connect (struct Peer *pos)
     strength *= 2; /* existing connections preferred */
   if (strength == pos->strength)
     return; /* nothing to do */
-  if (NULL != pos->sh)
+  if (NULL != pos->ash)
   {
-    GNUNET_ATS_connectivity_suggest_cancel (pos->sh);
-    pos->sh = NULL;
+    GNUNET_TRANSPORT_application_suggest_cancel (pos->ash);
+    pos->ash = NULL;
   }
   pos->strength = strength;
   if (0 != strength)
@@ -334,7 +330,11 @@ attempt_connect (struct Peer *pos)
                               gettext_noop ("# connect requests issued to 
ATS"),
                               1,
                               GNUNET_NO);
-    pos->sh = GNUNET_ATS_connectivity_suggest (ats, &pos->pid, strength);
+    // TODO Use strength somehow.
+    pos->ash = GNUNET_TRANSPORT_application_suggest (transport,
+                                                     &pos->pid,
+                                                     
GNUNET_MQ_PRIO_BEST_EFFORT,
+                                                     bw);
   }
 }
 
@@ -349,7 +349,7 @@ attempt_connect (struct Peer *pos)
  */
 static struct Peer *
 make_peer (const struct GNUNET_PeerIdentity *peer,
-           const struct GNUNET_HELLO_Message *hello,
+           const struct GNUNET_MessageHeader *hello,
            int is_friend)
 {
   struct Peer *ret;
@@ -359,8 +359,8 @@ make_peer (const struct GNUNET_PeerIdentity *peer,
   ret->is_friend = is_friend;
   if (NULL != hello)
   {
-    ret->hello = GNUNET_malloc (GNUNET_HELLO_size (hello));
-    GNUNET_memcpy (ret->hello, hello, GNUNET_HELLO_size (hello));
+    ret->hello = GNUNET_malloc (ntohs (hello->size));
+    GNUNET_memcpy (ret->hello, hello, ntohs (hello->size));
   }
   GNUNET_break (GNUNET_OK ==
                 GNUNET_CONTAINER_multipeermap_put (
@@ -440,10 +440,16 @@ find_advertisable_hello (void *cls,
   struct GNUNET_HashCode hc;
   size_t hs;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "find_advertisable_hello\n");
   if (pos == fah->peer)
     return GNUNET_YES;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "find_advertisable_hello 2\n");
   if (pos->hello == NULL)
     return GNUNET_YES;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "find_advertisable_hello 3\n");
   rst_time = GNUNET_TIME_absolute_get_remaining (pos->filter_expiration);
   if (0 == rst_time.rel_value_us)
   {
@@ -452,9 +458,11 @@ find_advertisable_hello (void *cls,
     setup_filter (pos);
   }
   fah->next_adv = GNUNET_TIME_relative_min (rst_time, fah->next_adv);
-  hs = GNUNET_HELLO_size (pos->hello);
+  hs = pos->hello->size;
   if (hs > fah->max_size)
     return GNUNET_YES;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "find_advertisable_hello 4\n");
   GNUNET_CRYPTO_hash (&fah->peer->pid,
                       sizeof(struct GNUNET_PeerIdentity),
                       &hc);
@@ -480,6 +488,8 @@ schedule_next_hello (void *cls)
   struct GNUNET_TIME_Relative delay;
   struct GNUNET_HashCode hc;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "schedule_next_hello\n");
   pl->hello_delay_task = NULL;
   GNUNET_assert (NULL != pl->mq);
   /* find applicable HELLOs */
@@ -492,15 +502,20 @@ schedule_next_hello (void *cls)
     GNUNET_SCHEDULER_add_delayed (fah.next_adv, &schedule_next_hello, pl);
   if (NULL == fah.result)
     return;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "schedule_next_hello 2\n");
   delay = GNUNET_TIME_absolute_get_remaining (pl->next_hello_allowed);
   if (0 != delay.rel_value_us)
     return;
 
-  want = GNUNET_HELLO_size (fah.result->hello);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Sending HELLO with %u bytes",
-              (unsigned int) want);
-  env = GNUNET_MQ_msg_copy (&fah.result->hello->header);
+              "schedule_next_hello 3\n");
+  want = ntohs (fah.result->hello->size);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Sending HELLO with %u bytes for peer %s\n",
+              (unsigned int) want,
+              GNUNET_i2s (&pl->pid));
+  env = GNUNET_MQ_msg_copy (fah.result->hello);
   GNUNET_MQ_send (pl->mq, env);
 
   /* avoid sending this one again soon */
@@ -535,11 +550,12 @@ reschedule_hellos (void *cls,
                    const struct GNUNET_PeerIdentity *pid,
                    void *value)
 {
+  (void) cls;
   struct Peer *peer = value;
-  struct Peer *skip = cls;
 
-  if (skip == peer)
-    return GNUNET_YES;
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Reschedule for `%s'\n",
+              GNUNET_i2s (&peer->pid));
   if (NULL == peer->mq)
     return GNUNET_YES;
   if (NULL != peer->hello_delay_task)
@@ -547,6 +563,8 @@ reschedule_hellos (void *cls,
     GNUNET_SCHEDULER_cancel (peer->hello_delay_task);
     peer->hello_delay_task = NULL;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Schedule_next_hello\n");
   peer->hello_delay_task =
     GNUNET_SCHEDULER_add_now (&schedule_next_hello, peer);
   return GNUNET_YES;
@@ -592,8 +610,7 @@ connect_notify (void *cls,
   if (pos->is_friend)
   {
     friend_count++;
-    if ((friend_count == minimum_friend_count) && (GNUNET_YES != friends_only))
-      whitelist_peers ();
+
     GNUNET_STATISTICS_set (stats,
                            gettext_noop ("# friends connected"),
                            friend_count,
@@ -683,8 +700,7 @@ disconnect_notify (void *cls,
        (friend_count < minimum_friend_count)) &&
       (NULL == add_task))
     add_task = GNUNET_SCHEDULER_add_now (&add_peer_task, NULL);
-  if ((friend_count < minimum_friend_count) && (NULL == blacklist))
-    blacklist = GNUNET_TRANSPORT_blacklist (cfg, &blacklist_check, NULL);
+
 }
 
 
@@ -693,18 +709,16 @@ disconnect_notify (void *cls,
  *
  * @param cls flag that we will set if we see any addresses
  * @param address the address of the peer
- * @param expiration when will the given address expire
  * @return #GNUNET_SYSERR always, to terminate iteration
  */
-static int
+static void
 address_iterator (void *cls,
-                  const struct GNUNET_HELLO_Address *address,
-                  struct GNUNET_TIME_Absolute expiration)
+                  const char *uri)
 {
   int *flag = cls;
 
-  *flag = GNUNET_YES;
-  return GNUNET_SYSERR;
+  *flag = *flag + 1;
+  //*flag = GNUNET_YES;
 }
 
 
@@ -715,55 +729,84 @@ address_iterator (void *cls,
  * @param hello the HELLO we got
  */
 static void
-consider_for_advertising (const struct GNUNET_HELLO_Message *hello)
+consider_for_advertising (const struct GNUNET_MessageHeader *hello)
 {
-  int have_address;
-  struct GNUNET_PeerIdentity pid;
+  int num_addresses_old;
+  int num_addresses_new;
+  struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (hello);
+  struct GNUNET_PeerIdentity *pid = GNUNET_HELLO_builder_get_id (builder);
   struct GNUNET_TIME_Absolute dt;
-  struct GNUNET_HELLO_Message *nh;
+  struct GNUNET_MQ_Envelope *env;
+  const struct GNUNET_MessageHeader *nh;
   struct Peer *peer;
   uint16_t size;
 
-  if (GNUNET_OK != GNUNET_HELLO_get_id (hello, &pid))
+  GNUNET_HELLO_builder_iterate (builder,
+                                pid,
+                                &address_iterator,
+                                &num_addresses_new);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "consider 0 for %s\n",
+              GNUNET_i2s (pid));
+  if (0 == num_addresses_new)
   {
-    GNUNET_break (0);
+    GNUNET_HELLO_builder_free (builder);
+    return; /* no point in advertising this one... */
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "consider 1\n");
+  if (NULL == pid)
+  {
+    GNUNET_HELLO_builder_free (builder);
     return;
   }
-  if (0 == GNUNET_memcmp (&pid, &my_identity))
-    return; /* that's me! */
-  have_address = GNUNET_NO;
-  GNUNET_HELLO_iterate_addresses (hello,
-                                  GNUNET_NO,
-                                  &address_iterator,
-                                  &have_address);
-  if (GNUNET_NO == have_address)
-    return; /* no point in advertising this one... */
-  peer = GNUNET_CONTAINER_multipeermap_get (peers, &pid);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "consider 2\n");
+  peer = GNUNET_CONTAINER_multipeermap_get (peers, pid);
   if (NULL == peer)
   {
-    peer = make_peer (&pid, hello, GNUNET_NO);
+    peer = make_peer (pid, hello, GNUNET_NO);
   }
   else if (NULL != peer->hello)
   {
-    dt = GNUNET_HELLO_equals (peer->hello, hello, GNUNET_TIME_absolute_get ());
-    if (dt.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us)
-      return;   /* nothing new here */
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Found HELLO from peer `%s' for advertising\n",
-              GNUNET_i2s (&pid));
-  if (NULL != peer->hello)
-  {
-    nh = GNUNET_HELLO_merge (peer->hello, hello);
-    GNUNET_free (peer->hello);
-    peer->hello = nh;
+    struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
+    struct GNUNET_TIME_Absolute new_hello_exp =
+      GNUNET_HELLO_builder_get_expiration_time (hello);
+    struct GNUNET_TIME_Absolute old_hello_exp =
+      GNUNET_HELLO_builder_get_expiration_time (peer->hello);
+    struct GNUNET_HELLO_Builder *builder_old = GNUNET_HELLO_builder_from_msg 
(peer->hello);
+    struct GNUNET_PeerIdentity *pid_old = GNUNET_HELLO_builder_get_id 
(builder_old);
+
+    GNUNET_HELLO_builder_iterate (builder_old,
+                                  pid_old,
+                                  &address_iterator,
+                                  &num_addresses_old);
+    if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) &&
+        (GNUNET_TIME_absolute_cmp (new_hello_exp, >, old_hello_exp) ||
+         num_addresses_old < num_addresses_new))
+    {
+      GNUNET_free (peer->hello);
+      size = ntohs (hello->size);
+      peer->hello = GNUNET_malloc (size);
+      GNUNET_memcpy (peer->hello, hello, size);
+    }
+    else
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "consider 3\n");
+      GNUNET_HELLO_builder_free (builder);
+      return;
+    }
   }
   else
   {
-    size = GNUNET_HELLO_size (hello);
+    size = ntohs (hello->size);
     peer->hello = GNUNET_malloc (size);
     GNUNET_memcpy (peer->hello, hello, size);
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Found HELLO from peer `%s' for advertising\n",
+              GNUNET_i2s (pid));
   if (NULL != peer->filter)
   {
     GNUNET_CONTAINER_bloomfilter_free (peer->filter);
@@ -772,12 +815,13 @@ consider_for_advertising (const struct 
GNUNET_HELLO_Message *hello)
   setup_filter (peer);
   /* since we have a new HELLO to pick from, re-schedule all
    * HELLO requests that are not bound by the HELLO send rate! */
-  GNUNET_CONTAINER_multipeermap_iterate (peers, &reschedule_hellos, peer);
+  GNUNET_CONTAINER_multipeermap_iterate (peers, &reschedule_hellos, NULL);
+  GNUNET_HELLO_builder_free (builder);
 }
 
 
 /**
- * PEERINFO calls this function to let us know about a possible peer
+ * PEERSTORE calls this function to let us know about a possible peer
  * that we might want to connect to.
  *
  * @param cls closure (not used)
@@ -788,7 +832,7 @@ consider_for_advertising (const struct GNUNET_HELLO_Message 
*hello)
 static void
 process_peer (void *cls,
               const struct GNUNET_PeerIdentity *peer,
-              const struct GNUNET_HELLO_Message *hello,
+              const struct GNUNET_MessageHeader *hello,
               const char *err_msg)
 {
   struct Peer *pos;
@@ -796,16 +840,15 @@ process_peer (void *cls,
   if (NULL != err_msg)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                _ ("Error in communication with PEERINFO service: %s\n"),
+                _ ("Error in communication with PEERSTORE service: %s\n"),
                 err_msg);
-    GNUNET_PEERINFO_notify_cancel (peerinfo_notify);
-    peerinfo_notify =
-      GNUNET_PEERINFO_notify (cfg, GNUNET_NO, &process_peer, NULL);
+    GNUNET_PEERSTORE_hello_changed_notify_cancel (peerstore_notify);
+    peerstore_notify =
+      GNUNET_PEERSTORE_hello_changed_notify (ps, GNUNET_NO, &process_peer,
+                                             NULL);
     return;
   }
   GNUNET_assert (NULL != peer);
-  if (0 == GNUNET_memcmp (&my_identity, peer))
-    return; /* that's me! */
   if (NULL == hello)
   {
     /* free existing HELLO, if any */
@@ -831,6 +874,15 @@ process_peer (void *cls,
   attempt_connect (pos);
 }
 
+static void
+start_notify (void *cls)
+{
+  (void) cls;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to process new hellos for 
gossiping.\n");
+  peerstore_notify =
+    GNUNET_PEERSTORE_hello_changed_notify (ps, GNUNET_NO, &process_peer, NULL);
+}
 
 /**
  * Function called after #GNUNET_CORE_connect has succeeded
@@ -852,8 +904,9 @@ core_init (void *cls, const struct GNUNET_PeerIdentity 
*my_id)
   }
   my_identity = *my_id;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am peer `%s'\n", GNUNET_i2s (my_id));
-  peerinfo_notify =
-    GNUNET_PEERINFO_notify (cfg, GNUNET_NO, &process_peer, NULL);
+  peerstore_notify_task = GNUNET_SCHEDULER_add_delayed 
(GNUNET_TIME_UNIT_MINUTES,
+                                                        start_notify,
+                                                        NULL);
 }
 
 
@@ -931,11 +984,13 @@ read_friends_file (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
  *         #GNUNET_SYSERR if @a message is invalid
  */
 static int
-check_hello (void *cls, const struct GNUNET_HELLO_Message *message)
+check_hello (void *cls, const struct GNUNET_MessageHeader *message)
 {
-  struct GNUNET_PeerIdentity pid;
+  struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (
+    message);
+  struct GNUNET_PeerIdentity *pid = GNUNET_HELLO_builder_get_id (builder);
 
-  if (GNUNET_OK != GNUNET_HELLO_get_id (message, &pid))
+  if (NULL == pid)
   {
     GNUNET_break_op (0);
     return GNUNET_SYSERR;
@@ -944,6 +999,13 @@ check_hello (void *cls, const struct GNUNET_HELLO_Message 
*message)
 }
 
 
+static void
+shc_cont (void *cls, int success)
+{
+  GNUNET_free (cls);
+}
+
+
 /**
  * This function is called whenever an encrypted HELLO message is
  * received.
@@ -952,21 +1014,23 @@ check_hello (void *cls, const struct 
GNUNET_HELLO_Message *message)
  * @param message the actual HELLO message
  */
 static void
-handle_hello (void *cls, const struct GNUNET_HELLO_Message *message)
+handle_hello (void *cls, const struct GNUNET_MessageHeader *message)
 {
+  struct GNUNET_PEERSTORE_StoreHelloContext *shc;
   const struct GNUNET_PeerIdentity *other = cls;
   struct Peer *peer;
-  struct GNUNET_PeerIdentity pid;
+  struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (
+    message);
+  struct GNUNET_PeerIdentity *pid = GNUNET_HELLO_builder_get_id (builder);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received encrypted HELLO from peer `%s'",
               GNUNET_i2s (other));
-  GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_id (message, &pid));
   GNUNET_STATISTICS_update (stats,
                             gettext_noop ("# HELLO messages received"),
                             1,
                             GNUNET_NO);
-  peer = GNUNET_CONTAINER_multipeermap_get (peers, &pid);
+  peer = GNUNET_CONTAINER_multipeermap_get (peers, pid);
   if (NULL == peer)
   {
     if ((GNUNET_YES == friends_only) || (friend_count < minimum_friend_count))
@@ -980,7 +1044,9 @@ handle_hello (void *cls, const struct GNUNET_HELLO_Message 
*message)
         (friend_count < minimum_friend_count))
       return;
   }
-  (void) GNUNET_PEERINFO_add_peer (pi, message, NULL, NULL);
+  GNUNET_HELLO_builder_from_msg (message);
+  shc = GNUNET_PEERSTORE_hello_add (ps, message, &shc_cont, shc);
+  GNUNET_HELLO_builder_free (builder);
 }
 
 
@@ -993,39 +1059,37 @@ handle_hello (void *cls, const struct 
GNUNET_HELLO_Message *message)
 static void
 cleaning_task (void *cls)
 {
-  if (NULL != peerinfo_notify)
+  if (NULL != peerstore_notify)
+  {
+    GNUNET_PEERSTORE_hello_changed_notify_cancel (peerstore_notify);
+    peerstore_notify = NULL;
+  }
+  else if (NULL != peerstore_notify_task)
   {
-    GNUNET_PEERINFO_notify_cancel (peerinfo_notify);
-    peerinfo_notify = NULL;
+    GNUNET_SCHEDULER_cancel (peerstore_notify_task);
   }
   if (NULL != handle)
   {
     GNUNET_CORE_disconnect (handle);
     handle = NULL;
   }
-  whitelist_peers ();
   if (NULL != add_task)
   {
     GNUNET_SCHEDULER_cancel (add_task);
     add_task = NULL;
   }
-  if (NULL != oh)
-  {
-    GNUNET_TRANSPORT_offer_hello_cancel (oh);
-    oh = NULL;
-  }
   GNUNET_CONTAINER_multipeermap_iterate (peers, &free_peer, NULL);
   GNUNET_CONTAINER_multipeermap_destroy (peers);
   peers = NULL;
-  if (NULL != ats)
+  if (NULL != transport)
   {
-    GNUNET_ATS_connectivity_done (ats);
-    ats = NULL;
+    GNUNET_TRANSPORT_application_done (transport);
+    transport = NULL;
   }
-  if (NULL != pi)
+  if (NULL != ps)
   {
-    GNUNET_PEERINFO_disconnect (pi);
-    pi = NULL;
+    GNUNET_PEERSTORE_disconnect (ps, GNUNET_YES);
+    ps = NULL;
   }
   if (NULL != stats)
   {
@@ -1051,22 +1115,18 @@ run (void *cls,
 {
   struct GNUNET_MQ_MessageHandler handlers[] =
   { GNUNET_MQ_hd_var_size (hello,
-                           GNUNET_MESSAGE_TYPE_HELLO,
-                           struct GNUNET_HELLO_Message,
+                           GNUNET_MESSAGE_TYPE_HELLO_URI,
+                           struct GNUNET_MessageHeader,
                            NULL),
     GNUNET_MQ_handler_end () };
   unsigned long long opt;
 
   cfg = c;
+  my_private_key =
+    GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg);
   stats = GNUNET_STATISTICS_create ("topology", cfg);
-  friends_only =
-    GNUNET_CONFIGURATION_get_value_yesno (cfg, "TOPOLOGY", "FRIENDS-ONLY");
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                          "TOPOLOGY",
-                                                          "MINIMUM-FRIENDS",
-                                                          &opt))
-    opt = 0;
-  minimum_friend_count = (unsigned int) opt;
+
+  minimum_friend_count = 0;
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (cfg,
                                              "TOPOLOGY",
@@ -1081,10 +1141,9 @@ run (void *cls,
               "Topology would like %u connections with at least %u friends\n",
               target_connection_count,
               minimum_friend_count);
-  if ((GNUNET_YES == friends_only) || (minimum_friend_count > 0))
-    blacklist = GNUNET_TRANSPORT_blacklist (cfg, &blacklist_check, NULL);
-  ats = GNUNET_ATS_connectivity_init (cfg);
-  pi = GNUNET_PEERINFO_connect (cfg);
+
+  transport = GNUNET_TRANSPORT_application_init (cfg);
+  ps = GNUNET_PEERSTORE_connect (cfg);
   handle = GNUNET_CORE_connect (cfg,
                                 NULL,
                                 &core_init,
diff --git a/src/topology/meson.build b/src/topology/meson.build
index e19316142..b196d98f2 100644
--- a/src/topology/meson.build
+++ b/src/topology/meson.build
@@ -33,10 +33,9 @@ executable ('gnunet-daemon-topology',
             dependencies: [libgnunetfriends_dep,
                            libgnunetutil_dep,
                            libgnunetcore_dep,
-                           libgnunetpeerinfo_dep,
+                           libgnunetpeerstore_dep,
                            libgnunetstatistics_dep,
-                           libgnunettransport_dep,
-                           libgnunetats_dep,
+                           libgnunettransportapplication_dep,
                            libgnunethello_dep],
             include_directories: [incdir, configuration_inc],
             install: true,
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 3cd2dc8bf..fab32146d 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -8,121 +8,26 @@ pkgcfgdir= $(pkgdatadir)/config.d/
 libexecdir= $(pkglibdir)/libexec/
 
 pkgcfg_DATA = \
-  transport.conf \
-  communicator-unix.conf
-
-HTTP_SERVER_PLUGIN_LA = libgnunet_plugin_transport_http_server.la
-HTTPS_SERVER_PLUGIN_LA = libgnunet_plugin_transport_https_server.la
-HTTP_SERVER_PLUGIN_TEST = test_plugin_http_server
-HTTPS_SERVER_PLUGIN_TEST = test_plugin_https_server
-
-HTTP_CLIENT_PLUGIN_TEST = test_plugin_http_client
-HTTPS_CLIENT_PLUGIN_TEST = test_plugin_https_client
-HTTP_CLIENT_PLUGIN_LA = libgnunet_plugin_transport_http_client.la
-HTTPS_CLIENT_PLUGIN_LA = libgnunet_plugin_transport_https_client.la
-
-HTTP_API_TEST = test_transport_api_http
-HTTP_REVERSE_API_TEST = test_transport_api_http_reverse
-HTTP_API_TIMEOUT_TEST = test_transport_api_timeout_http
-HTTP_REL_TEST = test_transport_api_reliability_http \
-                test_transport_api_reliability_http_xhr
-HTTP_QUOTA_TEST = test_quota_compliance_http \
-                  test_quota_compliance_http_asymmetric
-HTTP_SWITCH = test_transport_address_switch_http
-HTTPS_API_TEST = test_transport_api_https
-HTTPS_API_TIMEOUT_TEST = test_transport_api_timeout_https
-if HAVE_EXPERIMENTAL
- HTTPS_REL_TEST = test_transport_api_reliability_https \
-                 test_transport_api_reliability_https_xhr
-endif
-HTTPS_QUOTA_TEST = test_quota_compliance_https \
-               test_quota_compliance_https_asymmetric
-HTTPS_SWITCH = test_transport_address_switch_https
+  transport.conf
 
 if USE_COVERAGE
   AM_CFLAGS = --coverage -O0
 endif
 
-if HAVE_EXPERIMENTAL
-if LINUX
- WLAN_BIN = gnunet-helper-transport-wlan
- WLAN_BIN_DUMMY = gnunet-helper-transport-wlan-dummy
- WLAN_BIN_SENDER = gnunet-transport-wlan-sender
- WLAN_BIN_RECEIVER = gnunet-transport-wlan-receiver
- WLAN_PLUGIN_LA = libgnunet_plugin_transport_wlan.la
- WLAN_PLUGIN_TEST = test_plugin_wlan
- WLAN_API_TEST = test_transport_api_wlan
- WLAN_TIMEOUT_TEST = test_transport_api_timeout_wlan
- WLAN_REL_TEST = test_transport_api_reliability_wlan
- WLAN_QUOTA_TEST = test_quota_compliance_wlan \
-               test_quota_compliance_wlan_asymmetric
-endif
-
-if LINUX
-if HAVE_LIBBLUETOOTH
- BT_BIN = gnunet-helper-transport-bluetooth
- BT_PLUGIN_LA = libgnunet_plugin_transport_bluetooth.la
- BT_PLUGIN_TEST = test_plugin_bluetooth
- BT_API_TEST = test_transport_api_bluetooth
- BT_TIMEOUT_TEST = test_transport_api_timeout_bluetooth
- BT_REL_TEST = test_transport_api_reliability_bluetooth
- BT_QUOTA_TEST = test_quota_compliance_bluetooth \
-    test_quota_compliance_bluetooth_asymmetric
-endif
-endif
-
-# end of HAVE_EXPERIMENTAL
-endif
-
-
-UNIX_PLUGIN_LA = libgnunet_plugin_transport_unix.la
-UNIX_PLUGIN_TEST = test_transport_api_unix
-UNIX_TEST = test_plugin_unix
-UNIX_PLUGIN_TIMEOUT_TEST = test_transport_api_timeout_unix
-UNIX_REL_TEST = test_transport_api_reliability_unix
-UNIX_QUOTA_TEST = test_quota_compliance_unix \
-     test_quota_compliance_unix_asymmetric
-if LINUX
- UNIX_API_ABSTRACT_TEST = test_transport_api_unix_abstract
-endif
-
-
 noinst_PROGRAMS = \
  test_transport_start_with_config \
- gnunet-transport-profiler \
- gnunet-communicator-udp \
- $(WLAN_BIN_SENDER) \
- $(WLAN_BIN_RECEIVER)
+ gnunet-communicator-udp
 
 TESTING_LIBS = \
-  libgnunettransporttesting.la \
   libgnunettransporttesting2.la
 
 lib_LTLIBRARIES = \
-  libgnunettransport.la \
   libgnunettransportapplication.la \
   libgnunettransportcore.la \
   libgnunettransportcommunicator.la \
   libgnunettransportmonitor.la \
   $(TESTING_LIBS)
 
-libgnunettransporttesting_la_SOURCES = \
-  transport-testing.c transport-testing.h \
-  transport-testing-filenames.c \
-  transport-testing-loggers.c \
-  transport-testing-main.c \
-  transport-testing-send.c
-libgnunettransporttesting_la_LIBADD = \
-  libgnunettransport.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/arm/libgnunetarm.la \
-  $(GN_LIBINTL)
-libgnunettransporttesting_la_LDFLAGS = \
- $(GN_LIB_LDFLAGS)
-
 libgnunettransporttesting2_la_SOURCES = \
   transport_api_traits.c \
   transport_api_cmd_connecting_peers.c \
@@ -143,7 +48,6 @@ libgnunettransporttesting2_la_LIBADD = \
   libgnunettransportcore.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
   $(top_builddir)/src/testing/libgnunettesting.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
   $(top_builddir)/src/hello/libgnunethello.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/util/libgnunetutil.la
@@ -152,26 +56,6 @@ libgnunettransporttesting2_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS) \
   -version-info 0:0:0
 
-libgnunettransport_la_SOURCES = \
-  transport.h \
-  transport_api_address_to_string.c \
-  transport_api_blacklist.c \
-  transport_api_core.c \
-  transport_api_hello_get.c \
-  transport_api_manipulation.c \
-  transport_api_monitor_peers.c \
-  transport_api_monitor_plugins.c \
-  transport_api_offer_hello.c
-
-libgnunettransport_la_LIBADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(GN_LIBINTL)
-libgnunettransport_la_LDFLAGS = \
-  $(GN_LIB_LDFLAGS)  \
-  -version-info 4:0:2
-
 libgnunettransportapplication_la_SOURCES = \
   transport_api2_application.c
 libgnunettransportapplication_la_LIBADD = \
@@ -212,10 +96,6 @@ libgnunettransportmonitor_la_LDFLAGS = \
 
 
 libexec_PROGRAMS = \
- $(WLAN_BIN) \
- $(WLAN_BIN_DUMMY) \
- $(BT_BIN) \
- gnunet-service-transport \
  gnunet-service-tng \
  gnunet-communicator-unix \
  gnunet-communicator-udp \
@@ -228,8 +108,8 @@ endif
 endif
 
 
-bin_PROGRAMS = \
- gnunet-transport
+#bin_PROGRAMS = \
+# gnunet-transport
 
 bin_SCRIPTS = \
  gnunet-transport-certificate-creation
@@ -291,74 +171,22 @@ gnunet_communicator_quic_LDADD = \
 endif
 endif
 
-gnunet_helper_transport_wlan_SOURCES = \
- gnunet-helper-transport-wlan.c
-
-gnunet_helper_transport_wlan_dummy_SOURCES = \
- gnunet-helper-transport-wlan-dummy.c
-gnunet_helper_transport_wlan_dummy_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-gnunet_transport_wlan_sender_SOURCES = \
- gnunet-transport-wlan-sender.c
-gnunet_transport_wlan_sender_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-gnunet_transport_wlan_receiver_SOURCES = \
- gnunet-transport-wlan-receiver.c
-gnunet_transport_wlan_receiver_LDADD = \
-  $(top_builddir)/src/util/libgnunetutil.la
-
-gnunet_helper_transport_bluetooth_SOURCES = \
- gnunet-helper-transport-bluetooth.c
-
-gnunet_helper_transport_bluetooth_LDFLAGS = -lbluetooth
-
-
-gnunet_transport_profiler_SOURCES = \
- gnunet-transport-profiler.c
-gnunet_transport_profiler_LDADD = \
-  libgnunettransport.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(GN_LIBINTL)
-
-gnunet_transport_SOURCES = \
- gnunet-transport.c
-gnunet_transport_LDADD = \
-  libgnunettransport.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(GN_LIBINTL)
-
-gnunet_service_transport_SOURCES = \
- gnunet-service-transport.c gnunet-service-transport.h \
- gnunet-service-transport_ats.h gnunet-service-transport_ats.c \
- gnunet-service-transport_hello.h gnunet-service-transport_hello.c \
- gnunet-service-transport_neighbours.h gnunet-service-transport_neighbours.c \
- gnunet-service-transport_plugins.h gnunet-service-transport_plugins.c \
- gnunet-service-transport_validation.h gnunet-service-transport_validation.c \
- gnunet-service-transport_manipulation.h 
gnunet-service-transport_manipulation.c
-# Note that while gnunet-service-transport does not use libgnunetnat
-# directly, we must link against it as GNUNET_NAT_mini_map_stop will
-# leave a 'dangling' task to process_unmap_output which will cause
-# a crash on unloading of a plugin unless the service links against
-# that library as well.
-gnunet_service_transport_LDADD = \
-  libgnunettransport.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/nt/libgnunetnt.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(GN_GLPK) \
-  $(GN_LIBINTL)
-gnunet_service_transport_CFLAGS = \
-  $(AM_CFLAGS)
-# -DANALYZE
-
+#gnunet_transport_profiler_SOURCES = \
+# gnunet-transport-profiler.c
+#gnunet_transport_profiler_LDADD = \
+#  libgnunettransport.la \
+#  $(top_builddir)/src/hello/libgnunethello.la \
+#  $(top_builddir)/src/ats/libgnunetats.la \
+#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(GN_LIBINTL)
+
+#gnunet_transport_SOURCES = \
+# gnunet-transport.c
+#gnunet_transport_LDADD = \
+#  libgnunettransport.la \
+#  $(top_builddir)/src/hello/libgnunethello.la \
+#  $(top_builddir)/src/util/libgnunetutil.la \
+#  $(GN_LIBINTL)
 
 gnunet_service_tng_SOURCES = \
  gnunet-service-tng.c
@@ -371,14 +199,6 @@ gnunet_service_tng_LDADD = \
   $(GN_LIBINTL)
 
 plugin_LTLIBRARIES = \
-  libgnunet_plugin_transport_tcp.la \
-  $(UNIX_PLUGIN_LA) \
-  $(HTTP_CLIENT_PLUGIN_LA) \
-  $(HTTPS_CLIENT_PLUGIN_LA) \
-  $(HTTP_SERVER_PLUGIN_LA) \
-  $(HTTPS_SERVER_PLUGIN_LA) \
-  $(WLAN_PLUGIN_LA) \
-  $(BT_PLUGIN_LA) \
   libgnunet_test_transport_plugin_cmd_simple_send_performance.la \
   libgnunet_test_transport_plugin_cmd_nat_upnp.la \
   libgnunet_test_transport_plugin_cmd_simple_send.la \
@@ -396,7 +216,6 @@ libgnunet_test_transport_plugin_cmd_nat_upnp_la_LIBADD = \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(LTLIBINTL)
@@ -413,7 +232,6 @@ 
libgnunet_test_transport_plugin_cmd_udp_backchannel_la_LIBADD = \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(LTLIBINTL)
@@ -430,7 +248,6 @@ libgnunet_test_transport_plugin_cmd_simple_send_la_LIBADD = 
\
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(LTLIBINTL)
@@ -447,7 +264,6 @@ 
libgnunet_test_transport_plugin_cmd_simple_send_performance_la_LIBADD = \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(LTLIBINTL)
@@ -464,7 +280,6 @@ 
libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_LIBADD = \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(LTLIBINTL)
@@ -481,313 +296,41 @@ 
libgnunet_test_transport_plugin_cmd_simple_send_dv_la_LIBADD = \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/ats/libgnunetats.la \
   $(top_builddir)/src/arm/libgnunetarm.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(LTLIBINTL)
 libgnunet_test_transport_plugin_cmd_simple_send_dv_la_LDFLAGS = \
   $(GN_PLUGIN_LDFLAGS)
 
-if HAVE_EXPERIMENTAL
-plugin_LTLIBRARIES += \
-  libgnunet_plugin_transport_udp.la
-endif
-
-# Note: real plugins of course need to be added
-# to the plugin_LTLIBRARIES above
-noinst_LTLIBRARIES = \
-  libgnunet_plugin_transport_template.la
-
-libgnunet_plugin_transport_tcp_la_SOURCES = \
-  plugin_transport_tcp.c
-libgnunet_plugin_transport_tcp_la_LIBADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  $(top_builddir)/src/nat/libgnunetnatnew.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(LTLIBINTL)
-libgnunet_plugin_transport_tcp_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS)
-
-libgnunet_plugin_transport_template_la_SOURCES = \
-  plugin_transport_template.c
-libgnunet_plugin_transport_template_la_LIBADD = \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(LTLIBINTL)
-libgnunet_plugin_transport_template_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS)
-
-libgnunet_plugin_transport_wlan_la_SOURCES = \
-  plugin_transport_wlan.c plugin_transport_wlan.h
-libgnunet_plugin_transport_wlan_la_LIBADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  $(top_builddir)/src/fragmentation/libgnunetfragmentation.la \
-  $(top_builddir)/src/util/libgnunetutil.la
-libgnunet_plugin_transport_wlan_la_LDFLAGS = \
-  $(GN_PLUGIN_LDFLAGS)
-libgnunet_plugin_transport_wlan_la_CFLAGS = \
- $(AM_CFLAGS) -DBUILD_WLAN
-
-libgnunet_plugin_transport_bluetooth_la_SOURCES = \
-  plugin_transport_wlan.c plugin_transport_wlan.h
-libgnunet_plugin_transport_bluetooth_la_LIBADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  $(top_builddir)/src/fragmentation/libgnunetfragmentation.la \
-  $(top_builddir)/src/util/libgnunetutil.la
-libgnunet_plugin_transport_bluetooth_la_LDFLAGS = \
-  $(GN_PLUGIN_LDFLAGS)
-libgnunet_plugin_transport_bluetooth_la_CFLAGS = \
- $(AM_CFLAGS) -DBUILD_BLUETOOTH
-
-if HAVE_EXPERIMENTAL
-libgnunet_plugin_transport_udp_la_SOURCES = \
-  plugin_transport_udp.c plugin_transport_udp.h \
-  plugin_transport_udp_broadcasting.c
-libgnunet_plugin_transport_udp_la_LIBADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/fragmentation/libgnunetfragmentation.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  $(top_builddir)/src/nat/libgnunetnatnew.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(LTLIBINTL)
-libgnunet_plugin_transport_udp_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS)
-endif
-
-libgnunet_plugin_transport_unix_la_SOURCES = \
-  plugin_transport_unix.c
-libgnunet_plugin_transport_unix_la_LIBADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  $(top_builddir)/src/util/libgnunetutil.la \
-  $(LTLIBINTL)
-libgnunet_plugin_transport_unix_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS)
-
-
-libgnunet_plugin_transport_http_client_la_SOURCES = \
-  plugin_transport_http_client.c plugin_transport_http_common.c 
plugin_transport_http_common.h
-libgnunet_plugin_transport_http_client_la_LIBADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  @LIBCURL@ \
-  $(top_builddir)/src/util/libgnunetutil.la
-libgnunet_plugin_transport_http_client_la_LDFLAGS = \
-  $(GN_LIBINTL) \
-  $(GN_PLUGIN_LDFLAGS)
-libgnunet_plugin_transport_http_client_la_CFLAGS = \
- @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
-
-
-libgnunet_plugin_transport_http_server_la_SOURCES = \
-  plugin_transport_http_server.c plugin_transport_http_common.c
-libgnunet_plugin_transport_http_server_la_LIBADD = \
-  $(MHD_LIBS) \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  $(top_builddir)/src/nat/libgnunetnatnew.la \
-  $(top_builddir)/src/util/libgnunetutil.la
-libgnunet_plugin_transport_http_server_la_LDFLAGS = \
-  $(GN_LIBINTL) \
- $(GN_PLUGIN_LDFLAGS)
-libgnunet_plugin_transport_http_server_la_CFLAGS = \
- $(MHD_CFLAGS) $(AM_CFLAGS)
-
-libgnunet_plugin_transport_https_client_la_SOURCES = \
-  plugin_transport_http_client.c plugin_transport_http_common.c
-libgnunet_plugin_transport_https_client_la_LIBADD = \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  @LIBCURL@ \
-  $(top_builddir)/src/util/libgnunetutil.la
-libgnunet_plugin_transport_https_client_la_LDFLAGS = \
-  $(GN_LIBINTL) \
-  $(GN_PLUGIN_LDFLAGS)
-libgnunet_plugin_transport_https_client_la_CFLAGS = \
- @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) -DBUILD_HTTPS
-
-
-libgnunet_plugin_transport_https_server_la_SOURCES = \
-  plugin_transport_http_server.c plugin_transport_http_common.c
-libgnunet_plugin_transport_https_server_la_LIBADD = \
-  $(MHD_LIBS) \
-  $(top_builddir)/src/hello/libgnunethello.la \
-  $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
-  $(top_builddir)/src/nat/libgnunetnatnew.la \
-  $(top_builddir)/src/util/libgnunetutil.la
-libgnunet_plugin_transport_https_server_la_LDFLAGS = \
-  $(GN_LIBINTL) \
- $(GN_PLUGIN_LDFLAGS)
-libgnunet_plugin_transport_https_server_la_CFLAGS = \
- $(MHD_CFLAGS) $(AM_CFLAGS) -DBUILD_HTTPS
-
 check_PROGRAMS = \
- test_transport_address_switch_tcp \
- test_transport_testing_startstop \
- test_transport_testing_restart \
- test_plugin_tcp \
- $(UNIX_TEST) \
- $(WLAN_PLUGIN_TEST) \
- $(BT_PLUGIN_TEST) \
- test_http_common \
- $(HTTP_CLIENT_PLUGIN_TEST) \
- $(HTTPS_CLIENT_PLUGIN_TEST) \
- $(HTTP_SERVER_PLUGIN_TEST) \
- $(HTTPS_SERVER_PLUGIN_TEST) \
- test_transport_api_blacklisting_tcp \
- test_transport_api_disconnect_tcp \
- test_transport_api_tcp \
- test_transport_api2_tcp \
- test_transport_api_restart_1peer \
- test_transport_api_restart_2peers \
- test_transport_api_timeout_tcp \
- test_transport_api_limited_sockets_tcp \
- test_transport_api_tcp_nat \
- $(UNIX_PLUGIN_TEST) \
- $(UNIX_PLUGIN_TIMEOUT_TEST) \
- $(UNIX_API_ABSTRACT_TEST) \
- $(HTTP_API_TEST) \
- $(HTTP_REVERSE_API_TEST) \
- $(HTTP_API_TIMEOUT_TEST) \
- $(HTTP_SWITCH) \
- $(HTTPS_API_TEST) \
- $(HTTPS_API_TIMEOUT_TEST) \
- $(HTTPS_SWITCH) \
- $(WLAN_API_TEST) \
- $(WLAN_TIMEOUT_TEST) \
- $(BT_API_TEST) \
- $(BT_TIMEOUT_TEST) \
- test_transport_api_multi \
- test_transport_api_monitor_peers \
- test_transport_blacklisting_no_bl \
- test_transport_blacklisting_outbound_bl_full \
- test_transport_blacklisting_outbound_bl_plugin \
- test_transport_blacklisting_inbound_bl_plugin \
- test_transport_blacklisting_inbound_bl_full \
- test_transport_blacklisting_multiple_plugins \
- test_transport_api_manipulation_send_tcp \
- test_transport_api_manipulation_recv_tcp \
- test_transport_api_manipulation_cfg \
- test_transport_api_reliability_tcp \
- test_transport_api_reliability_tcp_nat \
- $(UNIX_REL_TEST) \
- $(HTTP_REL_TEST) \
- $(HTTPS_REL_TEST) \
- $(WLAN_REL_TEST) \
- $(WLAN_UREL_TEST) \
- $(BT_REL_TEST) \
- $(BT_UREL_TEST) \
- test_quota_compliance_tcp \
- test_quota_compliance_tcp_asymmetric \
- $(UNIX_QUOTA_TEST) \
- $(HTTP_QUOTA_TEST) \
- $(HTTPS_QUOTA_TEST) \
- $(WLAN_QUOTA_TEST) \
- $(BT_QUOTA_TEST)
-if HAVE_GETOPT_BINARY
-check_PROGRAMS += \
-test_transport_api_slow_ats
-endif
+ test_communicator_basic-unix \
+ test_communicator_basic-tcp \
+ test_communicator_basic-udp \
+ test_communicator_basic-quic \
+ test_communicator_rekey-tcp \
+ test_communicator_rekey-udp \
+ test_communicator_backchannel-udp \
+ test_communicator_bidirect-tcp
+
+# Only test TNG if we run experimental
 if HAVE_EXPERIMENTAL
-check_PROGRAMS += \
-  test_transport_address_switch_udp \
-  test_plugin_udp \
-  test_transport_api_udp \
-  test_transport_api_timeout_udp \
-  test_transport_api_udp_nat \
-  test_transport_api_reliability_udp \
-  test_quota_compliance_udp \
-  test_communicator_basic-unix \
-  test_communicator_basic-tcp \
-  test_communicator_basic-udp \
-  test_communicator_basic-quic \
-  test_communicator_rekey-tcp \
-  test_communicator_rekey-udp \
-  test_communicator_backchannel-udp \
-  test_communicator_bidirect-tcp
+check_SCRIPTS= \
+  test_transport_start_testcase.sh \
+  test_transport_simple_send_performance.sh \
+  test_transport_nat_icmp_tcp.sh \
+  test_transport_nat_upnp.sh \
+  test_transport_simple_send_string.sh \
+  test_transport_simple_send.sh \
+  test_transport_simple_send_broadcast.sh \
+  test_transport_udp_backchannel.sh \
+  test_transport_simple_send_dv_circle.sh \
+  test_transport_simple_send_dv_inverse.sh
 endif
 
 if ENABLE_TEST_RUN
 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
 TESTS = \
- test_transport_address_switch_tcp \
- $(HTTP_SWITCH) \
- $(HTTPS_SWITCH) \
- test_transport_testing_startstop \
- test_transport_testing_restart \
- test_plugin_tcp \
- $(UNIX_TEST) \
- $(WLAN_PLUGIN_TEST) \
- $(BT_PLUGIN_TEST) \
- test_transport_api_blacklisting_tcp \
- test_transport_api_disconnect_tcp \
- test_transport_api_tcp \
- test_transport_api_restart_1peer \
- test_transport_api_restart_2peers \
- test_transport_api_limited_sockets_tcp \
- test_transport_api_tcp_nat \
- $(UNIX_PLUGIN_TEST) \
- $(UNIX_API_ABSTRACT_TEST) \
- $(HTTP_API_TEST) \
- $(HTTPS_API_TEST) \
- $(WLAN_API_TEST) \
- $(BT_API_TEST) \
- test_transport_api_multi \
- test_transport_api_monitor_peers \
- test_transport_blacklisting_no_bl \
- test_transport_blacklisting_outbound_bl_full \
- test_transport_blacklisting_outbound_bl_plugin \
- test_transport_blacklisting_inbound_bl_plugin \
- test_transport_blacklisting_inbound_bl_full \
- test_transport_blacklisting_multiple_plugins \
- test_transport_api_manipulation_send_tcp \
- test_transport_api_manipulation_recv_tcp \
- test_transport_api_manipulation_cfg \
- test_transport_api_reliability_tcp \
- test_transport_api_reliability_tcp_nat \
- $(UNIX_REL_TEST) \
- $(HTTP_REL_TEST) \
- $(HTTPS_REL_TEST) \
- $(WLAN_REL_TEST) \
- $(WLAN_UREL_TEST) \
- $(BT_REL_TEST) \
- $(BT_UREL_TEST) \
- test_quota_compliance_tcp \
- test_quota_compliance_tcp_asymmetric \
- $(UNIX_QUOTA_TEST) \
- $(HTTP_QUOTA_TEST) \
- $(HTTPS_QUOTA_TEST) \
- test_transport_api_timeout_tcp \
- $(UNIX_PLUGIN_TIMEOUT_TEST) \
- $(HTTP_API_TIMEOUT_TEST) \
- $(HTTPS_API_TIMEOUT_TEST) \
- $(WLAN_TIMEOUT_TEST) \
- $(BT_TIMEOUT_TEST) \
- $(check_SCRIPTS)
-if HAVE_GETOPT_BINARY
-TESTS += \
-test_transport_api_slow_ats
-endif
-if HAVE_EXPERIMENTAL
-TESTS += \
-  test_transport_address_switch_udp \
-  test_plugin_udp \
-  test_transport_api_udp \
-  test_transport_api_timeout_udp \
-  test_transport_api_udp_nat \
-  test_transport_api_reliability_udp \
-  test_quota_compliance_udp \
+  $(check_SCRIPTS) \
   test_communicator_basic-unix \
   test_communicator_basic-tcp \
   test_communicator_basic-quic \
@@ -797,21 +340,7 @@ TESTS += \
   test_communicator_backchannel-udp \
   test_communicator_bidirect-tcp
 endif
-endif
 
-# Only test TNG if we run experimental
-if HAVE_EXPERIMENTAL
-check_SCRIPTS= \
-  test_transport_simple_send_performance.sh \
-  test_transport_nat_icmp_tcp.sh \
-  test_transport_nat_upnp.sh \
-  test_transport_simple_send_string.sh \
-  test_transport_simple_send.sh \
-  test_transport_simple_send_broadcast.sh \
-  test_transport_udp_backchannel.sh \
-  test_transport_simple_send_dv_circle.sh \
-  test_transport_simple_send_dv_inverse.sh
-endif
 
 test_transport_start_with_config_SOURCES = \
  test_transport_start_with_config.c
@@ -822,116 +351,6 @@ test_transport_start_with_config_LDADD = \
  libgnunettransportcore.la \
  libgnunettransporttesting2.la
 
-test_transport_testing_startstop_SOURCES = \
- test_transport_testing_startstop.c
-test_transport_testing_startstop_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- libgnunettransporttesting.la
-
-test_transport_testing_restart_SOURCES = \
- test_transport_testing_restart.c
-test_transport_testing_restart_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- libgnunettransporttesting.la
-
-test_transport_api_blacklisting_tcp_SOURCES = \
- test_transport_api_blacklisting.c
-test_transport_api_blacklisting_tcp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_blacklisting_no_bl_SOURCES = \
- test_transport_blacklisting.c
-test_transport_blacklisting_no_bl_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_blacklisting_outbound_bl_full_SOURCES = \
- test_transport_blacklisting.c
-test_transport_blacklisting_outbound_bl_full_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_blacklisting_outbound_bl_plugin_SOURCES = \
- test_transport_blacklisting.c
-test_transport_blacklisting_outbound_bl_plugin_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_blacklisting_inbound_bl_full_SOURCES = \
- test_transport_blacklisting.c
-test_transport_blacklisting_inbound_bl_full_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_blacklisting_inbound_bl_plugin_SOURCES = \
- test_transport_blacklisting.c
-test_transport_blacklisting_inbound_bl_plugin_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_blacklisting_multiple_plugins_SOURCES = \
- test_transport_blacklisting.c
-test_transport_blacklisting_multiple_plugins_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-
-test_transport_api_disconnect_tcp_SOURCES = \
- test_transport_api_disconnect.c
-test_transport_api_disconnect_tcp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_plugin_tcp_SOURCES = \
- test_plugin_transport.c
-test_plugin_tcp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-if HAVE_EXPERIMENTAL
-test_plugin_udp_SOURCES = \
- test_plugin_transport.c
-test_plugin_udp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-endif
-
-if HAVE_EXPERIMENTAL
 test_communicator_basic_unix_SOURCES = \
  test_communicator_basic.c
 test_communicator_basic_unix_LDADD = \
@@ -995,87 +414,6 @@ test_communicator_bidirect_tcp_LDADD = \
  $(top_builddir)/src/testing/libgnunettesting.la \
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/statistics/libgnunetstatistics.la
-endif
-
-test_plugin_unix_SOURCES = \
- test_plugin_transport.c
-test_plugin_unix_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-test_plugin_wlan_SOURCES = \
- test_plugin_transport.c
-test_plugin_wlan_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-test_plugin_bluetooth_SOURCES = \
- test_plugin_transport.c
-test_plugin_bluetooth_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-test_http_common_SOURCES = \
- test_http_common.c plugin_transport_http_common.c
-test_http_common_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-test_plugin_http_server_SOURCES = \
- test_plugin_transport.c
-test_plugin_http_server_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-test_plugin_https_server_SOURCES = \
- test_plugin_transport.c
-test_plugin_https_server_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-test_plugin_http_client_SOURCES = \
- test_plugin_transport.c
-test_plugin_http_client_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-test_plugin_https_client_SOURCES = \
- test_plugin_transport.c
-test_plugin_https_client_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-test_transport_api_tcp_SOURCES = \
- test_transport_api.c
-test_transport_api_tcp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
 
 test_transport_api2_tcp_SOURCES = \
  test_transport_api2.c
@@ -1084,483 +422,8 @@ test_transport_api2_tcp_LDADD = \
  $(top_builddir)/src/util/libgnunetutil.la  \
  libgnunettransporttesting2.la
 
-test_transport_api_restart_1peer_SOURCES = \
- test_transport_api_restart_reconnect.c
-test_transport_api_restart_1peer_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_restart_2peers_SOURCES = \
- test_transport_api_restart_reconnect.c
-test_transport_api_restart_2peers_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
-$(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_limited_sockets_tcp_SOURCES = \
- test_transport_api_limited_sockets.c
-test_transport_api_limited_sockets_tcp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-test_transport_api_tcp_nat_SOURCES = \
- test_transport_api.c
-test_transport_api_tcp_nat_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_manipulation_send_tcp_SOURCES = \
- test_transport_api_manipulation_send_tcp.c
-test_transport_api_manipulation_send_tcp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_manipulation_recv_tcp_SOURCES = \
- test_transport_api_manipulation_recv_tcp.c
-test_transport_api_manipulation_recv_tcp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_manipulation_cfg_SOURCES = \
- test_transport_api_manipulation_cfg.c
-test_transport_api_manipulation_cfg_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_reliability_tcp_SOURCES = \
- test_transport_api_reliability.c
-test_transport_api_reliability_tcp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_timeout_tcp_SOURCES = \
- test_transport_api_timeout.c
-test_transport_api_timeout_tcp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_timeout_unix_SOURCES = \
- test_transport_api_timeout.c
-test_transport_api_timeout_unix_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_timeout_wlan_SOURCES = \
- test_transport_api_timeout.c
-test_transport_api_timeout_wlan_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_timeout_bluetooth_SOURCES = \
- test_transport_api_timeout.c
-test_transport_api_timeout_bluetooth_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_reliability_tcp_nat_SOURCES = \
- test_transport_api_reliability.c
-test_transport_api_reliability_tcp_nat_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_reliability_bluetooth_SOURCES = \
- test_transport_api_reliability.c
-test_transport_api_reliability_bluetooth_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_reliability_wlan_SOURCES = \
- test_transport_api_reliability.c
-test_transport_api_reliability_wlan_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-if HAVE_EXPERIMENTAL
-test_transport_api_udp_SOURCES = \
- test_transport_api.c
-test_transport_api_udp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-test_transport_api_timeout_udp_SOURCES = \
- test_transport_api_timeout.c
-test_transport_api_timeout_udp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_udp_nat_SOURCES = \
- test_transport_api.c
-test_transport_api_udp_nat_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-endif
-
-test_transport_api_unix_SOURCES = \
- test_transport_api.c
-test_transport_api_unix_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_unix_abstract_SOURCES = \
- test_transport_api.c
-test_transport_api_unix_abstract_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-# HTTP tests
-test_transport_api_http_SOURCES = \
- test_transport_api.c
-test_transport_api_http_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_http_reverse_SOURCES = \
- test_transport_api.c
-test_transport_api_http_reverse_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_timeout_http_SOURCES = \
- test_transport_api_timeout.c
-test_transport_api_timeout_http_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_reliability_http_SOURCES = \
- test_transport_api_reliability.c
-test_transport_api_reliability_http_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_reliability_http_xhr_SOURCES = \
- test_transport_api_reliability.c
-test_transport_api_reliability_http_xhr_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_quota_compliance_http_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_http_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_quota_compliance_http_asymmetric_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_http_asymmetric_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_quota_compliance_https_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_https_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_quota_compliance_https_asymmetric_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_https_asymmetric_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-# HTTPS tests
-test_transport_api_https_SOURCES = \
- test_transport_api.c
-test_transport_api_https_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-test_transport_api_timeout_https_SOURCES = \
- test_transport_api_timeout.c
-test_transport_api_timeout_https_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-
-test_transport_api_reliability_https_SOURCES = \
- test_transport_api_reliability.c
-test_transport_api_reliability_https_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_reliability_https_xhr_SOURCES = \
- test_transport_api_reliability.c
-test_transport_api_reliability_https_xhr_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_reliability_unix_SOURCES = \
- test_transport_api_reliability.c
-test_transport_api_reliability_unix_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-if HAVE_EXPERIMENTAL
-test_transport_api_reliability_udp_SOURCES = \
- test_transport_api_reliability.c
-test_transport_api_reliability_udp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-endif
-
-if LINUX
-test_transport_api_wlan_SOURCES = \
- test_transport_api.c
-test_transport_api_wlan_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-endif
-
-if LINUX
-if HAVE_LIBBLUETOOTH
-test_transport_api_bluetooth_SOURCES = \
- test_transport_api.c
-test_transport_api_bluetooth_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-endif
-endif
-
-test_transport_address_switch_tcp_SOURCES = \
- test_transport_address_switch.c
-test_transport_address_switch_tcp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-if HAVE_EXPERIMENTAL
-test_transport_address_switch_udp_SOURCES = \
- test_transport_address_switch.c
-test_transport_address_switch_udp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-endif
-
- test_transport_address_switch_http_SOURCES = \
- test_transport_address_switch.c
-test_transport_address_switch_http_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
- test_transport_address_switch_https_SOURCES = \
- test_transport_address_switch.c
-test_transport_address_switch_https_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_quota_compliance_tcp_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_tcp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_quota_compliance_tcp_asymmetric_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_tcp_asymmetric_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-if HAVE_EXPERIMENTAL
-test_quota_compliance_udp_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_udp_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-endif
-
-test_quota_compliance_unix_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_unix_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_quota_compliance_unix_asymmetric_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_unix_asymmetric_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_quota_compliance_wlan_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_wlan_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_quota_compliance_wlan_asymmetric_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_wlan_asymmetric_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_quota_compliance_bluetooth_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_bluetooth_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_quota_compliance_bluetooth_asymmetric_SOURCES = \
- test_quota_compliance.c
-test_quota_compliance_bluetooth_asymmetric_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/nt/libgnunetnt.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_multi_SOURCES = \
- test_transport_api.c
-test_transport_api_multi_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_monitor_peers_SOURCES = \
- test_transport_api_monitor_peers.c
-test_transport_api_monitor_peers_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- libgnunettransporttesting.la
-
-test_transport_api_slow_ats_SOURCES = \
- test_transport_api.c
-test_transport_api_slow_ats_LDADD = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/util/libgnunetutil.la  \
- libgnunettransporttesting.la
-
-
 EXTRA_DIST = \
+test_transport_start_testcase.sh \
 test_transport_simple_send_performance.sh \
 test_transport_nat_icmp_tcp.sh \
 test_transport_nat_upnp.sh \
@@ -1571,78 +434,16 @@ test_transport_udp_backchannel.sh \
 test_transport_simple_send_dv_circle.sh \
 test_transport_simple_send_dv_inverse.sh \
 gnunet-transport-certificate-creation.in \
-communicator-unix.conf \
 test_plugin_hostkey \
 test_plugin_hostkey.ecc \
 test_delay \
 template_cfg_peer1.conf\
 template_cfg_peer2.conf\
-test_plugin_transport_data.conf\
-test_plugin_transport_data_udp.conf\
-test_quota_compliance_data.conf\
-test_quota_compliance_http_peer1.conf\
-test_quota_compliance_http_peer2.conf\
-test_quota_compliance_https_peer1.conf\
-test_quota_compliance_https_peer2.conf\
-test_quota_compliance_tcp_peer1.conf\
-test_quota_compliance_tcp_peer2.conf\
-test_quota_compliance_udp_peer1.conf\
-test_quota_compliance_udp_peer2.conf\
-test_quota_compliance_unix_peer1.conf\
-test_quota_compliance_unix_peer2.conf\
-test_quota_compliance_wlan_peer1.conf\
-test_quota_compliance_wlan_peer2.conf\
-test_quota_compliance_bluetooth_peer1.conf\
-test_quota_compliance_bluetooth_peer2.conf\
-test_quota_compliance_http_asymmetric_peer1.conf\
-test_quota_compliance_http_asymmetric_peer2.conf\
-test_quota_compliance_https_asymmetric_peer1.conf\
-test_quota_compliance_https_asymmetric_peer2.conf\
-test_quota_compliance_tcp_asymmetric_peer1.conf\
-test_quota_compliance_tcp_asymmetric_peer2.conf\
-test_quota_compliance_unix_asymmetric_peer1.conf\
-test_quota_compliance_unix_asymmetric_peer2.conf\
-test_quota_compliance_wlan_asymmetric_peer1.conf\
-test_quota_compliance_wlan_asymmetric_peer2.conf\
-test_quota_compliance_bluetooth_asymmetric_peer1.conf\
-test_quota_compliance_bluetooth_asymmetric_peer2.conf\
 test_transport_api_data.conf\
-test_transport_api_blacklisting_tcp_peer1.conf \
-test_transport_api_blacklisting_tcp_peer2.conf \
-test_transport_api_http_peer1.conf\
-test_transport_api_http_peer2.conf\
-test_transport_api_https_peer1.conf\
-test_transport_api_https_peer2.conf\
-test_transport_api_limited_sockets_tcp_peer1.conf\
-test_transport_api_limited_sockets_tcp_peer2.conf\
 test_transport_api_timeout_tcp_peer1.conf\
 test_transport_api_timeout_tcp_peer2.conf\
 test_transport_api_multi_peer1.conf\
 test_transport_api_multi_peer2.conf\
-test_transport_api_restart_1peer_peer1.conf\
-test_transport_api_restart_1peer_peer2.conf\
-test_transport_api_reliability_http_peer1.conf\
-test_transport_api_reliability_http_peer2.conf\
-test_transport_api_reliability_https_peer1.conf\
-test_transport_api_reliability_https_peer2.conf\
-test_transport_api_reliability_tcp_nat_peer1.conf\
-test_transport_api_reliability_tcp_nat_peer2.conf\
-test_transport_api_reliability_tcp_peer1.conf\
-test_transport_api_reliability_tcp_peer2.conf\
-test_transport_api_reliability_wlan_peer1.conf\
-test_transport_api_reliability_wlan_peer2.conf\
-test_transport_api_reliability_bluetooth_peer1.conf\
-test_transport_api_reliability_bluetooth_peer2.conf\
-test_transport_api_manipulation_send_tcp_peer1.conf\
-test_transport_api_manipulation_send_tcp_peer2.conf\
-test_transport_api_manipulation_recv_tcp_peer1.conf\
-test_transport_api_manipulation_recv_tcp_peer2.conf\
-test_transport_api_manipulation_cfg_peer1.conf\
-test_transport_api_manipulation_cfg_peer2.conf\
-test_transport_api_restart_1peer_peer1.conf\
-test_transport_api_restart_1peer_peer2.conf\
-test_transport_api_restart_2peers_peer1.conf\
-test_transport_api_restart_2peers_peer2.conf\
 test_transport_api_tcp_nat_peer1.conf\
 test_transport_api_tcp_nat_peer2.conf\
 test_transport_api_tcp_peer1.conf\
@@ -1653,65 +454,13 @@ test_transport_api_udp_nat_peer1.conf\
 test_transport_api_udp_nat_peer2.conf\
 test_transport_api_udp_peer1.conf\
 test_transport_api_udp_peer2.conf\
-test_transport_api_timeout_udp_peer1.conf\
-test_transport_api_timeout_udp_peer2.conf\
 test_transport_api_unix_peer1.conf\
 test_transport_api_unix_peer2.conf\
-test_transport_api_unix_abstract_peer1.conf \
-test_transport_api_unix_abstract_peer2.conf \
-test_transport_api_timeout_unix_peer1.conf\
-test_transport_api_timeout_unix_peer2.conf\
-test_transport_api_timeout_wlan_peer1.conf \
-test_transport_api_timeout_wlan_peer2.conf \
-test_transport_api_timeout_bluetooth_peer1.conf\
-test_transport_api_timeout_bluetooth_peer2.conf\
-test_transport_api_reliability_udp_peer1.conf\
-test_transport_api_reliability_udp_peer2.conf\
-test_transport_api_reliability_http_xhr_peer1.conf\
-test_transport_api_reliability_http_xhr_peer2.conf\
-test_transport_api_reliability_https_xhr_peer1.conf\
-test_transport_api_reliability_https_xhr_peer2.conf\
-test_transport_api_reliability_unix_peer1.conf\
-test_transport_api_reliability_unix_peer2.conf\
-test_transport_api_reliability_wlan_peer1.conf\
-test_transport_api_reliability_wlan_peer2.conf\
-test_transport_api_unreliability_wlan_peer1.conf\
-test_transport_api_unreliability_wlan_peer2.conf\
-test_transport_api_reliability_bluetooth_peer1.conf\
-test_transport_api_reliability_bluetooth_peer2.conf\
-test_transport_api_wlan_peer1.conf\
-test_transport_api_wlan_peer2.conf\
-test_transport_api_bluetooth_peer1.conf\
-test_transport_api_bluetooth_peer2.conf\
 test_transport_api_monitor_peers_peer1.conf\
 test_transport_api_monitor_peers_peer2.conf\
 test_transport_api_monitor_validation_peer1.conf\
 test_transport_api_monitor_validation_peer2.conf\
 test_transport_defaults.conf\
-test_transport_api_disconnect_tcp_peer1.conf\
-test_transport_api_disconnect_tcp_peer2.conf\
-test_transport_api_timeout_http_peer1.conf\
-test_transport_api_timeout_http_peer2.conf\
-test_transport_api_timeout_https_peer1.conf\
-test_transport_api_timeout_https_peer2.conf\
-test_transport_blacklisting_cfg_peer1.conf \
-test_transport_blacklisting_cfg_peer2.conf \
-test_transport_blacklisting_cfg_blp_peer1_full.conf\
-test_transport_blacklisting_cfg_blp_peer1_plugin.conf \
-test_transport_blacklisting_cfg_blp_peer2_full.conf\
-test_transport_blacklisting_cfg_blp_peer2_plugin.conf \
-test_transport_blacklisting_cfg_blp_peer1_multiple_plugins.conf \
-test_transport_blacklisting_cfg_blp_peer2_multiple_plugins.conf \
-test_transport_api_http_reverse_peer1.conf \
-test_transport_api_http_reverse_peer2.conf \
-perf_tcp_peer1.conf \
-perf_tcp_peer2.conf \
-test_transport_api_slow_ats_peer1.conf \
-test_transport_api_slow_ats_peer2.conf \
-  tcp_connection_legacy.c \
-  tcp_server_mst_legacy.c \
-  tcp_server_legacy.c \
-  tcp_service_legacy.c \
 test_communicator_unix_basic_peer1.conf \
 test_communicator_unix_basic_peer2.conf \
 test_communicator_tcp_basic_peer1.conf \
diff --git a/src/transport/communicator-unix.conf 
b/src/transport/communicator-unix.conf
deleted file mode 100644
index ad92616c6..000000000
--- a/src/transport/communicator-unix.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[communicator-unix]
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-communicator-unix.sock
diff --git a/src/transport/gnunet-helper-transport-bluetooth.c 
b/src/transport/gnunet-helper-transport-bluetooth.c
deleted file mode 100644
index 64f3b6160..000000000
--- a/src/transport/gnunet-helper-transport-bluetooth.c
+++ /dev/null
@@ -1,2286 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010, 2011, 2012 GNUnet e.V.
-   Copyright (C) 2007, 2008, Andy Green <andy@warmcat.com>
-   Copyright (C) 2009 Thomas d'Otreppe
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-#include "platform.h"
-#include "gnunet_private_config.h"
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/hci.h>
-#include <bluetooth/hci_lib.h>
-#include <bluetooth/rfcomm.h>
-#include <bluetooth/sdp.h>
-#include <bluetooth/sdp_lib.h>
-#include <errno.h>
-#include <linux/if.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include "plugin_transport_wlan.h"
-#include "gnunet_protocols.h"
-
-
-/**
- * Maximum number of ports assignable for RFCOMMM protocol.
- */
-#define MAX_PORTS 30
-
-/**
- * Maximum size of a message allowed in either direction
- * (used for our receive and sent buffers).
- */
-#define MAXLINE 4096
-
-
-/**
- * Maximum number of loops without inquiring for new devices.
- */
-#define MAX_LOOPS 5
-
-/**
- * In bluez library, the maximum name length of a device is 8
- */
-#define BLUEZ_DEVNAME_SIZE  8
-
-/**
- * struct for storing the information of the hardware.  There is only
- * one of these.
- */
-struct HardwareInfos
-{
-  /**
-   * Name of the interface, not necessarily 0-terminated (!).
-   */
-  char iface[IFNAMSIZ];
-
-  /**
-   * file descriptor for the rfcomm socket
-   */
-  int fd_rfcomm;
-
-  /**
-   * MAC address of our own bluetooth interface.
-   */
-  struct GNUNET_TRANSPORT_WLAN_MacAddress pl_mac;
-
-  /**
-   * SDP session
-   */
-  sdp_session_t *session;
-};
-
-/**
- * IO buffer used for buffering data in transit (to wireless or to stdout).
- */
-struct SendBuffer
-{
-  /**
-   * How many bytes of data are stored in 'buf' for transmission right now?
-   * Data always starts at offset 0 and extends to 'size'.
-   */
-  size_t size;
-
-  /**
-   * How many bytes that were stored in 'buf' did we already write to the
-   * destination?  Always smaller than 'size'.
-   */
-  size_t pos;
-
-  /**
-   * Buffered data; twice the maximum allowed message size as we add some
-   * headers.
-   */
-  char buf[MAXLINE * 2];
-};
-
-#ifdef __linux__
-/**
- * Devices buffer used to keep a list with all the discoverable devices in
- * order to send them HELLO messages one by one when it receive a broadcast 
message.
- */
-struct BroadcastMessages
-{
-  /* List with the discoverable devices' addresses */
-  bdaddr_t devices[MAX_PORTS];
-
-  /* List with the open sockets */
-  int fds[MAX_PORTS];
-
-
-  /* The number of the devices */
-  int size;
-
-  /* The current position */
-  int pos;
-
-  /* The device id */
-  int dev_id;
-};
-
-/**
- * Address used to identify the broadcast messages.
- */
-static struct GNUNET_TRANSPORT_WLAN_MacAddress broadcast_address = { { 255, 
255,
-                                                                       255, 
255,
-                                                                       255,
-                                                                       255 } };
-
-/**
- * Buffer with the discoverable devices.
- */
-static struct BroadcastMessages neighbours;
-
-static int searching_devices_count = 0;
-#endif
-
-/**
- * Buffer for data read from stdin to be transmitted to the bluetooth device
- */
-static struct SendBuffer write_pout;
-
-/**
- * Buffer for data read from the bluetooth device to be transmitted to stdout.
- */
-static struct SendBuffer write_std;
-
-
-/* ****** this are the same functions as the ones used in 
gnunet-helper-transport-wlan.c ****** */
-
-/**
- * To what multiple do we align messages?  8 byte should suffice for everyone
- * for now.
- */
-#define ALIGN_FACTOR 8
-
-/**
- * Smallest supported message.
- */
-#define MIN_BUFFER_SIZE sizeof(struct GNUNET_MessageHeader)
-
-
-/**
- * Functions with this signature are called whenever a
- * complete message is received by the tokenizer.
- *
- * @param cls closure
- * @param message the actual message
- */
-typedef void (*MessageTokenizerCallback) (void *cls,
-                                          const struct
-                                          GNUNET_MessageHeader *
-                                          message);
-
-/**
- * Handle to a message stream tokenizer.
- */
-struct MessageStreamTokenizer
-{
-  /**
-   * Function to call on completed messages.
-   */
-  MessageTokenizerCallback cb;
-
-  /**
-   * Closure for cb.
-   */
-  void *cb_cls;
-
-  /**
-   * Size of the buffer (starting at 'hdr').
-   */
-  size_t curr_buf;
-
-  /**
-   * How many bytes in buffer have we already processed?
-   */
-  size_t off;
-
-  /**
-   * How many bytes in buffer are valid right now?
-   */
-  size_t pos;
-
-  /**
-   * Beginning of the buffer.  Typed like this to force alignment.
-   */
-  struct GNUNET_MessageHeader *hdr;
-};
-
-
-/**
- * Create a message stream tokenizer.
- *
- * @param cb function to call on completed messages
- * @param cb_cls closure for cb
- * @return handle to tokenizer
- */
-static struct MessageStreamTokenizer *
-mst_create (MessageTokenizerCallback cb,
-            void *cb_cls)
-{
-  struct MessageStreamTokenizer *ret;
-
-  ret = malloc (sizeof(struct MessageStreamTokenizer));
-  if (NULL == ret)
-  {
-    fprintf (stderr, "Failed to allocate buffer for tokenizer\n");
-    exit (1);
-  }
-  ret->hdr = malloc (MIN_BUFFER_SIZE);
-  if (NULL == ret->hdr)
-  {
-    fprintf (stderr, "Failed to allocate buffer for alignment\n");
-    exit (1);
-  }
-  ret->curr_buf = MIN_BUFFER_SIZE;
-  ret->cb = cb;
-  ret->cb_cls = cb_cls;
-  ret->pos = 0;
-
-  return ret;
-}
-
-
-/**
- * Add incoming data to the receive buffer and call the
- * callback for all complete messages.
- *
- * @param mst tokenizer to use
- * @param buf input data to add
- * @param size number of bytes in buf
- * @return GNUNET_OK if we are done processing (need more data)
- *         GNUNET_SYSERR if the data stream is corrupt
- */
-static int
-mst_receive (struct MessageStreamTokenizer *mst,
-             const char *buf, size_t size)
-{
-  const struct GNUNET_MessageHeader *hdr;
-  size_t delta;
-  uint16_t want;
-  char *ibuf;
-  int need_align;
-  unsigned long offset;
-  int ret;
-
-  ret = GNUNET_OK;
-  ibuf = (char *) mst->hdr;
-  while (mst->pos > 0)
-  {
-do_align:
-    if (mst->pos < mst->off)
-    {
-      // fprintf (stderr, "We processed too many bytes!\n");
-      return GNUNET_SYSERR;
-    }
-    if ((mst->curr_buf - mst->off < sizeof(struct GNUNET_MessageHeader)) ||
-        (0 != (mst->off % ALIGN_FACTOR)))
-    {
-      /* need to align or need more space */
-      mst->pos -= mst->off;
-      memmove (ibuf, &ibuf[mst->off], mst->pos);
-      mst->off = 0;
-    }
-    if (mst->pos - mst->off < sizeof(struct GNUNET_MessageHeader))
-    {
-      delta =
-        GNUNET_MIN (sizeof(struct GNUNET_MessageHeader)
-                    - (mst->pos - mst->off), size);
-      GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
-      mst->pos += delta;
-      buf += delta;
-      size -= delta;
-    }
-    if (mst->pos - mst->off < sizeof(struct GNUNET_MessageHeader))
-    {
-      // FIXME should I reset ??
-      // mst->off = 0;
-      // mst->pos = 0;
-      return GNUNET_OK;
-    }
-    hdr = (const struct GNUNET_MessageHeader *) &ibuf[mst->off];
-    want = ntohs (hdr->size);
-    if (want < sizeof(struct GNUNET_MessageHeader))
-    {
-      fprintf (stderr,
-               "Received invalid message from stdin\n");
-      return GNUNET_SYSERR;
-    }
-    if ((mst->curr_buf - mst->off < want) &&
-        (mst->off > 0))
-    {
-      /* need more space */
-      mst->pos -= mst->off;
-      memmove (ibuf, &ibuf[mst->off], mst->pos);
-      mst->off = 0;
-    }
-    if (want > mst->curr_buf)
-    {
-      if (mst->off != 0)
-      {
-        fprintf (stderr, "Error! We should proceeded 0 bytes\n");
-        return GNUNET_SYSERR;
-      }
-      mst->hdr = realloc (mst->hdr, want);
-      if (NULL == mst->hdr)
-      {
-        fprintf (stderr, "Failed to allocate buffer for alignment\n");
-        exit (1);
-      }
-      ibuf = (char *) mst->hdr;
-      mst->curr_buf = want;
-    }
-    hdr = (const struct GNUNET_MessageHeader *) &ibuf[mst->off];
-    if (mst->pos - mst->off < want)
-    {
-      delta = GNUNET_MIN (want - (mst->pos - mst->off), size);
-      if (mst->pos + delta > mst->curr_buf)
-      {
-        fprintf (stderr, "The size of the buffer will be exceeded!\n");
-        return GNUNET_SYSERR;
-      }
-      GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
-      mst->pos += delta;
-      buf += delta;
-      size -= delta;
-    }
-    if (mst->pos - mst->off < want)
-    {
-      // FIXME should I use this?
-      // mst->off = 0;
-      // mst->pos = 0;
-      return GNUNET_OK;
-    }
-    mst->cb (mst->cb_cls, hdr);
-    mst->off += want;
-    if (mst->off == mst->pos)
-    {
-      /* reset to beginning of buffer, it's free right now! */
-      mst->off = 0;
-      mst->pos = 0;
-    }
-  }
-  if (0 != mst->pos)
-  {
-    fprintf (stderr,
-             "There should some valid bytes in the buffer on this stage\n");
-    return GNUNET_SYSERR;
-  }
-  while (size > 0)
-  {
-    if (size < sizeof(struct GNUNET_MessageHeader))
-      break;
-    offset = (unsigned long) buf;
-    need_align = (0 != offset % ALIGN_FACTOR) ? GNUNET_YES : GNUNET_NO;
-    if (GNUNET_NO == need_align)
-    {
-      /* can try to do zero-copy and process directly from original buffer */
-      hdr = (const struct GNUNET_MessageHeader *) buf;
-      want = ntohs (hdr->size);
-      if (want < sizeof(struct GNUNET_MessageHeader))
-      {
-        fprintf (stderr,
-                 "Received invalid message from stdin\n");
-        // exit (1);
-        mst->off = 0;
-        return GNUNET_SYSERR;
-      }
-      if (size < want)
-        break;                  /* or not, buffer incomplete, so copy to 
private buffer... */
-      mst->cb (mst->cb_cls, hdr);
-      buf += want;
-      size -= want;
-    }
-    else
-    {
-      /* need to copy to private buffer to align;
-       * yes, we go a bit more spaghetti than usual here */
-      goto do_align;
-    }
-  }
-  if (size > 0)
-  {
-    if (size + mst->pos > mst->curr_buf)
-    {
-      mst->hdr = realloc (mst->hdr, size + mst->pos);
-      if (NULL == mst->hdr)
-      {
-        fprintf (stderr, "Failed to allocate buffer for alignment\n");
-        exit (1);
-      }
-      ibuf = (char *) mst->hdr;
-      mst->curr_buf = size + mst->pos;
-    }
-    if (mst->pos + size > mst->curr_buf)
-    {
-      fprintf (stderr,
-               "Assertion failed\n");
-      exit (1);
-    }
-    GNUNET_memcpy (&ibuf[mst->pos], buf, size);
-    mst->pos += size;
-  }
-  return ret;
-}
-
-
-/**
- * Destroys a tokenizer.
- *
- * @param mst tokenizer to destroy
- */
-static void
-mst_destroy (struct MessageStreamTokenizer *mst)
-{
-  free (mst->hdr);
-  free (mst);
-}
-
-
-/**
- * Calculate crc32, the start of the calculation
- *
- * @param buf buffer to calc the crc
- * @param len len of the buffer
- * @return crc sum
- */
-static unsigned long
-calc_crc_osdep (const unsigned char *buf, size_t len)
-{
-  static const unsigned long int crc_tbl_osdep[256] = {
-    0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
-    0xE963A535, 0x9E6495A3,
-    0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD,
-    0xE7B82D07, 0x90BF1D91,
-    0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB,
-    0xF4D4B551, 0x83D385C7,
-    0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
-    0xFA0F3D63, 0x8D080DF5,
-    0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447,
-    0xD20D85FD, 0xA50AB56B,
-    0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75,
-    0xDCD60DCF, 0xABD13D59,
-    0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
-    0xCFBA9599, 0xB8BDA50F,
-    0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11,
-    0xC1611DAB, 0xB6662D3D,
-    0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F,
-    0x9FBFE4A5, 0xE8B8D433,
-    0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D,
-    0x91646C97, 0xE6635C01,
-    0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B,
-    0x8208F4C1, 0xF50FC457,
-    0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49,
-    0x8CD37CF3, 0xFBD44C65,
-    0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7,
-    0xA4D1C46D, 0xD3D6F4FB,
-    0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5,
-    0xAA0A4C5F, 0xDD0D7CC9,
-    0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3,
-    0xB966D409, 0xCE61E49F,
-    0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
-    0xB7BD5C3B, 0xC0BA6CAD,
-    0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF,
-    0x04DB2615, 0x73DC1683,
-    0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D,
-    0x0A00AE27, 0x7D079EB1,
-    0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
-    0x196C3671, 0x6E6B06E7,
-    0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9,
-    0x17B7BE43, 0x60B08ED5,
-    0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767,
-    0x3FB506DD, 0x48B2364B,
-    0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55,
-    0x316E8EEF, 0x4669BE79,
-    0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703,
-    0x220216B9, 0x5505262F,
-    0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31,
-    0x2CD99E8B, 0x5BDEAE1D,
-    0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
-    0x72076785, 0x05005713,
-    0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D,
-    0x7CDCEFB7, 0x0BDBDF21,
-    0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B,
-    0x6FB077E1, 0x18B74777,
-    0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69,
-    0x616BFFD3, 0x166CCF45,
-    0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7,
-    0x4969474D, 0x3E6E77DB,
-    0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5,
-    0x47B2CF7F, 0x30B5FFE9,
-    0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693,
-    0x54DE5729, 0x23D967BF,
-    0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1,
-    0x5A05DF1B, 0x2D02EF8D
-  };
-
-  unsigned long crc = 0xFFFFFFFF;
-
-  for (; len > 0; len--, buf++)
-    crc = crc_tbl_osdep[(crc ^ *buf) & 0xFF] ^ (crc >> 8);
-  return(~crc);
-}
-
-
-/**
- * Calculate and check crc of the bluetooth packet
- *
- * @param buf buffer of the packet, with len + 4 bytes of data,
- *            the last 4 bytes being the checksum
- * @param len length of the payload in data
- * @return 0 on success (checksum matches), 1 on error
- */
-static int
-check_crc_buf_osdep (const unsigned char *buf, size_t len)
-{
-  unsigned long crc;
-
-  crc = calc_crc_osdep (buf, len);
-  buf += len;
-  if ((((crc) & 0xFF) == buf[0]) && (((crc >> 8) & 0xFF) == buf[1]) &&
-      ( ((crc >> 16) & 0xFF) == buf[2]) && ( ((crc >> 24) & 0xFF) == buf[3]) )
-    return 0;
-  return 1;
-}
-
-
-/* ************** end of clone  ***************** */
-#ifdef __linux__
-/**
- * Function for assigning a port number
- *
- * @param socket the socket used to bind
- * @param addr pointer to the rfcomm address
- * @return 0 on success
- */
-static int
-bind_socket (int socket, struct sockaddr_rc *addr)
-{
-  int port, status;
-
-  /* Bind every possible port (from 0 to 30) and stop when binding doesn't 
fail */
-  // FIXME : it should start from port 1, but on my computer it doesn't work :)
-  for (port = 3; port <= 30; port++)
-  {
-    addr->rc_channel = port;
-    status = bind (socket, (struct sockaddr *) addr, sizeof(struct
-                                                            sockaddr_rc));
-    if (status == 0)
-      return 0;
-  }
-
-  return -1;
-}
-
-
-#endif
-
-/**
- * Function used for creating the service record and registering it.
- *
- * @param dev pointer to the device struct
- * @param rc_channel the rfcomm channel
- * @return 0 on success
- */
-static int
-register_service (struct HardwareInfos *dev, int rc_channel)
-{
-  /**
-   * 1. initializations
-   * 2. set the service ID, class, profile information
-   * 3. make the service record publicly browsable
-   * 4. register the RFCOMM channel
-   * 5. set the name, provider and description
-   * 6. register the service record to the local SDP server
-   * 7. cleanup
-   */uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                             dev->pl_mac.mac[5], dev->pl_mac.mac[4],
-                             dev->pl_mac.mac[3],
-                             dev->pl_mac.mac[2], dev->pl_mac.mac[1],
-                             dev->pl_mac.mac[0] };
-  const char *service_dsc = "Bluetooth plugin services";
-  const char *service_prov = "GNUnet provider";
-  uuid_t root_uuid, rfcomm_uuid, svc_uuid;
-  sdp_list_t *root_list = 0, *rfcomm_list = 0, *proto_list = 0,
-             *access_proto_list = 0, *svc_list = 0;
-  sdp_record_t *record = 0;
-  sdp_data_t *channel = 0;
-
-  record = sdp_record_alloc ();
-
-  /* Set the general service ID */
-  sdp_uuid128_create (&svc_uuid, &svc_uuid_int);
-  svc_list = sdp_list_append (0, &svc_uuid);
-  sdp_set_service_classes (record, svc_list);
-  sdp_set_service_id (record, svc_uuid);
-
-  /* Make the service record publicly browsable */
-  sdp_uuid16_create (&root_uuid, PUBLIC_BROWSE_GROUP);
-  root_list = sdp_list_append (0, &root_uuid);
-  sdp_set_browse_groups (record, root_list);
-
-  /* Register the RFCOMM channel */
-  sdp_uuid16_create (&rfcomm_uuid, RFCOMM_UUID);
-  channel = sdp_data_alloc (SDP_UINT8, &rc_channel);
-  rfcomm_list = sdp_list_append (0, &rfcomm_uuid);
-  sdp_list_append (rfcomm_list, channel);
-  proto_list = sdp_list_append (0, rfcomm_list);
-
-  /* Set protocol information */
-  access_proto_list = sdp_list_append (0, proto_list);
-  sdp_set_access_protos (record, access_proto_list);
-
-  /* Set the name, provider, and description */
-  sdp_set_info_attr (record, dev->iface, service_prov, service_dsc);
-
-  /* Connect to the local SDP server */
-  dev->session = sdp_connect (BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY);
-
-  if (! dev->session)
-  {
-    fprintf (stderr,
-             "Failed to connect to the SDP server on interface `%.*s': %s\n",
-             IFNAMSIZ, dev->iface, strerror (errno));
-    // FIXME exit?
-    return 1;
-  }
-
-  /* Register the service record */
-  if (sdp_record_register (dev->session, record, 0) < 0)
-  {
-    fprintf (stderr,
-             "Failed to register a service record on interface `%.*s': %s\n",
-             IFNAMSIZ, dev->iface, strerror (errno));
-    // FIXME exit?
-    return 1;
-  }
-
-  /* Cleanup */
-  sdp_data_free (channel);
-  sdp_list_free (root_list, 0);
-  sdp_list_free (rfcomm_list, 0);
-  sdp_list_free (proto_list, 0);
-  sdp_list_free (access_proto_list, 0);
-  sdp_list_free (svc_list, 0);
-  sdp_record_free (record);
-
-  return 0;
-}
-
-
-/**
- * Function used for searching and browsing for a service. This will return the
- * port number on which the service is running.
- *
- * @param dev pointer to the device struct
- * @param dest target address
- * @return channel
- */
-static int
-get_channel (struct HardwareInfos *dev, bdaddr_t dest)
-{
-  /**
-   * 1. detect all nearby devices
-   * 2. for each device:
-   * 2.1. connect to the SDP server running
-   * 2.2. get a list of service records with the specific UUID
-   * 2.3. for each service record get a list of the protocol sequences and get
-   *       the port number
-   */uint8_t svc_uuid_int[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-                             dest.b[5], dest.b[4], dest.b[3],
-                             dest.b[2], dest.b[1], dest.b[0] };
-  sdp_session_t *session = 0;
-  sdp_list_t *search_list = 0, *attrid_list = 0, *response_list = 0, *it = 0;
-  uuid_t svc_uuid;
-  uint32_t range = 0x0000ffff;
-  int channel = -1;
-
-  /* Connect to the local SDP server */
-  session = sdp_connect (BDADDR_ANY, &dest, 0);
-  if (! session)
-  {
-    fprintf (stderr,
-             "Failed to connect to the SDP server on interface `%.*s': %s\n",
-             IFNAMSIZ, dev->iface, strerror (errno));
-    return -1;
-  }
-
-  sdp_uuid128_create (&svc_uuid, &svc_uuid_int);
-  search_list = sdp_list_append (0, &svc_uuid);
-  attrid_list = sdp_list_append (0, &range);
-
-  if (sdp_service_search_attr_req (session, search_list,
-                                   SDP_ATTR_REQ_RANGE, attrid_list,
-                                   &response_list) == 0)
-  {
-    for (it = response_list; it; it = it->next)
-    {
-      sdp_record_t *record = (sdp_record_t *) it->data;
-      sdp_list_t *proto_list = 0;
-      if (sdp_get_access_protos (record, &proto_list) == 0)
-      {
-        channel = sdp_get_proto_port (proto_list, RFCOMM_UUID);
-        sdp_list_free (proto_list, 0);
-      }
-      sdp_record_free (record);
-    }
-  }
-
-  sdp_list_free (search_list, 0);
-  sdp_list_free (attrid_list, 0);
-  sdp_list_free (response_list, 0);
-
-  sdp_close (session);
-
-  if (-1 == channel)
-    fprintf (stderr,
-             "Failed to find the listening channel for interface `%.*s': %s\n",
-             IFNAMSIZ,
-             dev->iface,
-             strerror (errno));
-
-  return channel;
-}
-
-
-/**
- * Read from the socket and put the result into the buffer for transmission to 
'stdout'.
- *
- * @param sock file descriptor for reading
- * @param buf buffer to read to; first bytes will be the 'struct 
GNUNET_TRANSPORT_WLAN_Ieee80211Frame',
- *            followed by the actual payload
- * @param buf_size size of the buffer
- * @param ri where to write radiotap_rx info
- * @return number of bytes written to 'buf'
- */
-static ssize_t
-read_from_the_socket (void *sock,
-                      unsigned char *buf, size_t buf_size,
-                      struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *ri)
-{
-  unsigned char tmpbuf[buf_size];
-  ssize_t count;
-  count = read (*((int *) sock), tmpbuf, buf_size);
-
-  if (0 > count)
-  {
-    if (EAGAIN == errno)
-      return 0;
-
-    fprintf (stderr, "Failed to read from the HCI socket: %s\n", strerror (
-               errno));
-
-    return -1;
-  }
-
-  #ifdef __linux__
-  /* Get the channel used */
-  int len;
-  struct sockaddr_rc rc_addr = { 0 };
-
-  memset (&rc_addr, 0, sizeof(rc_addr));
-  len = sizeof(rc_addr);
-  if (0 > getsockname (*((int *) sock), (struct sockaddr *) &rc_addr,
-                       (socklen_t *) &len))
-  {
-    fprintf (stderr, "getsockname() call failed : %s\n", strerror (errno));
-    return -1;
-  }
-
-  memset (ri, 0, sizeof(*ri));
-  ri->ri_channel = rc_addr.rc_channel;
-  #endif
-
-  /* Detect CRC32 at the end */
-  if (0 == check_crc_buf_osdep (tmpbuf, count - sizeof(uint32_t)))
-  {
-    count -= sizeof(uint32_t);
-  }
-
-  GNUNET_memcpy (buf, tmpbuf, count);
-
-  return count;
-}
-
-
-/**
- * Open the bluetooth interface for reading/writing
- *
- * @param dev pointer to the device struct
- * @return 0 on success, non-zero on error
- */
-static int
-open_device (struct HardwareInfos *dev)
-{
-  int i, dev_id = -1, fd_hci;
-  struct
-  {
-    struct hci_dev_list_req list;
-    struct hci_dev_req dev[HCI_MAX_DEV];
-  } request;                                // used for detecting the local 
devices
-  struct sockaddr_rc rc_addr = { 0 };      // used for binding
-
-  /* Initialize the neighbour structure */
-  neighbours.dev_id = -1;
-  for (i = 0; i < MAX_PORTS; i++)
-    neighbours.fds[i] = -1;
-
-  /* Open a HCI socket */
-  fd_hci = socket (AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
-
-  if (fd_hci < 0)
-  {
-    fprintf (stderr,
-             "Failed to create HCI socket: %s\n",
-             strerror (errno));
-    return -1;
-  }
-
-  memset (&request, 0, sizeof(request));
-  request.list.dev_num = HCI_MAX_DEV;
-
-  if (ioctl (fd_hci, HCIGETDEVLIST, (void *) &request) < 0)
-  {
-    fprintf (stderr,
-             "ioctl(HCIGETDEVLIST) on interface `%.*s' failed: %s\n",
-             IFNAMSIZ,
-             dev->iface,
-             strerror (errno));
-    (void) close (fd_hci);
-    return 1;
-  }
-
-  /* Search for a device with dev->iface name */
-  for (i = 0; i < request.list.dev_num; i++)
-  {
-    struct hci_dev_info dev_info;
-
-    memset (&dev_info, 0, sizeof(struct hci_dev_info));
-    dev_info.dev_id = request.dev[i].dev_id;
-    strncpy (dev_info.name, dev->iface, BLUEZ_DEVNAME_SIZE);
-
-    if (ioctl (fd_hci, HCIGETDEVINFO, (void *) &dev_info))
-    {
-      fprintf (stderr,
-               "ioctl(HCIGETDEVINFO) on interface `%.*s' failed: %s\n",
-               IFNAMSIZ,
-               dev->iface,
-               strerror (errno));
-      (void) close (fd_hci);
-      return 1;
-    }
-
-    if (strncmp (dev_info.name, dev->iface, BLUEZ_DEVNAME_SIZE) == 0)
-    {
-      dev_id = dev_info.dev_id;     // the device was found
-      /**
-       * Copy the MAC address to the device structure
-       */
-      GNUNET_memcpy (&dev->pl_mac, &dev_info.bdaddr, sizeof(bdaddr_t));
-
-      /* Check if the interface is up */
-      if (hci_test_bit (HCI_UP, (void *) &dev_info.flags) == 0)
-      {
-        /* Bring the interface up */
-        if (ioctl (fd_hci, HCIDEVUP, dev_info.dev_id))
-        {
-          fprintf (stderr,
-                   "ioctl(HCIDEVUP) on interface `%.*s' failed: %s\n",
-                   IFNAMSIZ,
-                   dev->iface,
-                   strerror (errno));
-          (void) close (fd_hci);
-          return 1;
-        }
-      }
-
-      /* Check if the device is discoverable */
-      if ((hci_test_bit (HCI_PSCAN, (void *) &dev_info.flags) == 0) ||
-          (hci_test_bit (HCI_ISCAN, (void *) &dev_info.flags) == 0) )
-      {
-        /* Set interface Page Scan and Inqury Scan ON */
-        struct hci_dev_req dev_req;
-
-        memset (&dev_req, 0, sizeof(dev_req));
-        dev_req.dev_id = dev_info.dev_id;
-        dev_req.dev_opt = SCAN_PAGE | SCAN_INQUIRY;
-
-        if (ioctl (fd_hci, HCISETSCAN, (unsigned long) &dev_req))
-        {
-          fprintf (stderr,
-                   "ioctl(HCISETSCAN) on interface `%.*s' failed: %s\n",
-                   IFNAMSIZ,
-                   dev->iface,
-                   strerror (errno));
-          (void) close (fd_hci);
-          return 1;
-        }
-      }
-      break;
-    }
-  }
-
-  /* Check if the interface was not found */
-  if (-1 == dev_id)
-  {
-    fprintf (stderr,
-             "The interface %s was not found\n",
-             dev->iface);
-    (void) close (fd_hci);
-    return 1;
-  }
-
-  /* Close the hci socket */
-  (void) close (fd_hci);
-
-
-  /* Bind the rfcomm socket to the interface */
-  memset (&rc_addr, 0, sizeof(rc_addr));
-  rc_addr.rc_family = AF_BLUETOOTH;
-  rc_addr.rc_bdaddr = *BDADDR_ANY;
-
-  if (bind_socket (dev->fd_rfcomm, &rc_addr) != 0)
-  {
-    fprintf (stderr,
-             "Failed to bind interface `%.*s': %s\n",
-             IFNAMSIZ,
-             dev->iface,
-             strerror (errno));
-    return 1;
-  }
-
-  /* Register a SDP service */
-  if (register_service (dev, rc_addr.rc_channel) != 0)
-  {
-    fprintf (stderr,
-             "Failed to register a service on interface `%.*s': %s\n",
-             IFNAMSIZ,
-             dev->iface, strerror (errno));
-    return 1;
-  }
-
-  /* Switch socket in listening mode */
-  if (listen (dev->fd_rfcomm, 5) == -1)    // FIXME: probably we need a bigger 
number
-  {
-    fprintf (stderr, "Failed to listen on socket for interface `%.*s': %s\n",
-             IFNAMSIZ,
-             dev->iface, strerror (errno));
-    return 1;
-  }
-
-  return 0;
-}
-
-
-/**
- * Set the header to sane values to make attacks more difficult
- *
- * @param taIeeeHeader pointer to the header of the packet
- * @param dev pointer to the Hardware_Infos struct
- *
- **** copy from gnunet-helper-transport-wlan.c ****
- */
-static void
-mac_set (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader,
-         const struct HardwareInfos *dev)
-{
-  taIeeeHeader->frame_control = htons (IEEE80211_FC0_TYPE_DATA);
-  taIeeeHeader->addr3 = mac_bssid_gnunet;
-  taIeeeHeader->addr2 = dev->pl_mac;
-}
-
-
-#ifdef __linux__
-/**
- * Test if the given interface name really corresponds to a bluetooth
- * device.
- *
- * @param iface name of the interface
- * @return 0 on success, 1 on error
- **** similar with the one from gnunet-helper-transport-wlan.c ****
- */
-static int
-test_bluetooth_interface (const char *iface)
-{
-  char strbuf[512];
-  struct stat sbuf;
-  int ret;
-
-  ret = snprintf (strbuf, sizeof(strbuf),
-                  "/sys/class/bluetooth/%s/subsystem",
-                  iface);
-  if ((ret < 0) || (ret >= sizeof(strbuf)) || (0 != stat (strbuf, &sbuf)))
-  {
-    fprintf (stderr,
-             "Did not find 802.15.1 interface `%s'. Exiting.\n",
-             iface);
-    exit (1);
-  }
-  return 0;
-}
-
-
-#endif
-
-/**
- * Test incoming packets mac for being our own.
- *
- * @param taIeeeHeader buffer of the packet
- * @param dev the Hardware_Infos struct
- * @return 0 if mac belongs to us, 1 if mac is for another target
- *
- **** same as the one from gnunet-helper-transport-wlan.c ****
- */
-static int
-mac_test (const struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader,
-          const struct HardwareInfos *dev)
-{
-  static struct GNUNET_TRANSPORT_WLAN_MacAddress all_zeros;
-
-  if ((0 == memcmp (&taIeeeHeader->addr3, &all_zeros, MAC_ADDR_SIZE)) ||
-      (0 == memcmp (&taIeeeHeader->addr1, &all_zeros, MAC_ADDR_SIZE)))
-    return 0; /* some drivers set no Macs, then assume it is all for us! */
-
-  if (0 != memcmp (&taIeeeHeader->addr3, &mac_bssid_gnunet, MAC_ADDR_SIZE))
-    return 1; /* not a GNUnet ad-hoc package */
-  if ((0 == memcmp (&taIeeeHeader->addr1, &dev->pl_mac, MAC_ADDR_SIZE)) ||
-      (0 == memcmp (&taIeeeHeader->addr1, &bc_all_mac, MAC_ADDR_SIZE)))
-    return 0; /* for us, or broadcast */
-  return 1; /* not for us */
-}
-
-
-/**
- * Process data from the stdin. Takes the message, forces the sender MAC to be 
correct
- * and puts it into our buffer for transmission to the receiver.
- *
- * @param cls pointer to the device struct ('struct HardwareInfos*')
- * @param hdr pointer to the start of the packet
- *
- **** same as the one from gnunet-helper-transport-wlan.c ****
- */
-static void
-stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
-{
-  struct HardwareInfos *dev = cls;
-  const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header;
-  struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *blueheader;
-  size_t sendsize;
-
-  sendsize = ntohs (hdr->size);
-  if ((sendsize <
-       sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)) ||
-      (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)))
-  {
-    fprintf (stderr, "Received malformed message\n");
-    exit (1);
-  }
-  sendsize -= (sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)
-               - sizeof(struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame));
-  if (MAXLINE < sendsize)
-  {
-    fprintf (stderr, "Packet too big for buffer\n");
-    exit (1);
-  }
-  header = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr;
-  GNUNET_memcpy (&write_pout.buf, &header->frame, sendsize);
-  blueheader = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) &write_pout.buf;
-
-  /* payload contains MAC address, but we don't trust it, so we'll
-   * overwrite it with OUR MAC address to prevent mischief */
-  mac_set (blueheader, dev);
-  GNUNET_memcpy (&blueheader->addr1, &header->frame.addr1,
-                 sizeof(struct GNUNET_TRANSPORT_WLAN_MacAddress));
-  write_pout.size = sendsize;
-}
-
-
-#ifdef __linux__
-/**
- * Broadcast a HELLO message for peer discovery
- *
- * @param dev pointer to the device struct
- * @param dev pointer to the socket which was added to the set
- * @return 0 on success
- */
-static int
-send_broadcast (struct HardwareInfos *dev, int *sendsocket)
-{
-  int new_device = 0;
-  int loops = 0;
-
-search_for_devices:
-  if (((neighbours.size == neighbours.pos) && (new_device == 1)) ||
-      (neighbours.size == 0) )
-  {
-inquiry_devices:      // skip the conditions and force a inquiry for new 
devices
-    {
-      /**
-       * It means that I sent HELLO messages to all the devices from the list 
and I should search
-       * for new ones or that this is the first time when I do a search.
-       */
-      inquiry_info *devices = NULL;
-      int i, responses, max_responses = MAX_PORTS;
-
-      /* sanity checks */
-      if (neighbours.size >= MAX_PORTS)
-      {
-        fprintf (stderr,
-                 "%.*s reached the top limit for the discovarable devices\n",
-                 IFNAMSIZ,
-                 dev->iface);
-        return 2;
-      }
-
-      /* Get the device id */
-      if (neighbours.dev_id == -1)
-      {
-        char addr[19] = { 0 };     // the device MAC address
-
-        ba2str ((bdaddr_t *) &dev->pl_mac, addr);
-        neighbours.dev_id = hci_devid (addr);
-        if (neighbours.dev_id < 0)
-        {
-          fprintf (stderr,
-                   "Failed to get the device id for interface %.*s : %s\n",
-                   IFNAMSIZ,
-                   dev->iface, strerror (errno));
-          return 1;
-        }
-      }
-
-      devices = malloc (max_responses * sizeof(inquiry_info));
-      if (devices == NULL)
-      {
-        fprintf (stderr,
-                 "Failed to allocate memory for inquiry info list on interface 
%.*s\n",
-                 IFNAMSIZ,
-                 dev->iface);
-        return 1;
-      }
-
-      responses = hci_inquiry (neighbours.dev_id, 8, max_responses, NULL,
-                               &devices, IREQ_CACHE_FLUSH);
-      if (responses < 0)
-      {
-        fprintf (stderr, "Failed to inquiry on interface %.*s\n", IFNAMSIZ,
-                 dev->iface);
-        return 1;
-      }
-
-      fprintf (stderr, "LOG : Found %d devices\n", responses);  // FIXME 
delete it after debugging stage
-
-      if (responses == 0)
-      {
-        fprintf (stderr, "LOG : No devices discoverable\n");
-        return 1;
-      }
-
-      for (i = 0; i < responses; i++)
-      {
-        int j;
-        int found = 0;
-
-        /* sanity check */
-        if (i >= MAX_PORTS)
-        {
-          fprintf (stderr,
-                   "%.*s reached the top limit for the discoverable devices 
(after inquiry)\n",
-                   IFNAMSIZ,
-                   dev->iface);
-          return 2;
-        }
-
-        /* Search if the address already exists on the list */
-        for (j = 0; j < neighbours.size; j++)
-        {
-          if (memcmp (&(devices + i)->bdaddr, &(neighbours.devices[j]),
-                      sizeof(bdaddr_t)) == 0)
-          {
-            found = 1;
-            fprintf (stderr, "LOG : the device already exists on the list\n"); 
       // FIXME debugging message
-            break;
-          }
-        }
-
-        if (found == 0)
-        {
-          char addr[19] = { 0 };
-
-          ba2str (&(devices + i)->bdaddr, addr);
-          fprintf (stderr, "LOG : %s was added to the list\n", addr);      // 
FIXME debugging message
-          GNUNET_memcpy (&(neighbours.devices[neighbours.size++]), &(devices
-                                                                     + i)->
-                         bdaddr, sizeof(bdaddr_t));
-        }
-      }
-
-      free (devices);
-    }
-  }
-
-  int connection_successful = 0;
-  struct sockaddr_rc addr_rc = { 0 };
-  int errno_copy = 0;
-  addr_rc.rc_family = AF_BLUETOOTH;
-
-  /* Try to connect to a new device from the list */
-  while (neighbours.pos < neighbours.size)
-  {
-    /* Check if we are already connected to this device */
-    if (neighbours.fds[neighbours.pos] == -1)
-    {
-      memset (&addr_rc.rc_bdaddr, 0, sizeof(addr_rc.rc_bdaddr));
-      GNUNET_memcpy (&addr_rc.rc_bdaddr, &(neighbours.devices[neighbours.pos]),
-                     sizeof(addr_rc.rc_bdaddr));
-
-      addr_rc.rc_channel = get_channel (dev, addr_rc.rc_bdaddr);
-
-      *sendsocket = socket (AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
-      if ((-1 < *sendsocket) &&
-          (0 == connect (*sendsocket,
-                         (struct sockaddr *) &addr_rc,
-                         sizeof(addr_rc))))
-      {
-        neighbours.fds[neighbours.pos++] = *sendsocket;
-        connection_successful = 1;
-        char addr[19] = { 0 };
-        ba2str (&(neighbours.devices[neighbours.pos - 1]), addr);
-        fprintf (stderr, "LOG : Connected to %s\n", addr);
-        break;
-      }
-      else
-      {
-        char addr[19] = { 0 };
-        errno_copy = errno;       // Save a copy for later
-
-        if (-1 != *sendsocket)
-        {
-          (void) close (*sendsocket);
-          *sendsocket = -1;
-        }
-        ba2str (&(neighbours.devices[neighbours.pos]), addr);
-        fprintf (stderr,
-                 "LOG : Couldn't connect on device %s, error : %s\n",
-                 addr,
-                 strerror (errno));
-        if (errno != ECONNREFUSED)       // FIXME be sure that this works
-        {
-          fprintf (stderr, "LOG : Removes %d device from the list\n",
-                   neighbours.pos);
-          /* Remove the device from the list */
-          GNUNET_memcpy (&neighbours.devices[neighbours.pos],
-                         &neighbours.devices[neighbours.size - 1],
-                         sizeof(bdaddr_t));
-          memset (&neighbours.devices[neighbours.size - 1], 0,
-                  sizeof(bdaddr_t));
-          neighbours.fds[neighbours.pos] = neighbours.fds[neighbours.size - 1];
-          neighbours.fds[neighbours.size - 1] = -1;
-          neighbours.size -= 1;
-        }
-
-        neighbours.pos += 1;
-
-        if (neighbours.pos >= neighbours.size)
-          neighbours.pos = 0;
-
-        loops += 1;
-
-        if (loops == MAX_LOOPS)       // don't get stuck trying to connect to 
one device
-          return 1;
-      }
-    }
-    else
-    {
-      fprintf (stderr, "LOG : Search for a new device\n");    // FIXME 
debugging message
-      neighbours.pos += 1;
-    }
-  }
-
-  /* Cycle on the list */
-  if (neighbours.pos == neighbours.size)
-  {
-    neighbours.pos = 0;
-    searching_devices_count += 1;
-
-    if (searching_devices_count == MAX_LOOPS)
-    {
-      fprintf (stderr, "LOG : Force to inquiry for new devices\n");
-      searching_devices_count = 0;
-      goto inquiry_devices;
-    }
-  }
-  /* If a new device wasn't found, search an old one */
-  if (connection_successful == 0)
-  {
-    int loop_check = neighbours.pos;
-    while (neighbours.fds[neighbours.pos] == -1)
-    {
-      if (neighbours.pos == neighbours.size)
-        neighbours.pos = 0;
-
-      if (neighbours.pos == loop_check)
-      {
-        if (errno_copy == ECONNREFUSED)
-        {
-          fprintf (stderr, "LOG : No device found. Go back and search 
again\n");        // FIXME debugging message
-          new_device = 1;
-          loops += 1;
-          goto search_for_devices;
-        }
-        else
-        {
-          return 1;         // Skip the broadcast message
-        }
-      }
-
-      neighbours.pos += 1;
-    }
-
-    *sendsocket = neighbours.fds[neighbours.pos++];
-  }
-
-  return 0;
-}
-
-
-#endif
-
-/**
- * Main function of the helper.  This code accesses a bluetooth interface
- * forwards traffic in both directions between the bluetooth interface and
- * stdin/stdout of this process.  Error messages are written to stderr.
- *
- * @param argc number of arguments, must be 2
- * @param argv arguments only argument is the name of the interface (e.g. 
'hci0')
- * @return 0 on success (never happens, as we don't return unless aborted), 1 
on error
- *
- **** similar to gnunet-helper-transport-wlan.c ****
- */
-int
-main (int argc, char *argv[])
-{
-#ifdef __linux__
-  struct HardwareInfos dev;
-  char readbuf[MAXLINE];
-  int maxfd;
-  fd_set rfds;
-  fd_set wfds;
-  int stdin_open;
-  struct MessageStreamTokenizer *stdin_mst;
-  int raw_eno, i;
-  int crt_rfds = 0, rfds_list[MAX_PORTS];
-  int broadcast, sendsocket;
-
-  /* Assert privs so we can modify the firewall rules! */
-  {
-#ifdef HAVE_SETRESUID
-    uid_t uid = getuid ();
-
-    if (0 != setresuid (uid, 0, 0))
-    {
-      fprintf (stderr,
-               "Failed to setresuid to root: %s\n",
-               strerror (errno));
-      return 254;
-    }
-#else
-    if (0 != seteuid (0))
-    {
-      fprintf (stderr,
-               "Failed to seteuid back to root: %s\n", strerror (errno));
-      return 254;
-    }
-#endif
-  }
-
-  /* Make use of SGID capabilities on POSIX */
-  memset (&dev, 0, sizeof(dev));
-  dev.fd_rfcomm = socket (AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
-  raw_eno = errno;   /* remember for later */
-
-  /* Now that we've dropped root rights, we can do error checking */
-  if (2 != argc)
-  {
-    fprintf (stderr,
-             "You must specify the name of the interface as the first \
-                        and only argument to this program.\n");
-    if (-1 != dev.fd_rfcomm)
-      (void) close (dev.fd_rfcomm);
-    return 1;
-  }
-
-  if (-1 == dev.fd_rfcomm)
-  {
-    fprintf (stderr, "Failed to create a RFCOMM socket: %s\n", strerror (
-               raw_eno));
-    return 1;
-  }
-  if (dev.fd_rfcomm >= FD_SETSIZE)
-  {
-    fprintf (stderr, "File descriptor too large for select (%d > %d)\n",
-             dev.fd_rfcomm, FD_SETSIZE);
-    (void) close (dev.fd_rfcomm);
-    return 1;
-  }
-  if (0 != test_bluetooth_interface (argv[1]))
-  {
-    (void) close (dev.fd_rfcomm);
-    return 1;
-  }
-  strncpy (dev.iface, argv[1], IFNAMSIZ);
-  if (0 != open_device (&dev))
-  {
-    (void) close (dev.fd_rfcomm);
-    return 1;
-  }
-
-  /* Drop privs */
-  {
-    uid_t uid = getuid ();
-  #ifdef HAVE_SETRESUID
-    if (0 != setresuid (uid, uid, uid))
-    {
-      fprintf (stderr, "Failed to setresuid: %s\n", strerror (errno));
-      if (-1 != dev.fd_rfcomm)
-        (void) close (dev.fd_rfcomm);
-      return 1;
-    }
-  #else
-    if (0 != (setuid (uid) | seteuid (uid)))
-    {
-      fprintf (stderr, "Failed to setuid: %s\n", strerror (errno));
-      if (-1 != dev.fd_rfcomm)
-        (void) close (dev.fd_rfcomm);
-      return 1;
-    }
-  #endif
-  }
-
-  /* Send MAC address of the bluetooth interface to STDOUT first */
-  {
-    struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg;
-
-    macmsg.hdr.size = htons (sizeof(macmsg));
-    macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
-    GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof(struct
-                                                    
GNUNET_TRANSPORT_WLAN_MacAddress));
-    GNUNET_memcpy (write_std.buf, &macmsg, sizeof(macmsg));
-    write_std.size = sizeof(macmsg);
-  }
-
-
-  stdin_mst = mst_create (&stdin_send_hw, &dev);
-  stdin_open = 1;
-
-  /**
-   * TODO : I should make the time out of a mac endpoint smaller and check if 
the rate
-   * from get_wlan_header (plugin_transport_bluetooth.c) is correct.
-   */
-  while (1)
-  {
-    maxfd = -1;
-    broadcast = 0;
-    sendsocket = -1;
-
-    FD_ZERO (&rfds);
-    if ((0 == write_pout.size) && (1 == stdin_open))
-    {
-      FD_SET (STDIN_FILENO, &rfds);
-      maxfd = MAX (maxfd, STDIN_FILENO);
-    }
-    if (0 == write_std.size)
-    {
-      FD_SET (dev.fd_rfcomm, &rfds);
-      maxfd = MAX (maxfd, dev.fd_rfcomm);
-    }
-
-    for (i = 0; i < crt_rfds; i++)    // it can receive messages from multiple 
devices
-    {
-      FD_SET (rfds_list[i], &rfds);
-      maxfd = MAX (maxfd, rfds_list[i]);
-    }
-    FD_ZERO (&wfds);
-    if (0 < write_std.size)
-    {
-      FD_SET (STDOUT_FILENO, &wfds);
-      maxfd = MAX (maxfd, STDOUT_FILENO);
-    }
-    if (0 < write_pout.size)   // it can send messages only to one device per 
loop
-    {
-      struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *frame;
-      /* Get the destination address */
-      frame = (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) write_pout.buf;
-
-      if (memcmp (&frame->addr1, &dev.pl_mac,
-                  sizeof(struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0)
-      {
-        broadcast = 1;
-        memset (&write_pout, 0, sizeof(write_pout));      // clear the buffer
-      }
-      else if (memcmp (&frame->addr1, &broadcast_address,
-                       sizeof(struct GNUNET_TRANSPORT_WLAN_MacAddress)) == 0)
-      {
-        fprintf (stderr, "LOG : %s has a broadcast message (pos %d, size 
%d)\n",
-                 dev.iface, neighbours.pos, neighbours.size);                  
                                                    // FIXME: debugging message
-
-        if (send_broadcast (&dev, &sendsocket) != 0)      // if the searching 
wasn't successful don't get stuck on the select stage
-        {
-          broadcast = 1;
-          memset (&write_pout, 0, sizeof(write_pout));        // remove the 
message
-          fprintf (stderr,
-                   "LOG : Skipping the broadcast message (pos %d, size %d)\n",
-                   neighbours.pos, neighbours.size);
-        }
-        else
-        {
-          FD_SET (sendsocket, &wfds);
-          maxfd = MAX (maxfd, sendsocket);
-        }
-      }
-      else
-      {
-        int found = 0;
-        int pos = 0;
-        /* Search if the address already exists on the list */
-        for (i = 0; i < neighbours.size; i++)
-        {
-          if (memcmp (&frame->addr1, &(neighbours.devices[i]),
-                      sizeof(bdaddr_t)) == 0)
-          {
-            pos = i;
-            if (neighbours.fds[i] != -1)
-            {
-              found = 1;             // save the position where it was found
-              FD_SET (neighbours.fds[i], &wfds);
-              maxfd = MAX (maxfd, neighbours.fds[i]);
-              sendsocket = neighbours.fds[i];
-              fprintf (stderr, "LOG: the address was found in the list\n");
-              break;
-            }
-          }
-        }
-        if (found == 0)
-        {
-          int status;
-          struct sockaddr_rc addr = { 0 };
-
-          fprintf (stderr,
-                   "LOG : %s has a new message for 
%.2X:%.2X:%.2X:%.2X:%.2X:%.2X which isn't on the broadcast list\n",
-                   dev.iface,
-                   frame->addr1.mac[5], frame->addr1.mac[4],
-                   frame->addr1.mac[3],
-                   frame->addr1.mac[2], frame->addr1.mac[1],
-                   frame->addr1.mac[0]);                                       
           // FIXME: debugging message
-
-          sendsocket = socket (AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
-
-          if (sendsocket < 0)
-          {
-            fprintf (stderr,
-                     "Failed to create a RFCOMM socket (sending stage): %s\n",
-                     strerror (errno));
-            return -1;
-          }
-
-          GNUNET_memcpy (&addr.rc_bdaddr, &frame->addr1, sizeof(bdaddr_t));
-          addr.rc_family = AF_BLUETOOTH;
-          addr.rc_channel = get_channel (&dev, addr.rc_bdaddr);
-
-          int tries = 0;
-connect_retry:
-          status = connect (sendsocket, (struct sockaddr *) &addr,
-                            sizeof(addr));
-          if ((0 != status) && (errno != EAGAIN) )
-          {
-            if ((errno == ECONNREFUSED) && (tries < 2) )
-            {
-              fprintf (stderr, "LOG : %.*s failed to connect. Trying again!\n",
-                       IFNAMSIZ, dev.iface);
-              tries++;
-              goto connect_retry;
-            }
-            else if (errno == EBADF)
-            {
-              fprintf (stderr, "LOG : %s failed to connect : %s. Skip it!\n",
-                       dev.iface, strerror (errno));
-              memset (&write_pout, 0, sizeof(write_pout));
-              broadcast = 1;
-            }
-            else
-            {
-              fprintf (stderr,
-                       "LOG : %s failed to connect : %s. Try again later!\n",
-                       dev.iface,
-                       strerror (errno));
-              memset (&write_pout, 0, sizeof(write_pout));
-              broadcast = 1;
-            }
-          }
-          else
-          {
-            FD_SET (sendsocket, &wfds);
-            maxfd = MAX (maxfd, sendsocket);
-            fprintf (stderr, "LOG : Connection successful\n");
-            if (pos != 0)           // save the socket
-            {
-              neighbours.fds[pos] = sendsocket;
-            }
-            else
-            {
-              /* Add the new device to the discovered devices list */
-              if (neighbours.size < MAX_PORTS)
-              {
-                neighbours.fds[neighbours.size] = sendsocket;
-                GNUNET_memcpy (&(neighbours.devices[neighbours.size++]),
-                               &addr.rc_bdaddr, sizeof(bdaddr_t));
-              }
-              else
-              {
-                fprintf (stderr,
-                         "The top limit for the discovarable devices' list was 
reached\n");
-              }
-            }
-          }
-        }
-      }
-    }
-
-    if (broadcast == 0)
-    {
-      /* Select a fd which is ready for action :) */
-      {
-        int retval = select (maxfd + 1, &rfds, &wfds, NULL, NULL);
-        if ((-1 == retval) && (EINTR == errno))
-          continue;
-        if ((0 > retval) && (errno != EBADF) ) // we handle BADF errors later
-        {
-          fprintf (stderr, "select failed: %s\n", strerror (errno));
-          break;
-        }
-      }
-      if (FD_ISSET (STDOUT_FILENO, &wfds))
-      {
-        ssize_t ret =
-          write (STDOUT_FILENO, write_std.buf + write_std.pos,
-                 write_std.size - write_std.pos);
-        if (0 > ret)
-        {
-          fprintf (stderr, "Failed to write to STDOUT: %s\n", strerror 
(errno));
-          break;
-        }
-        write_std.pos += ret;
-        if (write_std.pos == write_std.size)
-        {
-          write_std.pos = 0;
-          write_std.size = 0;
-        }
-        fprintf (stderr, "LOG : %s sends a message to STDOUT\n", dev.iface);   
   // FIXME: debugging message
-      }
-      if (-1 != sendsocket)
-      {
-        if (FD_ISSET (sendsocket, &wfds))
-        {
-          ssize_t ret = write (sendsocket,
-                               write_pout.buf + write_std.pos,
-                               write_pout.size - write_pout.pos);
-          if (0 > ret)         // FIXME should I first check the error type?
-          {
-            fprintf (stderr,
-                     "Failed to write to bluetooth device: %s. Closing the 
socket!\n",
-                     strerror (errno));
-            for (i = 0; i < neighbours.size; i++)
-            {
-              if (neighbours.fds[i] == sendsocket)
-              {
-                (void) close (sendsocket);
-                neighbours.fds[i] = -1;
-                break;
-              }
-            }
-            /* Remove the message */
-            memset (&write_pout.buf + write_std.pos, 0, (write_pout.size
-                                                         - write_pout.pos));
-            write_pout.pos = 0;
-            write_pout.size = 0;
-          }
-          else
-          {
-            write_pout.pos += ret;
-            if ((write_pout.pos != write_pout.size) && (0 != ret))
-            {
-              /* We should not get partial sends with packet-oriented 
devices... */
-              fprintf (stderr, "Write error, partial send: %u/%u\n",
-                       (unsigned int) write_pout.pos,
-                       (unsigned int) write_pout.size);
-              break;
-            }
-
-            if (write_pout.pos == write_pout.size)
-            {
-              write_pout.pos = 0;
-              write_pout.size = 0;
-            }
-            fprintf (stderr, "LOG : %s sends a message to a DEVICE\n",
-                     dev.iface);                                               
             // FIXME: debugging message
-          }
-        }
-      }
-      for (i = 0; i <= maxfd; i++)
-      {
-        if (FD_ISSET (i, &rfds))
-        {
-          if (i == STDIN_FILENO)
-          {
-            ssize_t ret =
-              read (i, readbuf, sizeof(readbuf));
-            if (0 > ret)
-            {
-              fprintf (stderr,
-                       "Read error from STDIN: %s\n",
-                       strerror (errno));
-              break;
-            }
-            if (0 == ret)
-            {
-              /* stop reading... */
-              stdin_open = 0;
-            }
-            else
-            {
-              mst_receive (stdin_mst, readbuf, ret);
-              fprintf (stderr, "LOG : %s receives a message from STDIN\n",
-                       dev.iface);                                             
                   // FIXME: debugging message
-            }
-          }
-          else if (i == dev.fd_rfcomm)
-          {
-            int readsocket;
-            struct sockaddr_rc addr = { 0 };
-            unsigned int opt = sizeof(addr);
-
-            readsocket = accept (dev.fd_rfcomm, (struct sockaddr *) &addr,
-                                 &opt);
-            fprintf (stderr, "LOG : %s accepts a message\n", dev.iface);       
   // FIXME: debugging message
-            if (readsocket == -1)
-            {
-              fprintf (stderr,
-                       "Failed to accept a connection on interface: %.*s\n",
-                       IFNAMSIZ,
-                       strerror (errno));
-              break;
-            }
-            else
-            {
-              FD_SET (readsocket, &rfds);
-              maxfd = MAX (maxfd, readsocket);
-
-              if (crt_rfds < MAX_PORTS)
-                rfds_list[crt_rfds++] = readsocket;
-              else
-              {
-                fprintf (stderr,
-                         "The limit for the read file descriptors list was \
-                                  reached\n");
-                break;
-              }
-            }
-          }
-          else
-          {
-            struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rrm;
-            ssize_t ret;
-            fprintf (stderr, "LOG : %s reads something from the socket\n",
-                     dev.iface);                                               
                // FIXME : debugging message
-            rrm = (struct
-                   GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) 
write_std.buf;
-            ret =
-              read_from_the_socket ((void *) &i, (unsigned char *) &rrm->frame,
-                                    sizeof(write_std.buf)
-                                    - sizeof(struct
-                                             
GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
-                                    + sizeof(struct
-                                             
GNUNET_TRANSPORT_WLAN_Ieee80211Frame),
-                                    rrm);
-            if (0 >= ret)
-            {
-              int j;
-              FD_CLR (i, &rfds);
-              close (i);
-              /* Remove the socket from the list */
-              for (j = 0; j < crt_rfds; j++)
-              {
-                if (rfds_list[j] == i)
-                {
-                  rfds_list[j] ^= rfds_list[crt_rfds - 1];
-                  rfds_list[crt_rfds - 1] ^= rfds_list[j];
-                  rfds_list[j] ^= rfds_list[crt_rfds - 1];
-                  crt_rfds -= 1;
-                  break;
-                }
-              }
-
-              fprintf (stderr, "Read error from raw socket: %s\n", strerror (
-                         errno));
-              break;
-            }
-            if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev)))
-            {
-              write_std.size = ret
-                               + sizeof(struct
-                                        
GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
-                               - sizeof(struct
-                                        GNUNET_TRANSPORT_WLAN_Ieee80211Frame);
-              rrm->header.size = htons (write_std.size);
-              rrm->header.type = htons (
-                GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER);
-            }
-          }
-        }
-      }
-    }
-  }
-  /* Error handling, try to clean up a bit at least */
-  mst_destroy (stdin_mst);
-  stdin_mst = NULL;
-  sdp_close (dev.session);
-  (void) close (dev.fd_rfcomm);
-  if (-1 != sendsocket)
-    (void) close (sendsocket);
-
-  for (i = 0; i < crt_rfds; i++)
-    (void) close (rfds_list[i]);
-
-  for (i = 0; i < neighbours.size; i++)
-    (void) close (neighbours.fds[i]);
-  #else
-  struct HardwareInfos dev;
-  struct GNUNET_NETWORK_Handle *sendsocket;
-  struct GNUNET_NETWORK_FDSet *rfds;
-  struct GNUNET_NETWORK_FDSet *wfds;
-  struct GNUNET_NETWORK_Handle *rfds_list[MAX_PORTS];
-  char readbuf[MAXLINE] = { 0 };
-  SOCKADDR_BTH acc_addr = { 0 };
-  int addr_len = sizeof(SOCKADDR_BTH);
-  int broadcast, i, stdin_open, crt_rfds = 0;
-  HANDLE stdin_handle = GetStdHandle (STD_INPUT_HANDLE);
-  HANDLE stdout_handle = GetStdHandle (STD_OUTPUT_HANDLE);
-  struct MessageStreamTokenizer *stdin_mst;
-
-  /* check the handles */
-  if (stdin_handle == INVALID_HANDLE_VALUE)
-  {
-    fprintf (stderr, "Failed to get the stdin handle\n");
-    ExitProcess (2);
-  }
-
-  if (stdout_handle == INVALID_HANDLE_VALUE)
-  {
-    fprintf (stderr, "Failed to get the stdout handle\n");
-    ExitProcess (2);
-  }
-
-  /* initialize windows sockets */
-  initialize_windows_sockets ();
-
-  // /* test bluetooth socket family support */ --> it return false because 
the GNUNET_NETWORK_test_pf should also receive the type of socket 
(BTHPROTO_RFCOMM)
-  // if (GNUNET_NETWORK_test_pf (AF_BTH) != GNUNET_OK)
-  // {
-  //   fprintf (stderr, "AF_BTH family is not supported\n");
-  //   ExitProcess (2);
-  // }
-
-  /* create the socket */
-  dev.handle = GNUNET_NETWORK_socket_create (AF_BTH, SOCK_STREAM,
-                                             BTHPROTO_RFCOMM);
-  if (dev.handle == NULL)
-  {
-    fprintf (stderr, "Failed to create RFCOMM socket: ");
-    print_last_error ();
-    ExitProcess (2);
-  }
-
-
-  if (open_device (&dev) == -1)
-  {
-    fprintf (stderr, "Failed to open the device\n");
-    print_last_error ();
-    if (GNUNET_NETWORK_socket_close (dev.handle) != GNUNET_OK)
-    {
-      fprintf (stderr, "Failed to close the socket!\n");
-      print_last_error ();
-    }
-    ExitProcess (2);
-  }
-
-  if (GNUNET_OK != GNUNET_NETWORK_socket_set_blocking (dev.handle, 1))
-  {
-    fprintf (stderr, "Failed to change the socket mode\n");
-    ExitProcess (2);
-  }
-
-  memset (&write_std, 0, sizeof(write_std));
-  memset (&write_pout, 0, sizeof(write_pout));
-  stdin_open = 1;
-
-  rfds = GNUNET_NETWORK_fdset_create ();
-  wfds = GNUNET_NETWORK_fdset_create ();
-
-  /* Send MAC address of the bluetooth interface to STDOUT first */
-  {
-    struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg;
-
-    macmsg.hdr.size = htons (sizeof(macmsg));
-    macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
-    GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof(struct
-                                                    
GNUNET_TRANSPORT_WLAN_MacAddress_Copy));
-    GNUNET_memcpy (write_std.buf, &macmsg, sizeof(macmsg));
-    write_std.size = sizeof(macmsg);
-  }
-
-
-  stdin_mst = mst_create (&stdin_send_hw, &dev);
-  stdin_open = 1;
-
-  int pos = 0;
-  int stdin_pos = -1;
-  int stdout_pos = -1;
-  while (1)
-  {
-    broadcast = 0;
-    pos = 0;
-    stdin_pos = -1;
-    stdout_pos = -1;
-    sendsocket = NULL;   // FIXME ???memleaks
-
-    GNUNET_NETWORK_fdset_zero (rfds);
-    if ((0 == write_pout.size) && (1 == stdin_open))
-    {
-      stdin_pos = pos;
-      pos += 1;
-      GNUNET_NETWORK_fdset_handle_set (rfds, (struct
-                                              GNUNET_DISK_FileHandle*) &
-                                       stdin_handle);
-    }
-
-    if (0 == write_std.size)
-    {
-      pos += 1;
-      GNUNET_NETWORK_fdset_set (rfds, dev.handle);
-    }
-
-    for (i = 0; i < crt_rfds; i++)
-    {
-      pos += 1;
-      GNUNET_NETWORK_fdset_set (rfds, rfds_list[i]);
-    }
-
-    GNUNET_NETWORK_fdset_zero (wfds);
-    if (0 < write_std.size)
-    {
-      stdout_pos = pos;
-      GNUNET_NETWORK_fdset_handle_set (wfds, (struct
-                                              GNUNET_DISK_FileHandle*) &
-                                       stdout_handle);
-      // printf ("%s\n", write_std.buf);
-      // memset (write_std.buf, 0, write_std.size);
-      // write_std.size = 0;
-    }
-
-    if (0 < write_pout.size)
-    {
-      if (strcmp (argv[1], "ff:ff:ff:ff:ff:ff") == 0)
-      {
-        fprintf (stderr, "LOG: BROADCAST! Skipping the message\n");
-        // skip the message
-        broadcast = 1;
-        memset (write_pout.buf, 0, write_pout.size);
-        write_pout.size = 0;
-      }
-      else
-      {
-        SOCKADDR_BTH addr;
-        fprintf (stderr, "LOG : has a new message for %s\n", argv[1]);
-        sendsocket = GNUNET_NETWORK_socket_create (AF_BTH, SOCK_STREAM,
-                                                   BTHPROTO_RFCOMM);
-
-        if (sendsocket == NULL)
-        {
-          fprintf (stderr, "Failed to create RFCOMM socket: \n");
-          print_last_error ();
-          ExitProcess (2);
-        }
-
-        memset (&addr, 0, sizeof(addr));
-        // addr.addressFamily = AF_BTH;
-        if (SOCKET_ERROR ==
-            WSAStringToAddress (argv[1], AF_BTH, NULL, (LPSOCKADDR) &addr,
-                                &addr_len))
-        {
-          fprintf (stderr, "Failed to translate the address: ");
-          print_last_error ();
-          ExitProcess (2);
-        }
-        addr.port = get_channel (argv[1]);
-        if (addr.port == -1)
-        {
-          fprintf (stderr,
-                   "Couldn't find the sdp service for the address: %s\n",
-                   argv[1]);
-          memset (write_pout.buf, 0, write_pout.size);
-          write_pout.size = 0;
-          broadcast = 1;         // skipping the select part
-        }
-        else
-        {
-          if (GNUNET_OK != GNUNET_NETWORK_socket_connect (sendsocket,
-                                                          (LPSOCKADDR) &addr,
-                                                          addr_len))
-          {
-            fprintf (stderr, "Failed to connect: ");
-            print_last_error ();
-            ExitProcess (2);
-          }
-
-          if (GNUNET_OK != GNUNET_NETWORK_socket_set_blocking (sendsocket, 1))
-          {
-            fprintf (stderr, "Failed to change the socket mode\n");
-            ExitProcess (2);
-          }
-
-          GNUNET_NETWORK_fdset_set (wfds, sendsocket);
-        }
-      }
-    }
-
-    if (broadcast == 0)
-    {
-      int retval = GNUNET_NETWORK_socket_select (rfds, wfds, NULL,
-                                                 
GNUNET_TIME_relative_get_forever_ ());
-      if (retval < 0)
-      {
-        fprintf (stderr, "Select error\n");
-        ExitProcess (2);
-      }
-      // if (GNUNET_NETWORK_fdset_isset (wfds, (struct 
GNUNET_NETWORK_Handle*)&stdout_handle))
-      if (retval == stdout_pos)
-      {
-        fprintf (stderr, "LOG : sends a message to STDOUT\n");      // FIXME: 
debugging message
-        // ssize_t ret;
-        // ret = GNUNET_NETWORK_socket_send ((struct GNUNET_NETWORK_Handle 
*)&stdout_handle,  write_std.buf + write_std.pos, write_std.size - 
write_std.pos);
-        // ret = write (STDOUT_FILENO, write_std.buf + write_std.pos,  
write_std.size - write_std.pos);
-        DWORD ret;
-        if (FALSE == WriteFile (stdout_handle, write_std.buf + write_std.pos,
-                                write_std.size - write_std.pos, &ret, NULL))
-        {
-          fprintf (stderr, "Failed to write to STDOUT: ");
-          print_last_error ();
-          break;
-        }
-
-        if (ret <= 0)
-        {
-          fprintf (stderr, "Failed to write to STDOUT\n");
-          ExitProcess (2);
-        }
-
-        write_std.pos += ret;
-        if (write_std.pos == write_std.size)
-        {
-          write_std.pos = 0;
-          write_std.size = 0;
-        }
-      }
-      if (sendsocket != NULL)
-      {
-        if (GNUNET_NETWORK_fdset_isset (wfds, sendsocket))
-        {
-          ssize_t ret;
-          ret = GNUNET_NETWORK_socket_send (sendsocket, write_pout.buf
-                                            + write_pout.pos,
-                                            write_pout.size - write_pout.pos);
-
-          if (GNUNET_SYSERR == ret)
-          {
-            fprintf (stderr,
-                     "Failed to send to the socket. Closing the socket. Error: 
\n");
-            print_last_error ();
-            if (GNUNET_NETWORK_socket_close (sendsocket) != GNUNET_OK)
-            {
-              fprintf (stderr, "Failed to close the sendsocket!\n");
-              print_last_error ();
-            }
-            ExitProcess (2);
-          }
-          else
-          {
-            write_pout.pos += ret;
-            if ((write_pout.pos != write_pout.size) && (0 != ret))
-            {
-              /* we should not get partial sends with packet-oriented 
devices... */
-              fprintf (stderr, "Write error, partial send: %u/%u\n",
-                       (unsigned int) write_pout.pos,
-                       (unsigned int) write_pout.size);
-              break;
-            }
-
-            if (write_pout.pos == write_pout.size)
-            {
-              write_pout.pos = 0;
-              write_pout.size = 0;
-            }
-            fprintf (stderr, "LOG : sends a message to a DEVICE\n");          
// FIXME: debugging message
-          }
-        }
-      }
-
-      // if (GNUNET_NETWORK_fdset_isset (rfds, (struct 
GNUNET_NETWORK_Handle*)&stdin_handle))
-      if (retval == stdin_pos)
-      {
-        // ssize_t ret;
-        // ret = GNUNET_NETWORK_socket_recv ((struct GNUNET_NETWORK_Handle 
*)&stdin_handle, readbuf, sizeof (write_pout.buf));
-        // ret = read (STDIN_FILENO, readbuf, sizeof (readbuf));
-        DWORD ret;
-        if (FALSE == ReadFile (stdin_handle, readbuf, sizeof(readbuf), &ret,
-                               NULL))                                          
          /* do nothing asynchronous */
-        {
-          fprintf (stderr, "Read error from STDIN: ");
-          print_last_error ();
-          break;
-        }
-        if (0 == ret)
-        {
-          /* stop reading... */
-          stdin_open = 0;
-        }
-        else
-        {
-          mst_receive (stdin_mst, readbuf, ret);
-          fprintf (stderr, "LOG : receives a message from STDIN\n");        // 
FIXME: debugging message
-        }
-      }
-      else if (GNUNET_NETWORK_fdset_isset (rfds, dev.handle))
-      {
-        fprintf (stderr, "LOG: accepting connection\n");
-        struct GNUNET_NETWORK_Handle *readsocket;
-        readsocket = GNUNET_NETWORK_socket_accept (dev.handle,
-                                                   (LPSOCKADDR) &acc_addr,
-                                                   &addr_len);
-        if (readsocket == NULL)
-        {
-          fprintf (stderr, "Accept error %d: ", GetLastError ());
-          print_last_error ();
-          ExitProcess (2);
-        }
-        else
-        {
-          if (GNUNET_OK != GNUNET_NETWORK_socket_set_blocking (readsocket, 1))
-          {
-            fprintf (stderr, "Failed to change the socket mode\n");
-            ExitProcess (2);
-          }
-          GNUNET_NETWORK_fdset_set (rfds, readsocket);
-
-          if (crt_rfds < MAX_PORTS)
-            rfds_list[crt_rfds++] = readsocket;
-          else
-          {
-            fprintf (stderr,
-                     "The limit for the read file descriptors list was 
reached\n");
-            break;
-          }
-        }
-      }
-      else
-        for (i = 0; i < crt_rfds; i++)
-        {
-          if (GNUNET_NETWORK_fdset_isset (rfds, rfds_list[i]))
-          {
-            struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rrm;
-            ssize_t ret;
-            fprintf (stderr, "LOG: reading something from the socket\n");      
 // FIXME : debugging message
-            rrm = (struct
-                   GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) 
write_std.buf;
-            ret = read_from_the_socket (rfds_list[i], (unsigned
-                                                       char *) &rrm->frame,
-                                        sizeof(write_std.buf)
-                                        - sizeof(struct
-                                                 
GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
-                                        + sizeof(struct
-                                                 
GNUNET_TRANSPORT_WLAN_Ieee80211Frame),
-                                        rrm);
-            if (0 >= ret)
-            {
-              // TODO remove the socket from the list
-              if (GNUNET_NETWORK_socket_close (rfds_list[i]) != GNUNET_OK)
-              {
-                fprintf (stderr, "Failed to close the sendsocket!\n");
-                print_last_error ();
-              }
-
-              fprintf (stderr, "Read error from raw socket: ");
-              print_last_error ();
-              break;
-            }
-            if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev)))
-            {
-              write_std.size = ret
-                               + sizeof(struct
-                                        
GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
-                               - sizeof(struct
-                                        GNUNET_TRANSPORT_WLAN_Ieee80211Frame);
-              rrm->header.size = htons (write_std.size);
-              rrm->header.type = htons (
-                GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER);
-            }
-            break;
-          }
-        }
-    }
-  }
-
-  mst_destroy (stdin_mst);
-  stdin_mst = NULL;
-
-  if (GNUNET_NETWORK_socket_close (dev.handle) != GNUNET_OK)
-  {
-    fprintf (stderr, "Failed to close the socket!\n");
-    print_last_error ();
-  }
-
-  for (i = 0; i < crt_rfds; i++)
-  {
-    if (GNUNET_NETWORK_socket_close (rfds_list[i]) != GNUNET_OK)
-    {
-      fprintf (stderr, "Failed to close the socket!\n");
-      print_last_error ();
-    }
-  }
-
-  WSACleanup ();
-  #endif
-  return 1;                     /* we never exit 'normally' */
-}
diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c 
b/src/transport/gnunet-helper-transport-wlan-dummy.c
deleted file mode 100644
index ab77f5c68..000000000
--- a/src/transport/gnunet-helper-transport-wlan-dummy.c
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010, 2012 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/gnunet-helper-transport-wlan-dummy.c
- * @brief helper for the testcases for plugin_transport_wlan.c
- * @author David Brodski
- */
-#include "platform.h"
-#include "gnunet_protocols.h"
-#include "gnunet_util_lib.h"
-#include "plugin_transport_wlan.h"
-
-/**
- * Name of the fifo to use for IPC with the other dummy process.
- */
-#define FIFO_FILE1 "/tmp/test-transport/api-wlan-p1/WLAN_FIFO_in"
-
-/**
- * Name of the fifo to use for IPC with the other dummy process.
- */
-#define FIFO_FILE2 "/tmp/test-transport/api-wlan-p1/WLAN_FIFO_out"
-
-/**
- * Maximum size of a message allowed in either direction
- * (used for our receive and sent buffers).
- */
-#define MAXLINE 4096
-
-
-/**
- * IO buffer used for buffering data in transit.
- */
-struct SendBuffer
-{
-  /**
-   * How many bytes that were stored in 'buf' did we already write to the
-   * destination?  Always smaller than 'size'.
-   */
-  size_t pos;
-
-  /**
-   * How many bytes of data are stored in 'buf' for transmission right now?
-   * Data always starts at offset 0 and extends to 'size'.
-   */
-  size_t size;
-
-  /**
-   * Buffered data; twice the maximum allowed message size as we add some
-   * headers.
-   */
-  char buf[MAXLINE * 2];
-};
-
-
-/**
- * Flag set to 1 if we are to terminate, otherwise 0.
- */
-static int closeprog;
-
-
-/**
- * We're being killed, clean up.
- *
- * @param sig killing signal
- */
-static void
-sigfunc (int sig)
-{
-  closeprog = 1;
-  (void) unlink (FIFO_FILE1);
-  (void) unlink (FIFO_FILE2);
-}
-
-
-/**
- * Create control message for plugin
- *
- * @param buffer pointer to buffer for the message
- * @param mac pointer to the mac address
- * @return number of bytes written
- */
-static int
-send_mac_to_plugin (char *buffer, struct GNUNET_TRANSPORT_WLAN_MacAddress *mac)
-{
-  struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg;
-
-  GNUNET_memcpy (&macmsg.mac,
-                 (char *) mac,
-                 sizeof(struct GNUNET_TRANSPORT_WLAN_MacAddress));
-  macmsg.hdr.size =
-    htons (sizeof(struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
-  macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
-  GNUNET_memcpy (buffer,
-                 &macmsg,
-                 sizeof(struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
-  return sizeof(struct GNUNET_TRANSPORT_WLAN_HelperControlMessage);
-}
-
-
-/**
- * We got a message from the FIFO, check it, convert the message
- * type to the output forward and copy it to the buffer for stdout.
- *
- * @param cls the 'struct SendBuffer' to copy the converted message to
- * @param hdr inbound message from the FIFO
- * @return #GNUNET_OK on success,
- *    #GNUNET_NO to stop further processing (no error)
- *    #GNUNET_SYSERR to stop further processing with error
- */
-static int
-stdin_send (void *cls, const struct GNUNET_MessageHeader *hdr)
-{
-  struct SendBuffer *write_pout = cls;
-  const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *in;
-  size_t payload_size;
-  struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage newheader;
-  uint16_t sendsize;
-
-  sendsize = ntohs (hdr->size);
-  in = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr;
-  if ((GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)) ||
-      (sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) > sendsize))
-  {
-    fprintf (stderr, "%s", "Received malformed message\n");
-    exit (1);
-  }
-  payload_size =
-    sendsize - sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage);
-  if ((payload_size
-       + sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
-       + write_pout->size) > MAXLINE * 2)
-  {
-    fprintf (stderr, "%s", "Packet too big for buffer\n");
-    exit (1);
-  }
-  memset (&newheader, 0, sizeof(newheader));
-  newheader.header.size = htons (payload_size + sizeof(newheader));
-  newheader.header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER);
-  newheader.frame = in->frame;
-  GNUNET_memcpy (write_pout->buf + write_pout->size,
-                 &newheader,
-                 sizeof(newheader));
-  write_pout->size += sizeof(newheader);
-  GNUNET_memcpy (write_pout->buf + write_pout->size, &in[1], payload_size);
-  write_pout->size += payload_size;
-  return GNUNET_OK;
-}
-
-
-/**
- * We read a full message from stdin.  Copy it to our send buffer.
- *
- * @param cls the 'struct SendBuffer' to copy to
- * @param hdr the message we received to copy to the buffer
- * @return #GNUNET_OK on success,
- *    #GNUNET_NO to stop further processing (no error)
- *    #GNUNET_SYSERR to stop further processing with error
- */
-static int
-file_in_send (void *cls, const struct GNUNET_MessageHeader *hdr)
-{
-  struct SendBuffer *write_std = cls;
-  uint16_t sendsize;
-
-  sendsize = ntohs (hdr->size);
-  if ((sendsize + write_std->size) > MAXLINE * 2)
-  {
-    fprintf (stderr, "%s", "Packet too big for buffer\n");
-    exit (1);
-  }
-  GNUNET_memcpy (write_std->buf + write_std->size, hdr, sendsize);
-  write_std->size += sendsize;
-  return GNUNET_OK;
-}
-
-
-/**
- * Main function of a program that pretends to be a WLAN card.
- *
- * @param argc should be 2
- * @param argv either '1' or '2', depending on which of the two cards this 
dummy is to emulate
- * @return 1 on error, 0 if terminated normally via signal
- */
-int
-main (int argc, char *argv[])
-{
-  struct stat st;
-  int erg;
-  FILE *fpin = NULL;
-  FILE *fpout = NULL;
-  int fdpin;
-  int fdpout;
-  char readbuf[MAXLINE];
-  int readsize;
-  struct SendBuffer write_std;
-  struct SendBuffer write_pout;
-  int ret;
-  int maxfd;
-  fd_set rfds;
-  fd_set wfds;
-  struct timeval tv;
-  int retval;
-  struct GNUNET_MessageStreamTokenizer *stdin_mst = NULL;
-  struct GNUNET_MessageStreamTokenizer *file_in_mst = NULL;
-  struct GNUNET_TRANSPORT_WLAN_MacAddress macaddr;
-  int first;
-
-  if ((2 != argc) ||
-      ((0 != strcmp (argv[1], "1")) && (0 != strcmp (argv[1], "2"))))
-  {
-    fprintf (
-      stderr,
-      "%s",
-      "This program must be started with the operating mode (1 or 2) as the 
only argument.\n");
-    return 1;
-  }
-
-  /* make the fifos if needed */
-  umask (0);
-  if ((GNUNET_OK != GNUNET_DISK_directory_create_for_file (FIFO_FILE1)) ||
-      (GNUNET_OK != GNUNET_DISK_directory_create_for_file (FIFO_FILE2)))
-  {
-    fprintf (stderr, "Failed to create directory for file `%s'\n", FIFO_FILE1);
-    return 1;
-  }
-  if (0 == strcmp (argv[1], "1"))
-  {
-    if (0 != stat (FIFO_FILE1, &st))
-    {
-      erg = mkfifo (FIFO_FILE1, 0666);
-      if ((0 != erg) && (EEXIST != errno))
-        fprintf (stderr,
-                 "Error in mkfifo(%s): %s\n",
-                 FIFO_FILE1,
-                 strerror (errno));
-    }
-  }
-  else
-  {
-    if (0 != stat (FIFO_FILE2, &st))
-    {
-      GNUNET_break (0 == (erg = mkfifo (FIFO_FILE2, 0666)));
-      if ((0 != erg) && (EEXIST != errno))
-        fprintf (stderr,
-                 "Error in mkfifo(%s): %s\n",
-                 FIFO_FILE2,
-                 strerror (errno));
-    }
-  }
-
-  if (0 == strcmp (argv[1], "1"))
-  {
-    first = 1;
-    fpin = fopen (FIFO_FILE1, "r");
-    if (NULL == fpin)
-    {
-      fprintf (stderr,
-               "fopen of read FIFO_FILE1 failed: %s\n",
-               strerror (errno));
-      goto end;
-    }
-    if (NULL == (fpout = fopen (FIFO_FILE2, "w")))
-    {
-      GNUNET_break (0 == mkfifo (FIFO_FILE2, 0666));
-      fpout = fopen (FIFO_FILE2, "w");
-    }
-    if (NULL == fpout)
-    {
-      fprintf (stderr,
-               "fopen of write FIFO_FILE2 failed: %s\n",
-               strerror (errno));
-      goto end;
-    }
-  }
-  else
-  {
-    first = 0;
-    if (NULL == (fpout = fopen (FIFO_FILE1, "w")))
-    {
-      GNUNET_break (0 == mkfifo (FIFO_FILE1, 0666));
-      fpout = fopen (FIFO_FILE1, "w");
-    }
-    if (NULL == fpout)
-    {
-      fprintf (stderr,
-               "fopen of write FIFO_FILE1 failed: %s\n",
-               strerror (errno));
-      goto end;
-    }
-    fpin = fopen (FIFO_FILE2, "r");
-    if (NULL == fpin)
-    {
-      fprintf (stderr,
-               "fopen of read FIFO_FILE2 failed: %s\n",
-               strerror (errno));
-      goto end;
-    }
-  }
-
-  fdpin = fileno (fpin);
-  GNUNET_assert (fpin >= 0);
-  if (fdpin >= FD_SETSIZE)
-  {
-    fprintf (stderr,
-             "File fdpin number too large (%d > %u)\n",
-             fdpin,
-             (unsigned int) FD_SETSIZE);
-    goto end;
-  }
-
-  fdpout = fileno (fpout);
-  GNUNET_assert (fdpout >= 0);
-
-  if (fdpout >= FD_SETSIZE)
-  {
-    fprintf (stderr,
-             "File fdpout number too large (%d > %u)\n",
-             fdpout,
-             (unsigned int) FD_SETSIZE);
-    goto end;
-  }
-
-  signal (SIGINT, &sigfunc);
-  signal (SIGTERM, &sigfunc);
-  signal (GNUNET_TERM_SIG, &sigfunc);
-
-  write_std.size = 0;
-  write_std.pos = 0;
-  write_pout.size = 0;
-  write_pout.pos = 0;
-  stdin_mst = GNUNET_MST_create (&stdin_send, &write_pout);
-  file_in_mst = GNUNET_MST_create (&file_in_send, &write_std);
-
-  /* Send 'random' mac address */
-  macaddr.mac[0] = 0x13;
-  macaddr.mac[1] = 0x22;
-  macaddr.mac[2] = 0x33;
-  macaddr.mac[3] = 0x44;
-  macaddr.mac[4] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 
256);
-  macaddr.mac[5] = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, 256);
-  write_std.size = send_mac_to_plugin (write_std.buf, &macaddr);
-
-  while (0 == closeprog)
-  {
-    maxfd = -1;
-    tv.tv_sec = 5;
-    tv.tv_usec = 0;
-
-    FD_ZERO (&rfds);
-    FD_ZERO (&wfds);
-    /* if output queue is empty, read */
-    if (0 == write_pout.size)
-    {
-      FD_SET (STDIN_FILENO, &rfds);
-      maxfd = MAX (STDIN_FILENO, maxfd);
-    }
-    if (0 == write_std.size)
-    {
-      FD_SET (fdpin, &rfds);
-      maxfd = MAX (fdpin, maxfd);
-    }
-
-    /* if there is something to write, try to write */
-    if (0 < write_std.size)
-    {
-      FD_SET (STDOUT_FILENO, &wfds);
-      maxfd = MAX (maxfd, STDOUT_FILENO);
-    }
-    if (0 < write_pout.size)
-    {
-      FD_SET (fdpout, &wfds);
-      maxfd = MAX (maxfd, fdpout);
-    }
-
-    retval = select (maxfd + 1, &rfds, &wfds, NULL, &tv);
-    if ((-1 == retval) && (EINTR == errno))
-      continue;
-    if (0 > retval)
-    {
-      fprintf (stderr, "select failed: %s\n", strerror (errno));
-      closeprog = 1;
-      break;
-    }
-
-    if (FD_ISSET (STDOUT_FILENO, &wfds))
-    {
-      ret = write (STDOUT_FILENO,
-                   write_std.buf + write_std.pos,
-                   write_std.size - write_std.pos);
-      if (0 > ret)
-      {
-        closeprog = 1;
-        fprintf (stderr,
-                 "Write ERROR to STDOUT_FILENO: %s\n",
-                 strerror (errno));
-        break;
-      }
-      else
-      {
-        write_std.pos += ret;
-        /* check if finished writing */
-        if (write_std.pos == write_std.size)
-        {
-          write_std.pos = 0;
-          write_std.size = 0;
-        }
-      }
-    }
-
-    if (FD_ISSET (fdpout, &wfds))
-    {
-      ret = write (fdpout,
-                   write_pout.buf + write_pout.pos,
-                   write_pout.size - write_pout.pos);
-
-      if (0 > ret)
-      {
-        closeprog = 1;
-        fprintf (stderr,
-                 "Write ERROR to fdpout failed: %s\n",
-                 strerror (errno));
-      }
-      else
-      {
-        write_pout.pos += ret;
-        /* check if finished writing */
-        if (write_pout.pos == write_pout.size)
-        {
-          write_pout.pos = 0;
-          write_pout.size = 0;
-        }
-      }
-    }
-
-    if (FD_ISSET (STDIN_FILENO, &rfds))
-    {
-      readsize = read (STDIN_FILENO, readbuf, sizeof(readbuf));
-
-      if (0 > readsize)
-      {
-        closeprog = 1;
-        fprintf (stderr,
-                 "Error reading from STDIN_FILENO: %s\n",
-                 strerror (errno));
-      }
-      else if (0 < readsize)
-      {
-        GNUNET_MST_from_buffer (stdin_mst,
-                                readbuf,
-                                readsize,
-                                GNUNET_NO,
-                                GNUNET_NO);
-      }
-      else
-      {
-        /* eof */
-        closeprog = 1;
-      }
-    }
-
-    if (FD_ISSET (fdpin, &rfds))
-    {
-      readsize = read (fdpin, readbuf, sizeof(readbuf));
-      if (0 > readsize)
-      {
-        closeprog = 1;
-        fprintf (stderr, "Error reading from fdpin: %s\n", strerror (errno));
-        break;
-      }
-      else if (0 < readsize)
-      {
-        GNUNET_MST_from_buffer (file_in_mst,
-                                readbuf,
-                                readsize,
-                                GNUNET_NO,
-                                GNUNET_NO);
-      }
-      else
-      {
-        /* eof */
-        closeprog = 1;
-      }
-    }
-  }
-
-end:
-  /* clean up */
-  if (NULL != stdin_mst)
-    GNUNET_MST_destroy (stdin_mst);
-  if (NULL != file_in_mst)
-    GNUNET_MST_destroy (file_in_mst);
-
-  if (NULL != fpout)
-    fclose (fpout);
-  if (NULL != fpin)
-    fclose (fpin);
-  if (1 == first)
-  {
-    (void) unlink (FIFO_FILE1);
-    (void) unlink (FIFO_FILE2);
-  }
-  return 0;
-}
diff --git a/src/transport/gnunet-helper-transport-wlan.c 
b/src/transport/gnunet-helper-transport-wlan.c
deleted file mode 100644
index c1a230bef..000000000
--- a/src/transport/gnunet-helper-transport-wlan.c
+++ /dev/null
@@ -1,2165 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010, 2011, 2012 GNUnet e.V.
-   Copyright (c) 2007, 2008, Andy Green <andy@warmcat.com>
-   Copyright Copyright (C) 2009 Thomas d'Otreppe
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file src/transport/gnunet-helper-transport-wlan.c
- * @brief mediator between the wlan interface and gnunet; must run as root 
(SUID will do)
- *        This code will work under GNU/Linux only.
- * @author David Brodski
- * @author Christian Grothoff
- *
- * This program will allow receiving and sending traffic from the WLAN
- * interface.  It will force traffic to be in 'ad-hoc' mode, use the
- * proper MAC address of the WLAN interface and use a GNUnet-specific
- * SSID (and a GNUnet-specific SNAP header).  It only takes a single
- * argument, which is the name of the WLAN interface to use.  The
- * program detects if the interface is not a WLAN interface and exits
- * with an error in that case.
- *
- * Once initialized, the program will first send a 'struct
- * GNUNET_TRANSPORT_WLAN_HelperControlMessage' to 'stdout'.  That
- * message contains the MAC address of the WLAN interface.  It will
- * then read messages from the WLAN interface and send them together
- * with performance information as 'struct
- * GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage' messages to 'stdout'.
- * Furthermore, it will read a stream of messages from 'stdin' that
- * have the format from 'struct
- * GNUNET_TRANSPORT_WLAN_RadiotapSendMessage'.  Those messages will
- * then be sent via the WLAN interface; however, the sender MAC
- * address will be forced to be the correct address from our WLAN
- * card.  If 'stdin' closes, receiving from the WLAN interface will
- * continue.  If 'stdout' causes a SIGPIPE, the process dies from the
- * signal.  Errors cause an error message to be reported to 'stderr',
- * in most cases the process also exits (with status code '1').  The
- * program never terminates normally; it is safe to kill the
- * process with SIGTERM or SIGKILL at any time.
- *
- * Since it uses RAW sockets, the binary must be installed SUID or run
- * as 'root'.  In order to keep the security risk of the resulting
- * SUID binary minimal, the program ONLY opens the RAW socket with
- * root privileges, then drops them and only then starts to process
- * command line arguments.  The code also does not link against any
- * shared libraries (except libc) and is strictly minimal (except for
- * checking for errors).  The following list of people have reviewed
- * this code and considered it safe since the last modification (if
- * you reviewed it, please have your name added to the list):
- *
- * - Christian Grothoff (Apr 3rd 2012)
- */
-
-/*-
- * we use our local copy of ieee80211_radiotap.h
- *
- * - since we can't support extensions we don't understand
- * - since linux does not include it in userspace headers
- *
- * Portions of this code were taken from the ieee80211_radiotap.h header,
- * which is
- *
- * Copyright (c) 2003, 2004 David Young.  All rights reserved.
- *
- * 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.
- * 3. The name of David Young may not be used to endorse or promote
- *    products derived from this software without specific prior
- *    written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``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 DAVID
- * YOUNG 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.
- */
-
-/*
- * Modifications to fit into the linux IEEE 802.11 stack,
- * Mike Kershaw (dragorn@kismetwireless.net)
- */
-/*
- * parts taken from aircrack-ng, parts changend.
- */
-#include "platform.h"
-#include "gnunet_private_config.h"
-#include <netpacket/packet.h>
-#include <linux/if_ether.h>
-#include <linux/wireless.h>
-
-#include "gnunet_protocols.h"
-#include "plugin_transport_wlan.h"
-
-/**
- * Packet format type for the messages we receive from
- * the kernel.  This is for Ethernet 10Mbps format (no
- * performance information included).
- */
-#define ARPHRD_ETHER        1
-
-
-/**
- * Packet format type for the messages we receive from
- * the kernel.  This is for plain messages (with no
- * performance information included).
- */
-#define ARPHRD_IEEE80211        801
-
-
-/**
- * Packet format type for the messages we receive from
- * the kernel.  This is for the PRISM format.
- */
-#define ARPHRD_IEEE80211_PRISM  802
-
-/**
- * Packet format type for the messages we receive from
- * the kernel.  This is for messages with a
- * 'struct Ieee80211RadiotapHeader' (see below).
- */
-#define ARPHRD_IEEE80211_FULL   803
-
-
-/**
- * Maximum size of a message allowed in either direction
- * (used for our receive and sent buffers).
- */
-#define MAXLINE 4096
-
-
-/* ********* structure of messages of type ARPHRD_IEEE80211_PRISM *********** 
*/
-
-/**
- * Device name length in PRISM frames.
- * (In the kernel, this is "WLAN_DEVNAMELEN_MAX")
- */
-#define PRISM_DEVICE_NAME_LENGTH 16
-
-/**
- * Monitor Frame (indicator that we have a 'struct PrismHeader').
- */
-#define PRISM_MSGCODE_MONITOR 0x0041
-
-/**
- * Mac time element.  In micro-seconds.
- * Drivers appear to use a 64bit counter to hold mactime internal
- * the then fill the prism header with the lower 32 bits
- */
-#define PRISM_DID_MACTIME 0x2041
-
-/**
- * Channel element
- */
-#define PRISM_DID_CHANNEL 0x3041
-
-/**
- * Signal element.  Should be the signal strength in dbm, some people
- * suggest that instead "100 - (strength in dbm)" is used (to make this
- * a positive integer).
- */
-#define PRISM_DID_SIGNAL 0x6041
-
-/**
- * Noise element
- */
-#define PRISM_DID_NOISE 0x7041
-
-/**
- * Rate element, in units/multiples of 500Khz
- */
-#define PRISM_DID_RATE 0x8041
-
-
-/**
- * Value is set (supplied)
- */
-#define PRISM_STATUS_OK 0
-
-/**
- * Value not supplied.
- */
-#define PRISM_STATUS_NO_VALUE 1
-
-
-/**
- * Values in the 'struct PrismHeader'.  All in host byte order (!).
- */
-struct PrismValue
-{
-  /**
-   * This has a different ID for each parameter, see
-   * PRISM_DID_* constants.
-   */
-  uint32_t did;
-
-  /**
-   * See PRISM_STATUS_*-constants.  Note that they are unusual: 0 = set;  1 = 
not set
-   */
-  uint16_t status;
-
-  /**
-   * length of data (which is always a uint32_t, but presumably this can be 
used
-   * to specify that fewer bytes are used (with values in 'len' from 0-4).  We
-   * ignore this field.
-   */
-  uint16_t len;
-
-  /**
-   * The data value
-   */
-  uint32_t data;
-} __attribute__ ((packed));
-
-
-/**
- * Prism header format ('struct p80211msg' in Linux).  All in host byte order 
(!).
- */
-struct PrismHeader
-{
-  /**
-   * We expect this to be a PRISM_MSGCODE_*.
-   */
-  uint32_t msgcode;
-
-  /**
-   * The length of the entire header.
-   */
-  uint32_t msglen;
-
-  /**
-   * Name of the device that captured the packet.
-   */
-  char devname[PRISM_DEVICE_NAME_LENGTH];
-
-  /* followed by 'struct PrismValue's.  Documentation suggests that these
-     are typically the hosttime, mactime, channel, rssi, sq, signal, noise,
-     rate, istx and frmlen values, but documentation is sparse.  So we
-     will use the 'did' fields to find out what we actually got. */
-} __attribute__ ((packed));
-
-
-/* ******  end of structure of messages of type ARPHRD_IEEE80211_PRISM ******* 
*/
-
-/* ********** structure of messages of type ARPHRD_IEEE80211_FULL *********** 
*/
-
-/**
- * Bits in the 'it_present' bitmask from the 'struct
- * Ieee80211RadiotapHeader'.  For each value, we give the name, data
- * type, unit and then a description below.  Note that the actual size
- * of the extension can be bigger as arguments must be padded so that
- * args of a given length must begin at a boundary of that length.
- * However, note that compound args are allowed (eg, 2 x uint16_t for
- * IEEE80211_RADIOTAP_CHANNEL) so total argument length is not a
- * reliable indicator of alignment requirement.  See also
- * 'man 9 ieee80211_radiotap'.
- */
-enum RadiotapType
-{
-  /**
-   * IEEE80211_RADIOTAP_TSFT              __le64       microseconds
-   *
-   *      Value in microseconds of the MAC's 64-bit 802.11 Time
-   *      Synchronization Function timer when the first bit of the
-   *      MPDU arrived at the MAC. For received frames, only.
-   */
-  IEEE80211_RADIOTAP_TSFT = 0,
-
-  /**
-   * IEEE80211_RADIOTAP_FLAGS             uint8_t           bitmap
-   *
-   *      Properties of transmitted and received frames. See flags
-   *      defined below.
-   */
-  IEEE80211_RADIOTAP_FLAGS = 1,
-
-  /**
-   * IEEE80211_RADIOTAP_RATE              uint8_t           500kb/s
-   *
-   *      Tx/Rx data rate
-   */
-  IEEE80211_RADIOTAP_RATE = 2,
-
-  /**
-   * IEEE80211_RADIOTAP_CHANNEL           2 x __le16   MHz, bitmap
-   *
-   *      Tx/Rx frequency in MHz, followed by flags (see below).
-   */
-  IEEE80211_RADIOTAP_CHANNEL = 3,
-  /**
-   * IEEE80211_RADIOTAP_FHSS              __le16       see below
-   *
-   *      For frequency-hopping radios, the hop set (first byte)
-   *      and pattern (second byte).
-   */
-  IEEE80211_RADIOTAP_FHSS = 4,
-
-  /**
-   * IEEE80211_RADIOTAP_DBM_ANTSIGNAL     s8           decibels from
-   *                                                   one milliwatt (dBm)
-   *
-   *      RF signal power at the antenna, decibel difference from
-   *      one milliwatt.
-   */
-  IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
-
-  /**
-   * IEEE80211_RADIOTAP_DBM_ANTNOISE      s8           decibels from
-   *                                                   one milliwatt (dBm)
-   *
-   *      RF noise power at the antenna, decibel difference from one
-   *      milliwatt.
-   */
-  IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
-
-  /**
-   * IEEE80211_RADIOTAP_LOCK_QUALITY      __le16       unitless
-   *
-   *      Quality of Barker code lock. Unitless. Monotonically
-   *      nondecreasing with "better" lock strength. Called "Signal
-   *      Quality" in datasheets.  (Is there a standard way to measure
-   *      this?)
-   */
-  IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
-
-  /**
-   * IEEE80211_RADIOTAP_TX_ATTENUATION    __le16       unitless
-   *
-   *      Transmit power expressed as unitless distance from max
-   *      power set at factory calibration.  0 is max power.
-   *      Monotonically nondecreasing with lower power levels.
-   */
-  IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
-
-  /**
-   * IEEE80211_RADIOTAP_DB_TX_ATTENUATION __le16       decibels (dB)
-   *
-   *      Transmit power expressed as decibel distance from max power
-   *      set at factory calibration.  0 is max power.  Monotonically
-   *      nondecreasing with lower power levels.
-   */
-  IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
-
-  /**
-   * IEEE80211_RADIOTAP_DBM_TX_POWER      s8           decibels from
-   *                                                   one milliwatt (dBm)
-   *
-   *      Transmit power expressed as dBm (decibels from a 1 milliwatt
-   *      reference). This is the absolute power level measured at
-   *      the antenna port.
-   */
-  IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
-
-  /**
-   * IEEE80211_RADIOTAP_ANTENNA           uint8_t           antenna index
-   *
-   *      Unitless indication of the Rx/Tx antenna for this packet.
-   *      The first antenna is antenna 0.
-   */
-  IEEE80211_RADIOTAP_ANTENNA = 11,
-
-  /**
-   * IEEE80211_RADIOTAP_DB_ANTSIGNAL      uint8_t           decibel (dB)
-   *
-   *      RF signal power at the antenna, decibel difference from an
-   *      arbitrary, fixed reference.
-   */
-  IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
-
-  /**
-   * IEEE80211_RADIOTAP_DB_ANTNOISE       uint8_t           decibel (dB)
-   *
-   *      RF noise power at the antenna, decibel difference from an
-   *      arbitrary, fixed reference point.
-   */
-  IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
-
-  /**
-   * IEEE80211_RADIOTAP_RX_FLAGS          __le16       bitmap
-   *
-   *     Properties of received frames. See flags defined below.
-   */
-  IEEE80211_RADIOTAP_RX_FLAGS = 14,
-
-  /**
-   * IEEE80211_RADIOTAP_TX_FLAGS          __le16       bitmap
-   *
-   *     Properties of transmitted frames. See flags defined below.
-   */
-  IEEE80211_RADIOTAP_TX_FLAGS = 15,
-
-  /**
-   * IEEE80211_RADIOTAP_RTS_RETRIES       uint8_t           data
-   *
-   *     Number of rts retries a transmitted frame used.
-   */
-  IEEE80211_RADIOTAP_RTS_RETRIES = 16,
-
-  /**
-   * IEEE80211_RADIOTAP_DATA_RETRIES      uint8_t           data
-   *
-   *     Number of unicast retries a transmitted frame used.
-   */
-  IEEE80211_RADIOTAP_DATA_RETRIES = 17,
-
-  /**
-   * Extension bit, used to indicate that more bits are needed for
-   * the bitmask.
-   */
-  IEEE80211_RADIOTAP_EXT = 31
-};
-
-/**
- * Bitmask indicating an extension of the bitmask is used.
- * (Mask corresponding to IEEE80211_RADIOTAP_EXT).
- */
-#define IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK (1 << IEEE80211_RADIOTAP_EXT)
-
-
-/**
- * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get
- * as part of a 'struct Ieee80211RadiotapHeader' extension
- * if the IEEE80211_RADIOTAP_FLAGS bit is set in
- * 'it_present').  The radiotap flags are an 8-bit field.
- *
- * Frame was sent/received during CFP (Contention Free Period)
- */
-#define IEEE80211_RADIOTAP_F_CFP        0x01
-
-/**
- * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get
- * as part of a 'struct Ieee80211RadiotapHeader' extension
- * if the IEEE80211_RADIOTAP_FLAGS bit is set in
- * 'it_present').  The radiotap flags are an 8-bit field.
- *
- * Frame was sent/received with short preamble
- */
-#define IEEE80211_RADIOTAP_F_SHORTPRE   0x02
-
-/**
- * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get
- * as part of a 'struct Ieee80211RadiotapHeader' extension
- * if the IEEE80211_RADIOTAP_FLAGS bit is set in
- * 'it_present').  The radiotap flags are an 8-bit field.
- *
- * Frame was sent/received with WEP encryption
- */
-#define IEEE80211_RADIOTAP_F_WEP        0x04
-
-/**
- * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get
- * as part of a 'struct Ieee80211RadiotapHeader' extension
- * if the IEEE80211_RADIOTAP_FLAGS bit is set in
- * 'it_present').  The radiotap flags are an 8-bit field.
- *
- * Frame was sent/received with fragmentation
- */
-#define IEEE80211_RADIOTAP_F_FRAG       0x08
-
-/**
- * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get
- * as part of a 'struct Ieee80211RadiotapHeader' extension
- * if the IEEE80211_RADIOTAP_FLAGS bit is set in
- * 'it_present').  The radiotap flags are an 8-bit field.
- *
- * Frame includes FCS (CRC at the end that needs to be removeD).
- */
-#define IEEE80211_RADIOTAP_F_FCS        0x10
-
-/**
- * Bit in IEEE80211_RADIOTAP_FLAGS (which we might get
- * as part of a 'struct Ieee80211RadiotapHeader' extension
- * if the IEEE80211_RADIOTAP_FLAGS bit is set in
- * 'it_present').  The radiotap flags are an 8-bit field.
- *
- * Frame has padding between 802.11 header and payload
- * (to 32-bit boundary)
- */
-#define IEEE80211_RADIOTAP_F_DATAPAD    0x20
-
-
-/**
- * For IEEE80211_RADIOTAP_RX_FLAGS:
- * frame failed crc check
- */
-#define IEEE80211_RADIOTAP_F_RX_BADFCS  0x0001
-
-/**
- * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct 
RadiotapTransmissionHeader'):
- * failed due to excessive retries
- */
-#define IEEE80211_RADIOTAP_F_TX_FAIL    0x0001
-
-/**
- * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct 
RadiotapTransmissionHeader'):
- * used cts 'protection'
- */
-#define IEEE80211_RADIOTAP_F_TX_CTS     0x0002
-
-/**
- * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct 
RadiotapTransmissionHeader'):
- * used rts/cts handshake
- */
-#define IEEE80211_RADIOTAP_F_TX_RTS     0x0004
-
-/**
- * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct 
RadiotapTransmissionHeader'):
- * frame should not be ACKed
- */
-#define IEEE80211_RADIOTAP_F_TX_NOACK   0x0008
-
-/**
- * For IEEE80211_RADIOTAP_TX_FLAGS ('txflags' in 'struct 
RadiotapTransmissionHeader'):
- * sequence number handled by userspace
- */
-#define IEEE80211_RADIOTAP_F_TX_NOSEQ   0x0010
-
-
-/**
- * Generic header for radiotap messages (receiving and sending).  A
- * bit mask (it_present) determines which specific records follow.
- *
- * I am trying to describe precisely what the application programmer
- * should expect in the following, and for that reason I tell the
- * units and origin of each measurement (where it applies), or else I
- * use sufficiently weaselly language ("is a monotonically nondecreasing
- * function of...") that I cannot set false expectations for lawyerly
- * readers.
- *
- * The radio capture header precedes the 802.11 header.
- * All data in the header is little endian on all platforms.
- */
-struct Ieee80211RadiotapHeader
-{
-  /**
-   * Version 0. Only increases for drastic changes, introduction of
-   * compatible new fields does not count.
-   */
-  uint8_t it_version;
-
-  /**
-   * Padding.  Set to 0.
-   */
-  uint8_t it_pad;
-
-  /**
-   * length of the whole header in bytes, including it_version,
-   * it_pad, it_len, and data fields.
-   */
-  uint16_t it_len;
-
-  /**
-   * A bitmap telling which fields are present. Set bit 31
-   * (0x80000000) to extend the bitmap by another 32 bits.  Additional
-   * extensions are made by setting bit 31.
-   */
-  uint32_t it_present;
-};
-
-
-/**
- * Format of the header we need to prepend to messages to be sent to the
- * Kernel.
- */
-struct RadiotapTransmissionHeader
-{
-  /**
-   * First we begin with the 'generic' header we also get when receiving
-   * messages.
-   */
-  struct Ieee80211RadiotapHeader header;
-
-  /**
-   * Transmission rate (we use 0, kernel makes up its mind anyway).
-   */
-  uint8_t rate;
-
-  /**
-   * Padding (we use 0).  There is a requirement to pad args, so that
-   * args of a given length must begin at a boundary of that length.
-   * As our next argument is the 'it_len' with 2 bytes, we need 1 byte
-   * of padding.
-   */
-  uint8_t pad1;
-
-  /**
-   * Transmission flags from on the IEEE80211_RADIOTAP_F_TX_* constant family.
-   */
-  uint16_t txflags;
-};
-
-/**
- * The above 'struct RadiotapTransmissionHeader' should have the
- * following value for 'header.it_present' based on the presence of
- * the 'rate' and 'txflags' in the overall struct.
- */
-#define IEEE80211_RADIOTAP_OUR_TRANSMISSION_HEADER_MASK ((1 \
-                                                          << \
-                                                          
IEEE80211_RADIOTAP_RATE) \
-                                                         | (1 \
-                                                            << \
-                                                            
IEEE80211_RADIOTAP_TX_FLAGS))
-
-
-/**
- * struct Ieee80211RadiotapHeaderIterator - tracks walk through present 
radiotap arguments
- * in the radiotap header.  Used when we parse radiotap packets received from 
the kernel.
- */
-struct Ieee80211RadiotapHeaderIterator
-{
-  /**
-   * pointer to the radiotap header we are walking through
-   */
-  const struct Ieee80211RadiotapHeader *rtheader;
-
-  /**
-   * pointer to current radiotap arg
-   */
-  const uint8_t *this_arg;
-
-  /**
-   * internal next argument pointer
-   */
-  const uint8_t *arg;
-
-  /**
-   * internal pointer to next present uint32_t (if IEEE80211_RADIOTAP_EXT is 
used).
-   */
-  const uint32_t *next_bitmap;
-
-  /**
-   * length of radiotap header in host byte ordering
-   */
-  size_t max_length;
-
-  /**
-   * internal shifter for current uint32_t bitmap, (it_present in host byte 
order),
-   * If bit 0 is set, the 'arg_index' argument is present.
-   */
-  uint32_t bitmap_shifter;
-
-  /**
-   * IEEE80211_RADIOTAP_... index of current arg
-   */
-  unsigned int this_arg_index;
-
-  /**
-   * internal next argument index
-   */
-  unsigned int arg_index;
-};
-
-
-/* ************** end of structure of ARPHRD_IEEE80211_FULL ************** */
-
-/* ************************** our globals ******************************* */
-
-/**
- * struct for storing the information of the hardware.  There is only
- * one of these.
- */
-struct HardwareInfos
-{
-  /**
-   * file descriptor for the raw socket
-   */
-  int fd_raw;
-
-  /**
-   * Which format has the header that we're getting when receiving packets?
-   * Some  ARPHRD_IEEE80211_XXX-value.
-   */
-  int arptype_in;
-
-  /**
-   * Name of the interface, not necessarily 0-terminated (!).
-   */
-  char iface[IFNAMSIZ];
-
-  /**
-   * MAC address of our own WLAN interface.
-   */
-  struct GNUNET_TRANSPORT_WLAN_MacAddress pl_mac;
-};
-
-
-/**
- * IO buffer used for buffering data in transit (to wireless or to stdout).
- */
-struct SendBuffer
-{
-  /**
-   * How many bytes of data are stored in 'buf' for transmission right now?
-   * Data always starts at offset 0 and extends to 'size'.
-   */
-  size_t size;
-
-  /**
-   * How many bytes that were stored in 'buf' did we already write to the
-   * destination?  Always smaller than 'size'.
-   */
-  size_t pos;
-
-  /**
-   * Buffered data; twice the maximum allowed message size as we add some
-   * headers.
-   */
-  char buf[MAXLINE * 2];
-};
-
-
-/**
- * Buffer for data read from stdin to be transmitted to the wirless card.
- */
-static struct SendBuffer write_pout;
-
-/**
- * Buffer for data read from the wireless card to be transmitted to stdout.
- */
-static struct SendBuffer write_std;
-
-
-/* *********** specialized version of server_mst.c begins here ********** */
-
-/**
- * To what multiple do we align messages?  8 byte should suffice for everyone
- * for now.
- */
-#define ALIGN_FACTOR 8
-
-/**
- * Smallest supported message.
- */
-#define MIN_BUFFER_SIZE sizeof(struct GNUNET_MessageHeader)
-
-
-/**
- * Functions with this signature are called whenever a
- * complete message is received by the tokenizer.
- *
- * @param cls closure
- * @param message the actual message
- */
-typedef void (*MessageTokenizerCallback) (void *cls,
-                                          const struct
-                                          GNUNET_MessageHeader *
-                                          message);
-
-/**
- * Handle to a message stream tokenizer.
- */
-struct MessageStreamTokenizer
-{
-  /**
-   * Function to call on completed messages.
-   */
-  MessageTokenizerCallback cb;
-
-  /**
-   * Closure for cb.
-   */
-  void *cb_cls;
-
-  /**
-   * Size of the buffer (starting at 'hdr').
-   */
-  size_t curr_buf;
-
-  /**
-   * How many bytes in buffer have we already processed?
-   */
-  size_t off;
-
-  /**
-   * How many bytes in buffer are valid right now?
-   */
-  size_t pos;
-
-  /**
-   * Beginning of the buffer.  Typed like this to force alignment.
-   */
-  struct GNUNET_MessageHeader *hdr;
-};
-
-
-/**
- * Create a message stream tokenizer.
- *
- * @param cb function to call on completed messages
- * @param cb_cls closure for cb
- * @return handle to tokenizer
- */
-static struct MessageStreamTokenizer *
-mst_create (MessageTokenizerCallback cb,
-            void *cb_cls)
-{
-  struct MessageStreamTokenizer *ret;
-
-  ret = malloc (sizeof(struct MessageStreamTokenizer));
-  if (NULL == ret)
-  {
-    fprintf (stderr, "Failed to allocate buffer for tokenizer\n");
-    exit (1);
-  }
-  ret->hdr = malloc (MIN_BUFFER_SIZE);
-  if (NULL == ret->hdr)
-  {
-    fprintf (stderr, "Failed to allocate buffer for alignment\n");
-    exit (1);
-  }
-  ret->curr_buf = MIN_BUFFER_SIZE;
-  ret->cb = cb;
-  ret->cb_cls = cb_cls;
-  return ret;
-}
-
-
-/**
- * Add incoming data to the receive buffer and call the
- * callback for all complete messages.
- *
- * @param mst tokenizer to use
- * @param buf input data to add
- * @param size number of bytes in buf
- * @return GNUNET_OK if we are done processing (need more data)
- *         GNUNET_SYSERR if the data stream is corrupt
- */
-static int
-mst_receive (struct MessageStreamTokenizer *mst,
-             const char *buf, size_t size)
-{
-  const struct GNUNET_MessageHeader *hdr;
-  size_t delta;
-  uint16_t want;
-  char *ibuf;
-  int need_align;
-  unsigned long offset;
-  int ret;
-
-  ret = GNUNET_OK;
-  ibuf = (char *) mst->hdr;
-  while (mst->pos > 0)
-  {
-do_align:
-    if ((mst->curr_buf - mst->off < sizeof(struct GNUNET_MessageHeader)) ||
-        (0 != (mst->off % ALIGN_FACTOR)))
-    {
-      /* need to align or need more space */
-      mst->pos -= mst->off;
-      memmove (ibuf, &ibuf[mst->off], mst->pos);
-      mst->off = 0;
-    }
-    if (mst->pos - mst->off < sizeof(struct GNUNET_MessageHeader))
-    {
-      delta =
-        GNUNET_MIN (sizeof(struct GNUNET_MessageHeader)
-                    - (mst->pos - mst->off), size);
-      GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
-      mst->pos += delta;
-      buf += delta;
-      size -= delta;
-    }
-    if (mst->pos - mst->off < sizeof(struct GNUNET_MessageHeader))
-    {
-      return GNUNET_OK;
-    }
-    hdr = (const struct GNUNET_MessageHeader *) &ibuf[mst->off];
-    want = ntohs (hdr->size);
-    if (want < sizeof(struct GNUNET_MessageHeader))
-    {
-      fprintf (stderr,
-               "Received invalid message from stdin\n");
-      exit (1);
-    }
-    if (mst->curr_buf - mst->off < want)
-    {
-      /* need more space */
-      mst->pos -= mst->off;
-      memmove (ibuf, &ibuf[mst->off], mst->pos);
-      mst->off = 0;
-    }
-    if (want > mst->curr_buf)
-    {
-      mst->hdr = realloc (mst->hdr, want);
-      if (NULL == mst->hdr)
-      {
-        fprintf (stderr, "Failed to allocate buffer for alignment\n");
-        exit (1);
-      }
-      ibuf = (char *) mst->hdr;
-      mst->curr_buf = want;
-    }
-    hdr = (const struct GNUNET_MessageHeader *) &ibuf[mst->off];
-    if (mst->pos - mst->off < want)
-    {
-      delta = GNUNET_MIN (want - (mst->pos - mst->off), size);
-      GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
-      mst->pos += delta;
-      buf += delta;
-      size -= delta;
-    }
-    if (mst->pos - mst->off < want)
-    {
-      return GNUNET_OK;
-    }
-    mst->cb (mst->cb_cls, hdr);
-    mst->off += want;
-    if (mst->off == mst->pos)
-    {
-      /* reset to beginning of buffer, it's free right now! */
-      mst->off = 0;
-      mst->pos = 0;
-    }
-  }
-  while (size > 0)
-  {
-    if (size < sizeof(struct GNUNET_MessageHeader))
-      break;
-    offset = (unsigned long) buf;
-    need_align = (0 != offset % ALIGN_FACTOR) ? GNUNET_YES : GNUNET_NO;
-    if (GNUNET_NO == need_align)
-    {
-      /* can try to do zero-copy and process directly from original buffer */
-      hdr = (const struct GNUNET_MessageHeader *) buf;
-      want = ntohs (hdr->size);
-      if (want < sizeof(struct GNUNET_MessageHeader))
-      {
-        fprintf (stderr,
-                 "Received invalid message from stdin\n");
-        exit (1);
-      }
-      if (size < want)
-        break;                  /* or not, buffer incomplete, so copy to 
private buffer... */
-      mst->cb (mst->cb_cls, hdr);
-      buf += want;
-      size -= want;
-    }
-    else
-    {
-      /* need to copy to private buffer to align;
-       * yes, we go a bit more spaghetti than usual here */
-      goto do_align;
-    }
-  }
-  if (size > 0)
-  {
-    if (size + mst->pos > mst->curr_buf)
-    {
-      mst->hdr = realloc (mst->hdr, size + mst->pos);
-      if (NULL == mst->hdr)
-      {
-        fprintf (stderr, "Failed to allocate buffer for alignment\n");
-        exit (1);
-      }
-      ibuf = (char *) mst->hdr;
-      mst->curr_buf = size + mst->pos;
-    }
-    if (mst->pos + size > mst->curr_buf)
-    {
-      fprintf (stderr,
-               "Assertion failed\n");
-      exit (1);
-    }
-    GNUNET_memcpy (&ibuf[mst->pos], buf, size);
-    mst->pos += size;
-  }
-  return ret;
-}
-
-
-/**
- * Destroys a tokenizer.
- *
- * @param mst tokenizer to destroy
- */
-static void
-mst_destroy (struct MessageStreamTokenizer *mst)
-{
-  free (mst->hdr);
-  free (mst);
-}
-
-
-/* *****************  end of server_mst.c clone ***************** **/
-
-
-/* ************** code for handling of ARPHRD_IEEE80211_FULL ************** */
-
-/**
- * Radiotap header iteration
- *
- * call __ieee80211_radiotap_iterator_init() to init a semi-opaque iterator
- * struct Ieee80211RadiotapHeaderIterator (no need to init the struct 
beforehand)
- * then loop calling __ieee80211_radiotap_iterator_next()... it returns -1
- * if there are no more args in the header, or the next argument type index
- * that is present.  The iterator's this_arg member points to the start of the
- * argument associated with the current argument index that is present,
- * which can be found in the iterator's this_arg_index member.  This arg
- * index corresponds to the IEEE80211_RADIOTAP_... defines.
- *
- * @param iterator iterator to initialize
- * @param radiotap_header message to parse
- * @param max_length number of valid bytes in radiotap_header
- * @return 0 on success, -1 on error
- */
-static int
-ieee80211_radiotap_iterator_init (struct
-                                  Ieee80211RadiotapHeaderIterator *iterator,
-                                  const struct
-                                  Ieee80211RadiotapHeader *radiotap_header,
-                                  size_t max_length)
-{
-  if ((iterator == NULL) ||
-      (radiotap_header == NULL))
-    return -1;
-
-  /* Linux only supports version 0 radiotap format */
-  if (0 != radiotap_header->it_version)
-    return -1;
-
-  /* sanity check for allowed length and radiotap length field */
-  if ((max_length < sizeof(struct Ieee80211RadiotapHeader)) ||
-      (max_length < (GNUNET_le16toh (radiotap_header->it_len))))
-    return -1;
-
-  memset (iterator, 0, sizeof(struct Ieee80211RadiotapHeaderIterator));
-  iterator->rtheader = radiotap_header;
-  iterator->max_length = GNUNET_le16toh (radiotap_header->it_len);
-  iterator->bitmap_shifter = GNUNET_le32toh (radiotap_header->it_present);
-  iterator->arg = ((uint8_t *) radiotap_header) + sizeof(struct
-                                                         
Ieee80211RadiotapHeader);
-
-  /* find payload start allowing for extended bitmap(s) */
-  if (0 != (iterator->bitmap_shifter & IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK))
-  {
-    while (GNUNET_le32toh (*((uint32_t *) iterator->arg))
-           & IEEE80211_RADIOTAP_PRESENT_EXTEND_MASK)
-    {
-      iterator->arg += sizeof(uint32_t);
-      /*
-       * check for insanity where the present bitmaps
-       * keep claiming to extend up to or even beyond the
-       * stated radiotap header length
-       */if (iterator->arg - ((uint8_t *) iterator->rtheader) >
-          iterator->max_length)
-        return -1;
-    }
-    iterator->arg += sizeof(uint32_t);
-    /*
-     * no need to check again for blowing past stated radiotap
-     * header length, because ieee80211_radiotap_iterator_next
-     * checks it before it is dereferenced
-     */}
-  /* we are all initialized happily */
-  return 0;
-}
-
-
-/**
- * Returns the next radiotap parser iterator arg.
- *
- * This function returns the next radiotap arg index (IEEE80211_RADIOTAP_...)
- * and sets iterator->this_arg to point to the payload for the arg.  It takes
- * care of alignment handling and extended present fields.  interator->this_arg
- * can be changed by the caller.  The args pointed to are in little-endian
- * format.
- *
- * @param iterator: radiotap_iterator to move to next arg (if any)
- * @return next present arg index on success or -1 if no more or error
- */
-static int
-ieee80211_radiotap_iterator_next (struct
-                                  Ieee80211RadiotapHeaderIterator *iterator)
-{
-  /*
-   * small length lookup table for all radiotap types we heard of
-   * starting from b0 in the bitmap, so we can walk the payload
-   * area of the radiotap header
-   *
-   * There is a requirement to pad args, so that args
-   * of a given length must begin at a boundary of that length
-   * -- but note that compound args are allowed (eg, 2 x uint16_t
-   * for IEEE80211_RADIOTAP_CHANNEL) so total arg length is not
-   * a reliable indicator of alignment requirement.
-   *
-   * upper nybble: content alignment for arg
-   * lower nybble: content length for arg
-   */static const uint8_t rt_sizes[] = {
-    [IEEE80211_RADIOTAP_TSFT] = 0x88,
-    [IEEE80211_RADIOTAP_FLAGS] = 0x11,
-    [IEEE80211_RADIOTAP_RATE] = 0x11,
-    [IEEE80211_RADIOTAP_CHANNEL] = 0x24,
-    [IEEE80211_RADIOTAP_FHSS] = 0x22,
-    [IEEE80211_RADIOTAP_DBM_ANTSIGNAL] = 0x11,
-    [IEEE80211_RADIOTAP_DBM_ANTNOISE] = 0x11,
-    [IEEE80211_RADIOTAP_LOCK_QUALITY] = 0x22,
-    [IEEE80211_RADIOTAP_TX_ATTENUATION] = 0x22,
-    [IEEE80211_RADIOTAP_DB_TX_ATTENUATION] = 0x22,
-    [IEEE80211_RADIOTAP_DBM_TX_POWER] = 0x11,
-    [IEEE80211_RADIOTAP_ANTENNA] = 0x11,
-    [IEEE80211_RADIOTAP_DB_ANTSIGNAL] = 0x11,
-    [IEEE80211_RADIOTAP_DB_ANTNOISE] = 0x11,
-    [IEEE80211_RADIOTAP_TX_FLAGS] = 0x22,
-    [IEEE80211_RADIOTAP_RX_FLAGS] = 0x22,
-    [IEEE80211_RADIOTAP_RTS_RETRIES] = 0x11,
-    [IEEE80211_RADIOTAP_DATA_RETRIES] = 0x11
-                                        /*
-                                         * add more here as they are defined in
-                                         * include/net/ieee80211_radiotap.h
-                                         */
-  };
-
-  /*
-   * for every radiotap entry we can at
-   * least skip (by knowing the length)...
-   */
-  while (iterator->arg_index < sizeof(rt_sizes))
-  {
-    int hit = (0 != (iterator->bitmap_shifter & 1));
-
-    if (hit)
-    {
-      unsigned int wanted_alignment;
-      unsigned int unalignment;
-      /*
-       * arg is present, account for alignment padding
-       *  8-bit args can be at any alignment
-       * 16-bit args must start on 16-bit boundary
-       * 32-bit args must start on 32-bit boundary
-       * 64-bit args must start on 64-bit boundary
-       *
-       * note that total arg size can differ from alignment of
-       * elements inside arg, so we use upper nybble of length table
-       * to base alignment on.  First, 'wanted_alignment' is set to be
-       * 1 for 8-bit, 2 for 16-bit, 4 for 32-bit and 8 for 64-bit
-       * arguments.  Then, we calculate the 'unalignment' (how many
-       * bytes we are over by taking the difference of 'arg' and the
-       * overall starting point modulo the desired alignment.  As
-       * desired alignments are powers of two, we can do modulo with
-       * binary "&" (and also avoid the possibility of a division by
-       * zero if the 'rt_sizes' table contains bogus entries).
-       *
-       * also note: these alignments are relative to the start of the
-       * radiotap header.  There is no guarantee that the radiotap
-       * header itself is aligned on any kind of boundary, thus we
-       * need to really look at the delta here.
-       */wanted_alignment = rt_sizes[iterator->arg_index] >> 4;
-      unalignment = (((void *) iterator->arg) - ((void *) iterator->rtheader))
-                    & (wanted_alignment - 1);
-      if (0 != unalignment)
-      {
-        /* need padding (by 'wanted_alignment - unalignment') */
-        iterator->arg_index += wanted_alignment - unalignment;
-      }
-
-      /*
-       * this is what we will return to user, but we need to
-       * move on first so next call has something fresh to test
-       */
-      iterator->this_arg_index = iterator->arg_index;
-      iterator->this_arg = iterator->arg;
-
-      /* internally move on the size of this arg (using lower nybble from
-         the table) */
-      iterator->arg += rt_sizes[iterator->arg_index] & 0x0f;
-
-      /*
-       * check for insanity where we are given a bitmap that
-       * claims to have more arg content than the length of the
-       * radiotap section.  We will normally end up equalling this
-       * max_length on the last arg, never exceeding it.
-       */if ((((void *) iterator->arg) - ((void *) iterator->rtheader)) >
-          iterator->max_length)
-        return -1;
-    }
-
-    /* Now, move on to next bit / next entry */
-    iterator->arg_index++;
-
-    if (0 == (iterator->arg_index % 32))
-    {
-      /* completed current uint32_t bitmap */
-      if (0 != (iterator->bitmap_shifter & 1))
-      {
-        /* bit 31 was set, there is more; move to next uint32_t bitmap */
-        iterator->bitmap_shifter = GNUNET_le32toh (*iterator->next_bitmap);
-        iterator->next_bitmap++;
-      }
-      else
-      {
-        /* no more bitmaps: end (by setting arg_index to high, unsupported 
value) */
-        iterator->arg_index = sizeof(rt_sizes);
-      }
-    }
-    else
-    {
-      /* just try the next bit (while loop will move on) */
-      iterator->bitmap_shifter >>= 1;
-    }
-
-    /* if we found a valid arg earlier, return it now */
-    if (hit)
-      return iterator->this_arg_index;
-  }
-
-  /* we don't know how to handle any more args (or there are no more),
-     so we're done (this is not an error) */
-  return -1;
-}
-
-
-/**
- * Calculate crc32, the start of the calculation
- *
- * @param buf buffer to calc the crc
- * @param len len of the buffer
- * @return crc sum
- */
-static unsigned long
-calc_crc_osdep (const unsigned char *buf, size_t len)
-{
-  static const unsigned long int crc_tbl_osdep[256] = {
-    0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
-    0xE963A535, 0x9E6495A3,
-    0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD,
-    0xE7B82D07, 0x90BF1D91,
-    0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB,
-    0xF4D4B551, 0x83D385C7,
-    0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
-    0xFA0F3D63, 0x8D080DF5,
-    0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447,
-    0xD20D85FD, 0xA50AB56B,
-    0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75,
-    0xDCD60DCF, 0xABD13D59,
-    0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
-    0xCFBA9599, 0xB8BDA50F,
-    0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11,
-    0xC1611DAB, 0xB6662D3D,
-    0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F,
-    0x9FBFE4A5, 0xE8B8D433,
-    0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D,
-    0x91646C97, 0xE6635C01,
-    0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B,
-    0x8208F4C1, 0xF50FC457,
-    0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49,
-    0x8CD37CF3, 0xFBD44C65,
-    0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7,
-    0xA4D1C46D, 0xD3D6F4FB,
-    0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5,
-    0xAA0A4C5F, 0xDD0D7CC9,
-    0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3,
-    0xB966D409, 0xCE61E49F,
-    0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
-    0xB7BD5C3B, 0xC0BA6CAD,
-    0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF,
-    0x04DB2615, 0x73DC1683,
-    0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D,
-    0x0A00AE27, 0x7D079EB1,
-    0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
-    0x196C3671, 0x6E6B06E7,
-    0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9,
-    0x17B7BE43, 0x60B08ED5,
-    0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767,
-    0x3FB506DD, 0x48B2364B,
-    0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55,
-    0x316E8EEF, 0x4669BE79,
-    0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703,
-    0x220216B9, 0x5505262F,
-    0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31,
-    0x2CD99E8B, 0x5BDEAE1D,
-    0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
-    0x72076785, 0x05005713,
-    0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D,
-    0x7CDCEFB7, 0x0BDBDF21,
-    0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B,
-    0x6FB077E1, 0x18B74777,
-    0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69,
-    0x616BFFD3, 0x166CCF45,
-    0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7,
-    0x4969474D, 0x3E6E77DB,
-    0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5,
-    0x47B2CF7F, 0x30B5FFE9,
-    0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693,
-    0x54DE5729, 0x23D967BF,
-    0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1,
-    0x5A05DF1B, 0x2D02EF8D
-  };
-
-  unsigned long crc = 0xFFFFFFFF;
-
-  for (; len > 0; len--, buf++)
-    crc = crc_tbl_osdep[(crc ^ *buf) & 0xFF] ^ (crc >> 8);
-  return(~crc);
-}
-
-
-/**
- * Calculate and check crc of the wlan packet
- *
- * @param buf buffer of the packet, with len + 4 bytes of data,
- *            the last 4 bytes being the checksum
- * @param len length of the payload in data
- * @return 0 on success (checksum matches), 1 on error
- */
-static int
-check_crc_buf_osdep (const unsigned char *buf, size_t len)
-{
-  unsigned long crc;
-
-  crc = calc_crc_osdep (buf, len);
-  buf += len;
-  if ((((crc) & 0xFF) == buf[0]) && (((crc >> 8) & 0xFF) == buf[1]) &&
-      ( ((crc >> 16) & 0xFF) == buf[2]) && ( ((crc >> 24) & 0xFF) == buf[3]) )
-    return 0;
-  return 1;
-}
-
-
-/* ************end of code for handling of ARPHRD_IEEE80211_FULL 
************** */
-
-
-/* ************beginning of code for reading packets from kernel 
************** */
-
-/**
- * Return the channel from the frequency (in Mhz)
- *
- * @param frequency of the channel
- * @return number of the channel
- */
-static int
-get_channel_from_frequency (int32_t frequency)
-{
-  if ((frequency >= 2412) && (frequency <= 2472))
-    return (frequency - 2407) / 5;
-  if (frequency == 2484)
-    return 14;
-  if ((frequency >= 5000) && (frequency <= 6100))
-    return (frequency - 5000) / 5;
-  return -1;
-}
-
-
-/**
- * Get the channel used by our WLAN interface.
- *
- * @param dev pointer to the dev struct of the card
- * @return channel number, -1 on error
- */
-static int
-linux_get_channel (const struct HardwareInfos *dev)
-{
-  struct iwreq wrq;
-  int32_t frequency;
-
-  memset (&wrq, 0, sizeof(struct iwreq));
-  strncpy (wrq.ifr_name, dev->iface, IFNAMSIZ);
-  if (0 > ioctl (dev->fd_raw, SIOCGIWFREQ, &wrq))
-    return -1;
-  frequency = wrq.u.freq.m; /* 'iw_freq' defines 'm' as '__s32', so we keep it 
signed */
-  if (100000000 < frequency)
-    frequency /= 100000;
-  else if (1000000 < frequency)
-    frequency /= 1000;
-  if (1000 < frequency)
-    return get_channel_from_frequency (frequency);
-  return frequency;
-}
-
-
-/**
- * Read from the raw socket (the wlan card), parse the packet and
- * put the result into the buffer for transmission to 'stdout'.
- *
- * @param dev pointer to the struct of the wlan card
- * @param buf buffer to read to; first bytes will be the 'struct 
GNUNET_TRANSPORT_WLAN_Ieee80211Frame',
- *            followed by the actual payload
- * @param buf_size size of the buffer
- * @param ri where to write radiotap_rx info
- * @return number of bytes written to 'buf'
- */
-static ssize_t
-linux_read (struct HardwareInfos *dev,
-            unsigned char *buf, size_t buf_size,
-            struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *ri)
-{
-  unsigned char tmpbuf[buf_size];
-  ssize_t caplen;
-  size_t n;
-  int got_signal = 0;
-  int got_noise = 0;
-  int got_channel = 0;
-  int fcs_removed = 0;
-
-  caplen = read (dev->fd_raw, tmpbuf, buf_size);
-  if (0 > caplen)
-  {
-    if (EAGAIN == errno)
-      return 0;
-    fprintf (stderr, "Failed to read from RAW socket: %s\n", strerror (errno));
-    return -1;
-  }
-
-  memset (ri, 0, sizeof(*ri));
-  switch (dev->arptype_in)
-  {
-  case ARPHRD_IEEE80211_PRISM:
-    {
-      const struct PrismHeader *ph;
-
-      ph = (const struct PrismHeader*) tmpbuf;
-      n = ph->msglen;
-      if ((n < 8) || (n >= caplen))
-        return 0; /* invalid format */
-      if ((PRISM_MSGCODE_MONITOR == ph->msgcode) &&
-          (n >= sizeof(struct PrismHeader)))
-      {
-        const char *pos;
-        size_t left;
-        struct PrismValue pv;
-
-        left = n - sizeof(struct PrismHeader);
-        pos = (const char *) &ph[1];
-        while (left > sizeof(struct PrismValue))
-        {
-          left -= sizeof(struct PrismValue);
-          GNUNET_memcpy (&pv, pos, sizeof(struct PrismValue));
-          pos += sizeof(struct PrismValue);
-
-          switch (pv.did)
-          {
-          case PRISM_DID_NOISE:
-            if (PRISM_STATUS_OK == pv.status)
-            {
-              ri->ri_noise = pv.data;
-              /* got_noise = 1; */
-            }
-            break;
-
-          case PRISM_DID_RATE:
-            if (PRISM_STATUS_OK == pv.status)
-              ri->ri_rate = pv.data * 500000;
-            break;
-
-          case PRISM_DID_CHANNEL:
-            if (PRISM_STATUS_OK == pv.status)
-            {
-              ri->ri_channel = pv.data;
-              got_channel = 1;
-            }
-            break;
-
-          case PRISM_DID_MACTIME:
-            if (PRISM_STATUS_OK == pv.status)
-              ri->ri_mactime = pv.data;
-            break;
-
-          case PRISM_DID_SIGNAL:
-            if (PRISM_STATUS_OK == pv.status)
-            {
-              ri->ri_power = pv.data;
-              /* got_signal = 1; */
-            }
-            break;
-          }
-        }
-      }
-      if ((n < 8) || (n >= caplen))
-        return 0; /* invalid format */
-    }
-    break;
-
-  case ARPHRD_IEEE80211_FULL:
-    {
-      struct Ieee80211RadiotapHeaderIterator iterator;
-      struct Ieee80211RadiotapHeader *rthdr;
-
-      memset (&iterator, 0, sizeof(iterator));
-      rthdr = (struct Ieee80211RadiotapHeader *) tmpbuf;
-      n = GNUNET_le16toh (rthdr->it_len);
-      if ((n < sizeof(struct Ieee80211RadiotapHeader)) || (n >= caplen))
-        return 0; /* invalid 'it_len' */
-      if (0 != ieee80211_radiotap_iterator_init (&iterator, rthdr, caplen))
-        return 0;
-      /* go through the radiotap arguments we have been given by the driver */
-      while (0 <= ieee80211_radiotap_iterator_next (&iterator))
-      {
-        switch (iterator.this_arg_index)
-        {
-        case IEEE80211_RADIOTAP_TSFT:
-          ri->ri_mactime = GNUNET_le64toh (*((uint64_t *) iterator.this_arg));
-          break;
-
-        case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
-          if (! got_signal)
-          {
-            ri->ri_power = *((int8_t *) iterator.this_arg);
-            got_signal = 1;
-          }
-          break;
-
-        case IEEE80211_RADIOTAP_DB_ANTSIGNAL:
-          if (! got_signal)
-          {
-            ri->ri_power = *((int8_t *) iterator.this_arg);
-            got_signal = 1;
-          }
-          break;
-
-        case IEEE80211_RADIOTAP_DBM_ANTNOISE:
-          if (! got_noise)
-          {
-            ri->ri_noise = *((int8_t *) iterator.this_arg);
-            got_noise = 1;
-          }
-          break;
-
-        case IEEE80211_RADIOTAP_DB_ANTNOISE:
-          if (! got_noise)
-          {
-            ri->ri_noise = *((int8_t *) iterator.this_arg);
-            got_noise = 1;
-          }
-          break;
-
-        case IEEE80211_RADIOTAP_ANTENNA:
-          ri->ri_antenna = *iterator.this_arg;
-          break;
-
-        case IEEE80211_RADIOTAP_CHANNEL:
-          ri->ri_channel = *iterator.this_arg;
-          got_channel = 1;
-          break;
-
-        case IEEE80211_RADIOTAP_RATE:
-          ri->ri_rate = (*iterator.this_arg) * 500000;
-          break;
-
-        case IEEE80211_RADIOTAP_FLAGS:
-          {
-            uint8_t flags = *iterator.this_arg;
-            /* is the CRC visible at the end? if so, remove */
-            if (0 != (flags & IEEE80211_RADIOTAP_F_FCS))
-            {
-              fcs_removed = 1;
-              caplen -= sizeof(uint32_t);
-            }
-            break;
-          }
-
-        case IEEE80211_RADIOTAP_RX_FLAGS:
-          {
-            uint16_t flags = ntohs (*((uint16_t *) iterator.this_arg));
-            if (0 != (flags & IEEE80211_RADIOTAP_F_RX_BADFCS))
-              return 0;
-          }
-          break;
-        }     /* end of 'switch' */
-      }   /* end of the 'while' loop */
-    }
-    break;
-
-  case ARPHRD_IEEE80211:
-    n = 0;   /* no header */
-    break;
-
-  case ARPHRD_ETHER:
-    {
-      if (sizeof(struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) > caplen)
-        return 0; /* invalid */
-      GNUNET_memcpy (&buf[sizeof(struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame)],
-                     tmpbuf + sizeof(struct
-                                     GNUNET_TRANSPORT_WLAN_Ieee8023Frame),
-                     caplen - sizeof(struct
-                                     GNUNET_TRANSPORT_WLAN_Ieee8023Frame)
-                     - 4 /* 4 byte FCS */);
-      return caplen - sizeof(struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame) - 4;
-    }
-
-  default:
-    errno = ENOTSUP;   /* unsupported format */
-    return -1;
-  }
-  caplen -= n;
-  if (! got_channel)
-    ri->ri_channel = linux_get_channel (dev);
-
-  /* detect CRC32 at the end, even if the flag wasn't set and remove it */
-  if ((0 == fcs_removed) &&
-      (0 == check_crc_buf_osdep (tmpbuf + n, caplen - sizeof(uint32_t))))
-  {
-    /* NOTE: this heuristic can of course fail if there happens to
-       be a matching checksum at the end. Would be good to have
-       some data to see how often this heuristic actually works. */
-    caplen -= sizeof(uint32_t);
-  }
-  /* copy payload to target buffer */
-  GNUNET_memcpy (buf, tmpbuf + n, caplen);
-  return caplen;
-}
-
-
-/* ************end of code for reading packets from kernel ************** */
-
-/* ************other helper functions for main start here ************** */
-
-
-/**
- * Open the wireless network interface for reading/writing.
- *
- * @param dev pointer to the device struct
- * @return 0 on success
- */
-static int
-open_device_raw (struct HardwareInfos *dev)
-{
-  struct ifreq ifr;
-  struct iwreq wrq;
-  struct packet_mreq mr;
-  struct sockaddr_ll sll;
-
-  /* find the interface index */
-  memset (&ifr, 0, sizeof(ifr));
-  strncpy (ifr.ifr_name, dev->iface, IFNAMSIZ);
-  if (-1 == ioctl (dev->fd_raw, SIOCGIFINDEX, &ifr))
-  {
-    fprintf (stderr, "ioctl(SIOCGIFINDEX) on interface `%.*s' failed: %s\n",
-             IFNAMSIZ, dev->iface, strerror (errno));
-    return 1;
-  }
-
-  /* lookup the hardware type */
-  memset (&sll, 0, sizeof(sll));
-  sll.sll_family = AF_PACKET;
-  sll.sll_ifindex = ifr.ifr_ifindex;
-  sll.sll_protocol = htons (ETH_P_ALL);
-  if (-1 == ioctl (dev->fd_raw, SIOCGIFHWADDR, &ifr))
-  {
-    fprintf (stderr, "ioctl(SIOCGIFHWADDR) on interface `%.*s' failed: %s\n",
-             IFNAMSIZ, dev->iface, strerror (errno));
-    return 1;
-  }
-  if (((ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211) &&
-       (ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) &&
-       (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_PRISM) &&
-       (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_FULL)))
-  {
-    fprintf (stderr,
-             "Error: interface `%.*s' is not using a supported hardware 
address family (got %d)\n",
-             IFNAMSIZ, dev->iface,
-             ifr.ifr_hwaddr.sa_family);
-    return 1;
-  }
-
-  /* lookup iw mode */
-  memset (&wrq, 0, sizeof(struct iwreq));
-  strncpy (wrq.ifr_name, dev->iface, IFNAMSIZ);
-  if (-1 == ioctl (dev->fd_raw, SIOCGIWMODE, &wrq))
-  {
-    /* most probably not supported (ie for rtap ipw interface) *
-    * so just assume its correctly set...                     */
-    wrq.u.mode = IW_MODE_MONITOR;
-  }
-
-  if ((wrq.u.mode != IW_MODE_MONITOR) &&
-      (wrq.u.mode != IW_MODE_ADHOC))
-  {
-    fprintf (stderr,
-             "Error: interface `%.*s' is not in monitor or ad-hoc mode (got 
%d)\n",
-             IFNAMSIZ, dev->iface,
-             wrq.u.mode);
-    return 1;
-  }
-
-  /* Is interface st to up, broadcast & running ? */
-  if ((ifr.ifr_flags | IFF_UP | IFF_BROADCAST | IFF_RUNNING) != ifr.ifr_flags)
-  {
-    /* Bring interface up */
-    ifr.ifr_flags |= IFF_UP | IFF_BROADCAST | IFF_RUNNING;
-
-    if (-1 == ioctl (dev->fd_raw, SIOCSIFFLAGS, &ifr))
-    {
-      fprintf (stderr, "ioctl(SIOCSIFFLAGS) on interface `%.*s' failed: %s\n",
-               IFNAMSIZ, dev->iface, strerror (errno));
-      return 1;
-    }
-  }
-
-  /* bind the raw socket to the interface */
-  if (-1 == bind (dev->fd_raw, (struct sockaddr *) &sll, sizeof(sll)))
-  {
-    fprintf (stderr, "Failed to bind interface `%.*s': %s\n", IFNAMSIZ,
-             dev->iface, strerror (errno));
-    return 1;
-  }
-
-  /* lookup the hardware type */
-  if (-1 == ioctl (dev->fd_raw, SIOCGIFHWADDR, &ifr))
-  {
-    fprintf (stderr, "ioctl(SIOCGIFHWADDR) on interface `%.*s' failed: %s\n",
-             IFNAMSIZ, dev->iface, strerror (errno));
-    return 1;
-  }
-
-  GNUNET_memcpy (&dev->pl_mac, ifr.ifr_hwaddr.sa_data, MAC_ADDR_SIZE);
-  dev->arptype_in = ifr.ifr_hwaddr.sa_family;
-  if ((ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) &&
-      (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211) &&
-      (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_PRISM) &&
-      (ifr.ifr_hwaddr.sa_family != ARPHRD_IEEE80211_FULL))
-  {
-    fprintf (stderr, "Unsupported hardware link type %d on interface `%.*s'\n",
-             ifr.ifr_hwaddr.sa_family, IFNAMSIZ, dev->iface);
-    return 1;
-  }
-
-  /* enable promiscuous mode */
-  memset (&mr, 0, sizeof(mr));
-  mr.mr_ifindex = sll.sll_ifindex;
-  mr.mr_type = PACKET_MR_PROMISC;
-  if (0 !=
-      setsockopt (dev->fd_raw, SOL_PACKET, PACKET_ADD_MEMBERSHIP, &mr,
-                  sizeof(mr)))
-  {
-    fprintf (stderr,
-             "Failed to enable promiscuous mode on interface `%.*s'\n",
-             IFNAMSIZ,
-             dev->iface);
-    return 1;
-  }
-  return 0;
-}
-
-
-/**
- * Test if the given interface name really corresponds to a wireless
- * device.
- *
- * @param iface name of the interface
- * @return 0 on success, 1 on error
- */
-static int
-test_wlan_interface (const char *iface)
-{
-  char strbuf[512];
-  struct stat sbuf;
-  int ret;
-
-  ret = snprintf (strbuf, sizeof(strbuf),
-                  "/sys/class/net/%s/phy80211/subsystem",
-                  iface);
-  if ((ret < 0) || (ret >= sizeof(strbuf)) || (0 != stat (strbuf, &sbuf)))
-  {
-    fprintf (stderr,
-             "Did not find 802.11 interface `%s'. Exiting.\n",
-             iface);
-    exit (1);
-  }
-  return 0;
-}
-
-
-/**
- * Test incoming packets mac for being our own.
- *
- * @param taIeeeHeader buffer of the packet
- * @param dev the Hardware_Infos struct
- * @return 0 if mac belongs to us, 1 if mac is for another target
- */
-static int
-mac_test (const struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader,
-          const struct HardwareInfos *dev)
-{
-  static struct GNUNET_TRANSPORT_WLAN_MacAddress all_zeros;
-
-  if ((0 == memcmp (&taIeeeHeader->addr3, &all_zeros, MAC_ADDR_SIZE)) ||
-      (0 == memcmp (&taIeeeHeader->addr1, &all_zeros, MAC_ADDR_SIZE)))
-    return 0; /* some drivers set no Macs, then assume it is all for us! */
-
-  if (0 != memcmp (&taIeeeHeader->addr3, &mac_bssid_gnunet, MAC_ADDR_SIZE))
-    return 1; /* not a GNUnet ad-hoc package */
-  if ((0 == memcmp (&taIeeeHeader->addr1, &dev->pl_mac, MAC_ADDR_SIZE)) ||
-      (0 == memcmp (&taIeeeHeader->addr1, &bc_all_mac, MAC_ADDR_SIZE)))
-    return 0; /* for us, or broadcast */
-  return 1; /* not for us */
-}
-
-
-/**
- * Set the wlan header to sane values to make attacks more difficult
- *
- * @param taIeeeHeader pointer to the header of the packet
- * @param dev pointer to the Hardware_Infos struct
- */
-static void
-mac_set (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *taIeeeHeader,
-         const struct HardwareInfos *dev)
-{
-  taIeeeHeader->frame_control = htons (IEEE80211_FC0_TYPE_DATA);
-  taIeeeHeader->addr2 = dev->pl_mac;
-  taIeeeHeader->addr3 = mac_bssid_gnunet;
-}
-
-
-/**
- * Process data from the stdin.  Takes the message, prepends the
- * radiotap transmission header, forces the sender MAC to be correct
- * and puts it into our buffer for transmission to the kernel.
- *
- * @param cls pointer to the device struct ('struct HardwareInfos*')
- * @param hdr pointer to the start of the packet
- */
-static void
-stdin_send_hw (void *cls, const struct GNUNET_MessageHeader *hdr)
-{
-  struct HardwareInfos *dev = cls;
-  const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header;
-  struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *wlanheader;
-  size_t sendsize;
-  struct RadiotapTransmissionHeader rtheader;
-  struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame etheader;
-
-  sendsize = ntohs (hdr->size);
-  if ((sendsize <
-       sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)) ||
-      (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER != ntohs (hdr->type)))
-  {
-    fprintf (stderr, "Received malformed message\n");
-    exit (1);
-  }
-  sendsize -= (sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)
-               - sizeof(struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame));
-  if (MAXLINE < sendsize)
-  {
-    fprintf (stderr, "Packet too big for buffer\n");
-    exit (1);
-  }
-  header = (const struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) hdr;
-  switch (dev->arptype_in)
-  {
-  case ARPHRD_IEEE80211_PRISM:
-  case ARPHRD_IEEE80211_FULL:
-  case ARPHRD_IEEE80211:
-    rtheader.header.it_version = 0;
-    rtheader.header.it_pad = 0;
-    rtheader.header.it_len = GNUNET_htole16 (sizeof(rtheader));
-    rtheader.header.it_present = GNUNET_htole16 (
-      IEEE80211_RADIOTAP_OUR_TRANSMISSION_HEADER_MASK);
-    rtheader.rate = header->rate;
-    rtheader.pad1 = 0;
-    rtheader.txflags = GNUNET_htole16 (IEEE80211_RADIOTAP_F_TX_NOACK
-                                       | IEEE80211_RADIOTAP_F_TX_NOSEQ);
-    GNUNET_memcpy (write_pout.buf, &rtheader, sizeof(rtheader));
-    GNUNET_memcpy (&write_pout.buf[sizeof(rtheader)], &header->frame, 
sendsize);
-    wlanheader = (struct
-                  GNUNET_TRANSPORT_WLAN_Ieee80211Frame *) 
&write_pout.buf[sizeof(
-                                                                            
rtheader)
-                 ];
-
-    /* payload contains MAC address, but we don't trust it, so we'll
-     * overwrite it with OUR MAC address to prevent mischief */
-    mac_set (wlanheader, dev);
-    write_pout.size = sendsize + sizeof(rtheader);
-    break;
-
-  case ARPHRD_ETHER:
-    etheader.dst = header->frame.addr1;
-    /* etheader.src = header->frame.addr2; --- untrusted input */
-    etheader.src = dev->pl_mac;
-    etheader.type = htons (ETH_P_IP);
-    GNUNET_memcpy (write_pout.buf, &etheader, sizeof(etheader));
-    GNUNET_memcpy (&write_pout.buf[sizeof(etheader)], &header[1], sendsize
-                   - sizeof(struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame));
-    write_pout.size = sendsize - sizeof(struct
-                                        GNUNET_TRANSPORT_WLAN_Ieee80211Frame)
-                      + sizeof(etheader);
-    break;
-
-  default:
-    fprintf (stderr,
-             "Unsupported ARPTYPE!\n");
-    break;
-  }
-}
-
-
-/**
- * Main function of the helper.  This code accesses a WLAN interface
- * in monitoring mode (layer 2) and then forwards traffic in both
- * directions between the WLAN interface and stdin/stdout of this
- * process.  Error messages are written to stdout.
- *
- * @param argc number of arguments, must be 2
- * @param argv arguments only argument is the name of the interface (e.g. 
'mon0')
- * @return 0 on success (never happens, as we don't return unless aborted), 1 
on error
- */
-int
-main (int argc, char *argv[])
-{
-  struct HardwareInfos dev;
-  char readbuf[MAXLINE];
-  int maxfd;
-  fd_set rfds;
-  fd_set wfds;
-  int stdin_open;
-  struct MessageStreamTokenizer *stdin_mst;
-  int raw_eno;
-
-  /* assert privs so we can modify the firewall rules! */
-  {
-#ifdef HAVE_SETRESUID
-    uid_t uid = getuid ();
-
-    if (0 != setresuid (uid, 0, 0))
-    {
-      fprintf (stderr,
-               "Failed to setresuid to root: %s\n",
-               strerror (errno));
-      return 254;
-    }
-#else
-    if (0 != seteuid (0))
-    {
-      fprintf (stderr,
-               "Failed to seteuid back to root: %s\n", strerror (errno));
-      return 254;
-    }
-#endif
-  }
-
-  /* make use of SGID capabilities on POSIX */
-  memset (&dev, 0, sizeof(dev));
-  dev.fd_raw = socket (PF_PACKET, SOCK_RAW, htons (ETH_P_ALL));
-  raw_eno = errno; /* remember for later */
-
-  /* now that we've dropped root rights, we can do error checking */
-  if (2 != argc)
-  {
-    fprintf (stderr,
-             "You must specify the name of the interface as the first and only 
argument to this program.\n");
-    if (-1 != dev.fd_raw)
-      (void) close (dev.fd_raw);
-    return 1;
-  }
-
-  if (-1 == dev.fd_raw)
-  {
-    fprintf (stderr, "Failed to create raw socket: %s\n", strerror (raw_eno));
-    return 1;
-  }
-  if (dev.fd_raw >= FD_SETSIZE)
-  {
-    fprintf (stderr, "File descriptor too large for select (%d > %d)\n",
-             dev.fd_raw, FD_SETSIZE);
-    (void) close (dev.fd_raw);
-    return 1;
-  }
-  if (0 != test_wlan_interface (argv[1]))
-  {
-    (void) close (dev.fd_raw);
-    return 1;
-  }
-  memcpy (dev.iface, argv[1], IFNAMSIZ);
-  if (0 != open_device_raw (&dev))
-  {
-    (void) close (dev.fd_raw);
-    return 1;
-  }
-
-  /* drop privs */
-  {
-    uid_t uid = getuid ();
-#ifdef HAVE_SETRESUID
-    if (0 != setresuid (uid, uid, uid))
-    {
-      fprintf (stderr, "Failed to setresuid: %s\n", strerror (errno));
-      if (-1 != dev.fd_raw)
-        (void) close (dev.fd_raw);
-      return 1;
-    }
-#else
-    if (0 != (setuid (uid) | seteuid (uid)))
-    {
-      fprintf (stderr, "Failed to setuid: %s\n", strerror (errno));
-      if (-1 != dev.fd_raw)
-        (void) close (dev.fd_raw);
-      return 1;
-    }
-#endif
-  }
-
-
-  /* send MAC address of the WLAN interface to STDOUT first */
-  {
-    struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg;
-
-    macmsg.hdr.size = htons (sizeof(macmsg));
-    macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
-    GNUNET_memcpy (&macmsg.mac, &dev.pl_mac, sizeof(struct
-                                                    
GNUNET_TRANSPORT_WLAN_MacAddress));
-    GNUNET_memcpy (write_std.buf, &macmsg, sizeof(macmsg));
-    write_std.size = sizeof(macmsg);
-  }
-
-  stdin_mst = mst_create (&stdin_send_hw, &dev);
-  stdin_open = 1;
-  while (1)
-  {
-    maxfd = -1;
-    FD_ZERO (&rfds);
-    if ((0 == write_pout.size) && (1 == stdin_open))
-    {
-      FD_SET (STDIN_FILENO, &rfds);
-      maxfd = MAX (maxfd, STDIN_FILENO);
-    }
-    if (0 == write_std.size)
-    {
-      FD_SET (dev.fd_raw, &rfds);
-      maxfd = MAX (maxfd, dev.fd_raw);
-    }
-    FD_ZERO (&wfds);
-    if (0 < write_std.size)
-    {
-      FD_SET (STDOUT_FILENO, &wfds);
-      maxfd = MAX (maxfd, STDOUT_FILENO);
-    }
-    if (0 < write_pout.size)
-    {
-      FD_SET (dev.fd_raw, &wfds);
-      maxfd = MAX (maxfd, dev.fd_raw);
-    }
-    {
-      int retval = select (maxfd + 1, &rfds, &wfds, NULL, NULL);
-      if ((-1 == retval) && (EINTR == errno))
-        continue;
-      if (0 > retval)
-      {
-        fprintf (stderr, "select failed: %s\n", strerror (errno));
-        break;
-      }
-    }
-    if (FD_ISSET (STDOUT_FILENO, &wfds))
-    {
-      ssize_t ret =
-        write (STDOUT_FILENO, write_std.buf + write_std.pos,
-               write_std.size - write_std.pos);
-      if (0 > ret)
-      {
-        fprintf (stderr, "Failed to write to STDOUT: %s\n", strerror (errno));
-        break;
-      }
-      write_std.pos += ret;
-      if (write_std.pos == write_std.size)
-      {
-        write_std.pos = 0;
-        write_std.size = 0;
-      }
-    }
-    if (FD_ISSET (dev.fd_raw, &wfds))
-    {
-      ssize_t ret =
-        write (dev.fd_raw, write_pout.buf + write_pout.pos,
-               write_pout.size - write_pout.pos);
-      if (0 > ret)
-      {
-        fprintf (stderr, "Failed to write to WLAN device: %s\n",
-                 strerror (errno));
-        break;
-      }
-      write_pout.pos += ret;
-      if ((write_pout.pos != write_pout.size) && (0 != ret))
-      {
-        /* we should not get partial sends with packet-oriented devices... */
-        fprintf (stderr, "Write error, partial send: %u/%u\n",
-                 (unsigned int) write_pout.pos,
-                 (unsigned int) write_pout.size);
-        break;
-      }
-      if (write_pout.pos == write_pout.size)
-      {
-        write_pout.pos = 0;
-        write_pout.size = 0;
-      }
-    }
-
-    if (FD_ISSET (STDIN_FILENO, &rfds))
-    {
-      ssize_t ret =
-        read (STDIN_FILENO, readbuf, sizeof(readbuf));
-      if (0 > ret)
-      {
-        fprintf (stderr, "Read error from STDIN: %s\n", strerror (errno));
-        break;
-      }
-      if (0 == ret)
-      {
-        /* stop reading... */
-        stdin_open = 0;
-      }
-      mst_receive (stdin_mst, readbuf, ret);
-    }
-
-    if (FD_ISSET (dev.fd_raw, &rfds))
-    {
-      struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rrm;
-      ssize_t ret;
-
-      rrm = (struct
-             GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) write_std.buf;
-      ret =
-        linux_read (&dev, (unsigned char *) &rrm->frame,
-                    sizeof(write_std.buf)
-                    - sizeof(struct
-                             GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
-                    + sizeof(struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame),
-                    rrm);
-      if (0 > ret)
-      {
-        fprintf (stderr, "Read error from raw socket: %s\n", strerror (errno));
-        break;
-      }
-      if ((0 < ret) && (0 == mac_test (&rrm->frame, &dev)))
-      {
-        write_std.size = ret
-                         + sizeof(struct
-                                  GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)
-                         - sizeof(struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame);
-        rrm->header.size = htons (write_std.size);
-        rrm->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER);
-      }
-    }
-  }
-  /* Error handling, try to clean up a bit at least */
-  mst_destroy (stdin_mst);
-  (void) close (dev.fd_raw);
-  return 1;                     /* we never exit 'normally' */
-}
-
-
-/* end of gnunet-helper-transport-wlan.c */
diff --git a/src/transport/gnunet-service-tng.c 
b/src/transport/gnunet-service-tng.c
index 083db325e..7a7603e91 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -78,6 +78,7 @@
 #include "gnunet_transport_monitor_service.h"
 #include "gnunet_peerstore_service.h"
 #include "gnunet_hello_lib.h"
+#include "gnunet_hello_uri_lib.h"
 #include "gnunet_signatures.h"
 #include "transport.h"
 
@@ -2040,9 +2041,9 @@ struct IncomingRequest
   struct IncomingRequest *prev;
 
   /**
-   * Handle for watching the peerstore for HELLOs for this peer.
+   * Notify context for new HELLOs.
    */
-  struct GNUNET_PEERSTORE_WatchContext *wc;
+  struct GNUNET_PEERSTORE_NotifyContext *nc;
 
   /**
    * Which peer is this about?
@@ -2067,9 +2068,9 @@ struct PeerRequest
   struct TransportClient *tc;
 
   /**
-   * Handle for watching the peerstore for HELLOs for this peer.
+   * Notify context for new HELLOs.
    */
-  struct GNUNET_PEERSTORE_WatchContext *wc;
+  struct GNUNET_PEERSTORE_NotifyContext *nc;
 
   /**
    * What kind of performance preference does this @e tc have?
@@ -2761,6 +2762,11 @@ static const struct GNUNET_CONFIGURATION_Handle *GST_cfg;
  */
 static struct GNUNET_PeerIdentity GST_my_identity;
 
+/**
+ * Our HELLO
+ */
+struct GNUNET_HELLO_Builder *GST_my_hello;
+
 /**
  * Our private key.
  */
@@ -2914,8 +2920,8 @@ free_incoming_request (struct IncomingRequest *ir)
   GNUNET_CONTAINER_DLL_remove (ir_head, ir_tail, ir);
   GNUNET_assert (ir_total > 0);
   ir_total--;
-  GNUNET_PEERSTORE_watch_cancel (ir->wc);
-  ir->wc = NULL;
+  GNUNET_PEERSTORE_hello_changed_notify_cancel (ir->nc);
+  ir->nc = NULL;
   GNUNET_free (ir);
 }
 
@@ -3066,6 +3072,11 @@ free_pending_message (struct PendingMessage *pm)
   if (NULL != pm->bpm)
   {
     free_fragment_tree (pm->bpm);
+    if (NULL != pm->bpm->qe)
+    {
+      struct QueueEntry *qe = pm->bpm->qe;
+      qe->pm = NULL;
+    }
     GNUNET_free (pm->bpm);
   }
 
@@ -3887,8 +3898,8 @@ stop_peer_request (void *cls,
   struct TransportClient *tc = cls;
   struct PeerRequest *pr = value;
 
-  GNUNET_PEERSTORE_watch_cancel (pr->wc);
-  pr->wc = NULL;
+  GNUNET_PEERSTORE_hello_changed_notify_cancel (pr->nc);
+  pr->nc = NULL;
   GNUNET_assert (
     GNUNET_YES ==
     GNUNET_CONTAINER_multipeermap_remove (tc->details.application.requests,
@@ -4006,8 +4017,12 @@ notify_client_connect_info (void *cls,
                             void *value)
 {
   struct TransportClient *tc = cls;
+  struct Neighbour *n = value;
+  struct VirtualLink *vl = n->vl;
+
+  if ((NULL == vl) || (GNUNET_NO == vl->confirmed))
+    return GNUNET_OK;
 
-  (void) value;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Telling new CORE client about existing connection to %s\n",
               GNUNET_i2s (pid));
@@ -4306,7 +4321,7 @@ handle_client_recv_ok (void *cls, const struct 
RecvOkMessage *rom)
   delta = ntohl (rom->increase_window_delta);
   vl->core_recv_window += delta;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "CORE ack receiving message, increased CORE recv window to %u\n",
+              "CORE ack receiving message, increased CORE recv window to %d\n",
               vl->core_recv_window);
   GNUNET_SERVICE_client_continue (tc->client);
   if (vl->core_recv_window <= 0)
@@ -5309,7 +5324,8 @@ handle_client_send (void *cls, const struct 
OutboundMessage *obm)
   pm->bytes_msg = bytes_msg;
   memcpy (&pm[1], obmm, bytes_msg);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Sending %u bytes as <%llu> to %s\n",
+              "Sending message of type %u  with %u bytes as <%llu> to %s\n",
+              ntohs (obmm->type),
               bytes_msg,
               pm->logging_uuid,
               GNUNET_i2s (&obm->peer));
@@ -5454,6 +5470,13 @@ peerstore_store_own_cb (void *cls, int success)
 }
 
 
+static void
+shc_cont (void *cls, int success)
+{
+  GNUNET_free (cls);
+}
+
+
 /**
  * Ask peerstore to store our address.
  *
@@ -5463,16 +5486,47 @@ static void
 store_pi (void *cls)
 {
   struct AddressListEntry *ale = cls;
+  struct GNUNET_PEERSTORE_StoreHelloContext *shc;
   void *addr;
   size_t addr_len;
   struct GNUNET_TIME_Absolute expiration;
-
+  enum GNUNET_GenericReturnValue add_result;
+  struct GNUNET_MQ_Envelope *env;
+  const struct GNUNET_MessageHeader *msg;
+  const char *dash;
+  char *prefix = GNUNET_HELLO_address_to_prefix (ale->address);
+  char *address_uri;
+
+  dash = strchr (ale->address, '-');
+  dash++;
+  GNUNET_asprintf (&address_uri,
+                     "%s://%s",
+                     prefix,
+                     dash);
   ale->st = NULL;
   expiration = GNUNET_TIME_relative_to_absolute (ale->expiration);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Storing our address `%s' in peerstore until %s!\n",
               ale->address,
               GNUNET_STRINGS_absolute_time_to_string (expiration));
+  add_result = GNUNET_HELLO_builder_add_address (GST_my_hello,
+                                                 address_uri);
+  env = GNUNET_HELLO_builder_to_env (GST_my_hello,
+                                     GST_my_private_key,
+                                     GNUNET_TIME_UNIT_ZERO);
+  msg = GNUNET_MQ_env_get_msg (env);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "store_pi 1\n");
+  if (GNUNET_YES == add_result)
+    shc = GNUNET_PEERSTORE_hello_add (peerstore,
+                                      msg,
+                                      shc_cont,
+                                      shc);
+  else if (GNUNET_SYSERR == add_result)
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Error adding address to peerstore hello!\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "store_pi 2\n");
   GNUNET_HELLO_sign_address (ale->address,
                              ale->nt,
                              hello_mono_time,
@@ -5490,6 +5544,9 @@ store_pi (void *cls)
                                     &peerstore_store_own_cb,
                                     ale);
   GNUNET_free (addr);
+  GNUNET_free (env);
+  GNUNET_free (prefix);
+  GNUNET_free (address_uri);
   if (NULL == ale->sc)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -5691,7 +5748,7 @@ finish_handling_raw_message (struct VirtualLink *vl,
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Delivered message from %s of type %u to CORE recv window %u\n",
+              "Delivered message from %s of type %u to CORE recv window %d\n",
               GNUNET_i2s (&cmc->im.sender),
               ntohs (mh->type),
               vl->core_recv_window);
@@ -8516,7 +8573,7 @@ start_address_validation (const struct 
GNUNET_PeerIdentity *pid,
     }
     return;
   }
-  now = GNUNET_TIME_absolute_get ();
+  now = GNUNET_TIME_absolute_get_monotonic (GST_cfg);
   vs = GNUNET_new (struct ValidationState);
   vs->pid = *pid;
   vs->valid_until =
@@ -8542,6 +8599,34 @@ start_address_validation (const struct 
GNUNET_PeerIdentity *pid,
 }
 
 
+static void
+hello_for_incoming_cb (void *cls,
+                       const char *uri)
+{
+  const struct GNUNET_PeerIdentity *peer = cls;
+  int pfx_len;
+  const char *eou;
+  char *address;
+
+  eou = strstr (uri,
+                "://");
+  pfx_len = eou - uri;
+  eou += 3;
+  GNUNET_asprintf (&address,
+                   "%.*s-%s",
+                   pfx_len,
+                   uri,
+                   eou);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "helo for client %s\n",
+              address);
+
+  start_address_validation (peer, address);
+  GNUNET_free (address);
+}
+
+
 /**
  * Function called by PEERSTORE for each matching record.
  *
@@ -8551,11 +8636,12 @@ start_address_validation (const struct 
GNUNET_PeerIdentity *pid,
  */
 static void
 handle_hello_for_incoming (void *cls,
-                           const struct GNUNET_PEERSTORE_Record *record,
+                           const struct GNUNET_PeerIdentity *peer,
+                           const struct GNUNET_MessageHeader *hello,
                            const char *emsg)
 {
   struct IncomingRequest *ir = cls;
-  const char *val;
+  struct GNUNET_HELLO_Builder *builder;
 
   if (NULL != emsg)
   {
@@ -8564,13 +8650,13 @@ handle_hello_for_incoming (void *cls,
                 emsg);
     return;
   }
-  val = record->value;
-  if ((0 == record->value_size) || ('\0' != val[record->value_size - 1]))
-  {
-    GNUNET_break (0);
+  if (0 == GNUNET_memcmp (peer, &GST_my_identity))
     return;
-  }
-  start_address_validation (&ir->pid, (const char *) record->value);
+  builder = GNUNET_HELLO_builder_new (peer);
+  GNUNET_HELLO_builder_iterate (builder,
+                                (struct GNUNET_PeerIdentity *) peer,
+                                hello_for_incoming_cb,
+                                (struct GNUNET_PeerIdentity *) peer);
 }
 
 
@@ -8671,12 +8757,11 @@ handle_validation_challenge (
   ir = GNUNET_new (struct IncomingRequest);
   ir->pid = sender;
   GNUNET_CONTAINER_DLL_insert (ir_head, ir_tail, ir);
-  ir->wc = GNUNET_PEERSTORE_watch (peerstore,
-                                   "transport",
-                                   &ir->pid,
-                                   GNUNET_PEERSTORE_TRANSPORT_URLADDRESS_KEY,
-                                   &handle_hello_for_incoming,
-                                   ir);
+
+  ir->nc = GNUNET_PEERSTORE_hello_changed_notify (peerstore,
+                                                  GNUNET_NO,
+                                                  &handle_hello_for_incoming,
+                                                  NULL);
   ir_total++;
   /* Bound attempts we do in parallel here, might otherwise get excessive */
   while (ir_total > MAX_INCOMING_REQUEST)
@@ -8698,8 +8783,6 @@ struct CheckKnownChallengeContext
    * Set to a matching validation state, if one was found.
    */
   struct ValidationState *vs;
-
-  char *address_prefix;
 };
 
 
@@ -8721,8 +8804,7 @@ check_known_challenge (void *cls,
   struct ValidationState *vs = value;
 
   (void) pid;
-  if (0 != GNUNET_memcmp (&vs->challenge, ckac->challenge) ||
-      NULL == strstr (vs->address, ckac->address_prefix))
+  if (0 != GNUNET_memcmp (&vs->challenge, ckac->challenge))
     return GNUNET_OK;
   ckac->vs = vs;
   return GNUNET_NO;
@@ -8792,14 +8874,12 @@ handle_validation_response (
   struct CommunicatorMessageContext *cmc = cls;
   struct ValidationState *vs;
   struct CheckKnownChallengeContext ckac = { .challenge = &tvr->challenge,
-                                             .vs = NULL,
-                                             .address_prefix =
-                                               cmc->tc->details.communicator.
-                                               address_prefix};
+                                             .vs = NULL};
   struct GNUNET_TIME_Absolute origin_time;
   struct Queue *q;
   struct Neighbour *n;
   struct VirtualLink *vl;
+  const struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get_monotonic 
(GST_cfg);
 
   /* check this is one of our challenges */
   (void) GNUNET_CONTAINER_multipeermap_get_multiple (validation_map,
@@ -8876,6 +8956,19 @@ handle_validation_response (
     vs->validated_until,
     GNUNET_TIME_relative_multiply (vs->validation_rtt,
                                    VALIDATION_RTT_BUFFER_FACTOR));
+  if (GNUNET_TIME_absolute_cmp (vs->first_challenge_use, <, now))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "First challenge use is now %" PRIu64 " %s \n",
+                vs->first_challenge_use.abs_value_us,
+                GNUNET_sh2s (&vs->challenge.value));
+    vs->first_challenge_use = now;
+  }
+  else
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "First challenge use is later %" PRIu64 " %s \n",
+                vs->first_challenge_use.abs_value_us,
+                GNUNET_sh2s (&vs->challenge.value));
   vs->last_challenge_use =
     GNUNET_TIME_UNIT_ZERO_ABS; /* challenge was not yet used */
   update_next_challenge_time (vs, vs->first_challenge_use);
@@ -10249,9 +10342,10 @@ handle_send_message_ack (void *cls,
                 GNUNET_ntohll (sma->mid),
                 ntohl (sma->qid));
     // TODO I guess this can happen, if the Ack from the peer comes before the 
Ack from the queue.
+    // Update: Maybe QueueEntry was accidentally freed during freeing 
PendingMessage.
     /* this should never happen */
-    /*GNUNET_break (0);
-      GNUNET_SERVICE_client_drop (tc->client);*/
+    GNUNET_break (0);
+    //GNUNET_SERVICE_client_drop (tc->client);
     GNUNET_SERVICE_client_continue (tc->client);
     return;
   }
@@ -10516,6 +10610,8 @@ validation_start_cb (void *cls)
 {
   struct ValidationState *vs;
   struct Queue *q;
+  const struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get_monotonic (
+    GST_cfg);
 
   (void) cls;
   validation_task = NULL;
@@ -10539,6 +10635,13 @@ validation_start_cb (void *cls)
                  happen if we're really a lonely peer */
   }
   q = find_queue (&vs->pid, vs->address);
+  if (GNUNET_TIME_absolute_cmp (vs->first_challenge_use, >, now))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "To early to start next address validation for challenge %s\n",
+                GNUNET_sh2s (&vs->challenge.value));
+    return;
+  }
   if (NULL == q)
   {
     vs->awaiting_queue = GNUNET_YES;
@@ -11118,6 +11221,34 @@ handle_suggest_cancel (void *cls, const struct 
ExpressPreferenceMessage *msg)
 }
 
 
+static void
+hello_for_client_cb (void *cls,
+                       const char *uri)
+{
+  const struct GNUNET_PeerIdentity *peer = cls;
+  int pfx_len;
+  const char *eou;
+  char *address;
+
+  eou = strstr (uri,
+                "://");
+  pfx_len = eou - uri;
+  eou += 3;
+  GNUNET_asprintf (&address,
+                   "%.*s-%s",
+                   pfx_len,
+                   uri,
+                   eou);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "hello for client %s\n",
+              address);
+
+  start_address_validation (peer, address);
+  GNUNET_free (address);
+}
+
+
 /**
  * Function called by PEERSTORE for each matching record.
  *
@@ -11127,11 +11258,13 @@ handle_suggest_cancel (void *cls, const struct 
ExpressPreferenceMessage *msg)
  */
 static void
 handle_hello_for_client (void *cls,
-                         const struct GNUNET_PEERSTORE_Record *record,
+                         const struct GNUNET_PeerIdentity *peer,
+                         const struct GNUNET_MessageHeader *hello,
                          const char *emsg)
 {
-  struct PeerRequest *pr = cls;
+  (void) cls;
   const char *val;
+  struct GNUNET_HELLO_Builder *builder;
 
   if (NULL != emsg)
   {
@@ -11140,13 +11273,13 @@ handle_hello_for_client (void *cls,
                 emsg);
     return;
   }
-  val = record->value;
-  if ((0 == record->value_size) || ('\0' != val[record->value_size - 1]))
-  {
-    GNUNET_break (0);
+  if (0 == GNUNET_memcmp (peer, &GST_my_identity))
     return;
-  }
-  start_address_validation (&pr->pid, (const char *) record->value);
+  builder = GNUNET_HELLO_builder_new (peer);
+  GNUNET_HELLO_builder_iterate (builder,
+                                (struct GNUNET_PeerIdentity *) peer,
+                                hello_for_client_cb,
+                                NULL);
 }
 
 
@@ -11196,12 +11329,10 @@ handle_suggest (void *cls, const struct 
ExpressPreferenceMessage *msg)
     GNUNET_SERVICE_client_drop (tc->client);
     return;
   }
-  pr->wc = GNUNET_PEERSTORE_watch (peerstore,
-                                   "transport",
-                                   &pr->pid,
-                                   GNUNET_PEERSTORE_TRANSPORT_URLADDRESS_KEY,
-                                   &handle_hello_for_client,
-                                   pr);
+  pr->nc = GNUNET_PEERSTORE_hello_changed_notify (peerstore,
+                                                  GNUNET_NO,
+                                                  &handle_hello_for_client,
+                                                  NULL);
   GNUNET_SERVICE_client_continue (tc->client);
 }
 
@@ -11385,6 +11516,11 @@ do_shutdown (void *cls)
     GNUNET_STATISTICS_destroy (GST_stats, GNUNET_NO);
     GST_stats = NULL;
   }
+  if (NULL != GST_my_hello)
+  {
+    GNUNET_HELLO_builder_free (GST_my_hello);
+    GST_my_hello = NULL;
+  }
   if (NULL != GST_my_private_key)
   {
     GNUNET_free (GST_my_private_key);
@@ -11509,6 +11645,7 @@ run (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "My identity is `%s'\n",
               GNUNET_i2s_full (&GST_my_identity));
+  GST_my_hello = GNUNET_HELLO_builder_new (&GST_my_identity);
   GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg);
   GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
   peerstore = GNUNET_PEERSTORE_connect (GST_cfg);
diff --git a/src/transport/gnunet-service-transport.c 
b/src/transport/gnunet-service-transport.c
deleted file mode 100644
index 93790e293..000000000
--- a/src/transport/gnunet-service-transport.c
+++ /dev/null
@@ -1,2778 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010-2016 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/gnunet-service-transport.c
- * @brief main for gnunet-service-transport
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_ats_service.h"
-#include "gnunet-service-transport.h"
-#include "gnunet-service-transport_ats.h"
-#include "gnunet-service-transport_hello.h"
-#include "gnunet-service-transport_neighbours.h"
-#include "gnunet-service-transport_plugins.h"
-#include "gnunet-service-transport_validation.h"
-#include "gnunet-service-transport_manipulation.h"
-#include "transport.h"
-
-/**
- * Size of the blacklist hash map.
- */
-#define TRANSPORT_BLACKLIST_HT_SIZE 64
-
-/**
- * How many messages can we have pending for a given client process
- * before we start to drop incoming messages?  We typically should
- * have only one client and so this would be the primary buffer for
- * messages, so the number should be chosen rather generously.
- *
- * The expectation here is that most of the time the queue is large
- * enough so that a drop is virtually never required.  Note that
- * this value must be about as large as 'TOTAL_MSGS' in the
- * 'test_transport_api_reliability.c', otherwise that testcase may
- * fail.
- */
-#define MAX_PENDING (128 * 1024)
-
-
-/**
- * Information we need for an asynchronous session kill.
- */
-struct GNUNET_ATS_SessionKiller
-{
-  /**
-   * Kept in a DLL.
-   */
-  struct GNUNET_ATS_SessionKiller *next;
-
-  /**
-   * Kept in a DLL.
-   */
-  struct GNUNET_ATS_SessionKiller *prev;
-
-  /**
-   * Session to kill.
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * Plugin for the session.
-   */
-  struct GNUNET_TRANSPORT_PluginFunctions *plugin;
-
-  /**
-   * The kill task.
-   */
-  struct GNUNET_SCHEDULER_Task *task;
-};
-
-
-/**
- * What type of client is the `struct TransportClient` about?
- */
-enum ClientType
-{
-  /**
-   * We do not know yet (client is fresh).
-   */
-  CT_NONE = 0,
-
-  /**
-   * Is the CORE service, we need to forward traffic to it.
-   */
-  CT_CORE = 1,
-
-  /**
-   * It is a monitor, forward monitor data.
-   */
-  CT_MONITOR = 2,
-
-  /**
-   * It is a blacklist, query about allowed connections.
-   */
-  CT_BLACKLIST = 3,
-
-  /**
-   * CORE client without any handlers.
-   */
-  CT_CORE_NO_HANDLERS = 4
-};
-
-
-/**
- * Context we use when performing a blacklist check.
- */
-struct GST_BlacklistCheck;
-
-/**
- * Client connected to the transport service.
- */
-struct TransportClient
-{
-  /**
-   * This is a doubly-linked list.
-   */
-  struct TransportClient *next;
-
-  /**
-   * This is a doubly-linked list.
-   */
-  struct TransportClient *prev;
-
-  /**
-   * Handle to the client.
-   */
-  struct GNUNET_SERVICE_Client *client;
-
-  /**
-   * Message queue to the client.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * What type of client is this?
-   */
-  enum ClientType type;
-
-  union
-  {
-    /**
-     * Peer identity to monitor the addresses of.
-     * Zero to monitor all neighbours.  Valid if
-     * @e type is CT_MONITOR.
-     */
-    struct GNUNET_PeerIdentity monitor_peer;
-
-    /**
-     * Additional details if @e type is CT_BLACKLIST.
-     */
-    struct
-    {
-      /**
-       * Blacklist check that we're currently performing (or NULL
-       * if we're performing one that has been cancelled).
-       */
-      struct GST_BlacklistCheck *bc;
-
-      /**
-       * Set to #GNUNET_YES if we're currently waiting for a reply.
-       */
-      int waiting_for_reply;
-
-      /**
-       * #GNUNET_YES if we have to call receive_done for this client
-       */
-      int call_receive_done;
-    } blacklist;
-  } details;
-};
-
-
-/**
- * Context we use when performing a blacklist check.
- */
-struct GST_BlacklistCheck
-{
-  /**
-   * This is a linked list.
-   */
-  struct GST_BlacklistCheck *next;
-
-  /**
-   * This is a linked list.
-   */
-  struct GST_BlacklistCheck *prev;
-
-  /**
-   * Peer being checked.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Continuation to call with the result.
-   */
-  GST_BlacklistTestContinuation cont;
-
-  /**
-   * Closure for @e cont.
-   */
-  void *cont_cls;
-
-  /**
-   * Address for #GST_blacklist_abort_matching(), can be NULL.
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Session for #GST_blacklist_abort_matching(), can be NULL.
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * Our current position in the blacklisters list.
-   */
-  struct TransportClient *bl_pos;
-
-  /**
-   * Current task performing the check.
-   */
-  struct GNUNET_SCHEDULER_Task *task;
-};
-
-
-/**
- * Context for address to string operations
- */
-struct AddressToStringContext
-{
-  /**
-   * This is a doubly-linked list.
-   */
-  struct AddressToStringContext *next;
-
-  /**
-   * This is a doubly-linked list.
-   */
-  struct AddressToStringContext *prev;
-
-  /**
-   * Client that made the request.
-   */
-  struct TransportClient *tc;
-};
-
-
-/**
- * Closure for #handle_send_transmit_continuation()
- */
-struct SendTransmitContinuationContext
-{
-  /**
-   * Client that made the request.
-   */
-  struct TransportClient *tc;
-
-  /**
-   * Peer that was the target.
-   */
-  struct GNUNET_PeerIdentity target;
-
-  /**
-   * At what time did we receive the message?
-   */
-  struct GNUNET_TIME_Absolute send_time;
-
-  /**
-   * Unique ID, for logging.
-   */
-  unsigned long long uuid;
-
-  /**
-   * Set to #GNUNET_YES if the connection for @e target goes
-   * down and we thus must no longer send the
-   * #GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK message.
-   */
-  int down;
-};
-
-
-/**
- * Head of linked list of all clients to this service.
- */
-static struct TransportClient *clients_head;
-
-/**
- * Tail of linked list of all clients to this service.
- */
-static struct TransportClient *clients_tail;
-
-/**
- * Map of peer identities to active send transmit continuation
- * contexts. Used to flag contexts as 'dead' when a connection goes
- * down. Values are of type `struct SendTransmitContinuationContext
- * *`.
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *active_stccs;
-
-/**
- * Head of linked list of all pending address iterations
- */
-static struct AddressToStringContext *a2s_head;
-
-/**
- * Tail of linked list of all pending address iterations
- */
-static struct AddressToStringContext *a2s_tail;
-
-/**
- * Head of DLL of active blacklisting queries.
- */
-static struct GST_BlacklistCheck *bc_head;
-
-/**
- * Tail of DLL of active blacklisting queries.
- */
-static struct GST_BlacklistCheck *bc_tail;
-
-/**
- * Hashmap of blacklisted peers.  Values are of type 'char *' (transport 
names),
- * can be NULL if we have no static blacklist.
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *blacklist;
-
-/**
- * Notification context, to send updates on changes to active plugin
- * connections.
- */
-static struct GNUNET_NotificationContext *plugin_nc;
-
-/**
- * Plugin monitoring client we are currently syncing, NULL if all
- * monitoring clients are in sync.
- */
-static struct TransportClient *sync_client;
-
-/**
- * Peer identity that is all zeros, used as a way to indicate
- * "all peers".  Used for comparisons.
- */
-static struct GNUNET_PeerIdentity all_zeros;
-
-/**
- * Statistics handle.
- */
-struct GNUNET_STATISTICS_Handle *GST_stats;
-
-/**
- * Configuration handle.
- */
-const struct GNUNET_CONFIGURATION_Handle *GST_cfg;
-
-/**
- * Configuration handle.
- */
-struct GNUNET_PeerIdentity GST_my_identity;
-
-/**
- * Handle to peerinfo service.
- */
-struct GNUNET_PEERINFO_Handle *GST_peerinfo;
-
-/**
- * Our private key.
- */
-struct GNUNET_CRYPTO_EddsaPrivateKey GST_my_private_key;
-
-/**
- * ATS scheduling handle.
- */
-struct GNUNET_ATS_SchedulingHandle *GST_ats;
-
-/**
- * ATS connectivity handle.
- */
-struct GNUNET_ATS_ConnectivityHandle *GST_ats_connect;
-
-/**
- * Hello address expiration
- */
-struct GNUNET_TIME_Relative hello_expiration;
-
-/**
- * Head of DLL of asynchronous tasks to kill sessions.
- */
-static struct GNUNET_ATS_SessionKiller *sk_head;
-
-/**
- * Tail of DLL of asynchronous tasks to kill sessions.
- */
-static struct GNUNET_ATS_SessionKiller *sk_tail;
-
-/**
- * Interface scanner determines our LAN address range(s).
- */
-struct GNUNET_NT_InterfaceScanner *GST_is;
-
-/**
- * Queue the given message for transmission to the given client
- *
- * @param tc target of the message
- * @param msg message to transmit
- * @param may_drop #GNUNET_YES if the message can be dropped
- */
-static void
-unicast (struct TransportClient *tc,
-         const struct GNUNET_MessageHeader *msg,
-         int may_drop)
-{
-  struct GNUNET_MQ_Envelope *env;
-
-  if ((GNUNET_MQ_get_length (tc->mq) >= MAX_PENDING) &&
-      (GNUNET_YES == may_drop))
-  {
-    GNUNET_log (
-      GNUNET_ERROR_TYPE_DEBUG,
-      "Dropping message of type %u and size %u, have %u/%u messages pending\n",
-      ntohs (msg->type),
-      ntohs (msg->size),
-      GNUNET_MQ_get_length (tc->mq),
-      MAX_PENDING);
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# messages dropped due to slow client"),
-                              1,
-                              GNUNET_NO);
-    return;
-  }
-  env = GNUNET_MQ_msg_copy (msg);
-  GNUNET_MQ_send (tc->mq, env);
-}
-
-
-/**
- * Called whenever a client connects.  Allocates our
- * data structures associated with that client.
- *
- * @param cls closure, NULL
- * @param client identification of the client
- * @param mq message queue for the client
- * @return our `struct TransportClient`
- */
-static void *
-client_connect_cb (void *cls,
-                   struct GNUNET_SERVICE_Client *client,
-                   struct GNUNET_MQ_Handle *mq)
-{
-  struct TransportClient *tc;
-
-  tc = GNUNET_new (struct TransportClient);
-  tc->client = client;
-  tc->mq = mq;
-  GNUNET_CONTAINER_DLL_insert (clients_head, clients_tail, tc);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p connected\n", tc);
-  return tc;
-}
-
-
-/**
- * Perform next action in the blacklist check.
- *
- * @param cls the `struct GST_BlacklistCheck *`
- */
-static void
-do_blacklist_check (void *cls);
-
-
-/**
- * Mark the peer as down so we don't call the continuation
- * context in the future.
- *
- * @param cls a `struct TransportClient`
- * @param peer a peer we are sending to
- * @param value a `struct SendTransmitContinuationContext` to mark
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-mark_match_down (void *cls, const struct GNUNET_PeerIdentity *peer, void 
*value)
-{
-  struct TransportClient *tc = cls;
-  struct SendTransmitContinuationContext *stcc = value;
-
-  if (tc == stcc->tc)
-  {
-    stcc->down = GNUNET_YES;
-    stcc->tc = NULL;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Called whenever a client is disconnected.  Frees our
- * resources associated with that client.
- *
- * @param cls closure, NULL
- * @param client identification of the client
- * @param app_ctx our `struct TransportClient`
- */
-static void
-client_disconnect_cb (void *cls,
-                      struct GNUNET_SERVICE_Client *client,
-                      void *app_ctx)
-{
-  struct TransportClient *tc = app_ctx;
-  struct GST_BlacklistCheck *bc;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Client %p disconnected, cleaning up.\n",
-              tc);
-  if (NULL != active_stccs)
-    GNUNET_CONTAINER_multipeermap_iterate (active_stccs,
-                                           &mark_match_down,
-                                           tc);
-  for (struct AddressToStringContext *cur = a2s_head; NULL != cur;
-       cur = cur->next)
-  {
-    if (cur->tc == tc)
-      cur->tc = NULL;
-  }
-  GNUNET_CONTAINER_DLL_remove (clients_head, clients_tail, tc);
-  switch (tc->type)
-  {
-  case CT_NONE:
-    break;
-
-  case CT_CORE:
-    break;
-
-  case CT_MONITOR:
-    break;
-
-  case CT_BLACKLIST:
-    for (bc = bc_head; NULL != bc; bc = bc->next)
-    {
-      if (bc->bl_pos != tc)
-        continue;
-      bc->bl_pos = tc->next;
-      if (NULL == bc->task)
-        bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc);
-    }
-    break;
-
-  case CT_CORE_NO_HANDLERS:
-    break;
-  }
-  GNUNET_free (tc);
-}
-
-
-/**
- * Function called for each of our connected neighbours.  Notify the
- * client about the existing neighbour.
- *
- * @param cls the `struct TransportClient *` to notify
- * @param peer identity of the neighbour
- * @param address the address
- * @param state the current state of the peer
- * @param state_timeout the time out for the state
- * @param bandwidth_in inbound bandwidth in NBO
- * @param bandwidth_out outbound bandwidth in NBO
- */
-static void
-notify_client_about_neighbour (void *cls,
-                               const struct GNUNET_PeerIdentity *peer,
-                               const struct GNUNET_HELLO_Address *address,
-                               enum GNUNET_TRANSPORT_PeerState state,
-                               struct GNUNET_TIME_Absolute state_timeout,
-                               struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                               struct GNUNET_BANDWIDTH_Value32NBO 
bandwidth_out)
-{
-  struct TransportClient *tc = cls;
-  struct ConnectInfoMessage cim;
-
-  if (GNUNET_NO == GST_neighbours_test_connected (peer))
-    return;
-  cim.header.size = htons (sizeof(struct ConnectInfoMessage));
-  cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
-  cim.id = *peer;
-  cim.quota_out = bandwidth_out;
-  unicast (tc, &cim.header, GNUNET_NO);
-}
-
-
-/**
- * Initialize a normal client.  We got a start message from this
- * client, add it to the list of clients for broadcasting of inbound
- * messages.
- *
- * @param cls the client
- * @param start the start message that was sent
- */
-static void
-handle_client_start (void *cls, const struct StartMessage *start)
-{
-  struct TransportClient *tc = cls;
-  const struct GNUNET_MessageHeader *hello;
-  uint32_t options;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p sent START\n", tc);
-  options = ntohl (start->options);
-  if ((0 != (1 & options)) &&
-      (0 != memcmp (&start->self,
-                    &GST_my_identity,
-                    sizeof(struct GNUNET_PeerIdentity))))
-  {
-    /* client thinks this is a different peer, reject */
-    GNUNET_break (0);
-    GNUNET_SERVICE_client_drop (tc->client);
-    return;
-  }
-  if (CT_NONE != tc->type)
-  {
-    GNUNET_break (0);
-    GNUNET_SERVICE_client_drop (tc->client);
-    return;
-  }
-  if (0 != (2 & options))
-    tc->type = CT_CORE;
-  else
-    tc->type = CT_CORE_NO_HANDLERS;
-  hello = GST_hello_get ();
-  if (NULL != hello)
-    unicast (tc, hello, GNUNET_NO);
-  GST_neighbours_iterate (&notify_client_about_neighbour, tc);
-  GNUNET_SERVICE_client_continue (tc->client);
-}
-
-
-/**
- * Client sent us a HELLO.  Check the request.
- *
- * @param cls the client
- * @param message the HELLO message
- */
-static int
-check_client_hello (void *cls, const struct GNUNET_MessageHeader *message)
-{
-  return GNUNET_OK; /* FIXME: check here? */
-}
-
-
-/**
- * Client sent us a HELLO.  Process the request.
- *
- * @param cls the client
- * @param message the HELLO message
- */
-static void
-handle_client_hello (void *cls, const struct GNUNET_MessageHeader *message)
-{
-  struct TransportClient *tc = cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received HELLO message\n");
-  GST_validation_handle_hello (message);
-  GNUNET_SERVICE_client_continue (tc->client);
-}
-
-
-/**
- * Function called after the transmission is done.  Notify the client that it 
is
- * OK to send the next message.
- *
- * @param cls closure
- * @param success #GNUNET_OK on success, #GNUNET_NO on failure, #GNUNET_SYSERR 
if we're not connected
- * @param bytes_payload bytes payload sent
- * @param bytes_on_wire bytes sent on wire
- */
-static void
-handle_send_transmit_continuation (void *cls,
-                                   int success,
-                                   size_t bytes_payload,
-                                   size_t bytes_on_wire)
-{
-  struct SendTransmitContinuationContext *stcc = cls;
-  struct SendOkMessage send_ok_msg;
-#ifdef ENABLE_TTD
-  struct GNUNET_TIME_Relative delay;
-  const struct GNUNET_HELLO_Address *addr;
-
-  delay = GNUNET_TIME_absolute_get_duration (stcc->send_time);
-  addr = GST_neighbour_get_current_address (&stcc->target);
-
-  if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "It took us %s to send %u/%u bytes to %s (%d, %s)\n",
-                GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES),
-                (unsigned int) bytes_payload,
-                (unsigned int) bytes_on_wire,
-                GNUNET_i2s (&stcc->target),
-                success,
-                (NULL != addr) ? addr->transport_name : "%");
-  else
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "It took us %s to send %u/%u bytes to %s (%d, %s)\n",
-                GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES),
-                (unsigned int) bytes_payload,
-                (unsigned int) bytes_on_wire,
-                GNUNET_i2s (&stcc->target),
-                success,
-                (NULL != addr) ? addr->transport_name : "%");
-#endif
-
-  if (GNUNET_NO == stcc->down)
-  {
-    /* Only send confirmation if we are still connected */
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Sending SEND_OK for transmission request %llu\n",
-                stcc->uuid);
-    send_ok_msg.header.size = htons (sizeof(send_ok_msg));
-    send_ok_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK);
-    send_ok_msg.bytes_msg = htons (bytes_payload);
-    send_ok_msg.bytes_physical = htonl (bytes_on_wire);
-    send_ok_msg.success = htons (success);
-    send_ok_msg.peer = stcc->target;
-    unicast (stcc->tc, &send_ok_msg.header, GNUNET_NO);
-  }
-  GNUNET_assert (
-    GNUNET_OK ==
-    GNUNET_CONTAINER_multipeermap_remove (active_stccs, &stcc->target, stcc));
-  GNUNET_free (stcc);
-}
-
-
-/**
- * Client asked for transmission to a peer.  Process the request.
- *
- * @param cls the client
- * @param obm the send message that was sent
- */
-static int
-check_client_send (void *cls, const struct OutboundMessage *obm)
-{
-  uint16_t size;
-  const struct GNUNET_MessageHeader *obmm;
-
-  size = ntohs (obm->header.size) - sizeof(struct OutboundMessage);
-  if (size < sizeof(struct GNUNET_MessageHeader))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  obmm = (const struct GNUNET_MessageHeader *) &obm[1];
-  if (size != ntohs (obmm->size))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Client asked for transmission to a peer.  Process the request.
- *
- * @param cls the client
- * @param obm the send message that was sent
- */
-static void
-handle_client_send (void *cls, const struct OutboundMessage *obm)
-{
-  static unsigned long long uuid_gen;
-  struct TransportClient *tc = cls;
-  const struct GNUNET_MessageHeader *obmm;
-  struct SendTransmitContinuationContext *stcc;
-
-  obmm = (const struct GNUNET_MessageHeader *) &obm[1];
-  if (GNUNET_NO == GST_neighbours_test_connected (&obm->peer))
-  {
-    /* not connected, not allowed to send; can happen due to asynchronous 
operations */
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Could not send message to peer `%s': not connected\n",
-                GNUNET_i2s (&obm->peer));
-    GNUNET_STATISTICS_update (
-      GST_stats,
-      gettext_noop ("# bytes payload dropped (other peer was not connected)"),
-      ntohs (obmm->size),
-      GNUNET_NO);
-    GNUNET_SERVICE_client_continue (tc->client);
-    return;
-  }
-  GNUNET_log (
-    GNUNET_ERROR_TYPE_DEBUG,
-    "Received SEND request %llu for `%s' and first message of type %u and 
total size %u\n",
-    uuid_gen,
-    GNUNET_i2s (&obm->peer),
-    ntohs (obmm->type),
-    ntohs (obmm->size));
-  GNUNET_SERVICE_client_continue (tc->client);
-
-  stcc = GNUNET_new (struct SendTransmitContinuationContext);
-  stcc->target = obm->peer;
-  stcc->tc = tc;
-  stcc->send_time = GNUNET_TIME_absolute_get ();
-  stcc->uuid = uuid_gen++;
-  (void) GNUNET_CONTAINER_multipeermap_put (
-    active_stccs,
-    &stcc->target,
-    stcc,
-    GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  GST_manipulation_send (&obm->peer,
-                         obmm,
-                         ntohs (obmm->size),
-                         GNUNET_TIME_relative_ntoh (obm->timeout),
-                         &handle_send_transmit_continuation,
-                         stcc);
-}
-
-
-/**
- * Take the given address and append it to the set of results sent back to
- * the client.  This function may be called several times for a single
- * conversion.   The last invocation will be with a @a address of
- * NULL and a @a res of #GNUNET_OK.  Thus, to indicate conversion
- * errors, the callback might be called first with @a address NULL and
- * @a res being #GNUNET_SYSERR.  In that case, there will still be a
- * subsequent call later with @a address NULL and @a res #GNUNET_OK.
- *
- * @param cls the `struct AddressToStringContext`
- * @param buf text to transmit (contains the human-readable address, or NULL)
- * @param res #GNUNET_OK if conversion was successful, #GNUNET_SYSERR on error,
- *            never #GNUNET_NO
- */
-static void
-transmit_address_to_client (void *cls, const char *buf, int res)
-{
-  struct AddressToStringContext *actx = cls;
-  struct GNUNET_MQ_Envelope *env;
-  struct AddressToStringResultMessage *atsm;
-  size_t slen;
-
-  GNUNET_assert ((GNUNET_OK == res) || (GNUNET_SYSERR == res));
-  if (NULL == actx->tc)
-    return;
-  if (NULL == buf)
-  {
-    env = GNUNET_MQ_msg (atsm,
-                         
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY);
-    if (GNUNET_OK == res)
-    {
-      /* this was the last call, transmit */
-      atsm->res = htonl (GNUNET_OK);
-      atsm->addr_len = htonl (0);
-      GNUNET_MQ_send (actx->tc->mq, env);
-      GNUNET_CONTAINER_DLL_remove (a2s_head, a2s_tail, actx);
-      GNUNET_free (actx);
-      return;
-    }
-    if (GNUNET_SYSERR == res)
-    {
-      /* address conversion failed, but there will be more callbacks */
-      atsm->res = htonl (GNUNET_SYSERR);
-      atsm->addr_len = htonl (0);
-      GNUNET_MQ_send (actx->tc->mq, env);
-      return;
-    }
-  }
-  GNUNET_assert (GNUNET_OK == res);
-  /* successful conversion, append*/
-  slen = strlen (buf) + 1;
-  env =
-    GNUNET_MQ_msg_extra (atsm,
-                         slen,
-                         
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY);
-  atsm->res = htonl (GNUNET_YES);
-  atsm->addr_len = htonl (slen);
-  GNUNET_memcpy (&atsm[1], buf, slen);
-  GNUNET_MQ_send (actx->tc->mq, env);
-}
-
-
-/**
- * Client asked to resolve an address.  Check the request.
- *
- * @param cls the client
- * @param alum the resolution request
- * @return #GNUNET_OK if @a alum is well-formed
- */
-static int
-check_client_address_to_string (void *cls,
-                                const struct AddressLookupMessage *alum)
-{
-  const char *plugin_name;
-  const char *address;
-  uint32_t address_len;
-  uint16_t size;
-
-  size = ntohs (alum->header.size);
-  address_len = ntohs (alum->addrlen);
-  if (size <= sizeof(struct AddressLookupMessage) + address_len)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  address = (const char *) &alum[1];
-  plugin_name = (const char *) &address[address_len];
-  if ('\0' != plugin_name[size - sizeof(struct AddressLookupMessage)
-                          - address_len - 1])
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Client asked to resolve an address.  Process the request.
- *
- * @param cls the client
- * @param alum the resolution request
- */
-static void
-handle_client_address_to_string (void *cls,
-                                 const struct AddressLookupMessage *alum)
-{
-  struct TransportClient *tc = cls;
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-  const char *plugin_name;
-  const char *address;
-  uint32_t address_len;
-  struct AddressToStringContext *actx;
-  struct GNUNET_MQ_Envelope *env;
-  struct AddressToStringResultMessage *atsm;
-  struct GNUNET_TIME_Relative rtimeout;
-  int32_t numeric;
-
-  address_len = ntohs (alum->addrlen);
-  address = (const char *) &alum[1];
-  plugin_name = (const char *) &address[address_len];
-  rtimeout = GNUNET_TIME_relative_ntoh (alum->timeout);
-  numeric = ntohs (alum->numeric_only);
-  papi = GST_plugins_printer_find (plugin_name);
-  if (NULL == papi)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Failed to find plugin `%s'\n",
-                plugin_name);
-    env = GNUNET_MQ_msg (atsm,
-                         
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY);
-    atsm->res = htonl (GNUNET_SYSERR);
-    atsm->addr_len = htonl (0);
-    GNUNET_MQ_send (tc->mq, env);
-    env = GNUNET_MQ_msg (atsm,
-                         
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY);
-    atsm->res = htonl (GNUNET_OK);
-    atsm->addr_len = htonl (0);
-    GNUNET_MQ_send (tc->mq, env);
-    return;
-  }
-  actx = GNUNET_new (struct AddressToStringContext);
-  actx->tc = tc;
-  GNUNET_CONTAINER_DLL_insert (a2s_head, a2s_tail, actx);
-  GNUNET_SERVICE_client_disable_continue_warning (tc->client);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Pretty-printing address of %u bytes using plugin `%s'\n",
-              address_len,
-              plugin_name);
-  papi->address_pretty_printer (papi->cls,
-                                plugin_name,
-                                address,
-                                address_len,
-                                numeric,
-                                rtimeout,
-                                &transmit_address_to_client,
-                                actx);
-}
-
-
-/**
- * Compose #PeerIterateResponseMessage using the given peer and address.
- *
- * @param peer identity of the peer
- * @param address the address, NULL on disconnect
- * @return composed message
- */
-static struct PeerIterateResponseMessage *
-compose_address_iterate_response_message (
-  const struct GNUNET_PeerIdentity *peer,
-  const struct GNUNET_HELLO_Address *address)
-{
-  struct PeerIterateResponseMessage *msg;
-  size_t size;
-  size_t tlen;
-  size_t alen;
-  char *addr;
-
-  GNUNET_assert (NULL != peer);
-  if (NULL != address)
-  {
-    tlen = strlen (address->transport_name) + 1;
-    alen = address->address_length;
-  }
-  else
-  {
-    tlen = 0;
-    alen = 0;
-  }
-  size = (sizeof(struct PeerIterateResponseMessage) + alen + tlen);
-  msg = GNUNET_malloc (size);
-  msg->header.size = htons (size);
-  msg->header.type =
-    htons (GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE);
-  msg->reserved = htonl (0);
-  msg->peer = *peer;
-  msg->addrlen = htonl (alen);
-  msg->pluginlen = htonl (tlen);
-
-  if (NULL != address)
-  {
-    msg->local_address_info = htonl ((uint32_t) address->local_info);
-    addr = (char *) &msg[1];
-    GNUNET_memcpy (addr, address->address, alen);
-    GNUNET_memcpy (&addr[alen], address->transport_name, tlen);
-  }
-  return msg;
-}
-
-
-/**
- * Context for #send_validation_information() and
- * #send_peer_information().
- */
-struct IterationContext
-{
-  /**
-   * Context to use for the transmission.
-   */
-  struct TransportClient *tc;
-
-  /**
-   * Which peers do we care about?
-   */
-  struct GNUNET_PeerIdentity id;
-
-  /**
-   * #GNUNET_YES if @e id should be ignored because we want all peers.
-   */
-  int all;
-};
-
-
-/**
- * Output information of neighbours to the given client.
- *
- * @param cls the `struct PeerIterationContext *`
- * @param peer identity of the neighbour
- * @param address the address
- * @param state current state this peer is in
- * @param state_timeout timeout for the current state of the peer
- * @param bandwidth_in inbound quota in NBO
- * @param bandwidth_out outbound quota in NBO
- */
-static void
-send_peer_information (void *cls,
-                       const struct GNUNET_PeerIdentity *peer,
-                       const struct GNUNET_HELLO_Address *address,
-                       enum GNUNET_TRANSPORT_PeerState state,
-                       struct GNUNET_TIME_Absolute state_timeout,
-                       struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                       struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
-{
-  struct IterationContext *pc = cls;
-  struct GNUNET_MQ_Envelope *env;
-  struct PeerIterateResponseMessage *msg;
-
-  if ((GNUNET_YES != pc->all) && (0 != memcmp (peer, &pc->id, sizeof(pc->id))))
-    return;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Sending information about `%s' using address `%s' in state 
`%s'\n",
-              GNUNET_i2s (peer),
-              (NULL != address) ? GST_plugins_a2s (address) : "<none>",
-              GNUNET_TRANSPORT_ps2s (state));
-  msg = compose_address_iterate_response_message (peer, address);
-  msg->state = htonl (state);
-  msg->state_timeout = GNUNET_TIME_absolute_hton (state_timeout);
-  env = GNUNET_MQ_msg_copy (&msg->header);
-  GNUNET_free (msg);
-  GNUNET_MQ_send (pc->tc->mq, env);
-}
-
-
-/**
- * Client asked to obtain information about a specific or all peers
- * Process the request.
- *
- * @param cls the client
- * @param msg the peer address information request
- */
-static void
-handle_client_monitor_peers (void *cls, const struct PeerMonitorMessage *msg)
-{
-  struct TransportClient *tc = cls;
-  struct IterationContext pc;
-
-  if (CT_NONE != tc->type)
-  {
-    GNUNET_break (0);
-    GNUNET_SERVICE_client_drop (tc->client);
-    return;
-  }
-  GNUNET_SERVICE_client_disable_continue_warning (tc->client);
-  GNUNET_SERVICE_client_mark_monitor (tc->client);
-
-  /* Send initial list */
-  pc.tc = tc;
-  if (0 == memcmp (&msg->peer, &all_zeros, sizeof(struct GNUNET_PeerIdentity)))
-  {
-    /* iterate over all neighbours */
-    pc.all = GNUNET_YES;
-    pc.id = msg->peer;
-  }
-  else
-  {
-    /* just return one neighbour */
-    pc.all = GNUNET_NO;
-    pc.id = msg->peer;
-  }
-  GST_neighbours_iterate (&send_peer_information, &pc);
-
-  if (GNUNET_YES != ntohl (msg->one_shot))
-  {
-    tc->details.monitor_peer = msg->peer;
-    tc->type = CT_MONITOR;
-    if (0 !=
-        memcmp (&msg->peer, &all_zeros, sizeof(struct GNUNET_PeerIdentity)))
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Client %p started monitoring of the peer `%s'\n",
-                  tc,
-                  GNUNET_i2s (&msg->peer));
-    else
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Client %p started monitoring all peers\n",
-                  tc);
-  }
-  else
-  {
-    struct GNUNET_MessageHeader *msg;
-    struct GNUNET_MQ_Envelope *env;
-
-    env =
-      GNUNET_MQ_msg (msg,
-                     GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE_END);
-    GNUNET_MQ_send (tc->mq, env);
-  }
-}
-
-
-/**
- * Function called by the plugin with information about the
- * current sessions managed by the plugin (for monitoring).
- *
- * @param cls closure
- * @param session session handle this information is about,
- *        NULL to indicate that we are "in sync" (initial
- *        iteration complete)
- * @param info information about the state of the session,
- *        NULL if @a session is also NULL and we are
- *        merely signalling that the initial iteration is over
- */
-static void
-plugin_session_info_cb (void *cls,
-                        struct GNUNET_ATS_Session *session,
-                        const struct GNUNET_TRANSPORT_SessionInfo *info)
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct TransportPluginMonitorMessage *msg;
-  struct GNUNET_MessageHeader *sync;
-  size_t size;
-  size_t slen;
-  uint16_t alen;
-  char *name;
-  char *addr;
-
-  if (0 == GNUNET_notification_context_get_size (plugin_nc))
-  {
-    GST_plugins_monitor_subscribe (NULL, NULL);
-    return;
-  }
-  if ((NULL == info) && (NULL == session))
-  {
-    /* end of initial iteration */
-    if (NULL != sync_client)
-    {
-      env =
-        GNUNET_MQ_msg (sync, 
GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_SYNC);
-      GNUNET_MQ_send (sync_client->mq, env);
-      sync_client = NULL;
-    }
-    return;
-  }
-  GNUNET_assert (NULL != info);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Plugin event for peer %s on transport %s\n",
-              GNUNET_i2s (&info->address->peer),
-              info->address->transport_name);
-  slen = strlen (info->address->transport_name) + 1;
-  alen = info->address->address_length;
-  size = sizeof(struct TransportPluginMonitorMessage) + slen + alen;
-  if (size > UINT16_MAX)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  msg = GNUNET_malloc (size);
-  msg->header.size = htons (size);
-  msg->header.type = htons 
(GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_EVENT);
-  msg->session_state = htons ((uint16_t) info->state);
-  msg->is_inbound = htons ((int16_t) info->is_inbound);
-  msg->msgs_pending = htonl (info->num_msg_pending);
-  msg->bytes_pending = htonl (info->num_bytes_pending);
-  msg->timeout = GNUNET_TIME_absolute_hton (info->session_timeout);
-  msg->delay = GNUNET_TIME_absolute_hton (info->receive_delay);
-  msg->peer = info->address->peer;
-  msg->session_id = (uint64_t) (intptr_t) session;
-  msg->plugin_name_len = htons (slen);
-  msg->plugin_address_len = htons (alen);
-  name = (char *) &msg[1];
-  GNUNET_memcpy (name, info->address->transport_name, slen);
-  addr = &name[slen];
-  GNUNET_memcpy (addr, info->address->address, alen);
-  if (NULL != sync_client)
-  {
-    struct GNUNET_MQ_Envelope *env;
-
-    env = GNUNET_MQ_msg_copy (&msg->header);
-    GNUNET_MQ_send (sync_client->mq, env);
-  }
-  else
-  {
-    GNUNET_notification_context_broadcast (plugin_nc, &msg->header, GNUNET_NO);
-  }
-  GNUNET_free (msg);
-}
-
-
-/**
- * Client asked to obtain information about all plugin connections.
- *
- * @param cls the client
- * @param message the peer address information request
- */
-static void
-handle_client_monitor_plugins (void *cls,
-                               const struct GNUNET_MessageHeader *message)
-{
-  struct TransportClient *tc = cls;
-
-  GNUNET_SERVICE_client_mark_monitor (tc->client);
-  GNUNET_SERVICE_client_disable_continue_warning (tc->client);
-  GNUNET_notification_context_add (plugin_nc, tc->mq);
-  GNUNET_assert (NULL == sync_client);
-  sync_client = tc;
-  GST_plugins_monitor_subscribe (&plugin_session_info_cb, NULL);
-}
-
-
-/**
- * Broadcast the given message to all of our clients.
- *
- * @param msg message to broadcast
- * @param may_drop #GNUNET_YES if the message can be dropped / is payload
- */
-void
-GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, int may_drop)
-{
-  int done;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Asked to broadcast message of type %u with %u bytes\n",
-              (unsigned int) ntohs (msg->type),
-              (unsigned int) ntohs (msg->size));
-  done = GNUNET_NO;
-  for (struct TransportClient *tc = clients_head; NULL != tc; tc = tc->next)
-  {
-    if (CT_NONE == tc->type)
-      continue;   /* client not yet ready */
-    if ((GNUNET_YES == may_drop) && (CT_CORE != tc->type))
-      continue;   /* skip, this client does not care about payload */
-    unicast (tc, msg, may_drop);
-    done = GNUNET_YES;
-  }
-  if (GNUNET_NO == done)
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Message of type %u not delivered, is CORE service up?\n",
-                ntohs (msg->type));
-}
-
-
-/**
- * Broadcast the new active address to all clients monitoring the peer.
- *
- * @param peer peer this update is about (never NULL)
- * @param address address, NULL on disconnect
- * @param state the current state of the peer
- * @param state_timeout the time out for the state
- */
-void
-GST_clients_broadcast_peer_notification (
-  const struct GNUNET_PeerIdentity *peer,
-  const struct GNUNET_HELLO_Address *address,
-  enum GNUNET_TRANSPORT_PeerState state,
-  struct GNUNET_TIME_Absolute state_timeout)
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct PeerIterateResponseMessage *msg;
-
-  msg = compose_address_iterate_response_message (peer, address);
-  msg->state = htonl (state);
-  msg->state_timeout = GNUNET_TIME_absolute_hton (state_timeout);
-  for (struct TransportClient *tc = clients_head; NULL != tc; tc = tc->next)
-  {
-    if (CT_MONITOR != tc->type)
-      continue;
-    if ((0 == memcmp (&tc->details.monitor_peer,
-                      &all_zeros,
-                      sizeof(struct GNUNET_PeerIdentity))) ||
-        (0 == memcmp (&tc->details.monitor_peer,
-                      peer,
-                      sizeof(struct GNUNET_PeerIdentity))))
-    {
-      env = GNUNET_MQ_msg_copy (&msg->header);
-      GNUNET_MQ_send (tc->mq, env);
-    }
-  }
-  GNUNET_free (msg);
-}
-
-
-/**
- * Mark the peer as down so we don't call the continuation
- * context in the future.
- *
- * @param cls NULL
- * @param peer peer that got disconnected
- * @param value a `struct SendTransmitContinuationContext` to mark
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-mark_peer_down (void *cls, const struct GNUNET_PeerIdentity *peer, void *value)
-{
-  struct SendTransmitContinuationContext *stcc = value;
-
-  stcc->down = GNUNET_YES;
-  return GNUNET_OK;
-}
-
-
-/**
- * Notify all clients about a disconnect, and cancel
- * pending SEND_OK messages for this peer.
- *
- * @param peer peer that disconnected
- */
-void
-GST_clients_broadcast_disconnect (const struct GNUNET_PeerIdentity *peer)
-{
-  struct DisconnectInfoMessage disconnect_msg;
-
-  GNUNET_CONTAINER_multipeermap_get_multiple (active_stccs,
-                                              peer,
-                                              &mark_peer_down,
-                                              NULL);
-  disconnect_msg.header.size = htons (sizeof(struct DisconnectInfoMessage));
-  disconnect_msg.header.type = htons 
(GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT);
-  disconnect_msg.reserved = htonl (0);
-  disconnect_msg.peer = *peer;
-  GST_clients_broadcast (&disconnect_msg.header, GNUNET_NO);
-}
-
-
-/**
- * Transmit our HELLO message to the given (connected) neighbour.
- *
- * @param cls the 'HELLO' message
- * @param peer identity of the peer
- * @param address the address
- * @param state current state this peer is in
- * @param state_timeout timeout for the current state of the peer
- * @param bandwidth_in inbound quota in NBO
- * @param bandwidth_out outbound quota in NBO
- */
-static void
-transmit_our_hello (void *cls,
-                    const struct GNUNET_PeerIdentity *peer,
-                    const struct GNUNET_HELLO_Address *address,
-                    enum GNUNET_TRANSPORT_PeerState state,
-                    struct GNUNET_TIME_Absolute state_timeout,
-                    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
-{
-  const struct GNUNET_MessageHeader *hello = cls;
-
-  if (0 == memcmp (peer, &GST_my_identity, sizeof(struct GNUNET_PeerIdentity)))
-    return; /* not to ourselves */
-  if (GNUNET_NO == GST_neighbours_test_connected (peer))
-    return;
-
-  GST_neighbours_send (peer,
-                       hello,
-                       ntohs (hello->size),
-                       hello_expiration,
-                       NULL,
-                       NULL);
-}
-
-
-/**
- * My HELLO has changed. Tell everyone who should know.
- *
- * @param cls unused
- * @param hello new HELLO
- */
-static void
-process_hello_update (void *cls, const struct GNUNET_MessageHeader *hello)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Broadcasting HELLO to clients\n");
-  GST_clients_broadcast (hello, GNUNET_NO);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Broadcasting HELLO to neighbours\n");
-  GST_neighbours_iterate (&transmit_our_hello, (void *) hello);
-}
-
-
-/**
- * We received some payload.  Prepare to pass it on to our clients.
- *
- * @param address address and (claimed) identity of the other peer
- * @param session identifier used for this session (NULL for plugins
- *                that do not offer bi-directional communication to the sender
- *                using the same "connection")
- * @param message the message to process
- * @return how long the plugin should wait until receiving more data
- */
-static struct GNUNET_TIME_Relative
-process_payload (const struct GNUNET_HELLO_Address *address,
-                 struct GNUNET_ATS_Session *session,
-                 const struct GNUNET_MessageHeader *message)
-{
-  struct GNUNET_TIME_Relative ret;
-  int do_forward;
-  struct InboundMessage *im;
-  size_t msg_size = ntohs (message->size);
-  size_t size = sizeof(struct InboundMessage) + msg_size;
-  char buf[size] GNUNET_ALIGN;
-
-  do_forward = GNUNET_SYSERR;
-  ret = GST_neighbours_calculate_receive_delay (&address->peer,
-                                                msg_size,
-                                                &do_forward);
-  if (! GST_neighbours_test_connected (&address->peer))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Discarded %u bytes type %u payload from peer `%s'\n",
-                (unsigned int) msg_size,
-                ntohs (message->type),
-                GNUNET_i2s (&address->peer));
-    GNUNET_STATISTICS_update (
-      GST_stats,
-      gettext_noop ("# bytes payload discarded due to not connected peer"),
-      msg_size,
-      GNUNET_NO);
-    return ret;
-  }
-
-  if (GNUNET_YES != do_forward)
-    return ret;
-  im = (struct InboundMessage *) buf;
-  im->header.size = htons (size);
-  im->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RECV);
-  im->peer = address->peer;
-  GNUNET_memcpy (&im[1], message, ntohs (message->size));
-  GST_clients_broadcast (&im->header, GNUNET_YES);
-  return ret;
-}
-
-
-/**
- * Task to asynchronously terminate a session.
- *
- * @param cls the `struct GNUNET_ATS_SessionKiller` with the information for 
the kill
- */
-static void
-kill_session_task (void *cls)
-{
-  struct GNUNET_ATS_SessionKiller *sk = cls;
-
-  sk->task = NULL;
-  GNUNET_CONTAINER_DLL_remove (sk_head, sk_tail, sk);
-  sk->plugin->disconnect_session (sk->plugin->cls, sk->session);
-  GNUNET_free (sk);
-}
-
-
-/**
- * Force plugin to terminate session due to communication
- * issue.
- *
- * @param plugin_name name of the plugin
- * @param session session to termiante
- */
-static void
-kill_session (const char *plugin_name, struct GNUNET_ATS_Session *session)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *plugin;
-  struct GNUNET_ATS_SessionKiller *sk;
-
-  for (sk = sk_head; NULL != sk; sk = sk->next)
-    if (sk->session == session)
-      return;
-  plugin = GST_plugins_find (plugin_name);
-  if (NULL == plugin)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  /* need to issue disconnect asynchronously */
-  sk = GNUNET_new (struct GNUNET_ATS_SessionKiller);
-  sk->session = session;
-  sk->plugin = plugin;
-  sk->task = GNUNET_SCHEDULER_add_now (&kill_session_task, sk);
-  GNUNET_CONTAINER_DLL_insert (sk_head, sk_tail, sk);
-}
-
-
-/**
- * Black list check result for try_connect call
- * If connection to the peer is allowed request address and ???
- *
- * @param cls the message
- * @param peer the peer
- * @param address the address
- * @param session the session
- * @param result the result
- */
-static void
-connect_bl_check_cont (void *cls,
-                       const struct GNUNET_PeerIdentity *peer,
-                       const struct GNUNET_HELLO_Address *address,
-                       struct GNUNET_ATS_Session *session,
-                       int result)
-{
-  struct GNUNET_MessageHeader *msg = cls;
-
-  if (GNUNET_OK == result)
-  {
-    /* Blacklist allows to speak to this peer, forward SYN to neighbours  */
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Received SYN message from peer `%s' at `%s'\n",
-                GNUNET_i2s (peer),
-                GST_plugins_a2s (address));
-    if (GNUNET_OK != GST_neighbours_handle_session_syn (msg, peer))
-    {
-      GST_blacklist_abort_matching (address, session);
-      kill_session (address->transport_name, session);
-    }
-    GNUNET_free (msg);
-    return;
-  }
-  GNUNET_free (msg);
-  if (GNUNET_SYSERR == result)
-    return; /* check was aborted, session destroyed */
-  /* Blacklist denies to speak to this peer */
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Discarding SYN message from `%s' due to denied blacklist 
check\n",
-              GNUNET_i2s (peer));
-  kill_session (address->transport_name, session);
-}
-
-
-/**
- * Function called by the transport for each received message.
- *
- * @param cls closure, const char* with the name of the plugin we received the 
message from
- * @param address address and (claimed) identity of the other peer
- * @param message the message, NULL if we only care about
- *                learning about the delay until we should receive again
- * @param session identifier used for this session (NULL for plugins
- *                that do not offer bi-directional communication to the sender
- *                using the same "connection")
- * @return how long the plugin should wait until receiving more data
- *         (plugins that do not support this, can ignore the return value)
- */
-struct GNUNET_TIME_Relative
-GST_receive_callback (void *cls,
-                      const struct GNUNET_HELLO_Address *address,
-                      struct GNUNET_ATS_Session *session,
-                      const struct GNUNET_MessageHeader *message)
-{
-  const char *plugin_name = cls;
-  struct GNUNET_TIME_Relative ret;
-  uint16_t type;
-
-  ret = GNUNET_TIME_UNIT_ZERO;
-  if (NULL == message)
-    goto end;
-  type = ntohs (message->type);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received message with type %u from peer `%s' at %s\n",
-              type,
-              GNUNET_i2s (&address->peer),
-              GST_plugins_a2s (address));
-
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop ("# bytes total received"),
-                            ntohs (message->size),
-                            GNUNET_NO);
-  GST_neighbours_notify_data_recv (address, message);
-  switch (type)
-  {
-  case GNUNET_MESSAGE_TYPE_HELLO_URI:
-    /* Future HELLO message, discard  */
-    return ret;
-
-  case GNUNET_MESSAGE_TYPE_HELLO:
-    if (GNUNET_OK != GST_validation_handle_hello (message))
-    {
-      GNUNET_break_op (0);
-      GST_blacklist_abort_matching (address, session);
-    }
-    return ret;
-
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_PING:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Processing PING from `%s'\n",
-                GST_plugins_a2s (address));
-    if (GNUNET_OK !=
-        GST_validation_handle_ping (&address->peer, message, address, session))
-    {
-      GST_blacklist_abort_matching (address, session);
-      kill_session (plugin_name, session);
-    }
-    break;
-
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_PONG:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Processing PONG from `%s'\n",
-                GST_plugins_a2s (address));
-    if (GNUNET_OK != GST_validation_handle_pong (&address->peer, message))
-    {
-      GNUNET_break_op (0);
-      GST_blacklist_abort_matching (address, session);
-      kill_session (plugin_name, session);
-    }
-    break;
-
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_SYN:
-    /* Do blacklist check if communication with this peer is allowed */
-    (void) GST_blacklist_test_allowed (&address->peer,
-                                       NULL,
-                                       &connect_bl_check_cont,
-                                       GNUNET_copy_message (message),
-                                       address,
-                                       session);
-    break;
-
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_SYN_ACK:
-    if (GNUNET_OK !=
-        GST_neighbours_handle_session_syn_ack (message, address, session))
-    {
-      GST_blacklist_abort_matching (address, session);
-      kill_session (plugin_name, session);
-    }
-    break;
-
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK:
-    if (GNUNET_OK !=
-        GST_neighbours_handle_session_ack (message, address, session))
-    {
-      GNUNET_break_op (0);
-      GST_blacklist_abort_matching (address, session);
-      kill_session (plugin_name, session);
-    }
-    break;
-
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT:
-    GST_neighbours_handle_disconnect_message (&address->peer, message);
-    break;
-
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA:
-    GST_neighbours_handle_quota_message (&address->peer, message);
-    break;
-
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE:
-    GST_neighbours_keepalive (&address->peer, message);
-    break;
-
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE:
-    GST_neighbours_keepalive_response (&address->peer, message);
-    break;
-
-  default:
-    /* should be payload */
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop ("# bytes payload received"),
-                              ntohs (message->size),
-                              GNUNET_NO);
-    ret = process_payload (address, session, message);
-    break;
-  }
-end:
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Allowing receive from peer %s to continue in %s\n",
-              GNUNET_i2s (&address->peer),
-              GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES));
-  return ret;
-}
-
-
-/**
- * Function that will be called for each address the transport
- * is aware that it might be reachable under.  Update our HELLO.
- *
- * @param cls name of the plugin (const char*)
- * @param add_remove should the address added (YES) or removed (NO) from the
- *                   set of valid addresses?
- * @param address the address to add or remove
- */
-static void
-plugin_env_address_change_notification (
-  void *cls,
-  int add_remove,
-  const struct GNUNET_HELLO_Address *address)
-{
-  static int addresses = 0;
-
-  if (GNUNET_YES == add_remove)
-  {
-    addresses++;
-    GNUNET_STATISTICS_update (GST_stats, "# transport addresses", 1, 
GNUNET_NO);
-  }
-  else if (GNUNET_NO == add_remove)
-  {
-    if (0 == addresses)
-    {
-      GNUNET_break (0);
-    }
-    else
-    {
-      addresses--;
-      GNUNET_STATISTICS_update (GST_stats,
-                                "# transport addresses",
-                                -1,
-                                GNUNET_NO);
-    }
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Transport now has %u addresses to communicate\n",
-              addresses);
-  GST_hello_modify_addresses (add_remove, address);
-}
-
-
-/**
- * Function that will be called whenever the plugin internally
- * cleans up a session pointer and hence the service needs to
- * discard all of those sessions as well.  Plugins that do not
- * use sessions can simply omit calling this function and always
- * use NULL wherever a session pointer is needed.  This function
- * should be called BEFORE a potential "TransmitContinuation"
- * from the "TransmitFunction".
- *
- * @param cls closure
- * @param address which address was the session for
- * @param session which session is being destroyed
- */
-static void
-plugin_env_session_end (void *cls,
-                        const struct GNUNET_HELLO_Address *address,
-                        struct GNUNET_ATS_Session *session)
-{
-  struct GNUNET_ATS_SessionKiller *sk;
-
-  if (NULL == address)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if (NULL == session)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GNUNET_assert (strlen (address->transport_name) > 0);
-
-  GNUNET_log (
-    GNUNET_ERROR_TYPE_DEBUG,
-    "Notification from plugin about terminated session %p from peer `%s' 
address `%s'\n",
-    session,
-    GNUNET_i2s (&address->peer),
-    GST_plugins_a2s (address));
-
-  GST_neighbours_session_terminated (&address->peer, session);
-  GST_ats_del_session (address, session);
-  GST_blacklist_abort_matching (address, session);
-
-  for (sk = sk_head; NULL != sk; sk = sk->next)
-  {
-    if (sk->session == session)
-    {
-      GNUNET_CONTAINER_DLL_remove (sk_head, sk_tail, sk);
-      GNUNET_SCHEDULER_cancel (sk->task);
-      GNUNET_free (sk);
-      break;
-    }
-  }
-}
-
-
-/**
- * Black list check result from blacklist check triggered when a
- * plugin gave us a new session in #plugin_env_session_start().  If
- * connection to the peer is disallowed, kill the session.
- *
- * @param cls NULL
- * @param peer the peer
- * @param address address associated with the request
- * @param session session associated with the request
- * @param result the result
- */
-static void
-plugin_env_session_start_bl_check_cont (
-  void *cls,
-  const struct GNUNET_PeerIdentity *peer,
-  const struct GNUNET_HELLO_Address *address,
-  struct GNUNET_ATS_Session *session,
-  int result)
-{
-  if (GNUNET_OK != result)
-  {
-    kill_session (address->transport_name, session);
-    return;
-  }
-  if (GNUNET_YES !=
-      GNUNET_HELLO_address_check_option (address,
-                                         GNUNET_HELLO_ADDRESS_INFO_INBOUND))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Informing verifier about inbound session's address `%s'\n",
-                GST_plugins_a2s (address));
-    GST_validation_handle_address (address);
-  }
-}
-
-
-/**
- * Plugin tells transport service about a new inbound session
- *
- * @param cls unused
- * @param address the address
- * @param session the new session
- * @param scope network scope information
- */
-static void
-plugin_env_session_start (void *cls,
-                          const struct GNUNET_HELLO_Address *address,
-                          struct GNUNET_ATS_Session *session,
-                          enum GNUNET_NetworkType scope)
-{
-  struct GNUNET_ATS_Properties prop;
-
-  if (NULL == address)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if (NULL == session)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GNUNET_log (
-    GNUNET_ERROR_TYPE_INFO,
-    "Notification from plugin `%s' about new session from peer `%s' address 
`%s'\n",
-    address->transport_name,
-    GNUNET_i2s (&address->peer),
-    GST_plugins_a2s (address));
-  if (GNUNET_YES ==
-      GNUNET_HELLO_address_check_option (address,
-                                         GNUNET_HELLO_ADDRESS_INFO_INBOUND))
-  {
-    /* inbound is always new, but outbound MAY already be known, but
-       for example for UNIX, we have symmetric connections and thus we
-       may not know the address yet; add if necessary! */
-    /* FIXME: maybe change API here so we just pass scope? */
-    memset (&prop, 0, sizeof(prop));
-    GNUNET_break (GNUNET_NT_UNSPECIFIED != scope);
-    prop.scope = scope;
-    GST_ats_add_inbound_address (address, session, &prop);
-  }
-  /* Do blacklist check if communication with this peer is allowed */
-  (void) GST_blacklist_test_allowed (&address->peer,
-                                     address->transport_name,
-                                     &plugin_env_session_start_bl_check_cont,
-                                     NULL,
-                                     address,
-                                     session);
-}
-
-
-/**
- * Function called by ATS to notify the callee that the
- * assigned bandwidth or address for a given peer was changed.  If the
- * callback is called with address/bandwidth assignments of zero, the
- * ATS disconnect function will still be called once the disconnect
- * actually happened.
- *
- * @param cls closure
- * @param peer the peer this address is intended for
- * @param address address to use (for peer given in address)
- * @param session session to use (if available)
- * @param bandwidth_out assigned outbound bandwidth for the connection in NBO,
- *      0 to disconnect from peer
- * @param bandwidth_in assigned inbound bandwidth for the connection in NBO,
- *      0 to disconnect from peer
- * @param ats ATS information
- * @param ats_count number of @a ats elements
- */
-static void
-ats_request_address_change (void *cls,
-                            const struct GNUNET_PeerIdentity *peer,
-                            const struct GNUNET_HELLO_Address *address,
-                            struct GNUNET_ATS_Session *session,
-                            struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-                            struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
-{
-  uint32_t bw_in = ntohl (bandwidth_in.value__);
-  uint32_t bw_out = ntohl (bandwidth_out.value__);
-
-  if (NULL == peer)
-  {
-    /* ATS service died, all suggestions become invalid!
-       (but we'll keep using the allocations for a little
-       while, to keep going while ATS restarts) */
-    /* FIXME: We should drop all
-       connections now, as ATS won't explicitly tell
-       us and be unaware of ongoing resource allocations! */
-    return;
-  }
-  /* ATS tells me to disconnect from peer */
-  if ((0 == bw_in) && (0 == bw_out))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "ATS tells me to disconnect from peer `%s'\n",
-                GNUNET_i2s (peer));
-    GST_neighbours_force_disconnect (peer);
-    return;
-  }
-  GNUNET_assert (NULL != address);
-  GNUNET_STATISTICS_update (GST_stats,
-                            "# ATS suggestions received",
-                            1,
-                            GNUNET_NO);
-  GST_neighbours_switch_to_address (address,
-                                    session,
-                                    bandwidth_in,
-                                    bandwidth_out);
-}
-
-
-/**
- * Closure for #test_connection_ok().
- */
-struct TestConnectionContext
-{
-  /**
-   * Is this the first neighbour we're checking?
-   */
-  int first;
-
-  /**
-   * Handle to the blacklisting client we need to ask.
-   */
-  struct TransportClient *tc;
-};
-
-
-/**
- * Got the result about an existing connection from a new blacklister.
- * Shutdown the neighbour if necessary.
- *
- * @param cls unused
- * @param peer the neighbour that was investigated
- * @param address address associated with the request
- * @param session session associated with the request
- * @param allowed #GNUNET_OK if we can keep it,
- *                #GNUNET_NO if we must shutdown the connection
- */
-static void
-confirm_or_drop_neighbour (void *cls,
-                           const struct GNUNET_PeerIdentity *peer,
-                           const struct GNUNET_HELLO_Address *address,
-                           struct GNUNET_ATS_Session *session,
-                           int allowed)
-{
-  if (GNUNET_OK == allowed)
-    return; /* we're done */
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop ("# disconnects due to blacklist"),
-                            1,
-                            GNUNET_NO);
-  GST_neighbours_force_disconnect (peer);
-}
-
-
-/**
- * Test if an existing connection is still acceptable given a new
- * blacklisting client.
- *
- * @param cls the `struct TestConnectionContext *`
- * @param peer identity of the peer
- * @param address the address
- * @param state current state this peer is in
- * @param state_timeout timeout for the current state of the peer
- * @param bandwidth_in bandwidth assigned inbound
- * @param bandwidth_out bandwidth assigned outbound
- */
-static void
-test_connection_ok (void *cls,
-                    const struct GNUNET_PeerIdentity *peer,
-                    const struct GNUNET_HELLO_Address *address,
-                    enum GNUNET_TRANSPORT_PeerState state,
-                    struct GNUNET_TIME_Absolute state_timeout,
-                    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
-{
-  struct TestConnectionContext *tcc = cls;
-  struct GST_BlacklistCheck *bc;
-
-  bc = GNUNET_new (struct GST_BlacklistCheck);
-  GNUNET_CONTAINER_DLL_insert (bc_head, bc_tail, bc);
-  bc->peer = *peer;
-  bc->address = GNUNET_HELLO_address_copy (address);
-  bc->cont = &confirm_or_drop_neighbour;
-  bc->cont_cls = NULL;
-  bc->bl_pos = tcc->tc;
-  if (GNUNET_YES == tcc->first)
-  {
-    /* all would wait for the same client, no need to
-     * create more than just the first task right now */
-    bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc);
-    tcc->first = GNUNET_NO;
-  }
-}
-
-
-/**
- * Initialize a blacklisting client.  We got a blacklist-init
- * message from this client, add it to the list of clients
- * to query for blacklisting.
- *
- * @param cls the client
- * @param message the blacklist-init message that was sent
- */
-static void
-handle_client_blacklist_init (void *cls,
-                              const struct GNUNET_MessageHeader *message)
-{
-  struct TransportClient *tc = cls;
-  struct TestConnectionContext tcc;
-
-  if (CT_NONE != tc->type)
-  {
-    GNUNET_break (0);
-    GNUNET_SERVICE_client_drop (tc->client);
-    return;
-  }
-  GNUNET_SERVICE_client_mark_monitor (tc->client);
-  tc->type = CT_BLACKLIST;
-  tc->details.blacklist.call_receive_done = GNUNET_YES;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New blacklist client %p\n", tc);
-  /* confirm that all existing connections are OK! */
-  tcc.tc = tc;
-  tcc.first = GNUNET_YES;
-  GST_neighbours_iterate (&test_connection_ok, &tcc);
-}
-
-
-/**
- * Free the given entry in the blacklist.
- *
- * @param cls unused
- * @param key host identity (unused)
- * @param value the blacklist entry
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-free_blacklist_entry (void *cls,
-                      const struct GNUNET_PeerIdentity *key,
-                      void *value)
-{
-  char *be = value;
-
-  GNUNET_free (be);
-  return GNUNET_OK;
-}
-
-
-/**
- * Set traffic metric to manipulate
- *
- * @param cls closure
- * @param tm message containing information
- */
-static void
-handle_client_set_metric (void *cls, const struct TrafficMetricMessage *tm)
-{
-  struct TransportClient *tc = cls;
-
-  GST_manipulation_set_metric (tm);
-  GNUNET_SERVICE_client_continue (tc->client);
-}
-
-
-/**
- * Function called when the service shuts down.  Unloads our plugins
- * and cancels pending validations.
- *
- * @param cls closure, unused
- */
-static void
-shutdown_task (void *cls)
-{
-  struct AddressToStringContext *cur;
-
-  GST_neighbours_stop ();
-  GST_plugins_unload ();
-  GST_validation_stop ();
-  GST_ats_done ();
-  GNUNET_ATS_scheduling_done (GST_ats);
-  GST_ats = NULL;
-  GNUNET_ATS_connectivity_done (GST_ats_connect);
-  GST_ats_connect = NULL;
-  GNUNET_NT_scanner_done (GST_is);
-  GST_is = NULL;
-  while (NULL != (cur = a2s_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (a2s_head, a2s_tail, cur);
-    GNUNET_free (cur);
-  }
-  if (NULL != plugin_nc)
-  {
-    GNUNET_notification_context_destroy (plugin_nc);
-    plugin_nc = NULL;
-  }
-  GNUNET_CONTAINER_multipeermap_destroy (active_stccs);
-  active_stccs = NULL;
-  if (NULL != blacklist)
-  {
-    GNUNET_CONTAINER_multipeermap_iterate (blacklist,
-                                           &free_blacklist_entry,
-                                           NULL);
-    GNUNET_CONTAINER_multipeermap_destroy (blacklist);
-    blacklist = NULL;
-  }
-  GST_hello_stop ();
-  GST_manipulation_stop ();
-
-  if (NULL != GST_peerinfo)
-  {
-    GNUNET_PEERINFO_disconnect (GST_peerinfo);
-    GST_peerinfo = NULL;
-  }
-  if (NULL != GST_stats)
-  {
-    GNUNET_STATISTICS_destroy (GST_stats, GNUNET_NO);
-    GST_stats = NULL;
-  }
-}
-
-
-static void
-do_blacklist_check (void *cls)
-{
-  struct GST_BlacklistCheck *bc = cls;
-  struct TransportClient *tc;
-  struct GNUNET_MQ_Envelope *env;
-  struct BlacklistMessage *bm;
-
-  bc->task = NULL;
-  while (NULL != (tc = bc->bl_pos))
-  {
-    if (CT_BLACKLIST == tc->type)
-      break;
-    bc->bl_pos = tc->next;
-  }
-  if (NULL == tc)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "No other blacklist clients active, will allow neighbour 
`%s'\n",
-                GNUNET_i2s (&bc->peer));
-
-    bc->cont (bc->cont_cls, &bc->peer, bc->address, bc->session, GNUNET_OK);
-    GST_blacklist_test_cancel (bc);
-    return;
-  }
-  if ((NULL != tc->details.blacklist.bc) ||
-      (GNUNET_NO != tc->details.blacklist.waiting_for_reply))
-    return; /* someone else busy with this client */
-  tc->details.blacklist.bc = bc;
-  env = GNUNET_MQ_msg (bm, GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY);
-  bm->is_allowed = htonl (0);
-  bm->peer = bc->peer;
-  GNUNET_MQ_send (tc->mq, env);
-  if (GNUNET_YES == tc->details.blacklist.call_receive_done)
-  {
-    tc->details.blacklist.call_receive_done = GNUNET_NO;
-    GNUNET_SERVICE_client_continue (tc->client);
-  }
-  tc->details.blacklist.waiting_for_reply = GNUNET_YES;
-}
-
-
-/**
- * A blacklisting client has sent us reply. Process it.
- *
- * @param cls the client
- * @param msg the blacklist-reply message that was sent
- */
-static void
-handle_client_blacklist_reply (void *cls, const struct BlacklistMessage *msg)
-{
-  struct TransportClient *tc = cls;
-  struct GST_BlacklistCheck *bc;
-
-  if (CT_BLACKLIST != tc->type)
-  {
-    GNUNET_break (0);
-    GNUNET_SERVICE_client_drop (tc->client);
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Blacklist client %p sent reply for `%s'\n",
-              tc,
-              GNUNET_i2s (&msg->peer));
-  bc = tc->details.blacklist.bc;
-  tc->details.blacklist.bc = NULL;
-  tc->details.blacklist.waiting_for_reply = GNUNET_NO;
-  tc->details.blacklist.call_receive_done = GNUNET_YES;
-  if (NULL != bc)
-  {
-    /* only run this if the blacklist check has not been
-     * cancelled in the meantime... */
-    GNUNET_assert (bc->bl_pos == tc);
-    if (ntohl (msg->is_allowed) == GNUNET_SYSERR)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Blacklist check failed, peer not allowed\n");
-      /* For the duration of the continuation, make the ongoing
-         check invisible (to avoid double-cancellation); then
-         add it back again so we can re-use GST_blacklist_test_cancel() */
-      GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, bc);
-      bc->cont (bc->cont_cls, &bc->peer, bc->address, bc->session, GNUNET_NO);
-      GNUNET_CONTAINER_DLL_insert (bc_head, bc_tail, bc);
-      GST_blacklist_test_cancel (bc);
-      tc->details.blacklist.call_receive_done = GNUNET_NO;
-      GNUNET_SERVICE_client_continue (tc->client);
-      return;
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Blacklist check succeeded, continuing with checks\n");
-      tc->details.blacklist.call_receive_done = GNUNET_NO;
-      GNUNET_SERVICE_client_continue (tc->client);
-      bc->bl_pos = tc->next;
-      bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc);
-    }
-  }
-  /* check if any other blacklist checks are waiting for this blacklister */
-  for (bc = bc_head; bc != NULL; bc = bc->next)
-    if ((bc->bl_pos == tc) && (NULL == bc->task))
-    {
-      bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc);
-      break;
-    }
-}
-
-
-/**
- * Add the given peer to the blacklist (for the given transport).
- *
- * @param peer peer to blacklist
- * @param transport_name transport to blacklist for this peer, NULL for all
- */
-void
-GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer,
-                        const char *transport_name)
-{
-  char *transport = NULL;
-
-  if (NULL != transport_name)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Adding peer `%s' with plugin `%s' to blacklist\n",
-                GNUNET_i2s (peer),
-                transport_name);
-    transport = GNUNET_strdup (transport_name);
-  }
-  else
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Adding peer `%s' with all plugins to blacklist\n",
-                GNUNET_i2s (peer));
-  if (NULL == blacklist)
-    blacklist =
-      GNUNET_CONTAINER_multipeermap_create (TRANSPORT_BLACKLIST_HT_SIZE,
-                                            GNUNET_NO);
-
-  GNUNET_CONTAINER_multipeermap_put (blacklist,
-                                     peer,
-                                     transport,
-                                     
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-}
-
-
-/**
- * Abort blacklist if @a address and @a session match.
- *
- * @param address address used to abort matching checks
- * @param session session used to abort matching checks
- */
-void
-GST_blacklist_abort_matching (const struct GNUNET_HELLO_Address *address,
-                              struct GNUNET_ATS_Session *session)
-{
-  struct GST_BlacklistCheck *bc;
-  struct GST_BlacklistCheck *n;
-
-  n = bc_head;
-  while (NULL != (bc = n))
-  {
-    n = bc->next;
-    if ((bc->session == session) &&
-        (0 == GNUNET_HELLO_address_cmp (bc->address, address)))
-    {
-      bc->cont (bc->cont_cls,
-                &bc->peer,
-                bc->address,
-                bc->session,
-                GNUNET_SYSERR);
-      GST_blacklist_test_cancel (bc);
-    }
-  }
-}
-
-
-/**
- * Test if the given blacklist entry matches.  If so,
- * abort the iteration.
- *
- * @param cls the transport name to match (const char*)
- * @param key the key (unused)
- * @param value the 'char *' (name of a blacklisted transport)
- * @return #GNUNET_OK if the entry does not match, #GNUNET_NO if it matches
- */
-static int
-test_blacklisted (void *cls, const struct GNUNET_PeerIdentity *key, void 
*value)
-{
-  const char *transport_name = cls;
-  char *be = value;
-
-  /* Blacklist entry be:
-   *  (NULL == be): peer is blacklisted with all plugins
-   *  (NULL != be): peer is blacklisted for a specific plugin
-   *
-   * If (NULL != transport_name) we look for a transport specific entry:
-   *  if (transport_name == be) forbidden
-   *
-   */GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Comparing BL request for peer `%4s':`%s' with BL entry: `%s'\n",
-              GNUNET_i2s (key),
-              (NULL == transport_name) ? "unspecified" : transport_name,
-              (NULL == be) ? "all plugins" : be);
-  /* all plugins for this peer were blacklisted: disallow */
-  if (NULL == value)
-    return GNUNET_NO;
-
-  /* blacklist check for specific transport */
-  if ((NULL != transport_name) && (NULL != value))
-  {
-    if (0 == strcmp (transport_name, be))
-      return GNUNET_NO;   /* plugin is blacklisted! */
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Test if a peer/transport combination is blacklisted.
- *
- * @param peer the identity of the peer to test
- * @param transport_name name of the transport to test, never NULL
- * @param cont function to call with result
- * @param cont_cls closure for @a cont
- * @param address address to pass back to @a cont, can be NULL
- * @param session session to pass back to @a cont, can be NULL
- * @return handle to the blacklist check, NULL if the decision
- *        was made instantly and @a cont was already called
- */
-struct GST_BlacklistCheck *
-GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer,
-                            const char *transport_name,
-                            GST_BlacklistTestContinuation cont,
-                            void *cont_cls,
-                            const struct GNUNET_HELLO_Address *address,
-                            struct GNUNET_ATS_Session *session)
-{
-  struct GST_BlacklistCheck *bc;
-  struct TransportClient *tc;
-
-  GNUNET_assert (NULL != peer);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Blacklist check for peer `%s':%s\n",
-              GNUNET_i2s (peer),
-              (NULL != transport_name) ? transport_name : "unspecified");
-
-  /* Check local blacklist by iterating over hashmap
-   * If iteration is aborted, we found a matching blacklist entry */
-  if ((NULL != blacklist) &&
-      (GNUNET_SYSERR ==
-       GNUNET_CONTAINER_multipeermap_get_multiple (blacklist,
-                                                   peer,
-                                                   &test_blacklisted,
-                                                   (void *) transport_name)))
-  {
-    /* Disallowed by config, disapprove instantly */
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop ("# disconnects due to blacklist"),
-                              1,
-                              GNUNET_NO);
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ ("Disallowing connection to peer `%s' on transport %s\n"),
-                GNUNET_i2s (peer),
-                (NULL != transport_name) ? transport_name : "unspecified");
-    if (NULL != cont)
-      cont (cont_cls, peer, address, session, GNUNET_NO);
-    return NULL;
-  }
-
-  for (tc = clients_head; NULL != tc; tc = tc->next)
-    if (CT_BLACKLIST == tc->type)
-      break;
-  if (NULL == tc)
-  {
-    /* no blacklist clients, approve instantly */
-    if (NULL != cont)
-      cont (cont_cls, peer, address, session, GNUNET_OK);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Allowing connection to peer `%s' %s\n",
-                GNUNET_i2s (peer),
-                (NULL != transport_name) ? transport_name : "");
-    return NULL;
-  }
-
-  /* need to query blacklist clients */
-  bc = GNUNET_new (struct GST_BlacklistCheck);
-  GNUNET_CONTAINER_DLL_insert (bc_head, bc_tail, bc);
-  bc->peer = *peer;
-  bc->address = GNUNET_HELLO_address_copy (address);
-  bc->session = session;
-  bc->cont = cont;
-  bc->cont_cls = cont_cls;
-  bc->bl_pos = tc;
-  bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc);
-  return bc;
-}
-
-
-void
-GST_blacklist_test_cancel (struct GST_BlacklistCheck *bc)
-{
-  GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, bc);
-  if (NULL != bc->bl_pos)
-  {
-    if ((CT_BLACKLIST == bc->bl_pos->type) &&
-        (bc->bl_pos->details.blacklist.bc == bc))
-    {
-      /* we're at the head of the queue, remove us! */
-      bc->bl_pos->details.blacklist.bc = NULL;
-    }
-  }
-  if (NULL != bc->task)
-  {
-    GNUNET_SCHEDULER_cancel (bc->task);
-    bc->task = NULL;
-  }
-  GNUNET_free (bc->address);
-  GNUNET_free (bc);
-}
-
-
-/**
- * Function to iterate over options in the blacklisting section for a peer.
- *
- * @param cls closure
- * @param section name of the section
- * @param option name of the option
- * @param value value of the option
- */
-static void
-blacklist_cfg_iter (void *cls,
-                    const char *section,
-                    const char *option,
-                    const char *value)
-{
-  unsigned int *res = cls;
-  struct GNUNET_PeerIdentity peer;
-  char *plugs;
-  char *pos;
-
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_eddsa_public_key_from_string (option,
-                                                  strlen (option),
-                                                  &peer.public_key))
-    return;
-
-  if ((NULL == value) || (0 == strcmp (value, "")))
-  {
-    /* Blacklist whole peer */
-    GST_blacklist_add_peer (&peer, NULL);
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ ("Adding blacklisting entry for peer `%s'\n"),
-                GNUNET_i2s (&peer));
-  }
-  else
-  {
-    plugs = GNUNET_strdup (value);
-    for (pos = strtok (plugs, " "); pos != NULL; pos = strtok (NULL, " "))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  _ ("Adding blacklisting entry for peer `%s':`%s'\n"),
-                  GNUNET_i2s (&peer),
-                  pos);
-      GST_blacklist_add_peer (&peer, pos);
-    }
-    GNUNET_free (plugs);
-  }
-  (*res)++;
-}
-
-
-/**
- * Read blacklist configuration
- *
- * @param cfg the configuration handle
- * @param my_id my peer identity
- */
-static void
-read_blacklist_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                              const struct GNUNET_PeerIdentity *my_id)
-{
-  char cfg_sect[512];
-  unsigned int res = 0;
-
-  GNUNET_snprintf (cfg_sect,
-                   sizeof(cfg_sect),
-                   "transport-blacklist-%s",
-                   GNUNET_i2s_full (my_id));
-  GNUNET_CONFIGURATION_iterate_section_values (cfg,
-                                               cfg_sect,
-                                               &blacklist_cfg_iter,
-                                               &res);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Loaded %u blacklisting entries from configuration\n",
-              res);
-}
-
-
-/**
- * Initiate transport service.
- *
- * @param cls closure
- * @param c configuration to use
- * @param service the initialized service
- */
-static void
-run (void *cls,
-     const struct GNUNET_CONFIGURATION_Handle *c,
-     struct GNUNET_SERVICE_Handle *service)
-{
-  char *keyfile;
-  long long unsigned int max_fd_cfg;
-  int max_fd_rlimit;
-  int max_fd;
-  int friend_only;
-
-  /* setup globals */
-  GST_cfg = c;
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (c,
-                                                            "PEER",
-                                                            "PRIVATE_KEY",
-                                                            &keyfile))
-  {
-    GNUNET_log (
-      GNUNET_ERROR_TYPE_ERROR,
-      _ (
-        "Transport service is lacking key configuration settings. 
Exiting.\n"));
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (c,
-                                                        "transport",
-                                                        "HELLO_EXPIRATION",
-                                                        &hello_expiration))
-  {
-    hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION;
-  }
-  if (GNUNET_SYSERR ==
-      GNUNET_CRYPTO_eddsa_key_from_file (keyfile,
-                                         GNUNET_YES,
-                                         &GST_my_private_key))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to setup peer's private key\n");
-    GNUNET_SCHEDULER_shutdown ();
-    GNUNET_free (keyfile);
-    return;
-  }
-  GNUNET_free (keyfile);
-  GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg);
-  GST_peerinfo = GNUNET_PEERINFO_connect (GST_cfg);
-  GNUNET_CRYPTO_eddsa_key_get_public (&GST_my_private_key,
-                                      &GST_my_identity.public_key);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "My identity is `%s'\n",
-              GNUNET_i2s_full (&GST_my_identity));
-
-  GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
-  if (NULL == GST_peerinfo)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ ("Could not access PEERINFO service.  Exiting.\n"));
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-
-  max_fd_rlimit = 0;
-#if HAVE_GETRLIMIT
-  {
-    struct rlimit r_file;
-
-    if (0 == getrlimit (RLIMIT_NOFILE, &r_file))
-    {
-      max_fd_rlimit = r_file.rlim_cur;
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Maximum number of open files was: %u/%u\n",
-                  (unsigned int) r_file.rlim_cur,
-                  (unsigned int) r_file.rlim_max);
-    }
-    max_fd_rlimit =
-      (9 * max_fd_rlimit) / 10; /* Keep 10% for rest of transport */
-  }
-#endif
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (GST_cfg,
-                                                          "transport",
-                                                          "MAX_FD",
-                                                          &max_fd_cfg))
-    max_fd_cfg = max_fd_rlimit;
-
-  if (max_fd_cfg > max_fd_rlimit)
-    max_fd = max_fd_cfg;
-  else
-    max_fd = max_fd_rlimit;
-  if (max_fd < DEFAULT_MAX_FDS)
-    max_fd = DEFAULT_MAX_FDS;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Limiting number of sockets to %u: validation %u, neighbors: 
%u\n",
-              max_fd,
-              (max_fd / 3),
-              (max_fd / 3) * 2);
-
-  friend_only =
-    GNUNET_CONFIGURATION_get_value_yesno (GST_cfg, "topology", "FRIENDS-ONLY");
-  if (GNUNET_SYSERR == friend_only)
-    friend_only = GNUNET_NO; /* According to topology defaults */
-  /* start subsystems */
-  /* Disable DSTJ peer */
-  {
-    struct GNUNET_PeerIdentity dstj;
-    const char *ds = "DSTJBRRKZ8TBW3FGK6B0M5QXWT9WYNZ45H5MCV4HY7ST64Q8T9F0";
-
-    GNUNET_assert (
-      GNUNET_OK ==
-      GNUNET_CRYPTO_eddsa_public_key_from_string (ds,
-                                                  strlen (ds),
-                                                  &dstj.public_key));
-    GST_blacklist_add_peer (&dstj, NULL);
-  }
-  read_blacklist_configuration (GST_cfg, &GST_my_identity);
-  GST_is = GNUNET_NT_scanner_init ();
-  GST_ats_connect = GNUNET_ATS_connectivity_init (GST_cfg);
-  GST_ats =
-    GNUNET_ATS_scheduling_init (GST_cfg, &ats_request_address_change, NULL);
-  GST_ats_init ();
-  GST_manipulation_init ();
-  GST_plugins_load (&GST_manipulation_recv,
-                    &plugin_env_address_change_notification,
-                    &plugin_env_session_start,
-                    &plugin_env_session_end);
-  GST_hello_start (friend_only, &process_hello_update, NULL);
-  GST_neighbours_start ((max_fd / 3) * 2);
-  active_stccs = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_YES);
-  plugin_nc = GNUNET_notification_context_create (0);
-  GST_validation_start ((max_fd / 3));
-}
-
-
-/**
- * Define "main" method using service macro.
- */
-GNUNET_SERVICE_MAIN (
-  "transport",
-  GNUNET_SERVICE_OPTION_NONE,
-  &run,
-  &client_connect_cb,
-  &client_disconnect_cb,
-  NULL,
-  GNUNET_MQ_hd_fixed_size (client_start,
-                           GNUNET_MESSAGE_TYPE_TRANSPORT_START,
-                           struct StartMessage,
-                           NULL),
-  GNUNET_MQ_hd_var_size (client_hello,
-                         GNUNET_MESSAGE_TYPE_HELLO,
-                         struct GNUNET_MessageHeader,
-                         NULL),
-  GNUNET_MQ_hd_var_size (client_send,
-                         GNUNET_MESSAGE_TYPE_TRANSPORT_SEND,
-                         struct OutboundMessage,
-                         NULL),
-  GNUNET_MQ_hd_var_size (client_address_to_string,
-                         GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING,
-                         struct AddressLookupMessage,
-                         NULL),
-  GNUNET_MQ_hd_fixed_size (client_monitor_peers,
-                           GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST,
-                           struct PeerMonitorMessage,
-                           NULL),
-  GNUNET_MQ_hd_fixed_size (client_blacklist_init,
-                           GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_INIT,
-                           struct GNUNET_MessageHeader,
-                           NULL),
-  GNUNET_MQ_hd_fixed_size (client_blacklist_reply,
-                           GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_REPLY,
-                           struct BlacklistMessage,
-                           NULL),
-  GNUNET_MQ_hd_fixed_size (client_set_metric,
-                           GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC,
-                           struct TrafficMetricMessage,
-                           NULL),
-  GNUNET_MQ_hd_fixed_size (client_monitor_plugins,
-                           GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_START,
-                           struct GNUNET_MessageHeader,
-                           NULL),
-  GNUNET_MQ_handler_end ());
-
-
-/* end of file gnunet-service-transport.c */
diff --git a/src/transport/gnunet-service-transport_ats.c 
b/src/transport/gnunet-service-transport_ats.c
deleted file mode 100644
index 2438a0a48..000000000
--- a/src/transport/gnunet-service-transport_ats.c
+++ /dev/null
@@ -1,906 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/gnunet-service-transport_ats.c
- * @brief interfacing between transport and ATS service
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet-service-transport.h"
-#include "gnunet-service-transport_ats.h"
-#include "gnunet-service-transport_manipulation.h"
-#include "gnunet-service-transport_plugins.h"
-#include "gnunet_ats_service.h"
-
-/**
- * Log convenience function.
- */
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-ats", __VA_ARGS__)
-
-
-/**
- * Information we track for each address known to ATS.
- */
-struct AddressInfo
-{
-  /**
-   * The address (with peer identity).  Must never change
-   * while this struct is in the #p2a map.
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Session (can be NULL)
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * Record with ATS API for the address.
-   */
-  struct GNUNET_ATS_AddressRecord *ar;
-
-  /**
-   * Performance properties of this address.
-   */
-  struct GNUNET_ATS_Properties properties;
-
-  /**
-   * Time until when this address is blocked and should thus not be
-   * made available to ATS (@e ar should be NULL until this time).
-   * Used when transport determines that for some reason it
-   * (temporarily) cannot use an address, even though it has been
-   * validated.
-   */
-  struct GNUNET_TIME_Absolute blocked;
-
-  /**
-   * If an address is blocked as part of an exponential back-off,
-   * we track the current size of the backoff here.
-   */
-  struct GNUNET_TIME_Relative back_off;
-
-  /**
-   * Task scheduled to unblock an ATS-blocked address at
-   * @e blocked time, or NULL if the address is not blocked
-   * (and thus @e ar is non-NULL).
-   */
-  struct GNUNET_SCHEDULER_Task *unblock_task;
-
-  /**
-   * Set to #GNUNET_YES if the address has expired but we could
-   * not yet remove it because we still have a valid session.
-   */
-  int expired;
-};
-
-
-/**
- * Map from peer identities to one or more `struct AddressInfo` values
- * for the peer.
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *p2a;
-
-/**
- * Number of blocked addresses.
- */
-static unsigned int num_blocked;
-
-
-/**
- * Closure for #find_ai_cb() and #find_ai_no_session_cb().
- */
-struct FindClosure
-{
-  /**
-   * Session to look for (only used if the address is inbound).
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * Address to look for.
-   */
-  const struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Where to store the result.
-   */
-  struct AddressInfo *ret;
-};
-
-
-/**
- * Provide an update on the `p2a` map size to statistics.
- * This function should be called whenever the `p2a` map
- * is changed.
- */
-static void
-publish_p2a_stat_update ()
-{
-  GNUNET_STATISTICS_set (GST_stats,
-                         gettext_noop ("# Addresses given to ATS"),
-                         GNUNET_CONTAINER_multipeermap_size (p2a) - 
num_blocked,
-                         GNUNET_NO);
-  GNUNET_STATISTICS_set (GST_stats,
-                         "# blocked addresses",
-                         num_blocked,
-                         GNUNET_NO);
-}
-
-
-/**
- * Find matching address info.  Both the address and the session
- * must match; note that expired addresses are still found (as
- * the session kind-of keeps those alive).
- *
- * @param cls the `struct FindClosure`
- * @param key which peer is this about
- * @param value the `struct AddressInfo`
- * @return #GNUNET_YES to continue to iterate, #GNUNET_NO if we found the value
- */
-static int
-find_ai_cb (void *cls,
-            const struct GNUNET_PeerIdentity *key,
-            void *value)
-{
-  struct FindClosure *fc = cls;
-  struct AddressInfo *ai = value;
-
-  if ((0 ==
-       GNUNET_HELLO_address_cmp (fc->address,
-                                 ai->address)) &&
-      (fc->session == ai->session))
-  {
-    fc->ret = ai;
-    return GNUNET_NO;
-  }
-  return GNUNET_YES;
-}
-
-
-/**
- * Find the address information struct for the
- * given @a address and @a session.
- *
- * @param address address to look for
- * @param session session to match for inbound connections
- * @return NULL if this combination is unknown
- */
-static struct AddressInfo *
-find_ai (const struct GNUNET_HELLO_Address *address,
-         struct GNUNET_ATS_Session *session)
-{
-  struct FindClosure fc;
-
-  fc.address = address;
-  fc.session = session;
-  fc.ret = NULL;
-  GNUNET_CONTAINER_multipeermap_get_multiple (p2a,
-                                              &address->peer,
-                                              &find_ai_cb,
-                                              &fc);
-  return fc.ret;
-}
-
-
-/**
- * Find matching address info, ignoring sessions and expired
- * addresses.
- *
- * @param cls the `struct FindClosure`
- * @param key which peer is this about
- * @param value the `struct AddressInfo`
- * @return #GNUNET_YES to continue to iterate, #GNUNET_NO if we found the value
- */
-static int
-find_ai_no_session_cb (void *cls,
-                       const struct GNUNET_PeerIdentity *key,
-                       void *value)
-{
-  struct FindClosure *fc = cls;
-  struct AddressInfo *ai = value;
-
-  if (ai->expired)
-    return GNUNET_YES; /* expired do not count here */
-  if (0 ==
-      GNUNET_HELLO_address_cmp (fc->address,
-                                ai->address))
-  {
-    fc->ret = ai;
-    return GNUNET_NO;
-  }
-  return GNUNET_YES;
-}
-
-
-/**
- * Find the address information struct for the
- * given address (ignoring sessions)
- *
- * @param address address to look for
- * @return NULL if this combination is unknown
- */
-static struct AddressInfo *
-find_ai_no_session (const struct GNUNET_HELLO_Address *address)
-{
-  struct FindClosure fc;
-
-  fc.address = address;
-  fc.session = NULL;
-  fc.ret = NULL;
-  GNUNET_CONTAINER_multipeermap_get_multiple (p2a,
-                                              &address->peer,
-                                              &find_ai_no_session_cb,
-                                              &fc);
-  return fc.ret;
-}
-
-
-/**
- * Test if ATS knows about this @a address and @a session.
- * Note that even if the address is expired, we return
- * #GNUNET_YES if the respective session matches.
- *
- * @param address the address
- * @param session the session
- * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
- */
-int
-GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
-                  struct GNUNET_ATS_Session *session)
-{
-  return (NULL != find_ai (address, session)) ? GNUNET_YES : GNUNET_NO;
-}
-
-
-/**
- * Test if ATS knows about this @a address.  Note that
- * expired addresses do not count.
- *
- * @param address the address
- * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
- */
-int
-GST_ats_is_known_no_session (const struct GNUNET_HELLO_Address *address)
-{
-  return (NULL != find_ai_no_session (address))
-         ? GNUNET_YES
-         : GNUNET_NO;
-}
-
-
-/**
- * The blocking time for an address has expired, allow ATS to
- * suggest it again.
- *
- * @param cls the `struct AddressInfo` of the address to unblock
- */
-static void
-unblock_address (void *cls)
-{
-  struct AddressInfo *ai = cls;
-
-  ai->unblock_task = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Unblocking address %s of peer %s\n",
-       GST_plugins_a2s (ai->address),
-       GNUNET_i2s (&ai->address->peer));
-  ai->ar = GNUNET_ATS_address_add (GST_ats,
-                                   ai->address,
-                                   ai->session,
-                                   &ai->properties);
-  GNUNET_break (NULL != ai->ar);
-  num_blocked--;
-  publish_p2a_stat_update ();
-}
-
-
-/**
- * Temporarily block a valid address for use by ATS for address
- * suggestions.  This function should be called if an address was
- * suggested by ATS but failed to perform (i.e. failure to establish a
- * session or to exchange the PING/PONG).
- *
- * @param address the address to block
- * @param session the session (can be NULL)
- */
-void
-GST_ats_block_address (const struct GNUNET_HELLO_Address *address,
-                       struct GNUNET_ATS_Session *session)
-{
-  struct AddressInfo *ai;
-
-  if (0 ==
-      memcmp (&GST_my_identity,
-              &address->peer,
-              sizeof(struct GNUNET_PeerIdentity)))
-    return; /* our own, ignore! */
-  ai = find_ai (address,
-                session);
-  if ((NULL == ai) || (NULL == ai->ar))
-  {
-    /* The address is already gone/blocked, this can happen during a blacklist
-     * callback. */
-    return;
-  }
-  ai->back_off = GNUNET_TIME_STD_BACKOFF (ai->back_off);
-  if (GNUNET_YES ==
-      GNUNET_HELLO_address_check_option (address,
-                                         GNUNET_HELLO_ADDRESS_INFO_INBOUND))
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Removing address %s of peer %s from use (inbound died)\n",
-         GST_plugins_a2s (address),
-         GNUNET_i2s (&address->peer));
-  else
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         "Blocking address %s of peer %s from use for %s\n",
-         GST_plugins_a2s (address),
-         GNUNET_i2s (&address->peer),
-         GNUNET_STRINGS_relative_time_to_string (ai->back_off,
-                                                 GNUNET_YES));
-  /* destroy session and address */
-  if ((NULL == session) ||
-      (GNUNET_NO ==
-       GNUNET_ATS_address_del_session (ai->ar,
-                                       session)))
-  {
-    GNUNET_ATS_address_destroy (ai->ar);
-  }
-  /* "ar" has been freed, regardless how the branch
-     above played out: it was either freed in
-   #GNUNET_ATS_address_del_session() because it was
-     incoming, or explicitly in
-   #GNUNET_ATS_address_del_session(). */ai->ar = NULL;
-
-  /* determine when the address should come back to life */
-  ai->blocked = GNUNET_TIME_relative_to_absolute (ai->back_off);
-  ai->unblock_task = GNUNET_SCHEDULER_add_delayed (ai->back_off,
-                                                   &unblock_address,
-                                                   ai);
-  num_blocked++;
-  publish_p2a_stat_update ();
-}
-
-
-/**
- * Reset address blocking time.  Resets the exponential
- * back-off timer for this address to zero.  Called when
- * an address was used to create a successful connection.
- *
- * @param address the address to reset the blocking timer
- * @param session the session (can be NULL)
- */
-void
-GST_ats_block_reset (const struct GNUNET_HELLO_Address *address,
-                     struct GNUNET_ATS_Session *session)
-{
-  struct AddressInfo *ai;
-
-  if (0 ==
-      memcmp (&GST_my_identity,
-              &address->peer,
-              sizeof(struct GNUNET_PeerIdentity)))
-    return; /* our own, ignore! */
-  ai = find_ai (address, session);
-  if (NULL == ai)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  /* address is in successful use, so it should not be blocked right now */
-  GNUNET_break (NULL == ai->unblock_task);
-  ai->back_off = GNUNET_TIME_UNIT_ZERO;
-}
-
-
-/**
- * Notify ATS about a new inbound @a address. The @a address in
- * combination with the @a session must be new, but this function will
- * perform a santiy check.  If the @a address is indeed new, make it
- * available to ATS.
- *
- * @param address the address
- * @param session the session
- * @param prop performance information
- */
-void
-GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address,
-                             struct GNUNET_ATS_Session *session,
-                             const struct GNUNET_ATS_Properties *prop)
-{
-  struct GNUNET_ATS_AddressRecord *ar;
-  struct AddressInfo *ai;
-
-  if (0 ==
-      memcmp (&GST_my_identity,
-              &address->peer,
-              sizeof(struct GNUNET_PeerIdentity)))
-    return; /* our own, ignore! */
-
-  /* Sanity checks for a valid inbound address */
-  if (NULL == address->transport_name)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
-  GNUNET_assert (GNUNET_YES ==
-                 GNUNET_HELLO_address_check_option (address,
-                                                    
GNUNET_HELLO_ADDRESS_INFO_INBOUND));
-  GNUNET_assert (NULL != session);
-  ai = find_ai (address, session);
-  if (NULL != ai)
-  {
-    /* This should only be called for new sessions, and thus
-       we should not already have the address */
-    GNUNET_break (0);
-    return;
-  }
-  /* Is indeed new, let's tell ATS */
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Notifying ATS about peer `%s''s new inbound address `%s' session %p in 
network %s\n",
-       GNUNET_i2s (&address->peer),
-       GST_plugins_a2s (address),
-       session,
-       GNUNET_NT_to_string (prop->scope));
-  ar = GNUNET_ATS_address_add (GST_ats,
-                               address,
-                               session,
-                               prop);
-  GNUNET_assert (NULL != ar);
-  ai = GNUNET_new (struct AddressInfo);
-  ai->address = GNUNET_HELLO_address_copy (address);
-  ai->session = session;
-  ai->properties = *prop;
-  ai->ar = ar;
-  (void) GNUNET_CONTAINER_multipeermap_put (p2a,
-                                            &ai->address->peer,
-                                            ai,
-                                            
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  publish_p2a_stat_update ();
-}
-
-
-void
-GST_ats_add_address (const struct GNUNET_HELLO_Address *address,
-                     const struct GNUNET_ATS_Properties *prop)
-{
-  struct GNUNET_ATS_AddressRecord *ar;
-  struct AddressInfo *ai;
-
-  if (0 ==
-      memcmp (&GST_my_identity,
-              &address->peer,
-              sizeof(struct GNUNET_PeerIdentity)))
-    return; /* our own, ignore! */
-  /* validadte address */
-  if (NULL == address->transport_name)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GNUNET_assert (GNUNET_YES !=
-                 GNUNET_HELLO_address_check_option (address,
-                                                    
GNUNET_HELLO_ADDRESS_INFO_INBOUND));
-  ai = find_ai_no_session (address);
-  GNUNET_assert (NULL == ai);
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
-
-  /* address seems sane, let's tell ATS */
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "Notifying ATS about peer %s's new address `%s'\n",
-       GNUNET_i2s (&address->peer),
-       GST_plugins_a2s (address));
-  ar = GNUNET_ATS_address_add (GST_ats,
-                               address,
-                               NULL,
-                               prop);
-  GNUNET_assert (NULL != ar);
-  ai = GNUNET_new (struct AddressInfo);
-  ai->address = GNUNET_HELLO_address_copy (address);
-  ai->ar = ar;
-  ai->properties = *prop;
-  (void) GNUNET_CONTAINER_multipeermap_put (p2a,
-                                            &ai->address->peer,
-                                            ai,
-                                            
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  publish_p2a_stat_update ();
-}
-
-
-/**
- * Notify ATS about a new @a session now existing for the given
- * @a address.  Essentially, an outbound @a address was used
- * to establish a @a session.  It is safe to call this function
- * repeatedly for the same @a address and @a session pair.
- *
- * @param address the address
- * @param session the session
- */
-void
-GST_ats_new_session (const struct GNUNET_HELLO_Address *address,
-                     struct GNUNET_ATS_Session *session)
-{
-  struct AddressInfo *ai;
-
-  if (0 ==
-      memcmp (&GST_my_identity,
-              &address->peer,
-              sizeof(struct GNUNET_PeerIdentity)))
-    return; /* our own, ignore! */
-  ai = find_ai (address, NULL);
-  if (NULL == ai)
-  {
-    /* We may simply already be aware of the session, even if some
-       other part of the code could not tell if it just created a new
-       session or just got one recycled from the plugin; hence, we may
-       be called with "new" session even for an "old" session; in that
-       case, check that this is the case, but just ignore it. */GNUNET_assert 
(NULL != (find_ai (address, session)));
-    return;
-  }
-  GNUNET_assert (NULL == ai->session);
-  ai->session = session;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Telling ATS about new session for peer %s\n",
-       GNUNET_i2s (&address->peer));
-  /* Note that the address might currently be blocked; we only
-     tell ATS about the session if the address is currently not
-     blocked; otherwise, ATS will be told about the session on
-     unblock. */
-  if (NULL != ai->ar)
-    GNUNET_ATS_address_add_session (ai->ar,
-                                    session);
-  else
-    GNUNET_assert (NULL != ai->unblock_task);
-}
-
-
-/**
- * Release memory used by the given address data.
- *
- * @param ai the `struct AddressInfo`
- */
-static void
-destroy_ai (struct AddressInfo *ai)
-{
-  GNUNET_assert (NULL == ai->session);
-  if (NULL != ai->unblock_task)
-  {
-    GNUNET_SCHEDULER_cancel (ai->unblock_task);
-    ai->unblock_task = NULL;
-    num_blocked--;
-  }
-  GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CONTAINER_multipeermap_remove (p2a,
-                                                       &ai->address->peer,
-                                                       ai));
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Telling ATS to destroy address from peer %s\n",
-       GNUNET_i2s (&ai->address->peer));
-  if (NULL != ai->ar)
-  {
-    GNUNET_ATS_address_destroy (ai->ar);
-    ai->ar = NULL;
-  }
-  publish_p2a_stat_update ();
-  GNUNET_HELLO_address_free (ai->address);
-  GNUNET_free (ai);
-}
-
-
-/**
- * Notify ATS that the @a session (but not the @a address) of
- * a given @a address is no longer relevant. (The @a session
- * went down.)  This function may be called even if for the
- * respective outbound address #GST_ats_new_session() was
- * never called and thus the pair is unknown to ATS. In this
- * case, the call is simply ignored.
- *
- * @param address the address
- * @param session the session
- */
-void
-GST_ats_del_session (const struct GNUNET_HELLO_Address *address,
-                     struct GNUNET_ATS_Session *session)
-{
-  struct AddressInfo *ai;
-
-  if (0 ==
-      memcmp (&GST_my_identity,
-              &address->peer,
-              sizeof(struct GNUNET_PeerIdentity)))
-    return; /* our own, ignore! */
-  if (NULL == session)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  ai = find_ai (address,
-                session);
-  if (NULL == ai)
-  {
-    /* We sometimes create sessions just for sending a PING,
-       and if those are destroyed they were never known to
-       ATS which means we end up here (however, in this
-       case, the address must be an outbound address). */
-    GNUNET_break (GNUNET_YES !=
-                  GNUNET_HELLO_address_check_option (address,
-                                                     
GNUNET_HELLO_ADDRESS_INFO_INBOUND));
-    return;
-  }
-  GNUNET_assert (session == ai->session);
-  ai->session = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Telling ATS to destroy session %p from peer %s\n",
-       session,
-       GNUNET_i2s (&address->peer));
-  if (GNUNET_YES == ai->expired)
-  {
-    /* last reason to keep this 'ai' around is now gone, the
-       session is dead as well, clean up */
-    if (NULL != ai->ar)
-    {
-      /* Address expired but not blocked, and thus 'ar' was still
-         live because of the session; deleting just the session
-         will do for an inbound session, but for an outbound we
-         then also need to destroy the address with ATS. */
-      if (GNUNET_NO ==
-          GNUNET_ATS_address_del_session (ai->ar,
-                                          session))
-      {
-        GNUNET_ATS_address_destroy (ai->ar);
-      }
-      /* "ar" has been freed, regardless how the branch
-         above played out: it was either freed in
-       #GNUNET_ATS_address_del_session() because it was
-         incoming, or explicitly in
-       #GNUNET_ATS_address_del_session(). */ai->ar = NULL;
-    }
-    destroy_ai (ai);
-    return;
-  }
-
-  if (NULL == ai->ar)
-  {
-    /* If ATS doesn't know about the address/session, this means
-       this address was blocked. */
-    if (GNUNET_YES ==
-        GNUNET_HELLO_address_check_option (address,
-                                           GNUNET_HELLO_ADDRESS_INFO_INBOUND))
-    {
-      /* This was a blocked inbound session, which now lost the
-         session.  But inbound addresses are by themselves useless,
-         so we must forget about the address as well. */
-      destroy_ai (ai);
-      return;
-    }
-    /* Otherwise, we are done as we have set `ai->session` to NULL
-       already and ATS will simply not be told about the session when
-       the connection is unblocked and the outbound address becomes
-       available again. . */
-    return;
-  }
-
-  /* This is the "simple" case where ATS knows about the session and
-     the address is neither blocked nor expired.  Delete the session,
-     and if it was inbound, free the address as well. */
-  if (GNUNET_YES ==
-      GNUNET_ATS_address_del_session (ai->ar,
-                                      session))
-  {
-    /* This was an inbound address, the session is now gone, so we
-       need to also forget about the address itself. */
-    ai->ar = NULL;
-    destroy_ai (ai);
-  }
-}
-
-
-/**
- * Notify ATS about DV @a distance change to an @a address.
- * Does nothing if the @a address is not known to us.
- *
- * @param address the address
- * @param distance new distance value
- */
-void
-GST_ats_update_distance (const struct GNUNET_HELLO_Address *address,
-                         uint32_t distance)
-{
-  struct AddressInfo *ai;
-
-  ai = find_ai_no_session (address);
-  if (NULL == ai)
-  {
-    /* We do not know about this address, do nothing. */
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Updated distance for peer `%s' to %u\n",
-       GNUNET_i2s (&address->peer),
-       distance);
-  ai->properties.distance = distance;
-  /* Give manipulation its chance to change metrics */
-  GST_manipulation_manipulate_metrics (address,
-                                       ai->session,
-                                       &ai->properties);
-  /* Address may be blocked, only give ATS if address is
-     currently active. */
-  if (NULL != ai->ar)
-    GNUNET_ATS_address_update (ai->ar,
-                               &ai->properties);
-}
-
-
-void
-GST_ats_update_delay (const struct GNUNET_HELLO_Address *address,
-                      struct GNUNET_TIME_Relative delay)
-{
-  struct AddressInfo *ai;
-
-  ai = find_ai_no_session (address);
-  if (NULL == ai)
-  {
-    /* We do not know about this address, do nothing. */
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Updated latency for peer `%s' to %s\n",
-       GNUNET_i2s (&address->peer),
-       GNUNET_STRINGS_relative_time_to_string (delay,
-                                               GNUNET_YES));
-  ai->properties.delay = delay;
-  /* Give manipulation its chance to change metrics */
-  GST_manipulation_manipulate_metrics (address,
-                                       ai->session,
-                                       &ai->properties);
-  /* Address may be blocked, only give ATS if address is
-     currently active. */
-  if (NULL != ai->ar)
-    GNUNET_ATS_address_update (ai->ar,
-                               &ai->properties);
-}
-
-
-/**
- * Notify ATS about utilization changes to an @a address.
- * Does nothing if the @a address is not known to us.
- *
- * @param address our information about the address
- * @param bps_in new utilization inbound
- * @param bps_out new utilization outbound
- */
-void
-GST_ats_update_utilization (const struct GNUNET_HELLO_Address *address,
-                            uint32_t bps_in,
-                            uint32_t bps_out)
-{
-  struct AddressInfo *ai;
-
-  ai = find_ai_no_session (address);
-  if (NULL == ai)
-  {
-    /* We do not know about this address, do nothing. */
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Updating utilization for peer `%s' address %s: %u/%u\n",
-       GNUNET_i2s (&address->peer),
-       GST_plugins_a2s (address),
-       (unsigned int) bps_in,
-       (unsigned int) bps_out);
-  ai->properties.utilization_in = bps_in;
-  ai->properties.utilization_out = bps_out;
-  /* Give manipulation its chance to change metrics */
-  GST_manipulation_manipulate_metrics (address,
-                                       ai->session,
-                                       &ai->properties);
-  /* Address may be blocked, only give ATS if address is
-     currently active. */
-  if (NULL != ai->ar)
-    GNUNET_ATS_address_update (ai->ar,
-                               &ai->properties);
-}
-
-
-/**
- * Notify ATS that the address has expired and thus cannot
- * be used any longer.  This function must only be called
- * if the corresponding session is already gone.
- *
- * @param address the address
- */
-void
-GST_ats_expire_address (const struct GNUNET_HELLO_Address *address)
-{
-  struct AddressInfo *ai;
-
-  if (0 ==
-      memcmp (&GST_my_identity,
-              &address->peer,
-              sizeof(struct GNUNET_PeerIdentity)))
-    return; /* our own, ignore! */
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Address %s of peer %s expired\n",
-       GST_plugins_a2s (address),
-       GNUNET_i2s (&address->peer));
-  ai = find_ai_no_session (address);
-  if (NULL == ai)
-  {
-    GNUNET_assert (0);
-    return;
-  }
-  if (NULL != ai->session)
-  {
-    /* Got an active session, just remember the expiration
-       and act upon it when the session goes down. */
-    ai->expired = GNUNET_YES;
-    return;
-  }
-  /* Address expired, no session, free resources */
-  destroy_ai (ai);
-}
-
-
-/**
- * Initialize ATS subsystem.
- */
-void
-GST_ats_init ()
-{
-  p2a = GNUNET_CONTAINER_multipeermap_create (4, GNUNET_YES);
-}
-
-
-/**
- * Release memory used by the given address data.
- *
- * @param cls NULL
- * @param key which peer is this about
- * @param value the `struct AddressInfo`
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-destroy_ai_cb (void *cls,
-               const struct GNUNET_PeerIdentity *key,
-               void *value)
-{
-  struct AddressInfo *ai = value;
-
-  destroy_ai (ai);
-  return GNUNET_OK;
-}
-
-
-/**
- * Shutdown ATS subsystem.
- */
-void
-GST_ats_done ()
-{
-  GNUNET_CONTAINER_multipeermap_iterate (p2a,
-                                         &destroy_ai_cb,
-                                         NULL);
-  publish_p2a_stat_update ();
-  GNUNET_CONTAINER_multipeermap_destroy (p2a);
-  p2a = NULL;
-}
-
-
-/* end of gnunet-service-transport_ats.c */
diff --git a/src/transport/gnunet-service-transport_ats.h 
b/src/transport/gnunet-service-transport_ats.h
deleted file mode 100644
index ca972d1cc..000000000
--- a/src/transport/gnunet-service-transport_ats.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/gnunet-service-transport_ats.h
- * @brief interfacing between transport and ATS service
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_TRANSPORT_ATS_H
-#define GNUNET_SERVICE_TRANSPORT_ATS_H
-
-#include "gnunet_ats_service.h"
-
-/**
- * Initialize ATS subsystem.
- */
-void
-GST_ats_init (void);
-
-
-/**
- * Shutdown ATS subsystem.
- */
-void
-GST_ats_done (void);
-
-
-/**
- * Test if ATS knows about this @a address and @a session.
- * Note that even if the address is expired, we return
- * #GNUNET_YES if the respective session matches.
- *
- * @param address the address
- * @param session the session
- * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
- */
-int
-GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
-                  struct GNUNET_ATS_Session *session);
-
-
-/**
- * Test if ATS knows about this @a address.  Note that
- * expired addresses do not count.
- *
- * @param address the address
- * @return #GNUNET_YES if @a address is known, #GNUNET_NO if not.
- */
-int
-GST_ats_is_known_no_session (const struct GNUNET_HELLO_Address *address);
-
-
-/**
- * Temporarily block a valid address for use by ATS for address
- * suggestions.  This function should be called if an address was
- * suggested by ATS but failed to perform (i.e. failure to establish a
- * session or to exchange the PING/PONG).
- *
- * @param address the address to block
- * @param session the session (can be NULL)
- */
-void
-GST_ats_block_address (const struct GNUNET_HELLO_Address *address,
-                       struct GNUNET_ATS_Session *session);
-
-
-/**
- * Reset address blocking time.  Resets the exponential
- * back-off timer for this address to zero.  Called when
- * an address was used to create a successful connection.
- *
- * @param address the address to reset the blocking timer
- * @param session the session (can be NULL)
- */
-void
-GST_ats_block_reset (const struct GNUNET_HELLO_Address *address,
-                     struct GNUNET_ATS_Session *session);
-
-
-/**
- * Notify ATS about a new inbound @a address. The @a address in
- * combination with the @a session must be new, but this function will
- * perform a santiy check.  If the @a address is indeed new, make it
- * available to ATS.
- *
- * @param address the address
- * @param session the session
- * @param prop performance information
- */
-void
-GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address,
-                             struct GNUNET_ATS_Session *session,
-                             const struct GNUNET_ATS_Properties *prop);
-
-
-/**
- * Notify ATS about a new address including the network the address is
- * located in.  The address must NOT be inbound and must be new to ATS.
- *
- * @param address the address
- * @param prop performance information
- */
-void
-GST_ats_add_address (const struct GNUNET_HELLO_Address *address,
-                     const struct GNUNET_ATS_Properties *prop);
-
-
-/**
- * Notify ATS about a new @a session now existing for the given
- * @a address.  Essentially, an outbound @a address was used
- * to establish a @a session.  It is safe to call this function
- * repeatedly for the same @a address and @a session pair.
- *
- * @param address the address
- * @param session the session
- */
-void
-GST_ats_new_session (const struct GNUNET_HELLO_Address *address,
-                     struct GNUNET_ATS_Session *session);
-
-
-/**
- * Notify ATS about utilization changes to an @a address.
- * Does nothing if the @a address is not known to us.
- *
- * @param address our information about the address
- * @param bps_in new utilization inbound
- * @param bps_out new utilization outbound
- */
-void
-GST_ats_update_utilization (const struct GNUNET_HELLO_Address *address,
-                            uint32_t bps_in,
-                            uint32_t bps_out);
-
-
-/**
- * Notify ATS about @a delay changes to properties of an @a address.
- * Does nothing if the @a address is not known to us.
- *
- * @param address the address
- * @param delay new delay value
- */
-void
-GST_ats_update_delay (const struct GNUNET_HELLO_Address *address,
-                      struct GNUNET_TIME_Relative delay);
-
-
-/**
- * Notify ATS about DV @a distance change to an @a address.
- * Does nothing if the @a address is not known to us.
- *
- * @param address the address
- * @param distance new distance value
- */
-void
-GST_ats_update_distance (const struct GNUNET_HELLO_Address *address,
-                         uint32_t distance);
-
-
-/**
- * Notify ATS that the @a session (but not the @a address) of
- * a given @a address is no longer relevant. (The @a session
- * went down.) This function may be called even if for the
- * respective outbound address #GST_ats_new_session() was
- * never called and thus the pair is unknown to ATS. In this
- * case, the call is simply ignored.
- *
- * @param address the address
- * @param session the session
- */
-void
-GST_ats_del_session (const struct GNUNET_HELLO_Address *address,
-                     struct GNUNET_ATS_Session *session);
-
-
-/**
- * Notify ATS that the address has expired and thus cannot
- * be used any longer.  This function must only be called
- * if the corresponding session is already gone.
- *
- * @param address the address
- */
-void
-GST_ats_expire_address (const struct GNUNET_HELLO_Address *address);
-
-
-#endif
diff --git a/src/transport/gnunet-service-transport_hello.c 
b/src/transport/gnunet-service-transport_hello.c
deleted file mode 100644
index 1e5e8a225..000000000
--- a/src/transport/gnunet-service-transport_hello.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010,2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/gnunet-service-transport_hello.c
- * @brief hello management implementation
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_constants.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet-service-transport_hello.h"
-#include "gnunet-service-transport.h"
-#include "gnunet-service-transport_plugins.h"
-
-
-/**
- * How often do we refresh our HELLO (due to expiration concerns)?
- */
-#define HELLO_REFRESH_PERIOD GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_HOURS, 6)
-
-/**
- * Hello address expiration
- */
-extern struct GNUNET_TIME_Relative hello_expiration;
-
-
-/**
- * Entry in linked list of network addresses for ourselves.  Also
- * includes a cached signature for 'struct TransportPongMessage's.
- */
-struct OwnAddressList
-{
-  /**
-   * This is a doubly-linked list.
-   */
-  struct OwnAddressList *next;
-
-  /**
-   * This is a doubly-linked list.
-   */
-  struct OwnAddressList *prev;
-
-  /**
-   * The address.
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * How long until the current signature expires? (ZERO if the
-   * signature was never created).
-   */
-  struct GNUNET_TIME_Absolute pong_sig_expires;
-
-  /**
-   * Signature for a 'struct TransportPongMessage' for this address.
-   */
-  struct GNUNET_CRYPTO_EddsaSignature pong_signature;
-
-  /**
-   * How often has this address been added/removed? Used as
-   * some plugins may learn the same external address from
-   * multiple origins.
-   */
-  unsigned int rc;
-};
-
-
-/**
- * Our HELLO message.
- */
-static struct GNUNET_HELLO_Message *our_hello;
-
-/**
- * Function to call on HELLO changes.
- */
-static GST_HelloCallback hello_cb;
-
-/**
- * Closure for #hello_cb.
- */
-static void *hello_cb_cls;
-
-/**
- * Head of my addresses.
- */
-static struct OwnAddressList *oal_head;
-
-/**
- * Tail of my addresses.
- */
-static struct OwnAddressList *oal_tail;
-
-/**
- * Should we use a friend-only HELLO?
- */
-static int friend_option;
-
-/**
- * Identifier of #refresh_hello_task().
- */
-static struct GNUNET_SCHEDULER_Task *hello_task;
-
-
-/**
- * Closure for #address_generator().
- */
-struct GeneratorContext
-{
-  /**
-   * Where are we in the DLL?
-   */
-  struct OwnAddressList *addr_pos;
-
-  /**
-   * When do addresses expire?
-   */
-  struct GNUNET_TIME_Absolute expiration;
-};
-
-
-/**
- * Add an address from the `struct OwnAddressList` to the buffer.
- *
- * @param cls the `struct GeneratorContext`
- * @param max maximum number of bytes left
- * @param buf where to write the address
- * @return bytes written or #GNUNET_SYSERR to signal the
- *         end of the iteration.
- */
-static ssize_t
-address_generator (void *cls,
-                   size_t max,
-                   void *buf)
-{
-  struct GeneratorContext *gc = cls;
-  ssize_t ret;
-
-  if (NULL == gc->addr_pos)
-    return GNUNET_SYSERR; /* Done */
-  ret = GNUNET_HELLO_add_address (gc->addr_pos->address,
-                                  gc->expiration,
-                                  buf,
-                                  max);
-  gc->addr_pos = gc->addr_pos->next;
-  return ret;
-}
-
-
-/**
- * Construct our HELLO message from all of the addresses of
- * all of the transports.
- *
- * @param cls unused
- */
-static void
-refresh_hello_task (void *cls)
-{
-  struct GeneratorContext gc;
-
-  hello_task = NULL;
-  gc.addr_pos = oal_head;
-  gc.expiration = GNUNET_TIME_relative_to_absolute (hello_expiration);
-
-  GNUNET_free (our_hello);
-  our_hello = GNUNET_HELLO_create (&GST_my_identity.public_key,
-                                   &address_generator,
-                                   &gc,
-                                   friend_option);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Refreshed my %s HELLO, new size is %d\n",
-              (GNUNET_YES == friend_option) ? "friend-only" : "public",
-              GNUNET_HELLO_size (our_hello));
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop ("# refreshed my HELLO"),
-                            1,
-                            GNUNET_NO);
-  if (NULL != hello_cb)
-    hello_cb (hello_cb_cls,
-              GST_hello_get ());
-  GNUNET_PEERINFO_add_peer (GST_peerinfo,
-                            our_hello,
-                            NULL,
-                            NULL);
-  hello_task =
-    GNUNET_SCHEDULER_add_delayed (HELLO_REFRESH_PERIOD,
-                                  &refresh_hello_task,
-                                  NULL);
-}
-
-
-/**
- * Schedule task to refresh hello (but only if such a
- * task exists already, as otherwise the module might
- * have been shutdown).
- */
-static void
-refresh_hello ()
-{
-  if (NULL != hello_task)
-  {
-    GNUNET_SCHEDULER_cancel (hello_task);
-    hello_task = GNUNET_SCHEDULER_add_now (&refresh_hello_task,
-                                           NULL);
-  }
-}
-
-
-/**
- * Initialize the HELLO module.
- *
- * @param friend_only use a friend only hello
- * @param cb function to call whenever our HELLO changes
- * @param cb_cls closure for @a cb
- */
-void
-GST_hello_start (int friend_only,
-                 GST_HelloCallback cb,
-                 void *cb_cls)
-{
-  hello_cb = cb;
-  hello_cb_cls = cb_cls;
-  friend_option = friend_only;
-  refresh_hello_task (NULL);
-}
-
-
-/**
- * Shutdown the HELLO module.
- */
-void
-GST_hello_stop ()
-{
-  hello_cb = NULL;
-  hello_cb_cls = NULL;
-  if (NULL != hello_task)
-  {
-    GNUNET_SCHEDULER_cancel (hello_task);
-    hello_task = NULL;
-  }
-  if (NULL != our_hello)
-  {
-    GNUNET_free (our_hello);
-    our_hello = NULL;
-  }
-}
-
-
-/**
- * Obtain this peers HELLO message.
- *
- * @return our HELLO message
- */
-const struct GNUNET_MessageHeader *
-GST_hello_get ()
-{
-  return (const struct GNUNET_MessageHeader *) our_hello;
-}
-
-
-/**
- * Add or remove an address from this peer's HELLO message.
- *
- * @param addremove #GNUNET_YES to add, #GNUNET_NO to remove
- * @param address address to add or remove
- */
-void
-GST_hello_modify_addresses (int addremove,
-                            const struct GNUNET_HELLO_Address *address)
-{
-  struct OwnAddressList *al;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              (GNUNET_YES == addremove)
-              ? "Adding `%s' to the set of our addresses\n"
-              : "Removing `%s' from the set of our addresses\n",
-              GST_plugins_a2s (address));
-  GNUNET_assert (NULL != address);
-  for (al = oal_head; al != NULL; al = al->next)
-    if (0 == GNUNET_HELLO_address_cmp (address, al->address))
-      break;
-  if (GNUNET_NO == addremove)
-  {
-    if (NULL == al)
-    {
-      /* address to be removed not found!? */
-      GNUNET_break (0);
-      return;
-    }
-    al->rc--;
-    if (0 != al->rc)
-      return;   /* RC not yet zero */
-    GNUNET_CONTAINER_DLL_remove (oal_head,
-                                 oal_tail,
-                                 al);
-    GNUNET_HELLO_address_free (al->address);
-    GNUNET_free (al);
-    refresh_hello ();
-    return;
-  }
-  if (NULL != al)
-  {
-    /* address added twice or more */
-    al->rc++;
-    return;
-  }
-  al = GNUNET_new (struct OwnAddressList);
-  al->rc = 1;
-  GNUNET_CONTAINER_DLL_insert (oal_head,
-                               oal_tail,
-                               al);
-  al->address = GNUNET_HELLO_address_copy (address);
-  refresh_hello ();
-}
-
-
-int
-GST_hello_test_address (const struct GNUNET_HELLO_Address *address,
-                        struct GNUNET_CRYPTO_EddsaSignature **sig,
-                        struct GNUNET_TIME_Absolute **sig_expiration)
-{
-  struct OwnAddressList *al;
-
-  for (al = oal_head; al != NULL; al = al->next)
-    if (0 == GNUNET_HELLO_address_cmp (address,
-                                       al->address))
-    {
-      *sig = &al->pong_signature;
-      *sig_expiration = &al->pong_sig_expires;
-      return GNUNET_YES;
-    }
-  *sig = NULL;
-  *sig_expiration = NULL;
-  return GNUNET_NO;
-}
-
-
-/* end of file gnunet-service-transport_hello.c */
diff --git a/src/transport/gnunet-service-transport_hello.h 
b/src/transport/gnunet-service-transport_hello.h
deleted file mode 100644
index be089dd35..000000000
--- a/src/transport/gnunet-service-transport_hello.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010,2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/gnunet-service-transport_hello.h
- * @brief hello API
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_TRANSPORT_HELLO_H
-#define GNUNET_SERVICE_TRANSPORT_HELLO_H
-
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-
-
-/**
- * Signature of a function to call whenever our hello changes.
- *
- * @param cls closure
- * @param hello updated HELLO
- */
-typedef void
-(*GST_HelloCallback) (void *cls,
-                      const struct GNUNET_MessageHeader *hello);
-
-
-/**
- * Initialize the HELLO module.
- *
- * @param friend_only use a friend only hello
- * @param cb function to call whenever our HELLO changes
- * @param cb_cls closure for @a cb
- */
-void
-GST_hello_start (int friend_only,
-                 GST_HelloCallback cb,
-                 void *cb_cls);
-
-
-/**
- * Shutdown the HELLO module.
- */
-void
-GST_hello_stop (void);
-
-
-/**
- * Obtain this peers HELLO message.
- *
- * @return our HELLO message
- */
-const struct GNUNET_MessageHeader *
-GST_hello_get (void);
-
-
-/**
- * Add or remove an address from this peer's HELLO message.
- *
- * @param addremove #GNUNET_YES to add, #GNUNET_NO to remove
- * @param address address to add or remove
- */
-void
-GST_hello_modify_addresses (int addremove,
-                            const struct GNUNET_HELLO_Address *address);
-
-
-/**
- * Test if a particular address is one of ours.
- *
- * @param address the address to test
- * @param sig location where to cache PONG signatures for this address [set]
- * @param sig_expiration how long until the current 'sig' expires?
- *            (ZERO if sig was never created) [set]
- * @return #GNUNET_YES if this is one of our addresses,
- *         #GNUNET_NO if not
- */
-int
-GST_hello_test_address (const struct GNUNET_HELLO_Address *address,
-                        struct GNUNET_CRYPTO_EddsaSignature **sig,
-                        struct GNUNET_TIME_Absolute **sig_expiration);
-
-
-#endif
-/* end of file gnunet-service-transport_hello.h */
diff --git a/src/transport/gnunet-service-transport_manipulation.c 
b/src/transport/gnunet-service-transport_manipulation.c
deleted file mode 100644
index 9f39b2dca..000000000
--- a/src/transport/gnunet-service-transport_manipulation.c
+++ /dev/null
@@ -1,586 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010-2013 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/gnunet-service-transport_manipulation.c
- * @brief transport component manipulation traffic for simulation
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet-service-transport_hello.h"
-#include "gnunet-service-transport_neighbours.h"
-#include "gnunet-service-transport_plugins.h"
-#include "gnunet-service-transport_validation.h"
-#include "gnunet-service-transport.h"
-#include "transport.h"
-
-
-/**
- * Struct containing information about manipulations to a specific peer
- */
-struct TM_Peer
-{
-  /**
-   * Peer ID
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * How long to delay incoming messages for this peer.
-   */
-  struct GNUNET_TIME_Relative delay_in;
-
-  /**
-   * How long to delay outgoing messages for this peer.
-   */
-  struct GNUNET_TIME_Relative delay_out;
-
-  /**
-   * Manipulated properties to use for this peer.
-   */
-  struct GNUNET_ATS_Properties properties;
-
-  /**
-   * Task to schedule delayed sendding
-   */
-  struct GNUNET_SCHEDULER_Task *send_delay_task;
-
-  /**
-   * Send queue DLL head
-   */
-  struct DelayQueueEntry *send_head;
-
-  /**
-   * Send queue DLL tail
-   */
-  struct DelayQueueEntry *send_tail;
-};
-
-
-/**
- * Entry in the delay queue for an outbound delayed message
- */
-struct DelayQueueEntry
-{
-  /**
-   * Next in DLL
-   */
-  struct DelayQueueEntry *prev;
-
-  /**
-   * Previous in DLL
-   */
-  struct DelayQueueEntry *next;
-
-  /**
-   * Peer this entry is belonging to if (NULL == tmp): enqueued in
-   * generic DLL and scheduled by generic_send_delay_task else:
-   * enqueued in tmp->send_head and tmp->send_tail and scheduled by
-   * tmp->send_delay_task
-   */
-  struct TM_Peer *tmp;
-
-  /**
-   * Peer ID
-   */
-  struct GNUNET_PeerIdentity id;
-
-  /**
-   * Absolute time when to send
-   */
-  struct GNUNET_TIME_Absolute sent_at;
-
-  /**
-   * The message
-   */
-  void *msg;
-
-  /**
-   * The message size
-   */
-  size_t msg_size;
-
-  /**
-   * Message timeout
-   */
-  struct GNUNET_TIME_Relative timeout;
-
-  /**
-   * Transports send continuation
-   */
-  GST_NeighbourSendContinuation cont;
-
-  /**
-   * Transports send continuation cls
-   */
-  void *cont_cls;
-};
-
-/**
- * Hashmap contain all peers currently manipulated
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *peers;
-
-/**
- * Inbound delay to apply to all peers.
- */
-static struct GNUNET_TIME_Relative delay_in;
-
-/**
- * Outbound delay to apply to all peers.
- */
-static struct GNUNET_TIME_Relative delay_out;
-
-/**
- * DLL head for delayed messages based on general delay
- */
-static struct DelayQueueEntry *generic_dqe_head;
-
-/**
- * DLL tail for delayed messages based on general delay
- */
-static struct DelayQueueEntry *generic_dqe_tail;
-
-/**
- * Task to schedule delayed sending based on general delay
- */
-static struct GNUNET_SCHEDULER_Task *generic_send_delay_task;
-
-
-/**
- * Set traffic metric to manipulate
- *
- * @param tm message containing information
- */
-void
-GST_manipulation_set_metric (const struct TrafficMetricMessage *tm)
-{
-  static struct GNUNET_PeerIdentity zero;
-  struct TM_Peer *tmp;
-
-  if (0 == memcmp (&tm->peer,
-                   &zero,
-                   sizeof(struct GNUNET_PeerIdentity)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Received traffic metrics for all peers\n");
-    delay_in = GNUNET_TIME_relative_ntoh (tm->delay_in);
-    delay_out = GNUNET_TIME_relative_ntoh (tm->delay_out);
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received traffic metrics for peer `%s'\n",
-              GNUNET_i2s (&tm->peer));
-  if (NULL ==
-      (tmp = GNUNET_CONTAINER_multipeermap_get (peers,
-                                                &tm->peer)))
-  {
-    tmp = GNUNET_new (struct TM_Peer);
-    tmp->peer = tm->peer;
-    GNUNET_CONTAINER_multipeermap_put (peers,
-                                       &tm->peer,
-                                       tmp,
-                                       
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
-  }
-  GNUNET_ATS_properties_ntoh (&tmp->properties,
-                              &tm->properties);
-  tmp->delay_in = GNUNET_TIME_relative_ntoh (tm->delay_in);
-  tmp->delay_out = GNUNET_TIME_relative_ntoh (tm->delay_out);
-}
-
-
-/**
- * We have delayed transmission, now it is time to send the
- * message.
- *
- * @param cls the `struct DelayQueueEntry` to transmit
- */
-static void
-send_delayed (void *cls)
-{
-  struct DelayQueueEntry *dqe = cls;
-  struct DelayQueueEntry *next;
-  struct TM_Peer *tmp = dqe->tmp;
-
-  GNUNET_break (GNUNET_YES ==
-                GST_neighbours_test_connected (&dqe->id));
-  if (NULL != tmp)
-  {
-    tmp->send_delay_task = NULL;
-    GNUNET_CONTAINER_DLL_remove (tmp->send_head,
-                                 tmp->send_tail,
-                                 dqe);
-    next = tmp->send_head;
-    if (NULL != next)
-    {
-      /* More delayed messages */
-      tmp->send_delay_task = GNUNET_SCHEDULER_add_at (next->sent_at,
-                                                      &send_delayed,
-                                                      next);
-    }
-  }
-  else
-  {
-    /* Remove from generic queue */
-    generic_send_delay_task = NULL;
-    GNUNET_CONTAINER_DLL_remove (generic_dqe_head,
-                                 generic_dqe_tail,
-                                 dqe);
-    next = generic_dqe_head;
-    if (NULL != next)
-    {
-      /* More delayed messages */
-      generic_send_delay_task = GNUNET_SCHEDULER_add_at (next->sent_at,
-                                                         &send_delayed,
-                                                         next);
-    }
-  }
-  GST_neighbours_send (&dqe->id,
-                       dqe->msg,
-                       dqe->msg_size,
-                       dqe->timeout,
-                       dqe->cont,
-                       dqe->cont_cls);
-  GNUNET_free (dqe);
-}
-
-
-/**
- * Adapter function between transport's send function and transport plugins.
- * Delays message transmission if an artificial delay is configured.
- *
- * @param target the peer the message to send to
- * @param msg the message received
- * @param msg_size message size
- * @param timeout timeout
- * @param cont the continuation to call after sending
- * @param cont_cls cls for @a cont
- */
-void
-GST_manipulation_send (const struct GNUNET_PeerIdentity *target,
-                       const void *msg,
-                       size_t msg_size,
-                       struct GNUNET_TIME_Relative timeout,
-                       GST_NeighbourSendContinuation cont,
-                       void *cont_cls)
-{
-  struct TM_Peer *tmp;
-  struct DelayQueueEntry *dqe;
-  struct GNUNET_TIME_Relative delay;
-
-  if (NULL != (tmp =
-                 GNUNET_CONTAINER_multipeermap_get (peers,
-                                                    target)))
-    delay = tmp->delay_out;
-  else
-    delay = delay_out;
-  if (0 == delay.rel_value_us)
-  {
-    /* Normal sending */
-    GST_neighbours_send (target,
-                         msg,
-                         msg_size,
-                         timeout,
-                         cont, cont_cls);
-    return;
-  }
-  dqe = GNUNET_malloc (sizeof(struct DelayQueueEntry) + msg_size);
-  dqe->id = *target;
-  dqe->tmp = tmp;
-  dqe->sent_at = GNUNET_TIME_relative_to_absolute (delay);
-  dqe->cont = cont;
-  dqe->cont_cls = cont_cls;
-  dqe->msg = &dqe[1];
-  dqe->msg_size = msg_size;
-  dqe->timeout = timeout;
-  GNUNET_memcpy (dqe->msg,
-                 msg,
-                 msg_size);
-  if (NULL == tmp)
-  {
-    GNUNET_CONTAINER_DLL_insert_tail (generic_dqe_head,
-                                      generic_dqe_tail,
-                                      dqe);
-    if (NULL == generic_send_delay_task)
-      generic_send_delay_task = GNUNET_SCHEDULER_add_delayed (delay,
-                                                              &send_delayed,
-                                                              dqe);
-  }
-  else
-  {
-    GNUNET_CONTAINER_DLL_insert_tail (tmp->send_head,
-                                      tmp->send_tail,
-                                      dqe);
-    if (NULL == tmp->send_delay_task)
-      tmp->send_delay_task = GNUNET_SCHEDULER_add_delayed (delay,
-                                                           &send_delayed,
-                                                           dqe);
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Delaying %u byte message to peer `%s' with peer specific delay 
for %s\n",
-              (unsigned int) msg_size,
-              GNUNET_i2s (target),
-              GNUNET_STRINGS_relative_time_to_string (delay,
-                                                      GNUNET_YES));
-}
-
-
-/**
- * Function that will be called to manipulate ATS information according to
- * current manipulation settings
- *
- * @param address binary address
- * @param session the session
- * @param[in,out] prop metrics to modify
- */
-void
-GST_manipulation_manipulate_metrics (const struct GNUNET_HELLO_Address 
*address,
-                                     struct GNUNET_ATS_Session *session,
-                                     struct GNUNET_ATS_Properties *prop)
-{
-  const struct GNUNET_PeerIdentity *peer = &address->peer;
-  struct TM_Peer *tmp;
-
-  tmp = GNUNET_CONTAINER_multipeermap_get (peers,
-                                           peer);
-  if (NULL != tmp)
-    *prop = tmp->properties;
-}
-
-
-/**
- * Adapter function between transport plugins and transport receive function
- * manipulation delays for next send.
- *
- * @param cls the closure for transport
- * @param address the address and the peer the message was received from
- * @param message the message received
- * @param session the session the message was received on
- * @return manipulated delay for next receive
- */
-struct GNUNET_TIME_Relative
-GST_manipulation_recv (void *cls,
-                       const struct GNUNET_HELLO_Address *address,
-                       struct GNUNET_ATS_Session *session,
-                       const struct GNUNET_MessageHeader *message)
-{
-  struct TM_Peer *tmp;
-  struct GNUNET_TIME_Relative quota_delay;
-  struct GNUNET_TIME_Relative m_delay;
-
-  if (NULL !=
-      (tmp = GNUNET_CONTAINER_multipeermap_get (peers,
-                                                &address->peer)))
-    m_delay = tmp->delay_in;
-  else
-    m_delay = delay_in;
-
-  quota_delay = GST_receive_callback (cls,
-                                      address,
-                                      session,
-                                      message);
-  m_delay = GNUNET_TIME_relative_max (m_delay,
-                                      quota_delay);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Delaying next receive for peer `%s' for %s\n",
-              GNUNET_i2s (&address->peer),
-              GNUNET_STRINGS_relative_time_to_string (m_delay,
-                                                      GNUNET_YES));
-  return m_delay;
-}
-
-
-/**
- * Initialize traffic manipulation
- */
-void
-GST_manipulation_init ()
-{
-  struct GNUNET_TIME_Relative delay;
-
-  if ((GNUNET_OK ==
-       GNUNET_CONFIGURATION_get_value_time (GST_cfg,
-                                            "transport",
-                                            "MANIPULATE_DELAY_IN",
-                                            &delay)) &&
-      (delay.rel_value_us > 0))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Delaying inbound traffic for %s\n",
-                GNUNET_STRINGS_relative_time_to_string (delay,
-                                                        GNUNET_YES));
-    delay_in = delay;
-  }
-  if ((GNUNET_OK ==
-       GNUNET_CONFIGURATION_get_value_time (GST_cfg,
-                                            "transport",
-                                            "MANIPULATE_DELAY_OUT",
-                                            &delay)) &&
-      (delay.rel_value_us > 0))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Delaying outbound traffic for %s\n",
-                GNUNET_STRINGS_relative_time_to_string (delay,
-                                                        GNUNET_YES));
-    delay_out = delay;
-  }
-  peers = GNUNET_CONTAINER_multipeermap_create (4,
-                                                GNUNET_NO);
-}
-
-
-/**
- * Notify manipulation about disconnect so it can discard queued messages
- *
- * @param peer the disconnecting peer
- */
-void
-GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer)
-{
-  struct TM_Peer *tmp;
-  struct DelayQueueEntry *dqe;
-  struct DelayQueueEntry *next;
-
-  tmp = GNUNET_CONTAINER_multipeermap_get (peers,
-                                           peer);
-  if (NULL != tmp)
-  {
-    while (NULL != (dqe = tmp->send_head))
-    {
-      GNUNET_CONTAINER_DLL_remove (tmp->send_head,
-                                   tmp->send_tail,
-                                   dqe);
-      if (NULL != dqe->cont)
-        dqe->cont (dqe->cont_cls,
-                   GNUNET_SYSERR,
-                   dqe->msg_size,
-                   0);
-      GNUNET_free (dqe);
-    }
-  }
-  next = generic_dqe_head;
-  while (NULL != (dqe = next))
-  {
-    next = dqe->next;
-    if (0 == memcmp (peer,
-                     &dqe->id,
-                     sizeof(dqe->id)))
-    {
-      GNUNET_CONTAINER_DLL_remove (generic_dqe_head,
-                                   generic_dqe_tail,
-                                   dqe);
-      if (NULL != dqe->cont)
-        dqe->cont (dqe->cont_cls,
-                   GNUNET_SYSERR,
-                   dqe->msg_size,
-                   0);
-      GNUNET_free (dqe);
-    }
-  }
-  if (NULL != generic_send_delay_task)
-  {
-    GNUNET_SCHEDULER_cancel (generic_send_delay_task);
-    generic_send_delay_task = NULL;
-    if (NULL != generic_dqe_head)
-      generic_send_delay_task
-        = GNUNET_SCHEDULER_add_at (generic_dqe_head->sent_at,
-                                   &send_delayed,
-                                   generic_dqe_head);
-  }
-}
-
-
-/**
- * Free manipulation information about a peer.
- *
- * @param cls NULL
- * @param key peer the info is about
- * @param value a `struct TM_Peer` to free
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-free_tmps (void *cls,
-           const struct GNUNET_PeerIdentity *key,
-           void *value)
-{
-  struct TM_Peer *tmp = value;
-  struct DelayQueueEntry *dqe;
-
-  GNUNET_break (GNUNET_YES ==
-                GNUNET_CONTAINER_multipeermap_remove (peers,
-                                                      key,
-                                                      value));
-  while (NULL != (dqe = tmp->send_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (tmp->send_head,
-                                 tmp->send_tail,
-                                 dqe);
-    if (NULL != dqe->cont)
-      dqe->cont (dqe->cont_cls,
-                 GNUNET_SYSERR,
-                 dqe->msg_size,
-                 0);
-    GNUNET_free (dqe);
-  }
-  if (NULL != tmp->send_delay_task)
-  {
-    GNUNET_SCHEDULER_cancel (tmp->send_delay_task);
-    tmp->send_delay_task = NULL;
-  }
-  GNUNET_free (tmp);
-  return GNUNET_OK;
-}
-
-
-/**
- * Stop traffic manipulation
- */
-void
-GST_manipulation_stop ()
-{
-  struct DelayQueueEntry *cur;
-
-  GNUNET_CONTAINER_multipeermap_iterate (peers,
-                                         &free_tmps,
-                                         NULL);
-  GNUNET_CONTAINER_multipeermap_destroy (peers);
-  peers = NULL;
-  while (NULL != (cur = generic_dqe_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (generic_dqe_head,
-                                 generic_dqe_tail,
-                                 cur);
-    if (NULL != cur->cont)
-      cur->cont (cur->cont_cls,
-                 GNUNET_SYSERR,
-                 cur->msg_size,
-                 0);
-    GNUNET_free (cur);
-  }
-  if (NULL != generic_send_delay_task)
-  {
-    GNUNET_SCHEDULER_cancel (generic_send_delay_task);
-    generic_send_delay_task = NULL;
-  }
-}
-
-
-/* end of file gnunet-service-transport_manipulation.c */
diff --git a/src/transport/gnunet-service-transport_manipulation.h 
b/src/transport/gnunet-service-transport_manipulation.h
deleted file mode 100644
index b84f3fc32..000000000
--- a/src/transport/gnunet-service-transport_manipulation.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/gnunet-service-transport_neighbours.h
- * @brief neighbour manipulation API, allows manipulation of
- *        performance metrics (delay and towards ATS)
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
-#define GNUNET_SERVICE_TRANSPORT_MANIPULATION_H
-
-#include "platform.h"
-#include "gnunet-service-transport_hello.h"
-#include "gnunet-service-transport_neighbours.h"
-#include "gnunet-service-transport_plugins.h"
-#include "gnunet-service-transport_validation.h"
-#include "gnunet-service-transport.h"
-#include "transport.h"
-
-
-/**
- * Set traffic metric to manipulate
- *
- * @param message containing information
- */
-void
-GST_manipulation_set_metric (const struct TrafficMetricMessage *tm);
-
-
-/**
- * Adapter function between transport's send function and transport plugins
- *
- * @param target the peer the message to send to
- * @param msg the message received
- * @param msg_size message size
- * @param timeout timeout
- * @param cont the continuation to call after sending
- * @param cont_cls cls for continuation
- */
-void
-GST_manipulation_send (const struct GNUNET_PeerIdentity *target,
-                       const void *msg,
-                       size_t msg_size,
-                       struct GNUNET_TIME_Relative timeout,
-                       GST_NeighbourSendContinuation cont,
-                       void *cont_cls);
-
-
-/**
- * Adapter function between transport plugins and transport receive function
- * manipulation delays for next send.
- *
- * @param cls the closure for transport
- * @param address the address and the peer the message was received from
- * @param message the message received
- * @param session the session the message was received on
- * @return manipulated delay for next receive
- */
-struct GNUNET_TIME_Relative
-GST_manipulation_recv (void *cls,
-                       const struct GNUNET_HELLO_Address *address,
-                       struct GNUNET_ATS_Session *session,
-                       const struct GNUNET_MessageHeader *message);
-
-
-/**
- * Function that will be called to manipulate ATS information according to
- * current manipulation settings
- *
- * @param address binary address
- * @param session the session
- * @param prop[IN|OUT] metrics to modify
- */
-void
-GST_manipulation_manipulate_metrics (const struct GNUNET_HELLO_Address 
*address,
-                                     struct GNUNET_ATS_Session *session,
-                                     struct GNUNET_ATS_Properties *prop);
-
-
-/**
- * Notify manipulation about disconnect so it can discard queued messages
- *
- * @param peer the disconnecting peer
- */
-void
-GST_manipulation_peer_disconnect (const struct GNUNET_PeerIdentity *peer);
-
-
-/**
- * Initialize traffic manipulation
- */
-void
-GST_manipulation_init (void);
-
-
-/**
- * Stop traffic manipulation
- */
-void
-GST_manipulation_stop (void);
-
-#endif
-/* end of file gnunet-service-transport_neighbours.h */
diff --git a/src/transport/gnunet-service-transport_neighbours.c 
b/src/transport/gnunet-service-transport_neighbours.c
deleted file mode 100644
index e61441d9f..000000000
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ /dev/null
@@ -1,3947 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/gnunet-service-transport_neighbours.c
- * @brief neighbour management
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_ats_service.h"
-#include "gnunet-service-transport_ats.h"
-#include "gnunet-service-transport_neighbours.h"
-#include "gnunet-service-transport_manipulation.h"
-#include "gnunet-service-transport_plugins.h"
-#include "gnunet-service-transport_validation.h"
-#include "gnunet-service-transport.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_constants.h"
-#include "transport.h"
-
-/**
- * Experimental option to ignore SessionQuotaMessages from
- * the other peer.
- */
-#define IGNORE_INBOUND_QUOTA GNUNET_YES
-
-/**
- * Size of the neighbour hash map.
- */
-#define NEIGHBOUR_TABLE_SIZE 256
-
-/**
- * Time we give plugin to transmit DISCONNECT message before the
- * neighbour entry self-destructs.
- */
-#define DISCONNECT_SENT_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_MILLISECONDS, 500)
-
-/**
- * How often must a peer violate bandwidth quotas before we start
- * to simply drop its messages?
- */
-#define QUOTA_VIOLATION_DROP_THRESHOLD 10
-
-/**
- * How long are we willing to wait for a response from ATS before timing out?
- */
-#define ATS_RESPONSE_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 5)
-
-/**
- * How long are we willing to wait for an ACK from the other peer before
- * giving up on our connect operation?
- */
-#define SETUP_CONNECTION_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 15)
-
-/**
- * How long are we willing to wait for a successful reconnect if
- * an existing connection went down?  Much shorter than the
- * usual SETUP_CONNECTION_TIMEOUT as we do not inform the
- * higher layers about the disconnect during this period.
- */
-#define FAST_RECONNECT_TIMEOUT GNUNET_TIME_UNIT_SECONDS
-
-/**
- * Interval to send utilization data
- */
-#define UTIL_TRANSMISSION_INTERVAL GNUNET_TIME_UNIT_SECONDS
-
-/**
- * State describing which kind a reply this neighbour should send
- */
-enum GST_ACK_State
-{
-  /**
-   * We did not receive a SYN message for this neighbour
-   */
-  ACK_UNDEFINED = 0,
-
-  /**
-   * The neighbour received a SYN message and has to send a SYN_ACK
-   * as reply
-   */
-  ACK_SEND_SYN_ACK = 1,
-
-  /**
-   * The neighbour sent a SYN_ACK message and has to send a ACK
-   * as reply
-   */
-  ACK_SEND_ACK = 2
-};
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * Message a peer sends to another to indicate that it intends to
- * setup a connection/session for data exchange.  A 'SESSION_SYN'
- * should be answered with a 'SESSION_SYN_ACK' with the same body
- * to confirm.  A 'SESSION_SYN_ACK' should then be followed with
- * a 'ACK'.  Once the 'ACK' is received, both peers
- * should be connected.
- */
-struct TransportSynMessage
-{
-  /**
-   * Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_SYN
-   * or #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_SYN_ACK
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Always zero.
-   */
-  uint32_t reserved GNUNET_PACKED;
-
-  /**
-   * Absolute time at the sender.  Only the most recent connect
-   * message implies which session is preferred by the sender.
-   */
-  struct GNUNET_TIME_AbsoluteNBO timestamp;
-};
-
-
-/**
- * Message a peer sends to another when connected to indicate that a
- * session is in use and the peer is still alive or to respond to a keep alive.
- * A peer sends a message with type 
#GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE
- * to request a message with 
#GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE.
- * When the keep alive response with type is received, transport service
- * will call the respective plugin to update the session timeout
- */
-struct GNUNET_ATS_SessionKeepAliveMessage
-{
-  /**
-   * Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE or
-   * #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * A nonce to identify the session the keep alive is used for
-   */
-  uint32_t nonce GNUNET_PACKED;
-};
-
-
-/**
- * Message a peer sends to another when connected to indicate that
- * the other peer should limit transmissions to the indicated
- * quota.
- */
-struct GNUNET_ATS_SessionQuotaMessage
-{
-  /**
-   * Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Quota to use (for sending), in bytes per second.
-   */
-  uint32_t quota GNUNET_PACKED;
-};
-
-
-/**
- * Message we send to the other peer to notify it that we intentionally
- * are disconnecting (to reduce timeouts).  This is just a friendly
- * notification, peers must not rely on always receiving disconnect
- * messages.
- */
-struct GNUNET_ATS_SessionDisconnectMessage
-{
-  /**
-   * Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Always zero.
-   */
-  uint32_t reserved GNUNET_PACKED;
-
-  /**
-   * Purpose of the signature.  Extends over the timestamp.
-   * Purpose should be #GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DISCONNECT.
-   */
-  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
-  /**
-   * Absolute time at the sender.  Only the most recent connect
-   * message implies which session is preferred by the sender.
-   */
-  struct GNUNET_TIME_AbsoluteNBO timestamp;
-
-  /**
-   * Public key of the sender.
-   */
-  struct GNUNET_CRYPTO_EddsaPublicKey public_key;
-
-  /**
-   * Signature of the peer that sends us the disconnect.  Only
-   * valid if the timestamp is AFTER the timestamp from the
-   * corresponding 'SYN' message.
-   */
-  struct GNUNET_CRYPTO_EddsaSignature signature;
-};
-
-GNUNET_NETWORK_STRUCT_END
-
-
-/**
- * For each neighbour we keep a list of messages
- * that we still want to transmit to the neighbour.
- */
-struct MessageQueue
-{
-  /**
-   * This is a doubly linked list.
-   */
-  struct MessageQueue *next;
-
-  /**
-   * This is a doubly linked list.
-   */
-  struct MessageQueue *prev;
-
-  /**
-   * Function to call once we're done.
-   */
-  GST_NeighbourSendContinuation cont;
-
-  /**
-   * Closure for @e cont
-   */
-  void *cont_cls;
-
-  /**
-   * The message(s) we want to transmit, GNUNET_MessageHeader(s)
-   * stuck together in memory.  Allocated at the end of this struct.
-   */
-  const char *message_buf;
-
-  /**
-   * Size of the message buf
-   */
-  size_t message_buf_size;
-
-  /**
-   * At what time should we fail?
-   */
-  struct GNUNET_TIME_Absolute timeout;
-};
-
-
-/**
- * A possible address we could use to communicate with a neighbour.
- */
-struct NeighbourAddress
-{
-  /**
-   * Active session for this address.
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * Network-level address information.
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Timestamp of the 'SESSION_CONNECT' message we sent to the other
-   * peer for this address.  Use to check that the ACK is in response
-   * to our most recent 'SYN'.
-   */
-  struct GNUNET_TIME_Absolute connect_timestamp;
-
-  /**
-   * Inbound bandwidth from ATS for this address.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
-
-  /**
-   * Outbound bandwidth from ATS for this address.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
-
-  /**
-   * Did we tell ATS that this is our 'active' address?
-   */
-  int ats_active;
-
-  /**
-   * The current nonce sent in the last keep alive messages
-   */
-  uint32_t keep_alive_nonce;
-};
-
-
-/**
- * Entry in neighbours.
- */
-struct NeighbourMapEntry
-{
-  /**
-   * Head of list of messages we would like to send to this peer;
-   * must contain at most one message per client.
-   */
-  struct MessageQueue *messages_head;
-
-  /**
-   * Tail of list of messages we would like to send to this peer; must
-   * contain at most one message per client.
-   */
-  struct MessageQueue *messages_tail;
-
-  /**
-   * Are we currently trying to send a message? If so, which one?
-   */
-  struct MessageQueue *is_active;
-
-  /**
-   * Primary address we currently use to communicate with the neighbour.
-   */
-  struct NeighbourAddress primary_address;
-
-  /**
-   * Alternative address currently under consideration for communicating
-   * with the neighbour.
-   */
-  struct NeighbourAddress alternative_address;
-
-  /**
-   * Identity of this neighbour.
-   */
-  struct GNUNET_PeerIdentity id;
-
-  /**
-   * Main task that drives this peer (timeouts, keepalives, etc.).
-   * Always runs the #master_task().
-   */
-  struct GNUNET_SCHEDULER_Task *task;
-
-  /**
-   * Task to disconnect neighbour after we received a DISCONNECT message
-   */
-  struct GNUNET_SCHEDULER_Task *delayed_disconnect_task;
-
-  /**
-   * At what time should we sent the next keep-alive message?
-   */
-  struct GNUNET_TIME_Absolute keep_alive_time;
-
-  /**
-   * At what time did we sent the last keep-alive message?  Used
-   * to calculate round-trip time ("latency").
-   */
-  struct GNUNET_TIME_Absolute last_keep_alive_time;
-
-  /**
-   * Timestamp we should include in our next SYN_ACK message.
-   * (only valid if 'send_connect_ack' is #GNUNET_YES).  Used to build
-   * our SYN_ACK message.
-   */
-  struct GNUNET_TIME_Absolute connect_ack_timestamp;
-
-  /**
-   * ATS address suggest handle
-   */
-  struct GNUNET_ATS_ConnectivitySuggestHandle *suggest_handle;
-
-  /**
-   * Time where we should cut the connection (timeout) if we don't
-   * make progress in the state machine (or get a KEEPALIVE_RESPONSE
-   * if we are in #GNUNET_TRANSPORT_PS_CONNECTED).
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * Tracker for inbound bandwidth.
-   */
-  struct GNUNET_BANDWIDTH_Tracker in_tracker;
-
-  /**
-   * How often has the other peer (recently) violated the inbound
-   * traffic limit?  Incremented by 10 per violation, decremented by 1
-   * per non-violation (for each time interval).
-   */
-  unsigned int quota_violation_count;
-
-  /**
-   * Latest quota the other peer send us in bytes per second.
-   * We should not send more, least the other peer throttle
-   * receiving our traffic.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO neighbour_receive_quota;
-
-  /**
-   * The current state of the peer.
-   */
-  enum GNUNET_TRANSPORT_PeerState state;
-
-  /**
-   * Did we sent an KEEP_ALIVE message and are we expecting a response?
-   */
-  int expect_latency_response;
-
-  /**
-   * When a peer wants to connect we have to reply to the 1st SYN message
-   * with a SYN_ACK message. But sometime we cannot send this message
-   * immediately since we do not have an address and then we have to remember
-   * to send this message as soon as we have an address.
-   *
-   * Flag to set if we still need to send a SYN_ACK message to the other peer
-   * (once we have an address to use and the peer has been allowed by our
-   * blacklist).  Initially set to #ACK_UNDEFINED. Set to #ACK_SEND_SYN_ACK
-   * if we need to send a SYN_ACK.  Set to #ACK_SEND_ACK if we did
-   * send a SYN_ACK and should go to #S_CONNECTED upon receiving a
-   * 'ACK' (regardless of what our own state machine might say).
-   */
-  enum GST_ACK_State ack_state;
-
-  /**
-   * Tracking utilization of outbound bandwidth
-   */
-  uint32_t util_total_bytes_sent;
-
-  /**
-   * Tracking utilization of inbound bandwidth
-   */
-  uint32_t util_total_bytes_recv;
-
-  /**
-   * Date of last utilization transmission
-   */
-  struct GNUNET_TIME_Absolute last_util_transmission;
-};
-
-
-/**
- * Hash map from peer identities to the respective `struct NeighbourMapEntry`.
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *neighbours;
-
-/**
- * List of pending blacklist checks: head
- */
-static struct BlacklistCheckSwitchContext *pending_bc_head;
-
-/**
- * List of pending blacklist checks: tail
- */
-static struct BlacklistCheckSwitchContext *pending_bc_tail;
-
-/**
- * counter for connected neighbours
- */
-static unsigned int neighbours_connected;
-
-/**
- * Number of bytes we have currently queued for transmission.
- */
-static unsigned long long bytes_in_send_queue;
-
-/**
- * Task transmitting utilization data
- */
-static struct GNUNET_SCHEDULER_Task *util_transmission_tk;
-
-
-/**
- * Convert the given ACK state to a string.
- *
- * @param s state
- * @return corresponding human-readable string
- */
-static char *
-print_ack_state (enum GST_ACK_State s)
-{
-  switch (s)
-  {
-  case ACK_UNDEFINED:
-    return "UNDEFINED";
-
-  case ACK_SEND_SYN_ACK:
-    return "SEND_SYN_ACK";
-
-  case ACK_SEND_ACK:
-    return "SEND_ACK";
-
-  default:
-    GNUNET_break (0);
-    return "N/A";
-  }
-}
-
-
-/**
- * Send information about a new outbound quota to our clients.
- * Note that the outbound quota is enforced client-side (i.e.
- * in libgnunettransport).
- *
- * @param n affected peer
- */
-static void
-send_outbound_quota_to_clients (struct NeighbourMapEntry *n)
-{
-  struct QuotaSetMessage q_msg;
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min;
-
-  if (! GNUNET_TRANSPORT_is_connected (n->state))
-    return;
-#if IGNORE_INBOUND_QUOTA
-  bandwidth_min = n->primary_address.bandwidth_out;
-#else
-  bandwidth_min = GNUNET_BANDWIDTH_value_min (n->primary_address.bandwidth_out,
-                                              n->neighbour_receive_quota);
-#endif
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Sending outbound quota of %u Bps for peer `%s' to all 
clients\n",
-              ntohl (bandwidth_min.value__),
-              GNUNET_i2s (&n->id));
-  q_msg.header.size = htons (sizeof(struct QuotaSetMessage));
-  q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
-  q_msg.quota = bandwidth_min;
-  q_msg.peer = n->id;
-  GST_clients_broadcast (&q_msg.header,
-                         GNUNET_NO);
-}
-
-
-/**
- * Notify our clients that another peer connected to us.
- *
- * @param n the peer that connected
- */
-static void
-neighbours_connect_notification (struct NeighbourMapEntry *n)
-{
-  size_t len = sizeof(struct ConnectInfoMessage);
-  char buf[len] GNUNET_ALIGN;
-  struct ConnectInfoMessage *connect_msg = (struct ConnectInfoMessage *) buf;
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min;
-
-#if IGNORE_INBOUND_QUOTA
-  bandwidth_min = n->primary_address.bandwidth_out;
-#else
-  bandwidth_min = GNUNET_BANDWIDTH_value_min (n->primary_address.bandwidth_out,
-                                              n->neighbour_receive_quota);
-#endif
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "We are now connected to peer `%s'\n",
-              GNUNET_i2s (&n->id));
-  connect_msg->header.size = htons (sizeof(buf));
-  connect_msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
-  connect_msg->id = n->id;
-  connect_msg->quota_out = bandwidth_min;
-  GST_clients_broadcast (&connect_msg->header,
-                         GNUNET_NO);
-}
-
-
-/**
- * Notify our clients (and manipulation) that a peer disconnected from
- * us.
- *
- * @param n the peer that disconnected
- */
-static void
-neighbours_disconnect_notification (struct NeighbourMapEntry *n)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Peer `%s' disconnected\n",
-              GNUNET_i2s (&n->id));
-  GST_manipulation_peer_disconnect (&n->id);
-  GST_clients_broadcast_disconnect (&n->id);
-}
-
-
-/**
- * Notify transport clients that a neighbour peer changed its active
- * address.
- *
- * @param peer identity of the peer
- * @param address address possibly NULL if peer is not connected
- * @param state current state this peer is in
- * @param state_timeout timeout for the current state of the peer
- * @param bandwidth_in bandwidth assigned inbound, 0 on disconnect
- * @param bandwidth_out bandwidth assigned outbound, 0 on disconnect
- */
-static void
-neighbours_changed_notification (const struct GNUNET_PeerIdentity *peer,
-                                 const struct GNUNET_HELLO_Address *address,
-                                 enum GNUNET_TRANSPORT_PeerState state,
-                                 struct GNUNET_TIME_Absolute state_timeout,
-                                 struct GNUNET_BANDWIDTH_Value32NBO
-                                 bandwidth_in,
-                                 struct GNUNET_BANDWIDTH_Value32NBO
-                                 bandwidth_out)
-{
-  (void) bandwidth_in;
-  (void) bandwidth_out;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Notifying about change for peer `%s' with address `%s' in state 
`%s' timing out at %s\n",
-              GNUNET_i2s (peer),
-              GST_plugins_a2s (address),
-              GNUNET_TRANSPORT_ps2s (state),
-              GNUNET_STRINGS_absolute_time_to_string (state_timeout));
-  /* FIXME: include bandwidth in notification! */
-  GST_clients_broadcast_peer_notification (peer,
-                                           address,
-                                           state,
-                                           state_timeout);
-}
-
-
-/**
- * Lookup a neighbour entry in the neighbours hash map.
- *
- * @param pid identity of the peer to look up
- * @return the entry, NULL if there is no existing record
- */
-static struct NeighbourMapEntry *
-lookup_neighbour (const struct GNUNET_PeerIdentity *pid)
-{
-  if (NULL == neighbours)
-    return NULL;
-  return GNUNET_CONTAINER_multipeermap_get (neighbours, pid);
-}
-
-
-/**
- * Test if we're connected to the given peer.
- *
- * @param n neighbour entry of peer to test
- * @return #GNUNET_YES if we are connected, #GNUNET_NO if not
- */
-static int
-test_connected (struct NeighbourMapEntry *n)
-{
-  if (NULL == n)
-    return GNUNET_NO;
-  return GNUNET_TRANSPORT_is_connected (n->state);
-}
-
-
-/**
- * We don't need a given neighbour address any more.
- * Release its resources and give appropriate notifications
- * to ATS and other subsystems.
- *
- * @param na address we are done with; @a na itself must NOT be 'free'd, only 
the contents!
- */
-static void
-free_address (struct NeighbourAddress *na)
-{
-  if (GNUNET_YES == na->ats_active)
-    GST_validation_set_address_use (na->address,
-                                    GNUNET_NO);
-  if (NULL != na->address)
-  {
-    GST_ats_block_address (na->address,
-                           na->session);
-    GNUNET_HELLO_address_free (na->address);
-    na->address = NULL;
-  }
-  na->bandwidth_in = GNUNET_BANDWIDTH_value_init (0);
-  na->bandwidth_out = GNUNET_BANDWIDTH_value_init (0);
-  na->ats_active = GNUNET_NO;
-  na->keep_alive_nonce = 0;
-  na->session = NULL;
-}
-
-
-/**
- * Master task run for every neighbour.  Performs all of the time-related
- * activities (keep alive, send next message, disconnect if idle, finish
- * clean up after disconnect).
- *
- * @param cls the `struct NeighbourMapEntry` for which we are running
- */
-static void
-master_task (void *cls);
-
-
-/**
- * Set net state and state timeout for this neighbour and notify monitoring
- *
- * @param n the respective neighbour
- * @param s the new state
- * @param timeout the new timeout
- */
-static void
-set_state_and_timeout (struct NeighbourMapEntry *n,
-                       enum GNUNET_TRANSPORT_PeerState s,
-                       struct GNUNET_TIME_Absolute timeout)
-{
-  if (GNUNET_TRANSPORT_is_connected (s) &&
-      (! GNUNET_TRANSPORT_is_connected (n->state)))
-  {
-    neighbours_connect_notification (n);
-    GNUNET_STATISTICS_set (GST_stats,
-                           gettext_noop ("# peers connected"),
-                           ++neighbours_connected,
-                           GNUNET_NO);
-  }
-  if ((! GNUNET_TRANSPORT_is_connected (s)) &&
-      GNUNET_TRANSPORT_is_connected (n->state))
-  {
-    GNUNET_STATISTICS_set (GST_stats,
-                           gettext_noop ("# peers connected"),
-                           --neighbours_connected,
-                           GNUNET_NO);
-    neighbours_disconnect_notification (n);
-  }
-  n->state = s;
-  if ((timeout.abs_value_us < n->timeout.abs_value_us) &&
-      (NULL != n->task))
-  {
-    /* new timeout is earlier, reschedule master task */
-    GNUNET_SCHEDULER_cancel (n->task);
-    n->task = GNUNET_SCHEDULER_add_at (timeout,
-                                       &master_task,
-                                       n);
-  }
-  n->timeout = timeout;
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Neighbour `%s' changed state to %s with timeout %s\n",
-              GNUNET_i2s (&n->id),
-              GNUNET_TRANSPORT_ps2s (s),
-              GNUNET_STRINGS_absolute_time_to_string (timeout));
-  neighbours_changed_notification (&n->id,
-                                   n->primary_address.address,
-                                   n->state,
-                                   n->timeout,
-                                   n->primary_address.bandwidth_in,
-                                   n->primary_address.bandwidth_out);
-}
-
-
-/**
- * Initialize the alternative address of a neighbour
- *
- * @param n the neighbour
- * @param address address of the other peer, NULL if other peer
- *                       connected to us
- * @param session session to use (or NULL, in which case an
- *        address must be setup)
- * @param bandwidth_in inbound quota to be used when connection is up
- * @param bandwidth_out outbound quota to be used when connection is up
- */
-static void
-set_alternative_address (struct NeighbourMapEntry *n,
-                         const struct GNUNET_HELLO_Address *address,
-                         struct GNUNET_ATS_Session *session,
-                         struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                         struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-
-  if (NULL == (papi = GST_plugins_find (address->transport_name)))
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if (session == n->alternative_address.session)
-  {
-    n->alternative_address.bandwidth_in = bandwidth_in;
-    n->alternative_address.bandwidth_out = bandwidth_out;
-    return;
-  }
-  if (NULL != n->alternative_address.address)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Replacing existing alternative address with another one\n");
-    free_address (&n->alternative_address);
-  }
-  if (NULL == session)
-    session = papi->get_session (papi->cls,
-                                 address);
-  if (NULL == session)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Failed to obtain new session for peer `%s' and  address 
'%s'\n",
-                GNUNET_i2s (&address->peer),
-                GST_plugins_a2s (address));
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop ("# session creation failed"),
-                              1,
-                              GNUNET_NO);
-    return;
-  }
-  GST_ats_new_session (address,
-                       session);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Neighbour `%s' configured alternative address %s\n",
-              GNUNET_i2s (&n->id),
-              GST_plugins_a2s (address));
-
-  n->alternative_address.address = GNUNET_HELLO_address_copy (address);
-  n->alternative_address.bandwidth_in = bandwidth_in;
-  n->alternative_address.bandwidth_out = bandwidth_out;
-  n->alternative_address.session = session;
-  n->alternative_address.ats_active = GNUNET_NO;
-  n->alternative_address.keep_alive_nonce = 0;
-  GNUNET_assert (GNUNET_YES ==
-                 GST_ats_is_known (n->alternative_address.address,
-                                   n->alternative_address.session));
-}
-
-
-/**
- * Transmit a message using the current session of the given
- * neighbour.
- *
- * @param n entry for the recipient
- * @param msgbuf buffer to transmit
- * @param msgbuf_size number of bytes in @a msgbuf buffer
- * @param priority transmission priority
- * @param timeout transmission timeout
- * @param use_keepalive_timeout #GNUNET_YES to use plugin-specific keep-alive
- *        timeout (@a timeout is ignored in that case), #GNUNET_NO otherwise
- * @param cont continuation to call when finished (can be NULL)
- * @param cont_cls closure for @a cont
- * @return timeout (copy of @a timeout or a calculated one if
- *         @a use_keepalive_timeout is #GNUNET_YES.
- */
-static struct GNUNET_TIME_Relative
-send_with_session (struct NeighbourMapEntry *n,
-                   const void *msgbuf,
-                   size_t msgbuf_size,
-                   uint32_t priority,
-                   struct GNUNET_TIME_Relative timeout,
-                   unsigned int use_keepalive_timeout,
-                   GNUNET_TRANSPORT_TransmitContinuation cont,
-                   void *cont_cls)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-  struct GNUNET_TIME_Relative result = GNUNET_TIME_UNIT_FOREVER_REL;
-
-  GNUNET_assert (NULL != n->primary_address.session);
-  if ((((NULL == (papi = GST_plugins_find (
-                    n->primary_address.address->transport_name))) ||
-        (-1 == papi->send (papi->cls,
-                           n->primary_address.session,
-                           msgbuf,
-                           msgbuf_size,
-                           priority,
-                           (result = (GNUNET_NO == use_keepalive_timeout) ?
-                                     timeout :
-                                     GNUNET_TIME_relative_divide (
-                              GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
-                              papi->
-                              query_keepalive_factor (papi->cls))),
-                           cont,
-                           cont_cls)))) &&
-      (NULL != cont))
-    cont (cont_cls,
-          &n->id,
-          GNUNET_SYSERR,
-          msgbuf_size,
-          0);
-  GST_neighbours_notify_data_sent (n->primary_address.address,
-                                   n->primary_address.session,
-                                   msgbuf_size);
-  GNUNET_break (NULL != papi);
-  return result;
-}
-
-
-/**
- * Clear the primary address of a neighbour since this address is not
- * valid anymore and notify monitoring about it
- *
- * @param n the neighbour
- */
-static void
-unset_primary_address (struct NeighbourMapEntry *n)
-{
-  /* Notify monitoring about change */
-  if (NULL == n->primary_address.address)
-    return;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Disabling primary address\n");
-  neighbours_changed_notification (&n->id,
-                                   n->primary_address.address,
-                                   n->state,
-                                   n->timeout,
-                                   GNUNET_BANDWIDTH_value_init (0),
-                                   GNUNET_BANDWIDTH_value_init (0));
-  free_address (&n->primary_address);
-}
-
-
-/**
- * Free a neighbour map entry.
- *
- * @param n entry to free
- */
-static void
-free_neighbour (struct NeighbourMapEntry *n)
-{
-  struct MessageQueue *mq;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Freeing neighbour state of peer `%s'\n",
-              GNUNET_i2s (&n->id));
-  n->is_active = NULL; /* always free'd by its own continuation! */
-
-  /* fail messages currently in the queue */
-  while (NULL != (mq = n->messages_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (n->messages_head,
-                                 n->messages_tail,
-                                 mq);
-    if (NULL != mq->cont)
-      mq->cont (mq->cont_cls,
-                GNUNET_SYSERR,
-                mq->message_buf_size,
-                0);
-    GNUNET_free (mq);
-  }
-  /* Mark peer as disconnected */
-  set_state_and_timeout (n,
-                         GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED,
-                         GNUNET_TIME_UNIT_FOREVER_ABS);
-  /* free addresses and mark as unused */
-  unset_primary_address (n);
-
-  if (NULL != n->alternative_address.address)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Cleaning up alternative address\n");
-    free_address (&n->alternative_address);
-  }
-  GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CONTAINER_multipeermap_remove (neighbours,
-                                                       &n->id,
-                                                       n));
-
-  /* Cancel address requests for this peer */
-  if (NULL != n->suggest_handle)
-  {
-    GNUNET_ATS_connectivity_suggest_cancel (n->suggest_handle);
-    n->suggest_handle = NULL;
-  }
-
-  /* Cancel the disconnect task */
-  if (NULL != n->delayed_disconnect_task)
-  {
-    GNUNET_SCHEDULER_cancel (n->delayed_disconnect_task);
-    n->delayed_disconnect_task = NULL;
-  }
-
-  /* Cancel the master task */
-  if (NULL != n->task)
-  {
-    GNUNET_SCHEDULER_cancel (n->task);
-    n->task = NULL;
-  }
-  /* free rest of memory */
-  GNUNET_free (n);
-}
-
-
-/**
- * Function called when the 'DISCONNECT' message has been sent by the
- * plugin.  Frees the neighbour --- if the entry still exists.
- *
- * @param cls NULL
- * @param target identity of the neighbour that was disconnected
- * @param result #GNUNET_OK if the disconnect got out successfully
- * @param payload bytes payload
- * @param physical bytes on wire
- */
-static void
-send_disconnect_cont (void *cls,
-                      const struct GNUNET_PeerIdentity *target,
-                      int result,
-                      size_t payload,
-                      size_t physical)
-{
-  struct NeighbourMapEntry *n;
-
-  (void) cls;
-  (void) result;
-  (void) payload;
-  (void) physical;
-  n = lookup_neighbour (target);
-  if (NULL == n)
-    return; /* already gone */
-  if (GNUNET_TRANSPORT_PS_DISCONNECT != n->state)
-    return; /* have created a fresh entry since */
-  if (NULL != n->task)
-    GNUNET_SCHEDULER_cancel (n->task);
-  n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
-}
-
-
-/**
- * Transmit a DISCONNECT message to the other peer.
- *
- * @param n neighbour to send DISCONNECT message.
- */
-static void
-send_disconnect (struct NeighbourMapEntry *n)
-{
-  struct GNUNET_ATS_SessionDisconnectMessage disconnect_msg;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Sending DISCONNECT message to peer `%4s'\n",
-              GNUNET_i2s (&n->id));
-  disconnect_msg.header.size = htons (sizeof(struct
-                                             
GNUNET_ATS_SessionDisconnectMessage));
-  disconnect_msg.header.type =
-    htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT);
-  disconnect_msg.reserved = htonl (0);
-  disconnect_msg.purpose.size =
-    htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
-           + sizeof(struct GNUNET_CRYPTO_EddsaPublicKey)
-           + sizeof(struct GNUNET_TIME_AbsoluteNBO));
-  disconnect_msg.purpose.purpose =
-    htonl (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT);
-  disconnect_msg.timestamp =
-    GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
-  disconnect_msg.public_key = GST_my_identity.public_key;
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CRYPTO_eddsa_sign_ (&GST_my_private_key,
-                                            &disconnect_msg.purpose,
-                                            &disconnect_msg.signature));
-
-  (void) send_with_session (n,
-                            &disconnect_msg,
-                            sizeof(disconnect_msg),
-                            UINT32_MAX,
-                            GNUNET_TIME_UNIT_FOREVER_REL,
-                            GNUNET_NO,
-                            &send_disconnect_cont,
-                            NULL);
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop ("# DISCONNECT messages sent"),
-                            1,
-                            GNUNET_NO);
-}
-
-
-/**
- * Disconnect from the given neighbour, clean up the record.
- *
- * @param n neighbour to disconnect from
- */
-static void
-disconnect_neighbour (struct NeighbourMapEntry *n)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Disconnecting from peer %s in state %s\n",
-              GNUNET_i2s (&n->id),
-              GNUNET_TRANSPORT_ps2s (n->state));
-  /* depending on state, notify neighbour and/or upper layers of this peer
-     about disconnect */
-  switch (n->state)
-  {
-  case GNUNET_TRANSPORT_PS_NOT_CONNECTED:
-  case GNUNET_TRANSPORT_PS_INIT_ATS:
-    /* other peer is completely unaware of us, no need to send DISCONNECT */
-    free_neighbour (n);
-    return;
-
-  case GNUNET_TRANSPORT_PS_SYN_SENT:
-    send_disconnect (n);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_DISCONNECT,
-                           GNUNET_TIME_UNIT_FOREVER_ABS);
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ATS:
-    /* we never ACK'ed the other peer's request, no need to send DISCONNECT */
-    free_neighbour (n);
-    return;
-
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ACK:
-    /* we DID ACK the other peer's request, must send DISCONNECT */
-    send_disconnect (n);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_DISCONNECT,
-                           GNUNET_TIME_UNIT_FOREVER_ABS);
-    break;
-
-  case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT:
-  case GNUNET_TRANSPORT_PS_CONNECTED:
-  case GNUNET_TRANSPORT_PS_RECONNECT_SENT:
-    /* we are currently connected, need to send disconnect and do
-       internal notifications and update statistics */
-    send_disconnect (n);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_DISCONNECT,
-                           GNUNET_TIME_UNIT_FOREVER_ABS);
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_ATS:
-    /* Disconnecting while waiting for an ATS address to reconnect,
-     * cannot send DISCONNECT */
-    free_neighbour (n);
-    return;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT:
-    /* already disconnected, ignore */
-    break;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED:
-    /* already cleaned up, how did we get here!? */
-    GNUNET_assert (0);
-    break;
-
-  default:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unhandled state `%s'\n",
-                GNUNET_TRANSPORT_ps2s (n->state));
-    GNUNET_break (0);
-    break;
-  }
-  /* schedule timeout to clean up */
-  if (NULL != n->task)
-    GNUNET_SCHEDULER_cancel (n->task);
-  n->task = GNUNET_SCHEDULER_add_delayed (DISCONNECT_SENT_TIMEOUT,
-                                          &master_task,
-                                          n);
-}
-
-
-/**
- * Change the incoming quota for the given peer.  Updates
- * our own receive rate and informs the neighbour about
- * the new quota.
- *
- * @param n neighbour entry to change quota for
- * @param quota new quota
- * @return #GNUNET_YES if @a n is still valid, #GNUNET_NO if
- *   @a n was freed
- */
-static int
-set_incoming_quota (struct NeighbourMapEntry *n,
-                    struct GNUNET_BANDWIDTH_Value32NBO quota)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Setting inbound quota of %u Bps for peer `%s' to all clients\n",
-              ntohl (quota.value__), GNUNET_i2s (&n->id));
-  GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker,
-                                         quota);
-  if (0 != ntohl (quota.value__))
-  {
-    struct GNUNET_ATS_SessionQuotaMessage sqm;
-
-    sqm.header.size = htons (sizeof(struct GNUNET_ATS_SessionQuotaMessage));
-    sqm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA);
-    sqm.quota = quota.value__;
-    if (NULL != n->primary_address.session)
-      (void) send_with_session (n,
-                                &sqm,
-                                sizeof(sqm),
-                                UINT32_MAX - 1,
-                                GNUNET_TIME_UNIT_FOREVER_REL,
-                                GNUNET_NO,
-                                NULL, NULL);
-    return GNUNET_YES;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Disconnecting peer `%s' due to SET_QUOTA\n",
-              GNUNET_i2s (&n->id));
-  if (GNUNET_YES == test_connected (n))
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop ("# disconnects due to quota of 0"),
-                              1, GNUNET_NO);
-  disconnect_neighbour (n);
-  return GNUNET_NO;
-}
-
-
-/**
- * Initialize the primary address of a neighbour
- *
- * @param n the neighbour
- * @param address address of the other peer, NULL if other peer
- *                       connected to us
- * @param session session to use (or NULL, in which case an
- *        address must be setup)
- * @param bandwidth_in inbound quota to be used when connection is up
- * @param bandwidth_out outbound quota to be used when connection is up
- */
-static void
-set_primary_address (struct NeighbourMapEntry *n,
-                     const struct GNUNET_HELLO_Address *address,
-                     struct GNUNET_ATS_Session *session,
-                     struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                     struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
-{
-  if (session == n->primary_address.session)
-  {
-    GST_validation_set_address_use (n->primary_address.address,
-                                    GNUNET_YES);
-    if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__)
-    {
-      n->primary_address.bandwidth_in = bandwidth_in;
-      if (GNUNET_YES !=
-          set_incoming_quota (n,
-                              bandwidth_in))
-        return;
-    }
-    if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__)
-    {
-      n->primary_address.bandwidth_out = bandwidth_out;
-      send_outbound_quota_to_clients (n);
-    }
-    return;
-  }
-  if ((NULL != n->primary_address.address) &&
-      (0 == GNUNET_HELLO_address_cmp (address,
-                                      n->primary_address.address)))
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if (NULL == session)
-  {
-    GNUNET_break (0);
-    GST_ats_block_address (address,
-                           session);
-    return;
-  }
-  if (NULL != n->primary_address.address)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Replacing existing primary address with another one\n");
-    free_address (&n->primary_address);
-  }
-  n->primary_address.address = GNUNET_HELLO_address_copy (address);
-  n->primary_address.bandwidth_in = bandwidth_in;
-  n->primary_address.bandwidth_out = bandwidth_out;
-  n->primary_address.session = session;
-  n->primary_address.keep_alive_nonce = 0;
-  GNUNET_assert (GNUNET_YES ==
-                 GST_ats_is_known (n->primary_address.address,
-                                   n->primary_address.session));
-  /* subsystems about address use */
-  GST_validation_set_address_use (n->primary_address.address,
-                                  GNUNET_YES);
-  if (GNUNET_YES !=
-      set_incoming_quota (n,
-                          bandwidth_in))
-    return;
-  send_outbound_quota_to_clients (n);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Neighbour `%s' switched to address `%s'\n",
-              GNUNET_i2s (&n->id),
-              GST_plugins_a2s (address));
-
-  neighbours_changed_notification (&n->id,
-                                   n->primary_address.address,
-                                   n->state,
-                                   n->timeout,
-                                   n->primary_address.bandwidth_in,
-                                   n->primary_address.bandwidth_out);
-}
-
-
-/**
- * We're done with our transmission attempt, continue processing.
- *
- * @param cls the `struct MessageQueue` of the message
- * @param receiver intended receiver
- * @param success whether it worked or not
- * @param size_payload bytes payload sent
- * @param physical bytes sent on wire
- */
-static void
-transmit_send_continuation (void *cls,
-                            const struct GNUNET_PeerIdentity *receiver,
-                            int success,
-                            size_t size_payload,
-                            size_t physical)
-{
-  struct MessageQueue *mq = cls;
-  struct NeighbourMapEntry *n;
-
-  if (NULL == (n = lookup_neighbour (receiver)))
-  {
-    if (NULL != mq->cont)
-      mq->cont (mq->cont_cls,
-                GNUNET_SYSERR /* not connected */,
-                size_payload,
-                0);
-    GNUNET_free (mq);
-    return;   /* disconnect or other error while transmitting, can happen */
-  }
-  if (n->is_active == mq)
-  {
-    /* this is still "our" neighbour, remove us from its queue
-       and allow it to send the next message now */
-    n->is_active = NULL;
-    if (NULL != n->task)
-      GNUNET_SCHEDULER_cancel (n->task);
-    n->task = GNUNET_SCHEDULER_add_now (&master_task,
-                                        n);
-  }
-  if (bytes_in_send_queue < mq->message_buf_size)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Bytes_in_send_queue `%llu', Message_size %u, result: %s, 
payload %u, on wire %u\n",
-                bytes_in_send_queue,
-                (unsigned int) mq->message_buf_size,
-                (GNUNET_OK == success) ? "OK" : "FAIL",
-                (unsigned int) size_payload,
-                (unsigned int) physical);
-    GNUNET_break (0);
-  }
-
-  GNUNET_break (size_payload == mq->message_buf_size);
-  bytes_in_send_queue -= mq->message_buf_size;
-  GNUNET_STATISTICS_set (GST_stats,
-                         gettext_noop (
-                           "# bytes in message queue for other peers"),
-                         bytes_in_send_queue,
-                         GNUNET_NO);
-  if (GNUNET_OK == success)
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# messages transmitted to other peers"),
-                              1,
-                              GNUNET_NO);
-  else
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                              (
-                                "# transmission failures for messages to other 
peers"),
-                              1, GNUNET_NO);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Sending message to `%s' of type %u with %u bytes was a %s\n",
-              GNUNET_i2s (receiver),
-              ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type),
-              (unsigned int) mq->message_buf_size,
-              (success == GNUNET_OK) ? "success" : "FAILURE");
-  if (NULL != mq->cont)
-    mq->cont (mq->cont_cls,
-              success,
-              size_payload,
-              physical);
-  GNUNET_free (mq);
-}
-
-
-/**
- * Check the message list for the given neighbour and if we can
- * send a message, do so.  This function should only be called
- * if the connection is at least generally ready for transmission.
- * While we will only send one message at a time, no bandwidth
- * quota management is performed here.  If a message was given to
- * the plugin, the continuation will automatically re-schedule
- * the 'master' task once the next message might be transmitted.
- *
- * @param n target peer for which to transmit
- */
-static void
-try_transmission_to_peer (struct NeighbourMapEntry *n)
-{
-  struct MessageQueue *mq;
-  struct GNUNET_TIME_Relative timeout;
-
-  if (NULL == n->primary_address.address)
-  {
-    /* no address, why are we here? */
-    GNUNET_break (0);
-    return;
-  }
-  if ((0 == n->primary_address.address->address_length) &&
-      (NULL == n->primary_address.session))
-  {
-    /* no address, why are we here? */
-    GNUNET_break (0);
-    return;
-  }
-  if (NULL != n->is_active)
-  {
-    /* transmission already pending */
-    return;
-  }
-
-  /* timeout messages from the queue that are past their due date */
-  while (NULL != (mq = n->messages_head))
-  {
-    timeout = GNUNET_TIME_absolute_get_remaining (mq->timeout);
-    if (timeout.rel_value_us > 0)
-      break;
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# messages timed out while in transport 
queue"),
-                              1,
-                              GNUNET_NO);
-    GNUNET_CONTAINER_DLL_remove (n->messages_head,
-                                 n->messages_tail,
-                                 mq);
-    n->is_active = mq;
-    transmit_send_continuation (mq,
-                                &n->id,
-                                GNUNET_SYSERR,
-                                mq->message_buf_size,
-                                0);     /* timeout */
-  }
-  if (NULL == mq)
-    return;                     /* no more messages */
-  if (NULL == n->primary_address.address)
-  {
-    /* transmit_send_continuation() caused us to drop session,
-       can't try transmission anymore. */
-    return;
-  }
-
-
-  GNUNET_CONTAINER_DLL_remove (n->messages_head,
-                               n->messages_tail,
-                               mq);
-  n->is_active = mq;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Giving message with %u bytes to plugin session %p\n",
-              (unsigned int) mq->message_buf_size,
-              n->primary_address.session);
-  (void) send_with_session (n,
-                            mq->message_buf,
-                            mq->message_buf_size,
-                            0 /* priority */,
-                            timeout,
-                            GNUNET_NO,
-                            &transmit_send_continuation,
-                            mq);
-}
-
-
-/**
- * Send keepalive message to the neighbour.  Must only be called
- * if we are on 'connected' state or while trying to switch addresses.
- * Will internally determine if a keepalive is truly needed (so can
- * always be called).
- *
- * @param n neighbour that went idle and needs a keepalive
- */
-static void
-send_keepalive (struct NeighbourMapEntry *n)
-{
-  struct GNUNET_ATS_SessionKeepAliveMessage m;
-  struct GNUNET_TIME_Relative timeout;
-  uint32_t nonce;
-
-  GNUNET_assert ((GNUNET_TRANSPORT_PS_CONNECTED == n->state) ||
-                 (GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT == n->state));
-  if (GNUNET_TIME_absolute_get_remaining (n->keep_alive_time).rel_value_us > 0)
-    return; /* no keepalive needed at this time */
-
-  nonce = 0; /* 0 indicates 'not set' */
-  while (0 == nonce)
-    nonce = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
-                                      UINT32_MAX);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Sending KEEPALIVE to peer `%s' with nonce %u\n",
-              GNUNET_i2s (&n->id),
-              nonce);
-  m.header.size = htons (sizeof(struct GNUNET_ATS_SessionKeepAliveMessage));
-  m.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE);
-  m.nonce = htonl (nonce);
-
-  timeout = send_with_session (n,
-                               &m,
-                               sizeof(m),
-                               UINT32_MAX /* priority */,
-                               GNUNET_TIME_UNIT_FOREVER_REL,
-                               GNUNET_YES,
-                               NULL, NULL);
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop ("# KEEPALIVES sent"),
-                            1,
-                            GNUNET_NO);
-  n->primary_address.keep_alive_nonce = nonce;
-  n->expect_latency_response = GNUNET_YES;
-  n->last_keep_alive_time = GNUNET_TIME_absolute_get ();
-  n->keep_alive_time = GNUNET_TIME_relative_to_absolute (timeout);
-}
-
-
-/**
- * Keep the connection to the given neighbour alive longer,
- * we received a KEEPALIVE (or equivalent); send a response.
- *
- * @param neighbour neighbour to keep alive (by sending keep alive response)
- * @param m the keep alive message containing the nonce to respond to
- */
-void
-GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour,
-                          const struct GNUNET_MessageHeader *m)
-{
-  struct NeighbourMapEntry *n;
-  const struct GNUNET_ATS_SessionKeepAliveMessage *msg_in;
-  struct GNUNET_ATS_SessionKeepAliveMessage msg;
-
-  if (sizeof(struct GNUNET_ATS_SessionKeepAliveMessage) != ntohs (m->size))
-  {
-    GNUNET_break_op (0);
-    return;
-  }
-
-  msg_in = (const struct GNUNET_ATS_SessionKeepAliveMessage *) m;
-  if (NULL == (n = lookup_neighbour (neighbour)))
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                                ("# KEEPALIVE messages discarded (peer 
unknown)"),
-                              1, GNUNET_NO);
-    return;
-  }
-  if (NULL == n->primary_address.session)
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                                ("# KEEPALIVE messages discarded (no 
session)"),
-                              1, GNUNET_NO);
-    return;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received KEEPALIVE request from peer `%s' with nonce %u\n",
-              GNUNET_i2s (&n->id),
-              ntohl (msg_in->nonce));
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop (
-                              "# KEEPALIVES received in good order"),
-                            1,
-                            GNUNET_NO);
-
-  /* send reply to allow neighbour to measure latency */
-  msg.header.size = htons (sizeof(struct GNUNET_ATS_SessionKeepAliveMessage));
-  msg.header.type = htons (
-    GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE);
-  msg.nonce = msg_in->nonce;
-  (void) send_with_session (n,
-                            &msg,
-                            sizeof(struct GNUNET_ATS_SessionKeepAliveMessage),
-                            UINT32_MAX /* priority */,
-                            GNUNET_TIME_UNIT_FOREVER_REL,
-                            GNUNET_YES,
-                            NULL, NULL);
-}
-
-
-/**
- * We received a KEEP_ALIVE_RESPONSE message and use this to calculate
- * latency to this peer.  Pass the updated information (existing ats
- * plus calculated latency) to ATS.
- *
- * @param neighbour neighbour to keep alive
- * @param m the message containing the keep alive response
- */
-void
-GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
-                                   const struct GNUNET_MessageHeader *m)
-{
-  struct NeighbourMapEntry *n;
-  const struct GNUNET_ATS_SessionKeepAliveMessage *msg;
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-  struct GNUNET_TIME_Relative latency;
-
-  if (sizeof(struct GNUNET_ATS_SessionKeepAliveMessage) != ntohs (m->size))
-  {
-    GNUNET_break_op (0);
-    return;
-  }
-
-  msg = (const struct GNUNET_ATS_SessionKeepAliveMessage *) m;
-  if (NULL == (n = lookup_neighbour (neighbour)))
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# KEEPALIVE_RESPONSEs discarded (not 
connected)"),
-                              1,
-                              GNUNET_NO);
-    return;
-  }
-  if ((GNUNET_TRANSPORT_PS_CONNECTED != n->state) ||
-      (GNUNET_YES != n->expect_latency_response))
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# KEEPALIVE_RESPONSEs discarded (not 
expected)"),
-                              1,
-                              GNUNET_NO);
-    return;
-  }
-  if (NULL == n->primary_address.address)
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# KEEPALIVE_RESPONSEs discarded (address 
changed)"),
-                              1,
-                              GNUNET_NO);
-    return;
-  }
-  if (n->primary_address.keep_alive_nonce != ntohl (msg->nonce))
-  {
-    if (0 == n->primary_address.keep_alive_nonce)
-      GNUNET_STATISTICS_update (GST_stats,
-                                gettext_noop (
-                                  "# KEEPALIVE_RESPONSEs discarded (no 
nonce)"),
-                                1,
-                                GNUNET_NO);
-    else
-      GNUNET_STATISTICS_update (GST_stats,
-                                gettext_noop (
-                                  "# KEEPALIVE_RESPONSEs discarded (bad 
nonce)"),
-                                1,
-                                GNUNET_NO);
-    return;
-  }
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop (
-                              "# KEEPALIVE_RESPONSEs received (OK)"),
-                            1,
-                            GNUNET_NO);
-
-
-  /* Update session timeout here */
-  if (NULL != (papi = GST_plugins_find (
-                 n->primary_address.address->transport_name)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Updating session for peer `%s' for session %p\n",
-                GNUNET_i2s (&n->id),
-                n->primary_address.session);
-    papi->update_session_timeout (papi->cls,
-                                  &n->id,
-                                  n->primary_address.session);
-  }
-  else
-  {
-    GNUNET_break (0);
-  }
-
-  n->primary_address.keep_alive_nonce = 0;
-  n->expect_latency_response = GNUNET_NO;
-  set_state_and_timeout (n,
-                         n->state,
-                         GNUNET_TIME_relative_to_absolute (
-                           GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
-
-  latency = GNUNET_TIME_absolute_get_duration (n->last_keep_alive_time);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received KEEPALIVE_RESPONSE from peer `%s', latency is %s\n",
-              GNUNET_i2s (&n->id),
-              GNUNET_STRINGS_relative_time_to_string (latency,
-                                                      GNUNET_YES));
-  GST_ats_update_delay (n->primary_address.address,
-                        GNUNET_TIME_relative_divide (latency,
-                                                     2));
-}
-
-
-/**
- * We have received a message from the given sender.  How long should
- * we delay before receiving more?  (Also used to keep the peer marked
- * as live).
- *
- * @param sender sender of the message
- * @param size size of the message
- * @param do_forward set to #GNUNET_YES if the message should be forwarded to 
clients
- *                   #GNUNET_NO if the neighbour is not connected or violates 
the quota,
- *                   #GNUNET_SYSERR if the connection is not fully up yet
- * @return how long to wait before reading more from this sender
- */
-struct GNUNET_TIME_Relative
-GST_neighbours_calculate_receive_delay (const struct
-                                        GNUNET_PeerIdentity *sender,
-                                        ssize_t size,
-                                        int *do_forward)
-{
-  struct NeighbourMapEntry *n;
-  struct GNUNET_TIME_Relative ret;
-
-  if (NULL == neighbours)
-  {
-    *do_forward = GNUNET_NO;
-    return GNUNET_TIME_UNIT_FOREVER_REL;   /* This can happen during shutdown 
*/
-  }
-  if (NULL == (n = lookup_neighbour (sender)))
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# messages discarded due to lack of neighbour 
record"),
-                              1,
-                              GNUNET_NO);
-    *do_forward = GNUNET_NO;
-    return GNUNET_TIME_UNIT_ZERO;
-  }
-  if (! test_connected (n))
-  {
-    *do_forward = GNUNET_SYSERR;
-    return GNUNET_TIME_UNIT_ZERO;
-  }
-  if (GNUNET_YES == GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, size))
-  {
-    n->quota_violation_count++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Bandwidth quota (%u b/s) violation detected (total of %u).\n",
-                n->in_tracker.available_bytes_per_s__,
-                n->quota_violation_count);
-    /* Discount 32k per violation */
-    GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, -32 * 1024);
-  }
-  else
-  {
-    if (n->quota_violation_count > 0)
-    {
-      /* try to add 32k back */
-      GNUNET_BANDWIDTH_tracker_consume (&n->in_tracker, 32 * 1024);
-      n->quota_violation_count--;
-    }
-  }
-  if (n->quota_violation_count > QUOTA_VIOLATION_DROP_THRESHOLD)
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                                ("# bandwidth quota violations by other 
peers"),
-                              1, GNUNET_NO);
-    *do_forward = GNUNET_NO;
-    return GNUNET_CONSTANTS_QUOTA_VIOLATION_TIMEOUT;
-  }
-  *do_forward = GNUNET_YES;
-  ret = GNUNET_BANDWIDTH_tracker_get_delay (&n->in_tracker, 32 * 1024);
-  if (ret.rel_value_us > 0)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Throttling read (%lld bytes excess at %u b/s), waiting %s 
before reading more.\n",
-                (long long) n->in_tracker.consumption_since_last_update__,
-                (unsigned int) n->in_tracker.available_bytes_per_s__,
-                GNUNET_STRINGS_relative_time_to_string (ret, GNUNET_YES));
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop ("# ms throttling suggested"),
-                              (int64_t) ret.rel_value_us / 1000LL,
-                              GNUNET_NO);
-  }
-  return ret;
-}
-
-
-void
-GST_neighbours_send (const struct GNUNET_PeerIdentity *target,
-                     const void *msg,
-                     size_t msg_size,
-                     struct GNUNET_TIME_Relative timeout,
-                     GST_NeighbourSendContinuation cont,
-                     void *cont_cls)
-{
-  struct NeighbourMapEntry *n;
-  struct MessageQueue *mq;
-
-  /* All ove these cases should never happen; they are all API violations.
-     But we check anyway, just to be sure. */
-  if (NULL == (n = lookup_neighbour (target)))
-  {
-    GNUNET_break (0);
-    if (NULL != cont)
-      cont (cont_cls,
-            GNUNET_SYSERR,
-            msg_size,
-            0);
-    return;
-  }
-  if (GNUNET_YES != test_connected (n))
-  {
-    GNUNET_break (0);
-    if (NULL != cont)
-      cont (cont_cls,
-            GNUNET_SYSERR,
-            msg_size,
-            0);
-    return;
-  }
-  bytes_in_send_queue += msg_size;
-  GNUNET_STATISTICS_set (GST_stats,
-                         gettext_noop
-                           ("# bytes in message queue for other peers"),
-                         bytes_in_send_queue, GNUNET_NO);
-  mq = GNUNET_malloc (sizeof(struct MessageQueue) + msg_size);
-  mq->cont = cont;
-  mq->cont_cls = cont_cls;
-  GNUNET_memcpy (&mq[1], msg, msg_size);
-  mq->message_buf = (const char *) &mq[1];
-  mq->message_buf_size = msg_size;
-  mq->timeout = GNUNET_TIME_relative_to_absolute (timeout);
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Enqueueing %u bytes to send to peer %s\n",
-              (unsigned int) msg_size,
-              GNUNET_i2s (target));
-  GNUNET_CONTAINER_DLL_insert_tail (n->messages_head,
-                                    n->messages_tail,
-                                    mq);
-  if (NULL != n->task)
-    GNUNET_SCHEDULER_cancel (n->task);
-  n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
-}
-
-
-/**
- * Continuation called from our attempt to transmitted our
- * #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_SYN to the specified @a
- * target.  Continue processing based on the @a result.  Specifically,
- * if we failed to transmit, discard the address we used.
- *
- * @param cls NULL
- * @param target which peer received the transmission
- * @param result #GNUNET_OK if sending worked
- * @param size_payload how many bytes of payload were sent (ignored)
- * @param size_on_wire how much bandwidth was consumed on the wire (ignored)
- */
-static void
-send_session_syn_cont (void *cls,
-                       const struct GNUNET_PeerIdentity *target,
-                       int result,
-                       size_t size_payload,
-                       size_t size_on_wire)
-{
-  struct NeighbourMapEntry *n;
-
-  (void) cls;
-  (void) size_payload;
-  (void) size_on_wire;
-  n = lookup_neighbour (target);
-  if (NULL == n)
-  {
-    /* SYN continuation was called after neighbor was freed,
-     * for example due to a time out for the state or the session
-     * used was already terminated: nothing to do here... */
-    return;
-  }
-
-  if ((GNUNET_TRANSPORT_PS_SYN_SENT != n->state) &&
-      (GNUNET_TRANSPORT_PS_RECONNECT_SENT != n->state) &&
-      (GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT != n->state))
-  {
-    /* SYN continuation was called after neighbor changed state,
-     * for example due to a time out for the state or the session
-     * used was already terminated: nothing to do here... */
-    return;
-  }
-  if (GNUNET_OK == result)
-    return;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              _ ("Failed to send SYN message to peer `%s'\n"),
-              GNUNET_i2s (target));
-  switch (n->state)
-  {
-  case GNUNET_TRANSPORT_PS_SYN_SENT:
-    /* Remove address and request an additional one */
-    unset_primary_address (n);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_INIT_ATS,
-                           GNUNET_TIME_relative_to_absolute (
-                             FAST_RECONNECT_TIMEOUT));
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_SENT:
-    /* Remove address and request an additional one */
-    unset_primary_address (n);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_RECONNECT_ATS,
-                           GNUNET_TIME_relative_to_absolute (
-                             ATS_RESPONSE_TIMEOUT));
-    break;
-
-  case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT:
-    /* Remove address and request and go back to primary address */
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# Failed attempts to switch addresses (failed 
to send SYN CONT)"),
-                              1,
-                              GNUNET_NO);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Switch failed, cleaning up alternative address\n");
-    free_address (&n->alternative_address);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_CONNECTED,
-                           GNUNET_TIME_relative_to_absolute (
-                             ATS_RESPONSE_TIMEOUT));
-    break;
-
-  default:
-    disconnect_neighbour (n);
-    break;
-  }
-}
-
-
-/**
- * Send a SYN message via the given address.
- *
- * @param na address to use
- */
-static void
-send_syn (struct NeighbourAddress *na)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-  struct TransportSynMessage connect_msg;
-  struct NeighbourMapEntry *n;
-
-  GNUNET_assert (NULL != na->session);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Sending SYN message to peer `%s' at %s\n",
-              GNUNET_i2s (&na->address->peer),
-              GST_plugins_a2s (na->address));
-
-  papi = GST_plugins_find (na->address->transport_name);
-  GNUNET_assert (NULL != papi);
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop
-                              ("# SYN messages sent"),
-                            1, GNUNET_NO);
-  na->connect_timestamp = GNUNET_TIME_absolute_get ();
-  connect_msg.header.size = htons (sizeof(struct TransportSynMessage));
-  connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_SYN);
-  connect_msg.reserved = htonl (0);
-  connect_msg.timestamp = GNUNET_TIME_absolute_hton (na->connect_timestamp);
-  if (-1 ==
-      papi->send (papi->cls,
-                  na->session,
-                  (const char *) &connect_msg,
-                  sizeof(struct TransportSynMessage),
-                  UINT_MAX,
-                  SETUP_CONNECTION_TIMEOUT,
-                  &send_session_syn_cont, NULL))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                _ ("Failed to transmit SYN message to %s\n"),
-                GST_plugins_a2s (na->address));
-    n = lookup_neighbour (&na->address->peer);
-    if (NULL == n)
-    {
-      GNUNET_break (0);
-      return;
-    }
-    switch (n->state)
-    {
-    case GNUNET_TRANSPORT_PS_SYN_SENT:
-      /* Remove address and request and additional one */
-      GNUNET_assert (na == &n->primary_address);
-      unset_primary_address (n);
-      set_state_and_timeout (n,
-                             GNUNET_TRANSPORT_PS_INIT_ATS,
-                             GNUNET_TIME_relative_to_absolute (
-                               FAST_RECONNECT_TIMEOUT));
-      /* Hard failure to send the SYN message with this address:
-         Destroy address and session */
-      break;
-
-    case GNUNET_TRANSPORT_PS_RECONNECT_SENT:
-      /* Remove address and request an additional one */
-      GNUNET_assert (na == &n->primary_address);
-      unset_primary_address (n);
-      set_state_and_timeout (n,
-                             GNUNET_TRANSPORT_PS_RECONNECT_ATS,
-                             GNUNET_TIME_relative_to_absolute (
-                               ATS_RESPONSE_TIMEOUT));
-      break;
-
-    case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT:
-      GNUNET_assert (na == &n->alternative_address);
-      GNUNET_STATISTICS_update (GST_stats,
-                                gettext_noop (
-                                  "# Failed attempts to switch addresses 
(failed to send SYN)"),
-                                1,
-                                GNUNET_NO);
-      /* Remove address and request an additional one */
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Switch failed, cleaning up alternative address\n");
-      free_address (&n->alternative_address);
-      set_state_and_timeout (n,
-                             GNUNET_TRANSPORT_PS_CONNECTED,
-                             GNUNET_TIME_relative_to_absolute (
-                               ATS_RESPONSE_TIMEOUT));
-      break;
-
-    default:
-      GNUNET_break (0);
-      disconnect_neighbour (n);
-      break;
-    }
-    return;
-  }
-  GST_neighbours_notify_data_sent (na->address,
-                                   na->session,
-                                   sizeof(struct TransportSynMessage));
-}
-
-
-/**
- * Continuation called from our attempt to transmitted our
- * #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_SYN_ACK to the specified @a
- * target.  Continue processing based on the @a result.  Specifically,
- * if we failed to transmit, discard the address we used.
- *
- * @param cls NULL
- * @param target which peer received the transmission
- * @param result #GNUNET_OK if sending worked
- * @param size_payload how many bytes of payload were sent (ignored)
- * @param size_on_wire how much bandwidth was consumed on the wire (ignored)
- */
-static void
-send_session_syn_ack_cont (void *cls,
-                           const struct GNUNET_PeerIdentity *target,
-                           int result,
-                           size_t size_payload,
-                           size_t size_on_wire)
-{
-  struct NeighbourMapEntry *n;
-
-  (void) cls;
-  (void) size_payload;
-  (void) size_on_wire;
-  n = lookup_neighbour (target);
-  if (NULL == n)
-  {
-    /* SYN_ACK continuation was called after neighbor was freed,
-     * for example due to a time out for the state or the session
-     * used was already terminated: nothing to do here... */
-    return;
-  }
-
-  if (GNUNET_TRANSPORT_PS_SYN_RECV_ACK != n->state)
-  {
-    /* SYN_ACK continuation was called after neighbor changed state,
-     * for example due to a time out for the state or the session
-     * used was already terminated: nothing to do here... */
-    return;
-  }
-  if (GNUNET_OK == result)
-    return;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              _ (
-                "Failed to send SYN_ACK message to peer `%s' using address 
`%s'\n"),
-              GNUNET_i2s (target),
-              GST_plugins_a2s (n->primary_address.address));
-
-  /* Remove address and request and additional one */
-  /* FIXME: what if the neighbour's primary address
-     changed in the meantime? Might want to instead
-     pass "something" around in closure to be sure. */
-  unset_primary_address (n);
-  n->ack_state = ACK_SEND_SYN_ACK;
-  set_state_and_timeout (n,
-                         GNUNET_TRANSPORT_PS_SYN_RECV_ATS,
-                         GNUNET_TIME_relative_to_absolute (
-                           ATS_RESPONSE_TIMEOUT));
-}
-
-
-/**
- * Send a SYN_ACK message via the given address.
- *
- * @param na address and session to use
- * @param timestamp timestamp to use for the ACK message
- * @return #GNUNET_SYSERR if sending immediately failed, #GNUNET_OK otherwise
- */
-static void
-send_syn_ack_message (struct NeighbourAddress *na,
-                      struct GNUNET_TIME_Absolute timestamp)
-{
-  const struct GNUNET_HELLO_Address *address = na->address;
-  struct GNUNET_ATS_Session *session = na->session;
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-  struct TransportSynMessage connect_msg;
-  struct NeighbourMapEntry *n;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Sending SYN_ACK to peer `%s'\n",
-              GNUNET_i2s (&address->peer));
-
-  if (NULL == (papi = GST_plugins_find (address->transport_name)))
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if (NULL == session)
-    session = papi->get_session (papi->cls,
-                                 address);
-  if (NULL == session)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GST_ats_new_session (address,
-                       session);
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop
-                              ("# SYN_ACK messages sent"),
-                            1, GNUNET_NO);
-  connect_msg.header.size = htons (sizeof(struct TransportSynMessage));
-  connect_msg.header.type = htons (
-    GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_SYN_ACK);
-  connect_msg.reserved = htonl (0);
-  connect_msg.timestamp = GNUNET_TIME_absolute_hton (timestamp);
-
-  if (GNUNET_SYSERR ==
-      papi->send (papi->cls,
-                  session,
-                  (const char *) &connect_msg,
-                  sizeof(struct TransportSynMessage),
-                  UINT_MAX,
-                  GNUNET_TIME_UNIT_FOREVER_REL,
-                  &send_session_syn_ack_cont, NULL))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                _ ("Failed to transmit SYN_ACK message to %s\n"),
-                GST_plugins_a2s (address));
-
-    n = lookup_neighbour (&address->peer);
-    if (NULL == n)
-    {
-      GNUNET_break (0);
-      return;
-    }
-    /* Remove address and request and additional one */
-    unset_primary_address (n);
-    n->ack_state = ACK_SEND_SYN_ACK;
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_SYN_RECV_ATS,
-                           GNUNET_TIME_relative_to_absolute (
-                             ATS_RESPONSE_TIMEOUT));
-    return;
-  }
-}
-
-
-/**
- * Function called by the bandwidth tracker for a peer whenever
- * the tracker's state changed such that we need to recalculate
- * the delay for flow control.  We calculate the latest delay
- * and inform the plugin (if applicable).
- *
- * @param cls the `struct NeighbourMapEntry` to update calculations for
- */
-static void
-inbound_bw_tracker_update (void *cls)
-{
-  struct NeighbourMapEntry *n = cls;
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-  struct GNUNET_TIME_Relative delay;
-  int do_forward;
-
-  if (NULL == n->primary_address.address)
-    return; /* not active, ignore */
-  papi = GST_plugins_find (n->primary_address.address->transport_name);
-  GNUNET_assert (NULL != papi);
-  if (NULL == papi->update_inbound_delay)
-    return;
-  delay = GST_neighbours_calculate_receive_delay (&n->id,
-                                                  0,
-                                                  &do_forward);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "New inbound delay for peer `%s' is %llu ms\n",
-              GNUNET_i2s (&n->id),
-              (unsigned long long) delay.rel_value_us / 1000LL);
-  if (NULL == n->primary_address.session)
-    return;
-  papi->update_inbound_delay (papi->cls,
-                              &n->id,
-                              n->primary_address.session,
-                              delay);
-}
-
-
-/**
- * Create a fresh entry in the neighbour map for the given peer
- *
- * @param peer peer to create an entry for
- * @return new neighbour map entry
- */
-static struct NeighbourMapEntry *
-setup_neighbour (const struct GNUNET_PeerIdentity *peer)
-{
-  struct NeighbourMapEntry *n;
-
-  if (0 ==
-      memcmp (&GST_my_identity,
-              peer,
-              sizeof(struct GNUNET_PeerIdentity)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Cowardly refusing to consider myself my neighbour!\n");
-    return NULL;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Creating new neighbour entry for `%s'\n",
-              GNUNET_i2s (peer));
-  n = GNUNET_new (struct NeighbourMapEntry);
-  n->id = *peer;
-  n->ack_state = ACK_UNDEFINED;
-  n->last_util_transmission = GNUNET_TIME_absolute_get ();
-  n->neighbour_receive_quota = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT;
-  GNUNET_BANDWIDTH_tracker_init (&n->in_tracker,
-                                 &inbound_bw_tracker_update,
-                                 n,
-                                 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
-                                 MAX_BANDWIDTH_CARRY_S);
-  n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
-  set_state_and_timeout (n,
-                         GNUNET_TRANSPORT_PS_NOT_CONNECTED,
-                         GNUNET_TIME_UNIT_FOREVER_ABS);
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multipeermap_put (neighbours,
-                                                    &n->id,
-                                                    n,
-                                                    
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-  n->suggest_handle = GNUNET_ATS_connectivity_suggest (GST_ats_connect,
-                                                       peer,
-                                                       0);
-
-  return n;
-}
-
-
-/**
- * Entry in a DLL we use to keep track of pending blacklist checks.
- */
-struct BlacklistCheckSwitchContext
-{
-  /**
-   * DLL prev pointer.
-   */
-  struct BlacklistCheckSwitchContext *prev;
-
-  /**
-   * DLL next pointer.
-   */
-  struct BlacklistCheckSwitchContext *next;
-
-  /**
-   * Handle to the blacklist check we are performing.
-   */
-  struct GST_BlacklistCheck *blc;
-
-  /**
-   * Inbound bandwidth that was assigned to @e address.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
-
-  /**
-   * Outbound bandwidth that was assigned to @e address.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
-};
-
-
-/**
- * We received a 'SYN' message from the other peer.
- * Consider switching to it.
- *
- * @param message possibly a `struct TransportSynMessage` (check format)
- * @param peer identity of the peer to switch the address for
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_neighbours_handle_session_syn (const struct GNUNET_MessageHeader *message,
-                                   const struct GNUNET_PeerIdentity *peer)
-{
-  const struct TransportSynMessage *scm;
-  struct NeighbourMapEntry *n;
-  struct GNUNET_TIME_Absolute ts;
-
-  if (ntohs (message->size) != sizeof(struct TransportSynMessage))
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop
-                              ("# SYN messages received"),
-                            1, GNUNET_NO);
-  if (NULL == neighbours)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ (
-                  "SYN request from peer `%s' ignored due impending 
shutdown\n"),
-                GNUNET_i2s (peer));
-    return GNUNET_OK;   /* we're shutting down */
-  }
-  scm = (const struct TransportSynMessage *) message;
-  GNUNET_break_op (0 == ntohl (scm->reserved));
-  ts = GNUNET_TIME_absolute_ntoh (scm->timestamp);
-  if (0 ==
-      memcmp (&GST_my_identity,
-              peer,
-              sizeof(struct GNUNET_PeerIdentity)))
-  {
-    /* loopback connection-to-self, ignore */
-    return GNUNET_SYSERR;
-  }
-  n = lookup_neighbour (peer);
-  if (NULL == n)
-  {
-    /* This is a new neighbour and set to not connected */
-    n = setup_neighbour (peer);
-    GNUNET_assert (NULL != n);
-  }
-
-  /* Remember this SYN message in neighbour */
-  n->ack_state = ACK_SEND_SYN_ACK;
-  n->connect_ack_timestamp = ts;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Received SYN for peer `%s' in state %s/%s\n",
-              GNUNET_i2s (peer),
-              GNUNET_TRANSPORT_ps2s (n->state),
-              print_ack_state (n->ack_state));
-
-  switch (n->state)
-  {
-  case GNUNET_TRANSPORT_PS_NOT_CONNECTED:
-    /* Request an address from ATS to send SYN_ACK to this peer */
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_SYN_RECV_ATS,
-                           GNUNET_TIME_relative_to_absolute (
-                             ATS_RESPONSE_TIMEOUT));
-    break;
-
-  case GNUNET_TRANSPORT_PS_INIT_ATS:
-    /* SYN message takes priority over us asking ATS for address:
-     * Wait for ATS to suggest an address and send SYN_ACK */
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_SYN_RECV_ATS,
-                           GNUNET_TIME_relative_to_absolute (
-                             ATS_RESPONSE_TIMEOUT));
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ATS:
-    /* We already wait for an address to send an SYN_ACK */
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_SENT:
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ACK:
-    /* Send ACK immediately */
-    n->ack_state = ACK_SEND_ACK;
-    send_syn_ack_message (&n->primary_address,
-                          ts);
-    break;
-
-  case GNUNET_TRANSPORT_PS_CONNECTED:
-    /* we are already connected and can thus send the ACK immediately */
-    GNUNET_assert (NULL != n->primary_address.address);
-    GNUNET_assert (NULL != n->primary_address.session);
-    n->ack_state = ACK_SEND_ACK;
-    send_syn_ack_message (&n->primary_address,
-                          ts);
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_ATS:
-    /* We wait for ATS address suggestion */
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_SENT:
-    /* We received a SYN message while waiting for a SYN_ACK in fast
-     * reconnect. Send SYN_ACK immediately */
-    n->ack_state = ACK_SEND_ACK;
-    send_syn_ack_message (&n->primary_address,
-                          n->connect_ack_timestamp);
-    break;
-
-  case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT:
-    /* We are already connected and can thus send the ACK immediately;
-       still, it can never hurt to have an alternative address, so also
-       tell ATS  about it */
-    GNUNET_assert (NULL != n->primary_address.address);
-    GNUNET_assert (NULL != n->primary_address.session);
-    n->ack_state = ACK_SEND_ACK;
-    send_syn_ack_message (&n->primary_address,
-                          ts);
-    break;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT:
-    /* Get rid of remains and re-try */
-    free_neighbour (n);
-    n = setup_neighbour (peer);
-    GNUNET_assert (NULL != n);
-    /* Remember the SYN time stamp for ACK message */
-    n->ack_state = ACK_SEND_SYN_ACK;
-    n->connect_ack_timestamp = ts;
-    /* Request an address for the peer */
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_SYN_RECV_ATS,
-                           GNUNET_TIME_relative_to_absolute (
-                             ATS_RESPONSE_TIMEOUT));
-    break;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED:
-    /* should not be possible */
-    GNUNET_assert (0);
-    break;
-
-  default:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unhandled state `%s'\n",
-                GNUNET_TRANSPORT_ps2s (n->state));
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Check if the given @a address is the same that we are already
- * using for the respective neighbour. If so, update the bandwidth
- * assignment and possibly the session and return #GNUNET_OK.
- * If the new address is different from what the neighbour is
- * using right now, return #GNUNET_NO.
- *
- * @param address address of the other peer,
- * @param session session to use or NULL if transport should initiate a session
- * @param bandwidth_in inbound quota to be used when connection is up,
- *      0 to disconnect from peer
- * @param bandwidth_out outbound quota to be used when connection is up,
- *      0 to disconnect from peer
- * @return #GNUNET_OK if we were able to just update the bandwidth and session,
- *         #GNUNET_NO if more extensive changes are required (address changed)
- */
-static int
-try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address,
-                         struct GNUNET_ATS_Session *session,
-                         struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                         struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
-{
-  struct NeighbourMapEntry *n;
-
-  n = lookup_neighbour (&address->peer);
-  if ((NULL == n) ||
-      (NULL == n->primary_address.address) ||
-      (0 != GNUNET_HELLO_address_cmp (address,
-                                      n->primary_address.address)))
-    return GNUNET_NO;
-  /* We are not really switching addresses, but merely adjusting
-     session and/or bandwidth, can do fast ATS update! */
-  if (session != n->primary_address.session)
-  {
-    /* switch to a different session, but keeping same address; could
-       happen if there is a 2nd inbound connection */
-    n->primary_address.session = session;
-    GNUNET_assert (GNUNET_YES ==
-                   GST_ats_is_known (n->primary_address.address,
-                                     n->primary_address.session));
-  }
-  if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__)
-  {
-    n->primary_address.bandwidth_in = bandwidth_in;
-    if (GNUNET_YES !=
-        set_incoming_quota (n,
-                            bandwidth_in))
-      return GNUNET_NO;
-  }
-  if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__)
-  {
-    n->primary_address.bandwidth_out = bandwidth_out;
-    send_outbound_quota_to_clients (n);
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * We've been asked to switch addresses, and just now got the result
- * from the blacklist check to see if this is allowed.
- *
- * @param cls the `struct BlacklistCheckSwitchContext` with
- *        the information about the future address
- * @param peer the peer we may switch addresses on
- * @param address address associated with the request
- * @param session session associated with the request
- * @param result #GNUNET_OK if the connection is allowed,
- *               #GNUNET_NO if not,
- *               #GNUNET_SYSERR if operation was aborted
- */
-static void
-switch_address_bl_check_cont (void *cls,
-                              const struct GNUNET_PeerIdentity *peer,
-                              const struct GNUNET_HELLO_Address *address,
-                              struct GNUNET_ATS_Session *session,
-                              int result)
-{
-  struct BlacklistCheckSwitchContext *blc_ctx = cls;
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-  struct NeighbourMapEntry *n;
-
-  if (GNUNET_SYSERR == result)
-    goto cleanup;
-
-  papi = GST_plugins_find (address->transport_name);
-  if (NULL == papi)
-  {
-    /* This can happen during shutdown. */
-    goto cleanup;
-  }
-
-  if (GNUNET_NO == result)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Blacklist denied to switch to suggested address `%s' session 
%p for peer `%s'\n",
-                GST_plugins_a2s (address),
-                session,
-                GNUNET_i2s (peer));
-    GNUNET_STATISTICS_update (GST_stats,
-                              "# ATS suggestions ignored (blacklist denied)",
-                              1,
-                              GNUNET_NO);
-    if (NULL != session)
-      papi->disconnect_session (papi->cls,
-                                session);
-    if (GNUNET_YES !=
-        GNUNET_HELLO_address_check_option (address,
-                                           GNUNET_HELLO_ADDRESS_INFO_INBOUND))
-      GST_ats_block_address (address,
-                             NULL);
-    goto cleanup;
-  }
-
-
-  if (NULL == session)
-  {
-    /* need to create a session, ATS only gave us an address */
-    session = papi->get_session (papi->cls,
-                                 address);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Obtained new session for peer `%s' and  address '%s': %p\n",
-                GNUNET_i2s (&address->peer),
-                GST_plugins_a2s (address),
-                session);
-    if (NULL != session)
-      GST_ats_new_session (address,
-                           session);
-  }
-  if (NULL == session)
-  {
-    /* session creation failed, bad!, fail! */
-    GNUNET_STATISTICS_update (GST_stats,
-                              "# ATS suggestions ignored (failed to create 
session)",
-                              1,
-                              GNUNET_NO);
-    /* No session could be obtained, remove blacklist check and clean up */
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Failed to obtain new session for peer `%s' and address 
'%s'\n",
-                GNUNET_i2s (&address->peer),
-                GST_plugins_a2s (address));
-    GST_ats_block_address (address,
-                           session);
-    goto cleanup;
-  }
-
-  /* We did this check already before going into blacklist, but
-     it is theoretically possible that the situation changed in
-     the meantime, hence we check again here */
-  if (GNUNET_OK ==
-      try_run_fast_ats_update (address,
-                               session,
-                               blc_ctx->bandwidth_in,
-                               blc_ctx->bandwidth_out))
-    goto cleanup; /* was just a minor update, we're done */
-
-  /* check if we also need to setup the neighbour entry */
-  if (NULL == (n = lookup_neighbour (peer)))
-  {
-    n = setup_neighbour (peer);
-    if (NULL == n)
-    {
-      /* not sure how this can happen... */
-      GNUNET_break (0);
-      goto cleanup;
-    }
-    n->state = GNUNET_TRANSPORT_PS_INIT_ATS;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Peer `%s' switches to address `%s'\n",
-              GNUNET_i2s (&address->peer),
-              GST_plugins_a2s (address));
-
-  switch (n->state)
-  {
-  case GNUNET_TRANSPORT_PS_NOT_CONNECTED:
-    GNUNET_break (0);
-    GST_ats_block_address (address,
-                           session);
-    free_neighbour (n);
-    return;
-
-  case GNUNET_TRANSPORT_PS_INIT_ATS:
-    /* We requested an address and ATS suggests one:
-     * set primary address and send SYN message*/
-    set_primary_address (n,
-                         address,
-                         session,
-                         blc_ctx->bandwidth_in,
-                         blc_ctx->bandwidth_out);
-    if (ACK_SEND_SYN_ACK == n->ack_state)
-    {
-      /* Send pending SYN_ACK message */
-      n->ack_state = ACK_SEND_ACK;
-      send_syn_ack_message (&n->primary_address,
-                            n->connect_ack_timestamp);
-    }
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_SYN_SENT,
-                           GNUNET_TIME_relative_to_absolute (
-                             SETUP_CONNECTION_TIMEOUT));
-    send_syn (&n->primary_address);
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_SENT:
-    /* ATS suggested a new address while waiting for an SYN_ACK:
-     * Switch and send new SYN */
-    /* ATS suggests a different address, switch again */
-    set_primary_address (n,
-                         address,
-                         session,
-                         blc_ctx->bandwidth_in,
-                         blc_ctx->bandwidth_out);
-    if (ACK_SEND_SYN_ACK == n->ack_state)
-    {
-      /* Send pending SYN_ACK message */
-      n->ack_state = ACK_SEND_ACK;
-      send_syn_ack_message (&n->primary_address,
-                            n->connect_ack_timestamp);
-    }
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_SYN_SENT,
-                           GNUNET_TIME_relative_to_absolute (
-                             SETUP_CONNECTION_TIMEOUT));
-    send_syn (&n->primary_address);
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ATS:
-    /* We requested an address and ATS suggests one:
-    * set primary address and send SYN_ACK message*/
-    set_primary_address (n,
-                         address,
-                         session,
-                         blc_ctx->bandwidth_in,
-                         blc_ctx->bandwidth_out);
-    /* Send an ACK message as a response to the SYN msg */
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_SYN_RECV_ACK,
-                           GNUNET_TIME_relative_to_absolute (
-                             SETUP_CONNECTION_TIMEOUT));
-    send_syn_ack_message (&n->primary_address,
-                          n->connect_ack_timestamp);
-    if ((ACK_SEND_SYN_ACK == n->ack_state) ||
-        (ACK_UNDEFINED == n->ack_state))
-      n->ack_state = ACK_SEND_ACK;
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ACK:
-    /* ATS asks us to switch while we were trying to connect; switch to new
-       address and check blacklist again */
-    if ((ACK_SEND_SYN_ACK == n->ack_state))
-    {
-      n->ack_state = ACK_SEND_ACK;
-      send_syn_ack_message (&n->primary_address,
-                            n->connect_ack_timestamp);
-    }
-    set_primary_address (n,
-                         address,
-                         session,
-                         blc_ctx->bandwidth_in,
-                         blc_ctx->bandwidth_out);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_SYN_RECV_ACK,
-                           GNUNET_TIME_relative_to_absolute (
-                             SETUP_CONNECTION_TIMEOUT));
-    break;
-
-  case GNUNET_TRANSPORT_PS_CONNECTED:
-    GNUNET_assert (NULL != n->primary_address.address);
-    GNUNET_assert (NULL != n->primary_address.session);
-    GNUNET_break (n->primary_address.session != session);
-    /* ATS asks us to switch a life connection; see if we can get
-       a SYN_ACK on it before we actually do this! */
-    set_alternative_address (n,
-                             address,
-                             session,
-                             blc_ctx->bandwidth_in,
-                             blc_ctx->bandwidth_out);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT,
-                           GNUNET_TIME_relative_to_absolute (
-                             SETUP_CONNECTION_TIMEOUT));
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop ("# Attempts to switch addresses"),
-                              1,
-                              GNUNET_NO);
-    send_syn (&n->alternative_address);
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_ATS:
-    set_primary_address (n,
-                         address,
-                         session,
-                         blc_ctx->bandwidth_in,
-                         blc_ctx->bandwidth_out);
-    if (ACK_SEND_SYN_ACK == n->ack_state)
-    {
-      /* Send pending SYN_ACK message */
-      n->ack_state = ACK_SEND_ACK;
-      send_syn_ack_message (&n->primary_address,
-                            n->connect_ack_timestamp);
-    }
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_RECONNECT_SENT,
-                           GNUNET_TIME_relative_to_absolute (
-                             FAST_RECONNECT_TIMEOUT));
-    send_syn (&n->primary_address);
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_SENT:
-    /* ATS asks us to switch while we were trying to reconnect; switch to new
-       address and send SYN again */
-    set_primary_address (n,
-                         address,
-                         session,
-                         blc_ctx->bandwidth_in,
-                         blc_ctx->bandwidth_out);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_RECONNECT_SENT,
-                           GNUNET_TIME_relative_to_absolute (
-                             FAST_RECONNECT_TIMEOUT));
-    send_syn (&n->primary_address);
-    break;
-
-  case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT:
-    if ((0 == GNUNET_HELLO_address_cmp (n->primary_address.address,
-                                        address)) &&
-        (n->primary_address.session == session))
-    {
-      /* ATS switches back to still-active session */
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "ATS double-switched, cleaning up alternative address\n");
-      free_address (&n->alternative_address);
-      set_state_and_timeout (n,
-                             GNUNET_TRANSPORT_PS_CONNECTED,
-                             n->timeout);
-      break;
-    }
-    /* ATS asks us to switch a life connection, send */
-    set_alternative_address (n,
-                             address,
-                             session,
-                             blc_ctx->bandwidth_in,
-                             blc_ctx->bandwidth_out);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT,
-                           GNUNET_TIME_relative_to_absolute (
-                             SETUP_CONNECTION_TIMEOUT));
-    send_syn (&n->alternative_address);
-    break;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT:
-    /* not going to switch addresses while disconnecting */
-    GNUNET_STATISTICS_update (GST_stats,
-                              "# ATS suggestion ignored (disconnecting)",
-                              1,
-                              GNUNET_NO);
-    return;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED:
-    GNUNET_assert (0);
-    break;
-
-  default:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unhandled state `%s'\n",
-                GNUNET_TRANSPORT_ps2s (n->state));
-    GNUNET_break (0);
-    break;
-  }
-cleanup:
-  GNUNET_CONTAINER_DLL_remove (pending_bc_head,
-                               pending_bc_tail,
-                               blc_ctx);
-  GNUNET_free (blc_ctx);
-}
-
-
-/**
- * For the given peer, switch to this address.
- *
- * Before accepting this addresses and actively using it, a blacklist check
- * is performed.
- *
- * If any check fails or the suggestion can somehow not be followed, we
- * MUST call #GST_ats_block_address() to tell ATS that the suggestion
- * could not be satisfied and force ATS to do something else.
- *
- * @param address address of the other peer,
- * @param session session to use or NULL if transport should initiate a session
- * @param bandwidth_in inbound quota to be used when connection is up,
- *      0 to disconnect from peer
- * @param bandwidth_out outbound quota to be used when connection is up,
- *      0 to disconnect from peer
- */
-void
-GST_neighbours_switch_to_address (const struct GNUNET_HELLO_Address *address,
-                                  struct GNUNET_ATS_Session *session,
-                                  struct GNUNET_BANDWIDTH_Value32NBO
-                                  bandwidth_in,
-                                  struct GNUNET_BANDWIDTH_Value32NBO
-                                  bandwidth_out)
-{
-  struct GST_BlacklistCheck *blc;
-  struct BlacklistCheckSwitchContext *blc_ctx;
-
-  GNUNET_assert (NULL != address->transport_name);
-  if (GNUNET_OK ==
-      try_run_fast_ats_update (address,
-                               session,
-                               bandwidth_in,
-                               bandwidth_out))
-    return;
-
-  /* Check if plugin is available */
-  if (NULL == (GST_plugins_find (address->transport_name)))
-  {
-    /* we don't have the plugin for this address */
-    GNUNET_break (0);
-    GST_ats_block_address (address,
-                           session);
-    return;
-  }
-  if ((NULL == session) &&
-      (GNUNET_HELLO_address_check_option (address,
-                                          GNUNET_HELLO_ADDRESS_INFO_INBOUND)))
-  {
-    /* This is a inbound address and we do not have a session to use! */
-    GNUNET_break (0);
-    GST_ats_block_address (address,
-                           session);
-    return;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "ATS suggests address '%s' for peer `%s' at %u/%u speed\n",
-              GST_plugins_a2s (address),
-              GNUNET_i2s (&address->peer),
-              (unsigned int) ntohl (bandwidth_in.value__),
-              (unsigned int) ntohl (bandwidth_out.value__));
-
-  /* Perform blacklist check */
-  blc_ctx = GNUNET_new (struct BlacklistCheckSwitchContext);
-  blc_ctx->bandwidth_in = bandwidth_in;
-  blc_ctx->bandwidth_out = bandwidth_out;
-  GNUNET_CONTAINER_DLL_insert (pending_bc_head,
-                               pending_bc_tail,
-                               blc_ctx);
-  if (NULL != (blc = GST_blacklist_test_allowed (&address->peer,
-                                                 address->transport_name,
-                                                 &switch_address_bl_check_cont,
-                                                 blc_ctx,
-                                                 address,
-                                                 session)))
-  {
-    blc_ctx->blc = blc;
-  }
-}
-
-
-/**
- * Function called to send network utilization data to ATS for
- * each active connection.
- *
- * @param cls NULL
- * @param key peer we send utilization data for
- * @param value the `struct NeighbourMapEntry *` with data to send
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-send_utilization_data (void *cls,
-                       const struct GNUNET_PeerIdentity *key,
-                       void *value)
-{
-  struct NeighbourMapEntry *n = value;
-  uint32_t bps_in;
-  uint32_t bps_out;
-  struct GNUNET_TIME_Relative delta;
-
-  (void) cls;
-  if ((GNUNET_YES != test_connected (n)) ||
-      (NULL == n->primary_address.address))
-    return GNUNET_OK;
-  delta = GNUNET_TIME_absolute_get_difference (n->last_util_transmission,
-                                               GNUNET_TIME_absolute_get ());
-  bps_in = 0;
-  if ((0 != n->util_total_bytes_recv) && (0 != delta.rel_value_us))
-    bps_in = (1000LL * 1000LL * n->util_total_bytes_recv)
-             / (delta.rel_value_us);
-  bps_out = 0;
-  if ((0 != n->util_total_bytes_sent) && (0 != delta.rel_value_us))
-    bps_out = (1000LL * 1000LL * n->util_total_bytes_sent) / 
delta.rel_value_us;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "`%s' total: received %u Bytes/s, sent %u Bytes/s\n",
-              GNUNET_i2s (key),
-              bps_in,
-              bps_out);
-  GST_ats_update_utilization (n->primary_address.address,
-                              bps_in,
-                              bps_out);
-  n->util_total_bytes_recv = 0;
-  n->util_total_bytes_sent = 0;
-  n->last_util_transmission = GNUNET_TIME_absolute_get ();
-  return GNUNET_OK;
-}
-
-
-/**
- * Task transmitting utilization in a regular interval
- *
- * @param cls the `struct NeighbourMapEntry` for which we are running
- */
-static void
-utilization_transmission (void *cls)
-{
-  (void) cls;
-  util_transmission_tk = NULL;
-  GNUNET_CONTAINER_multipeermap_iterate (neighbours,
-                                         &send_utilization_data,
-                                         NULL);
-  util_transmission_tk
-    = GNUNET_SCHEDULER_add_delayed (UTIL_TRANSMISSION_INTERVAL,
-                                    &utilization_transmission,
-                                    NULL);
-}
-
-
-/**
- * Track information about data we received from the
- * given address (used to notify ATS about our utilization
- * of allocated resources).
- *
- * @param address the address we got data from
- * @param message the message we received (really only the size is used)
- */
-void
-GST_neighbours_notify_data_recv (const struct GNUNET_HELLO_Address *address,
-                                 const struct GNUNET_MessageHeader *message)
-{
-  struct NeighbourMapEntry *n;
-
-  n = lookup_neighbour (&address->peer);
-  if (NULL == n)
-    return;
-  n->util_total_bytes_recv += ntohs (message->size);
-}
-
-
-/**
- * Track information about data we transmitted using the given @a
- * address and @a session (used to notify ATS about our utilization of
- * allocated resources).
- *
- * @param address the address we transmitted data to
- * @param session session we used to transmit data
- * @param message the message we sent (really only the size is used)
- */
-void
-GST_neighbours_notify_data_sent (const struct GNUNET_HELLO_Address *address,
-                                 struct GNUNET_ATS_Session *session,
-                                 size_t size)
-{
-  struct NeighbourMapEntry *n;
-
-  n = lookup_neighbour (&address->peer);
-  if (NULL == n)
-    return;
-  if (n->primary_address.session != session)
-    return;
-  n->util_total_bytes_sent += size;
-}
-
-
-static void
-master_task (void *cls)
-{
-  struct NeighbourMapEntry *n = cls;
-  struct GNUNET_TIME_Relative delay;
-
-  n->task = NULL;
-  delay = GNUNET_TIME_absolute_get_remaining (n->timeout);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Master task runs for neighbour `%s' in state %s with timeout in 
%s\n",
-              GNUNET_i2s (&n->id),
-              GNUNET_TRANSPORT_ps2s (n->state),
-              GNUNET_STRINGS_relative_time_to_string (delay,
-                                                      GNUNET_YES));
-  switch (n->state)
-  {
-  case GNUNET_TRANSPORT_PS_NOT_CONNECTED:
-    /* invalid state for master task, clean up */
-    GNUNET_break (0);
-    free_neighbour (n);
-    return;
-
-  case GNUNET_TRANSPORT_PS_INIT_ATS:
-    if (0 == delay.rel_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Connection to `%s' timed out waiting for ATS to provide 
address\n",
-                  GNUNET_i2s (&n->id));
-      free_neighbour (n);
-      return;
-    }
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_SENT:
-    if (0 == delay.rel_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Connection to `%s' timed out waiting for other peer to send 
SYN_ACK\n",
-                  GNUNET_i2s (&n->id));
-      /* Remove address and request and additional one */
-      unset_primary_address (n);
-      set_state_and_timeout (n,
-                             GNUNET_TRANSPORT_PS_INIT_ATS,
-                             GNUNET_TIME_relative_to_absolute (
-                               ATS_RESPONSE_TIMEOUT));
-      return;
-    }
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ATS:
-    if (0 == delay.rel_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Connection to `%s' timed out waiting ATS to provide address 
to use for SYN_ACK\n",
-                  GNUNET_i2s (&n->id));
-      free_neighbour (n);
-      return;
-    }
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ACK:
-    if (0 == delay.rel_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Connection to `%s' timed out waiting for other peer to send 
ACK\n",
-                  GNUNET_i2s (&n->id));
-      disconnect_neighbour (n);
-      return;
-    }
-    break;
-
-  case GNUNET_TRANSPORT_PS_CONNECTED:
-    if (0 == delay.rel_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Connection to `%s' timed out, missing 
KEEPALIVE_RESPONSEs\n",
-                  GNUNET_i2s (&n->id));
-      disconnect_neighbour (n);
-      return;
-    }
-    try_transmission_to_peer (n);
-    send_keepalive (n);
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_ATS:
-    if (0 == delay.rel_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Connection to `%s' timed out, waiting for ATS replacement 
address\n",
-                  GNUNET_i2s (&n->id));
-      disconnect_neighbour (n);
-      return;
-    }
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_SENT:
-    if (0 == delay.rel_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Connection to `%s' timed out, waiting for other peer to 
SYN_ACK replacement address\n",
-                  GNUNET_i2s (&n->id));
-      disconnect_neighbour (n);
-      return;
-    }
-    break;
-
-  case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT:
-    if (0 == delay.rel_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Switch failed, cleaning up alternative address\n");
-      free_address (&n->alternative_address);
-      set_state_and_timeout (n,
-                             GNUNET_TRANSPORT_PS_CONNECTED,
-                             GNUNET_TIME_relative_to_absolute (
-                               SETUP_CONNECTION_TIMEOUT));
-    }
-    try_transmission_to_peer (n);
-    send_keepalive (n);
-    break;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Cleaning up connection to `%s' after sending DISCONNECT\n",
-                GNUNET_i2s (&n->id));
-    free_neighbour (n);
-    return;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED:
-    /* how did we get here!? */
-    GNUNET_assert (0);
-    break;
-
-  default:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unhandled state `%s'\n",
-                GNUNET_TRANSPORT_ps2s (n->state));
-    GNUNET_break (0);
-    break;
-  }
-  delay = GNUNET_TIME_absolute_get_remaining (n->timeout);
-  if ((GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT == n->state) ||
-      (GNUNET_TRANSPORT_PS_CONNECTED == n->state))
-  {
-    /* if we are *now* in one of the two states, we're sending
-       keep alive messages, so we need to consider the keepalive
-       delay, not just the connection timeout */
-    delay = GNUNET_TIME_relative_min (GNUNET_TIME_absolute_get_remaining (
-                                        n->keep_alive_time),
-                                      delay);
-  }
-  if (NULL == n->task)
-    n->task = GNUNET_SCHEDULER_add_delayed (delay,
-                                            &master_task,
-                                            n);
-}
-
-
-/**
- * Send a ACK message to the neighbour to confirm that we
- * got its SYN_ACK.
- *
- * @param n neighbour to send the ACK to
- */
-static void
-send_session_ack_message (struct NeighbourMapEntry *n)
-{
-  struct GNUNET_MessageHeader msg;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Sending ACK message to peer `%s'\n",
-              GNUNET_i2s (&n->id));
-
-  msg.size = htons (sizeof(struct GNUNET_MessageHeader));
-  msg.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_ACK);
-  (void) send_with_session (n,
-                            &msg,
-                            sizeof(struct GNUNET_MessageHeader),
-                            UINT32_MAX,
-                            GNUNET_TIME_UNIT_FOREVER_REL,
-                            GNUNET_NO,
-                            NULL, NULL);
-}
-
-
-/**
- * We received a 'SESSION_SYN_ACK' message from the other peer.
- * Consider switching to it.
- *
- * @param message possibly a `struct GNUNET_ATS_SessionConnectMessage` (check 
format)
- * @param peer identity of the peer to switch the address for
- * @param address address of the other peer, NULL if other peer
- *                       connected to us
- * @param session session to use (or NULL)
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_neighbours_handle_session_syn_ack (const struct
-                                       GNUNET_MessageHeader *message,
-                                       const struct
-                                       GNUNET_HELLO_Address *address,
-                                       struct GNUNET_ATS_Session *session)
-{
-  const struct TransportSynMessage *scm;
-  struct GNUNET_TIME_Absolute ts;
-  struct NeighbourMapEntry *n;
-
-  (void) session;
-  if (ntohs (message->size) != sizeof(struct TransportSynMessage))
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop
-                              ("# SYN_ACK messages received"),
-                            1, GNUNET_NO);
-  scm = (const struct TransportSynMessage *) message;
-  GNUNET_break_op (ntohl (scm->reserved) == 0);
-  if (NULL == (n = lookup_neighbour (&address->peer)))
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                                ("# unexpected SYN_ACK messages (no peer)"),
-                              1, GNUNET_NO);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received SYN_ACK message from peer `%s' in state %s/%s\n",
-              GNUNET_i2s (&address->peer),
-              GNUNET_TRANSPORT_ps2s (n->state),
-              print_ack_state (n->ack_state));
-  ts = GNUNET_TIME_absolute_ntoh (scm->timestamp);
-  switch (n->state)
-  {
-  case GNUNET_TRANSPORT_PS_NOT_CONNECTED:
-    GNUNET_break (0);
-    free_neighbour (n);
-    return GNUNET_SYSERR;
-
-  case GNUNET_TRANSPORT_PS_INIT_ATS:
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# unexpected SYN_ACK messages (not ready)"),
-                              1,
-                              GNUNET_NO);
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_SENT:
-    if (ts.abs_value_us != n->primary_address.connect_timestamp.abs_value_us)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "SYN_ACK ignored as the timestamp does not match our SYN 
request\n");
-      return GNUNET_OK;
-    }
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_CONNECTED,
-                           GNUNET_TIME_relative_to_absolute (
-                             GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
-    set_primary_address (n,
-                         n->primary_address.address,
-                         n->primary_address.session,
-                         n->primary_address.bandwidth_in,
-                         n->primary_address.bandwidth_out);
-    send_session_ack_message (n);
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ATS:
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ACK:
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# unexpected SYN_ACK messages (not ready)"),
-                              1,
-                              GNUNET_NO);
-    break;
-
-  case GNUNET_TRANSPORT_PS_CONNECTED:
-    /* duplicate SYN_ACK, let's answer by duplicate ACK just in case */
-    send_session_ack_message (n);
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_ATS:
-    /* we didn't expect any SYN_ACK, as we are waiting for ATS
-       to give us a new address... */
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# unexpected SYN_ACK messages (waiting on 
ATS)"),
-                              1,
-                              GNUNET_NO);
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_SENT:
-    /* Reconnecting with new address address worked; go back to connected! */
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_CONNECTED,
-                           GNUNET_TIME_relative_to_absolute (
-                             GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
-    send_session_ack_message (n);
-    break;
-
-  case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT:
-    /* new address worked; adopt it and go back to connected! */
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_CONNECTED,
-                           GNUNET_TIME_relative_to_absolute (
-                             GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
-    GNUNET_break (GNUNET_NO == n->alternative_address.ats_active);
-
-    /* Set primary addresses */
-    set_primary_address (n,
-                         n->alternative_address.address,
-                         n->alternative_address.session,
-                         n->alternative_address.bandwidth_in,
-                         n->alternative_address.bandwidth_out);
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# Successful attempts to switch addresses"),
-                              1,
-                              GNUNET_NO);
-
-    GNUNET_HELLO_address_free (n->alternative_address.address);
-    memset (&n->alternative_address,
-            0,
-            sizeof(n->alternative_address));
-    send_session_ack_message (n);
-    break;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT:
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                                ("# unexpected SYN_ACK messages 
(disconnecting)"),
-                              1, GNUNET_NO);
-    return GNUNET_SYSERR;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED:
-    GNUNET_assert (0);
-    break;
-
-  default:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unhandled state `%s'\n",
-                GNUNET_TRANSPORT_ps2s (n->state));
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * A session was terminated. Take note; if needed, try to get
- * an alternative address from ATS.
- *
- * @param peer identity of the peer where the session died
- * @param session session that is gone
- * @return #GNUNET_YES if this was a session used, #GNUNET_NO if
- *        this session was not in use
- */
-int
-GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
-                                   struct GNUNET_ATS_Session *session)
-{
-  struct NeighbourMapEntry *n;
-
-  if (NULL == (n = lookup_neighbour (peer)))
-    return GNUNET_NO; /* can't affect us */
-  if (session != n->primary_address.session)
-  {
-    /* Free alternative address */
-    if (session == n->alternative_address.session)
-    {
-      if (GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT == n->state)
-        set_state_and_timeout (n,
-                               GNUNET_TRANSPORT_PS_CONNECTED,
-                               n->timeout);
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Session died, cleaning up alternative address\n");
-      free_address (&n->alternative_address);
-    }
-    return GNUNET_NO;   /* doesn't affect us further */
-  }
-
-  n->expect_latency_response = GNUNET_NO;
-  /* The session for neighbour's primary address died */
-  switch (n->state)
-  {
-  case GNUNET_TRANSPORT_PS_NOT_CONNECTED:
-    GNUNET_break (0);
-    free_neighbour (n);
-    return GNUNET_YES;
-
-  case GNUNET_TRANSPORT_PS_INIT_ATS:
-    GNUNET_break (0);
-    free_neighbour (n);
-    return GNUNET_YES;
-
-  case GNUNET_TRANSPORT_PS_SYN_SENT:
-    /* The session used to send the SYN terminated:
-     * this implies a connect error*/
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Failed to send SYN in CONNECT_SENT with `%s' %p: session 
terminated\n",
-                GST_plugins_a2s (n->primary_address.address),
-                n->primary_address.session);
-
-    /* Destroy the address since it cannot be used */
-    unset_primary_address (n);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_INIT_ATS,
-                           GNUNET_TIME_relative_to_absolute (
-                             ATS_RESPONSE_TIMEOUT));
-    break;
-
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ATS:
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ACK:
-    /* error on inbound session; free neighbour entirely */
-    free_neighbour (n);
-    return GNUNET_YES;
-
-  case GNUNET_TRANSPORT_PS_CONNECTED:
-    /* Our primary connection died, try a fast reconnect */
-    unset_primary_address (n);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_RECONNECT_ATS,
-                           GNUNET_TIME_relative_to_absolute (
-                             ATS_RESPONSE_TIMEOUT));
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_ATS:
-    /* we don't have an address, how can it go down? */
-    GNUNET_break (0);
-    break;
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_SENT:
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Failed to send SYN in RECONNECT_SENT with `%s' %p: session 
terminated\n",
-                GST_plugins_a2s (n->primary_address.address),
-                n->primary_address.session);
-    /* Destroy the address since it cannot be used */
-    unset_primary_address (n);
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_RECONNECT_ATS,
-                           GNUNET_TIME_relative_to_absolute (
-                             ATS_RESPONSE_TIMEOUT));
-    break;
-
-  case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT:
-    /* primary went down while we were waiting for SYN_ACK on secondary;
-       secondary as primary */
-
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Connection `%s' %p to peer `%s' was terminated while 
switching, "
-                "switching to alternative address `%s' %p\n",
-                GST_plugins_a2s (n->primary_address.address),
-                n->primary_address.session,
-                GNUNET_i2s (peer),
-                GST_plugins_a2s (n->alternative_address.address),
-                n->alternative_address.session);
-
-    /* Destroy the inbound address since it cannot be used */
-    free_address (&n->primary_address);
-    n->primary_address = n->alternative_address;
-    GNUNET_assert (GNUNET_YES ==
-                   GST_ats_is_known (n->primary_address.address,
-                                     n->primary_address.session));
-    memset (&n->alternative_address,
-            0,
-            sizeof(struct NeighbourAddress));
-    set_state_and_timeout (n,
-                           GNUNET_TRANSPORT_PS_RECONNECT_SENT,
-                           GNUNET_TIME_relative_to_absolute (
-                             FAST_RECONNECT_TIMEOUT));
-    break;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT:
-    unset_primary_address (n);
-    break;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED:
-    /* neighbour was freed and plugins told to terminate session */
-    return GNUNET_NO;
-
-  default:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unhandled state `%s'\n",
-                GNUNET_TRANSPORT_ps2s (n->state));
-    GNUNET_break (0);
-    break;
-  }
-  if (NULL != n->task)
-    GNUNET_SCHEDULER_cancel (n->task);
-  n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
-  return GNUNET_YES;
-}
-
-
-/**
- * We received a 'ACK' message from the other peer.
- * If we sent a 'SYN_ACK' last, this means we are now
- * connected.  Otherwise, do nothing.
- *
- * @param message possibly a 'struct GNUNET_ATS_SessionConnectMessage' (check 
format)
- * @param address address of the other peer
- * @param session session to use (or NULL)
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
-                                   const struct GNUNET_HELLO_Address *address,
-                                   struct GNUNET_ATS_Session *session)
-{
-  struct NeighbourMapEntry *n;
-
-  (void) session;
-  if (ntohs (message->size) != sizeof(struct GNUNET_MessageHeader))
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop ("# ACK messages received"),
-                            1,
-                            GNUNET_NO);
-  if (NULL == (n = lookup_neighbour (&address->peer)))
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received ACK for peer `%s' in state %s/%s\n",
-              GNUNET_i2s (&address->peer),
-              GNUNET_TRANSPORT_ps2s (n->state),
-              print_ack_state (n->ack_state));
-
-  /* Check if we are in a plausible state for having sent
-     a SYN_ACK.  If not, return, otherwise break.
-
-     The remote peers sends a ACK as a response for a SYN_ACK
-     message.
-
-     We expect a ACK:
-     - If a remote peer has sent a SYN, we responded with a SYN_ACK and
-     now wait for the ACK to finally be connected
-     - If we sent a SYN_ACK to this peer before */if 
(((GNUNET_TRANSPORT_PS_SYN_RECV_ACK != n->state) &&
-       (ACK_SEND_ACK != n->ack_state)) ||
-      (NULL == n->primary_address.address))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Received unexpected ACK message from peer `%s' in state 
%s/%s\n",
-                GNUNET_i2s (&address->peer),
-                GNUNET_TRANSPORT_ps2s (n->state),
-                print_ack_state (n->ack_state));
-
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop ("# unexpected ACK messages"),
-                              1,
-                              GNUNET_NO);
-    return GNUNET_OK;
-  }
-  if (GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT == n->state)
-  {
-    /* We tried to switch addresses while being connect. We explicitly wait
-     * for a SYN_ACK before going to GNUNET_TRANSPORT_PS_CONNECTED,
-     * so we do not want to set the address as in use! */
-    return GNUNET_OK;
-  }
-  set_state_and_timeout (n,
-                         GNUNET_TRANSPORT_PS_CONNECTED,
-                         GNUNET_TIME_relative_to_absolute (
-                           GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
-
-  if (NULL == n->primary_address.address)
-  {
-    /* See issue #3693.
-     * We are in state = PSY_SYN_RECV_ACK or ack_state = ACK_SEND_ACK, which
-     * really means we did try (and succeed) to send a SYN and are waiting for
-     * an ACK.
-     * That suggests that the primary_address used to be non-NULL, but maybe it
-     * got reset to NULL without the state being changed appropriately?
-     */GNUNET_break (0);
-    return GNUNET_OK;
-  }
-
-  /* Reset backoff for primary address */
-  GST_ats_block_reset (n->primary_address.address,
-                       n->primary_address.session);
-  return GNUNET_OK;
-}
-
-
-/**
- * Test if we're connected to the given peer.
- *
- * @param target peer to test
- * @return #GNUNET_YES if we are connected, #GNUNET_NO if not
- */
-int
-GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target)
-{
-  return test_connected (lookup_neighbour (target));
-}
-
-
-/**
- * Task to asynchronously run #free_neighbour().
- *
- * @param cls the `struct NeighbourMapEntry` to free
- */
-static void
-delayed_disconnect (void *cls)
-{
-  struct NeighbourMapEntry *n = cls;
-
-  n->delayed_disconnect_task = NULL;
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Disconnecting by request from peer %s\n",
-              GNUNET_i2s (&n->id));
-  free_neighbour (n);
-}
-
-
-void
-GST_neighbours_handle_quota_message (const struct GNUNET_PeerIdentity *peer,
-                                     const struct GNUNET_MessageHeader *msg)
-{
-  struct NeighbourMapEntry *n;
-  const struct GNUNET_ATS_SessionQuotaMessage *sqm;
-  struct GNUNET_BANDWIDTH_Value32NBO last;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received QUOTA message from peer `%s'\n",
-              GNUNET_i2s (peer));
-  if (ntohs (msg->size) != sizeof(struct GNUNET_ATS_SessionQuotaMessage))
-  {
-    GNUNET_break_op (0);
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# quota messages ignored (malformed)"),
-                              1,
-                              GNUNET_NO);
-    return;
-  }
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop
-                              ("# QUOTA messages received"),
-                            1, GNUNET_NO);
-  sqm = (const struct GNUNET_ATS_SessionQuotaMessage *) msg;
-  if (NULL == (n = lookup_neighbour (peer)))
-  {
-    /* gone already */
-    return;
-  }
-  last = GNUNET_BANDWIDTH_value_max (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
-                                     GNUNET_BANDWIDTH_value_init (ntohl (
-                                                                    
sqm->quota)));
-  if (last.value__ != n->neighbour_receive_quota.value__)
-  {
-    n->neighbour_receive_quota = last;
-    send_outbound_quota_to_clients (n);
-  }
-}
-
-
-/**
- * We received a disconnect message from the given peer,
- * validate and process.
- *
- * @param peer sender of the message
- * @param msg the disconnect message
- */
-void
-GST_neighbours_handle_disconnect_message (const struct
-                                          GNUNET_PeerIdentity *peer,
-                                          const struct
-                                          GNUNET_MessageHeader *msg)
-{
-  struct NeighbourMapEntry *n;
-  const struct GNUNET_ATS_SessionDisconnectMessage *sdm;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received DISCONNECT message from peer `%s'\n",
-              GNUNET_i2s (peer));
-  if (ntohs (msg->size) != sizeof(struct GNUNET_ATS_SessionDisconnectMessage))
-  {
-    GNUNET_break_op (0);
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                                ("# disconnect messages ignored (malformed)"),
-                              1,
-                              GNUNET_NO);
-    return;
-  }
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop
-                              ("# DISCONNECT messages received"),
-                            1, GNUNET_NO);
-  sdm = (const struct GNUNET_ATS_SessionDisconnectMessage *) msg;
-  if (NULL == (n = lookup_neighbour (peer)))
-  {
-    /* gone already */
-    return;
-  }
-  if (GNUNET_TIME_absolute_ntoh (sdm->timestamp).abs_value_us <=
-      n->connect_ack_timestamp.abs_value_us)
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# disconnect messages ignored (timestamp)"),
-                              1,
-                              GNUNET_NO);
-    return;
-  }
-  if (0 != memcmp (peer,
-                   &sdm->public_key,
-                   sizeof(struct GNUNET_PeerIdentity)))
-  {
-    GNUNET_break_op (0);
-    return;
-  }
-  if (ntohl (sdm->purpose.size) !=
-      sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
-      + sizeof(struct GNUNET_CRYPTO_EddsaPublicKey)
-      + sizeof(struct GNUNET_TIME_AbsoluteNBO))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "DISCONNECT message from peer `%s' has invalid size\n",
-                GNUNET_i2s (peer));
-    GNUNET_break_op (0);
-    return;
-  }
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_eddsa_verify_ (
-        GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT,
-        &sdm->purpose,
-        &sdm->signature,
-        &sdm->public_key))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "DISCONNECT message from peer `%s' cannot be verified \n",
-                GNUNET_i2s (peer));
-    GNUNET_break_op (0);
-    return;
-  }
-  if (NULL == n->delayed_disconnect_task)
-  {
-    n->delayed_disconnect_task = GNUNET_SCHEDULER_add_now (&delayed_disconnect,
-                                                           n);
-  }
-}
-
-
-/**
- * Closure for the #neighbours_iterate() function.
- */
-struct IteratorContext
-{
-  /**
-   * Function to call on each connected neighbour.
-   */
-  GST_NeighbourIterator cb;
-
-  /**
-   * Closure for @e cb.
-   */
-  void *cb_cls;
-};
-
-
-/**
- * Call the callback from the closure for each neighbour.
- *
- * @param cls the `struct IteratorContext`
- * @param key the hash of the public key of the neighbour
- * @param value the `struct NeighbourMapEntry`
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-neighbours_iterate (void *cls,
-                    const struct GNUNET_PeerIdentity *key,
-                    void *value)
-{
-  struct IteratorContext *ic = cls;
-  struct NeighbourMapEntry *n = value;
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
-  struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
-
-  (void) key;
-  if (NULL != n->primary_address.address)
-  {
-    bandwidth_in = n->primary_address.bandwidth_in;
-    bandwidth_out = n->primary_address.bandwidth_out;
-  }
-  else
-  {
-    bandwidth_in = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT;
-    bandwidth_out = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT;
-  }
-  ic->cb (ic->cb_cls,
-          &n->id,
-          n->primary_address.address,
-          n->state,
-          n->timeout,
-          bandwidth_in, bandwidth_out);
-  return GNUNET_OK;
-}
-
-
-/**
- * Iterate over all connected neighbours.
- *
- * @param cb function to call
- * @param cb_cls closure for @a cb
- */
-void
-GST_neighbours_iterate (GST_NeighbourIterator cb,
-                        void *cb_cls)
-{
-  struct IteratorContext ic;
-
-  if (NULL == neighbours)
-    return; /* can happen during shutdown */
-  ic.cb = cb;
-  ic.cb_cls = cb_cls;
-  GNUNET_CONTAINER_multipeermap_iterate (neighbours,
-                                         &neighbours_iterate,
-                                         &ic);
-}
-
-
-/**
- * If we have an active connection to the given target, it must be shutdown.
- *
- * @param target peer to disconnect from
- */
-void
-GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target)
-{
-  struct NeighbourMapEntry *n;
-
-  if (NULL == (n = lookup_neighbour (target)))
-    return;  /* not active */
-  if (GNUNET_YES == test_connected (n))
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# disconnected from peer upon explicit 
request"),
-                              1,
-                              GNUNET_NO);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Forced disconnect from peer %s\n",
-              GNUNET_i2s (target));
-  disconnect_neighbour (n);
-}
-
-
-/**
- * Obtain current address information for the given neighbour.
- *
- * @param peer
- * @return address currently used
- */
-const struct GNUNET_HELLO_Address *
-GST_neighbour_get_current_address (const struct GNUNET_PeerIdentity *peer)
-{
-  struct NeighbourMapEntry *n;
-
-  n = lookup_neighbour (peer);
-  if (NULL == n)
-    return NULL;
-  return n->primary_address.address;
-}
-
-
-/**
- * Initialize the neighbours subsystem.
- *
- * @param max_fds maximum number of fds to use
- */
-void
-GST_neighbours_start (unsigned int max_fds)
-{
-  (void) max_fds;
-  neighbours = GNUNET_CONTAINER_multipeermap_create (NEIGHBOUR_TABLE_SIZE,
-                                                     GNUNET_NO);
-  util_transmission_tk = GNUNET_SCHEDULER_add_delayed (
-    UTIL_TRANSMISSION_INTERVAL,
-    &utilization_transmission,
-    NULL);
-}
-
-
-/**
- * Disconnect from the given neighbour.
- *
- * @param cls unused
- * @param key hash of neighbour's public key (not used)
- * @param value the `struct NeighbourMapEntry` of the neighbour
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-disconnect_all_neighbours (void *cls,
-                           const struct GNUNET_PeerIdentity *key,
-                           void *value)
-{
-  struct NeighbourMapEntry *n = value;
-
-  (void) cls;
-  (void) key;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Disconnecting peer `%4s' during shutdown\n",
-              GNUNET_i2s (&n->id));
-  free_neighbour (n);
-  return GNUNET_OK;
-}
-
-
-/**
- * Cleanup the neighbours subsystem.
- */
-void
-GST_neighbours_stop ()
-{
-  if (NULL == neighbours)
-    return;
-  if (NULL != util_transmission_tk)
-  {
-    GNUNET_SCHEDULER_cancel (util_transmission_tk);
-    util_transmission_tk = NULL;
-  }
-  GNUNET_CONTAINER_multipeermap_iterate (neighbours,
-                                         &disconnect_all_neighbours,
-                                         NULL);
-  GNUNET_CONTAINER_multipeermap_destroy (neighbours);
-  neighbours = NULL;
-}
-
-
-/* end of file gnunet-service-transport_neighbours.c */
diff --git a/src/transport/gnunet-service-transport_neighbours.h 
b/src/transport/gnunet-service-transport_neighbours.h
deleted file mode 100644
index 7ce911aa1..000000000
--- a/src/transport/gnunet-service-transport_neighbours.h
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/gnunet-service-transport_neighbours.h
- * @brief neighbour management API
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_TRANSPORT_NEIGHBOURS_H
-#define GNUNET_SERVICE_TRANSPORT_NEIGHBOURS_H
-
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_transport_plugin.h"
-#include "gnunet-service-transport.h"
-#include "transport.h"
-#include "gnunet_util_lib.h"
-
-
-/**
- * Initialize the neighbours subsystem.
- *
- * @param max_fds maximum number of fds to use
- */
-void
-GST_neighbours_start (unsigned int max_fds);
-
-
-/**
- * Cleanup the neighbours subsystem.
- */
-void
-GST_neighbours_stop (void);
-
-
-/**
- * Test if we're connected to the given peer.
- *
- * @param target peer to test
- * @return #GNUNET_YES if we are connected, #GNUNET_NO if not
- */
-int
-GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target);
-
-
-/**
- * Function called after the transmission is done.
- *
- * @param cls closure
- * @param success #GNUNET_OK on success, #GNUNET_NO on failure, #GNUNET_SYSERR 
if we're not connected
- * @param bytes_payload how much payload was transmitted
- * @param bytes_on_wire how many bytes were used on the wire
- */
-typedef void
-(*GST_NeighbourSendContinuation) (void *cls,
-                                  int success,
-                                  size_t bytes_payload,
-                                  size_t bytes_on_wire);
-
-
-/**
- * Transmit a message to the given target using the active connection.
- *
- * @param target destination
- * @param msg message to send
- * @param msg_size number of bytes in @a msg
- * @param timeout when to fail with timeout
- * @param cont function to call when done
- * @param cont_cls closure for @a cont
- */
-void
-GST_neighbours_send (const struct GNUNET_PeerIdentity *target,
-                     const void *msg,
-                     size_t msg_size,
-                     struct GNUNET_TIME_Relative timeout,
-                     GST_NeighbourSendContinuation cont, void *cont_cls);
-
-
-/**
- * We have received a message from the given sender.
- * How long should we delay before receiving more?
- * (Also used to keep the peer marked as live).
- *
- * @param sender sender of the message
- * @param size size of the message
- * @param do_forward set to #GNUNET_YES if the message should be forwarded to 
clients
- *                   #GNUNET_NO if the neighbour is not connected or violates 
the quota
- * @return how long to wait before reading more from this sender
- */
-struct GNUNET_TIME_Relative
-GST_neighbours_calculate_receive_delay (const struct
-                                        GNUNET_PeerIdentity *sender,
-                                        ssize_t size,
-                                        int *do_forward);
-
-
-/**
- * Keep the connection to the given neighbour alive longer,
- * we received a KEEPALIVE (or equivalent); send a response.
- *
- * @param neighbour neighbour to keep alive (by sending keep alive response)
- * @param m the keep alive message containing the nonce to respond to
- */
-void
-GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour,
-                          const struct GNUNET_MessageHeader *m);
-
-
-/**
- * We received a KEEP_ALIVE_RESPONSE message and use this to calculate
- * latency to this peer.  Pass the updated information (existing ats
- * plus calculated latency) to ATS.
- *
- * @param neighbour neighbour to keep alive
- * @param m the message containing the keep alive response
- */
-void
-GST_neighbours_keepalive_response (const struct GNUNET_PeerIdentity *neighbour,
-                                   const struct GNUNET_MessageHeader *m);
-
-
-/**
- * If we have an active connection to the given target, it must be shutdown.
- *
- * @param target peer to disconnect from
- */
-void
-GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target);
-
-
-/**
- * Function called for each neighbour.
- *
- * @param cls closure
- * @param peer identity of the neighbour
- * @param address the address of the neighbour
- * @param state current state the peer is in
- * @param state_timeout timeout for this state
- * @param bandwidth_in inbound quota in NBO
- * @param bandwidth_out outbound quota in NBO
- */
-typedef void
-(*GST_NeighbourIterator) (void *cls,
-                          const struct GNUNET_PeerIdentity *peer,
-                          const struct GNUNET_HELLO_Address *address,
-                          enum GNUNET_TRANSPORT_PeerState state,
-                          struct GNUNET_TIME_Absolute state_timeout,
-                          struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                          struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out);
-
-
-/**
- * Iterate over all connected neighbours.
- *
- * @param cb function to call
- * @param cb_cls closure for @a cb
- */
-void
-GST_neighbours_iterate (GST_NeighbourIterator cb, void *cb_cls);
-
-
-/**
- * A session was terminated. Take note.
- *
- * @param peer identity of the peer where the session died
- * @param session session that is gone
- * @return #GNUNET_YES if this was a session used, #GNUNET_NO if
- *        this session was not in use
- */
-int
-GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
-                                   struct GNUNET_ATS_Session *session);
-
-
-/**
- * Track information about data we received from the
- * given address (used to notify ATS about our utilization
- * of allocated resources).
- *
- * @param address the address we got data from
- * @param message the message we received (really only the size is used)
- */
-void
-GST_neighbours_notify_data_recv (const struct GNUNET_HELLO_Address *address,
-                                 const struct GNUNET_MessageHeader *message);
-
-
-/**
- * Track information about data we transmitted using the given @a
- * address and @a session (used to notify ATS about our utilization of
- * allocated resources).
- *
- * @param address the address we transmitted data to
- * @param session session we used to transmit data
- * @param message the message we sent (really only the size is used)
- */
-void
-GST_neighbours_notify_data_sent (const struct GNUNET_HELLO_Address *address,
-                                 struct GNUNET_ATS_Session *session,
-                                 size_t size);
-
-
-/**
- * For an existing neighbour record, set the active connection to
- * use the given address.
- *
- * @param address address of the other peer to start using
- * @param session session to use (or NULL)
- * @param bandwidth_in inbound quota to be used when connection is up
- * @param bandwidth_out outbound quota to be used when connection is up
- */
-void
-GST_neighbours_switch_to_address (const struct GNUNET_HELLO_Address *address,
-                                  struct GNUNET_ATS_Session *session,
-                                  struct GNUNET_BANDWIDTH_Value32NBO
-                                  bandwidth_in,
-                                  struct GNUNET_BANDWIDTH_Value32NBO
-                                  bandwidth_out);
-
-
-/**
- * We received a 'SESSION_CONNECT' message from the other peer.
- * Consider switching to it.
- *
- * @param message possibly a 'struct GNUNET_ATS_SessionConnectMessage' (check 
format)
- * @param peer identity of the peer to switch the address for
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_neighbours_handle_session_syn (const struct GNUNET_MessageHeader *message,
-                                   const struct GNUNET_PeerIdentity *peer);
-
-
-/**
- * We received a 'SESSION_CONNECT_ACK' message from the other peer.
- * Consider switching to it.
- *
- * @param message possibly a `struct GNUNET_ATS_SessionConnectMessage` (check 
format)
- * @param address address of the other peer
- * @param session session to use (or NULL)
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_neighbours_handle_session_syn_ack (const struct
-                                       GNUNET_MessageHeader *message,
-                                       const struct
-                                       GNUNET_HELLO_Address *address,
-                                       struct GNUNET_ATS_Session *session);
-
-
-/**
- * We received a 'SESSION_ACK' message from the other peer.
- * If we sent a 'CONNECT_ACK' last, this means we are now
- * connected.  Otherwise, do nothing.
- *
- * @param message possibly a 'struct GNUNET_ATS_SessionConnectMessage' (check 
format)
- * @param address address of the other peer
- * @param session session to use (or NULL)
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
-                                   const struct GNUNET_HELLO_Address *address,
-                                   struct GNUNET_ATS_Session *session);
-
-
-/**
- * Obtain current address information for the given neighbour.
- *
- * @param peer
- * @return address currently used
- */
-const struct GNUNET_HELLO_Address *
-GST_neighbour_get_current_address (const struct GNUNET_PeerIdentity *peer);
-
-
-/**
- * We received a quota message from the given peer,
- * validate and process.
- *
- * @param peer sender of the message
- * @param msg the quota message
- */
-void
-GST_neighbours_handle_quota_message (const struct GNUNET_PeerIdentity *peer,
-                                     const struct GNUNET_MessageHeader *msg);
-
-
-/**
- * We received a disconnect message from the given peer,
- * validate and process.
- *
- * @param peer sender of the message
- * @param msg the disconnect message
- */
-void
-GST_neighbours_handle_disconnect_message (const struct
-                                          GNUNET_PeerIdentity *peer,
-                                          const struct
-                                          GNUNET_MessageHeader *msg);
-
-
-#endif
-/* end of file gnunet-service-transport_neighbours.h */
diff --git a/src/transport/gnunet-service-transport_plugins.c 
b/src/transport/gnunet-service-transport_plugins.c
deleted file mode 100644
index 218ef80ab..000000000
--- a/src/transport/gnunet-service-transport_plugins.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2010-2014 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/gnunet-service-transport_plugins.c
- * @brief plugin management
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet-service-transport.h"
-#include "gnunet-service-transport_hello.h"
-#include "gnunet-service-transport_ats.h"
-#include "gnunet-service-transport_plugins.h"
-
-/**
- * Entry in doubly-linked list of all of our plugins.
- */
-struct TransportPlugin
-{
-  /**
-   * This is a doubly-linked list.
-   */
-  struct TransportPlugin *next;
-
-  /**
-   * This is a doubly-linked list.
-   */
-  struct TransportPlugin *prev;
-
-  /**
-   * API of the transport as returned by the plugin's
-   * initialization function.
-   */
-  struct GNUNET_TRANSPORT_PluginFunctions *api;
-
-  /**
-   * Short name for the plugin (e.g. "tcp").
-   */
-  char *short_name;
-
-  /**
-   * Name of the library (e.g. "gnunet_plugin_transport_tcp").
-   */
-  char *lib_name;
-
-  /**
-   * Environment this transport service is using
-   * for this plugin.
-   */
-  struct GNUNET_TRANSPORT_PluginEnvironment env;
-};
-
-/**
- * Head of DLL of all loaded plugins.
- */
-static struct TransportPlugin *plugins_head;
-
-/**
- * Head of DLL of all loaded plugins.
- */
-static struct TransportPlugin *plugins_tail;
-
-
-/**
- * Function that will be called to update metrics for an address
- *
- * @param cls closure
- * @param address address to update metrics for
- * @param distance new distance
- */
-static void
-plugin_env_update_distance (void *cls,
-                            const struct GNUNET_HELLO_Address *address,
-                            uint32_t distance)
-{
-  GST_ats_update_distance (address,
-                           distance);
-}
-
-
-/**
- * Function that will be called to figure if an address is an loopback,
- * LAN, WAN etc. address
- *
- * @param cls closure
- * @param addr binary address
- * @param addrlen length of the @a addr
- * @return type of the network @a addr belongs to
- */
-static enum GNUNET_NetworkType
-plugin_env_address_to_type (void *cls,
-                            const struct sockaddr *addr,
-                            size_t addrlen)
-{
-  if (NULL == GST_is)
-  {
-    GNUNET_break (0);
-    return GNUNET_NT_UNSPECIFIED;
-  }
-  return GNUNET_NT_scanner_get_type (GST_is,
-                                     addr,
-                                     addrlen);
-}
-
-
-void
-GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb,
-                  GNUNET_TRANSPORT_AddressNotification address_cb,
-                  GNUNET_TRANSPORT_SessionStart session_start_cb,
-                  GNUNET_TRANSPORT_SessionEnd session_end_cb)
-{
-  struct TransportPlugin *plug;
-  struct TransportPlugin *next;
-  unsigned long long tneigh;
-  char *libname;
-  char *plugs;
-  char *pos;
-  int fail;
-
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_number (GST_cfg,
-                                             "TRANSPORT",
-                                             "NEIGHBOUR_LIMIT",
-                                             &tneigh))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ ("Transport service is lacking NEIGHBOUR_LIMIT option.\n"));
-    return;
-  }
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_string (GST_cfg,
-                                             "TRANSPORT",
-                                             "PLUGINS",
-                                             &plugs))
-    return;
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              _ ("Starting transport plugins `%s'\n"),
-              plugs);
-  for (pos = strtok (plugs, " "); pos != NULL; pos = strtok (NULL, " "))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _ ("Loading `%s' transport plugin\n"),
-                pos);
-    GNUNET_asprintf (&libname,
-                     "libgnunet_plugin_transport_%s",
-                     pos);
-    plug = GNUNET_new (struct TransportPlugin);
-    plug->short_name = GNUNET_strdup (pos);
-    plug->lib_name = libname;
-    plug->env.cfg = GST_cfg;
-    plug->env.my_identity = &GST_my_identity;
-    plug->env.get_our_hello = &GST_hello_get;
-    plug->env.cls = plug->short_name;
-    plug->env.receive = recv_cb;
-    plug->env.notify_address = address_cb;
-    plug->env.session_start = session_start_cb;
-    plug->env.session_end = session_end_cb;
-    plug->env.get_address_type = &plugin_env_address_to_type;
-    plug->env.update_address_distance = &plugin_env_update_distance;
-    plug->env.max_connections = tneigh;
-    plug->env.stats = GST_stats;
-    GNUNET_CONTAINER_DLL_insert (plugins_head,
-                                 plugins_tail,
-                                 plug);
-  }
-  GNUNET_free (plugs);
-  next = plugins_head;
-  while (NULL != next)
-  {
-    plug = next;
-    next = plug->next;
-    plug->api = GNUNET_PLUGIN_load (plug->lib_name,
-                                    &plug->env);
-    if (NULL == plug->api)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Failed to load transport plugin for `%s'\n"),
-                  plug->lib_name);
-      GNUNET_CONTAINER_DLL_remove (plugins_head,
-                                   plugins_tail,
-                                   plug);
-      GNUNET_free (plug->short_name);
-      GNUNET_free (plug->lib_name);
-      GNUNET_free (plug);
-      continue;
-    }
-    fail = GNUNET_NO;
-    if (NULL == plug->api->address_pretty_printer)
-    {
-      fail = GNUNET_YES;
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Missing function `%s' in transport plugin for `%s'\n"),
-                  "address_pretty_printer",
-                  plug->lib_name);
-    }
-    if (NULL == plug->api->address_to_string)
-    {
-      fail = GNUNET_YES;
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Missing function `%s' in transport plugin for `%s'\n"),
-                  "address_to_string",
-                  plug->lib_name);
-    }
-    if (NULL == plug->api->string_to_address)
-    {
-      fail = GNUNET_YES;
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Missing function `%s' in transport plugin for `%s'\n"),
-                  "string_to_address",
-                  plug->lib_name);
-    }
-    if (NULL == plug->api->check_address)
-    {
-      fail = GNUNET_YES;
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Missing function `%s' in transport plugin for `%s'\n"),
-                  "check_address",
-                  plug->lib_name);
-    }
-    if (NULL == plug->api->get_session)
-    {
-      fail = GNUNET_YES;
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Missing function `%s' in transport plugin for `%s'\n"),
-                  "get_session",
-                  plug->lib_name);
-    }
-    if (NULL == plug->api->get_network)
-    {
-      fail = GNUNET_YES;
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Missing function `%s' in transport plugin for `%s'\n"),
-                  "get_network",
-                  plug->lib_name);
-    }
-    if (NULL == plug->api->send)
-    {
-      fail = GNUNET_YES;
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Missing function `%s' in transport plugin for `%s'\n"),
-                  "send",
-                  plug->lib_name);
-    }
-    if (NULL == plug->api->disconnect_peer)
-    {
-      fail = GNUNET_YES;
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Missing function `%s' in transport plugin for `%s'\n"),
-                  "disconnect_peer",
-                  plug->lib_name);
-    }
-    if (NULL == plug->api->disconnect_session)
-    {
-      fail = GNUNET_YES;
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Missing function `%s' in transport plugin for `%s'\n"),
-                  "disconnect_session",
-                  plug->lib_name);
-    }
-    if (NULL == plug->api->query_keepalive_factor)
-    {
-      fail = GNUNET_YES;
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Missing function `%s' in transport plugin for `%s'\n"),
-                  "query_keepalive_factor",
-                  plug->lib_name);
-    }
-    if (NULL == plug->api->update_session_timeout)
-    {
-      fail = GNUNET_YES;
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Missing function `%s' in transport plugin for `%s'\n"),
-                  "update_session_timeout",
-                  plug->lib_name);
-    }
-    if (GNUNET_YES == fail)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Did not load plugin `%s' due to missing functions\n"),
-                  plug->lib_name);
-      GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api));
-      GNUNET_CONTAINER_DLL_remove (plugins_head,
-                                   plugins_tail,
-                                   plug);
-      GNUNET_free (plug->short_name);
-      GNUNET_free (plug->lib_name);
-      GNUNET_free (plug);
-    }
-  }
-}
-
-
-/**
- * Unload all plugins
- */
-void
-GST_plugins_unload ()
-{
-  struct TransportPlugin *plug;
-
-  while (NULL != (plug = plugins_head))
-  {
-    GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api));
-    GNUNET_free (plug->lib_name);
-    GNUNET_free (plug->short_name);
-    GNUNET_CONTAINER_DLL_remove (plugins_head, plugins_tail, plug);
-    GNUNET_free (plug);
-  }
-}
-
-
-/**
- * Obtain the plugin API based on a plugin name.
- *
- * @param name name of the plugin
- * @return the plugin's API, NULL if the plugin is not loaded
- */
-struct GNUNET_TRANSPORT_PluginFunctions *
-GST_plugins_find (const char *name)
-{
-  struct TransportPlugin *pos;
-
-  for (pos = plugins_head; NULL != pos; pos = pos->next)
-    if (0 == strcmp (name, pos->short_name))
-      break;
-  if (NULL == pos)
-    return NULL;
-  return pos->api;
-}
-
-
-/**
- * Obtain the plugin API based on a the stripped plugin name after the 
underscore.
- *
- * Example: GST_plugins_printer_find (http_client) will return all plugins
- * starting with the prefix "http":
- * http_client or server if loaded
- *
- * @param name name of the plugin
- * @return the plugin's API, NULL if the plugin is not loaded
- */
-struct GNUNET_TRANSPORT_PluginFunctions *
-GST_plugins_printer_find (const char *name)
-{
-  struct TransportPlugin *pos;
-  char *stripped = GNUNET_strdup (name);
-  char *sep = strchr (stripped, '_');
-
-  if (NULL != sep)
-    sep[0] = '\0';
-  for (pos = plugins_head; NULL != pos; pos = pos->next)
-    if (pos->short_name == strstr (pos->short_name, stripped))
-      break;
-  GNUNET_free (stripped);
-  if (NULL == pos)
-    return NULL;
-  return pos->api;
-}
-
-
-/**
- * Convert a given address to a human-readable format.  Note that the
- * return value will be overwritten on the next call to this function.
- *
- * @param address the address to convert
- * @return statically allocated (!) human-readable address
- */
-const char *
-GST_plugins_a2s (const struct GNUNET_HELLO_Address *address)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *api;
-  static char unable_to_show[1024];
-  static const char *s;
-
-  if (NULL == address)
-    return "<NULL>";
-  if (0 == address->address_length)
-    return TRANSPORT_SESSION_INBOUND_STRING; /* Addresse with length 0 are 
inbound, address->address itself may be NULL */
-  api = GST_plugins_printer_find (address->transport_name);
-  if (NULL == api)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Failed to find transport plugin `%s'\n",
-                address->transport_name);
-    return "<plugin unknown>";
-  }
-  if (0 == address->address_length)
-  {
-    GNUNET_snprintf (unable_to_show,
-                     sizeof(unable_to_show),
-                     "<unable to stringify %u-byte long address of %s 
transport>",
-                     (unsigned int) address->address_length,
-                     address->transport_name);
-    return unable_to_show;
-  }
-  return(NULL != (s = api->address_to_string (NULL,
-                                              address->address,
-                                              address->address_length))
-         ? s
-         : "<invalid>");
-}
-
-
-void
-GST_plugins_monitor_subscribe (GNUNET_TRANSPORT_SessionInfoCallback cb,
-                               void *cb_cls)
-{
-  struct TransportPlugin *pos;
-
-  for (pos = plugins_head; NULL != pos; pos = pos->next)
-    if (NULL == pos->api->setup_monitor)
-      GNUNET_break (0);
-    else
-      pos->api->setup_monitor (pos->api->cls,
-                               cb,
-                               cb_cls);
-}
-
-
-/* end of file gnunet-service-transport_plugins.c */
diff --git a/src/transport/gnunet-service-transport_plugins.h 
b/src/transport/gnunet-service-transport_plugins.h
deleted file mode 100644
index fdd819fc5..000000000
--- a/src/transport/gnunet-service-transport_plugins.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010,2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/gnunet-service-transport_plugins.h
- * @brief plugin management API
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_TRANSPORT_PLUGINS_H
-#define GNUNET_SERVICE_TRANSPORT_PLUGINS_H
-
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_transport_plugin.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-
-
-/**
- * Load and initialize all plugins.  The respective functions will be
- * invoked by the plugins when the respective events happen.  The
- * closure will be set to a 'const char*' containing the name of the
- * plugin that caused the call.
- *
- * @param recv_cb function to call when data is received
- * @param address_cb function to call when our public addresses changed
- * @param session_start_cb function to call when a session was created
- * @param session_end_cb function to call when a session was terminated
- */
-void
-GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb,
-                  GNUNET_TRANSPORT_AddressNotification address_cb,
-                  GNUNET_TRANSPORT_SessionStart session_start_cb,
-                  GNUNET_TRANSPORT_SessionEnd session_end_cb);
-
-/**
- * Unload all plugins
- */
-void
-GST_plugins_unload (void);
-
-
-/**
- * Obtain the plugin API based on a plugin name.
- *
- * @param name name of the plugin
- * @return the plugin's API, NULL if the plugin is not loaded
- */
-struct GNUNET_TRANSPORT_PluginFunctions *
-GST_plugins_find (const char *name);
-
-
-/**
- * Obtain the plugin API based on a the stripped plugin name after the 
underscore.
- *
- * Example: GST_plugins_printer_find (http_client) will return all plugins
- * starting with the prefix "http":
- * http_client or server if loaded
- *
- * @param name name of the plugin
- * @return the plugin's API, NULL if the plugin is not loaded
- */
-struct GNUNET_TRANSPORT_PluginFunctions *
-GST_plugins_printer_find (const char *name);
-
-
-/**
- * Convert a given address to a human-readable format.  Note that the
- * return value will be overwritten on the next call to this function.
- *
- * @param address address to convert
- * @return statically allocated (!) human-readable address
- */
-const char *
-GST_plugins_a2s (const struct GNUNET_HELLO_Address *address);
-
-
-/**
- * Register callback with all plugins to monitor their status.
- *
- * @param cb callback to register, NULL to unsubscribe
- * @param cb_cls closure for @a cb
- */
-void
-GST_plugins_monitor_subscribe (GNUNET_TRANSPORT_SessionInfoCallback cb,
-                               void *cb_cls);
-
-
-#endif
-/* end of file gnunet-service-transport_plugins.h */
diff --git a/src/transport/gnunet-service-transport_validation.c 
b/src/transport/gnunet-service-transport_validation.c
deleted file mode 100644
index 86161bd85..000000000
--- a/src/transport/gnunet-service-transport_validation.c
+++ /dev/null
@@ -1,1819 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2015 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/gnunet-service-transport_validation.c
- * @brief address validation subsystem
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet-service-transport_ats.h"
-#include "gnunet-service-transport_hello.h"
-#include "gnunet-service-transport_neighbours.h"
-#include "gnunet-service-transport_plugins.h"
-#include "gnunet-service-transport_validation.h"
-#include "gnunet-service-transport.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_ats_service.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_signatures.h"
-
-/**
- * Current state of a validation process.
- *
- * FIXME: what state is used to indicate that a validation
- * was successful? If that is clarified/determined, "UGH" in
- * ~gnunetpeerinfogtk.c:1103 should be resolved.
- */
-enum GNUNET_TRANSPORT_ValidationState
-{
-  /**
-   * Undefined state
-   *
-   * Used for final callback indicating operation done
-   */
-  GNUNET_TRANSPORT_VS_NONE,
-
-  /**
-   * Fresh validation entry
-   *
-   * Entry was just created, no validation process was executed
-   */
-  GNUNET_TRANSPORT_VS_NEW,
-
-  /**
-   * Updated validation entry
-   *
-   * This is an update for an existing validation entry
-   */
-  GNUNET_TRANSPORT_VS_UPDATE,
-
-  /**
-   * Timeout for validation entry
-   *
-   * A timeout occurred during the validation process
-   */
-  GNUNET_TRANSPORT_VS_TIMEOUT,
-
-  /**
-   * Validation entry is removed
-   *
-   * The validation entry is getting removed due to a failed validation
-   */
-  GNUNET_TRANSPORT_VS_REMOVE
-};
-
-
-/**
- * How long is a PONG signature valid?  We'll recycle a signature until
- * 1/4 of this time is remaining.  PONGs should expire so that if our
- * external addresses change an adversary cannot replay them indefinitely.
- * OTOH, we don't want to spend too much time generating PONG signatures,
- * so they must have some lifetime to reduce our CPU usage.
- */
-#define PONG_SIGNATURE_LIFETIME GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_HOURS, 1)
-
-/**
- * After how long do we expire an address in a HELLO that we just
- * validated?  This value is also used for our own addresses when we
- * create a HELLO.
- */
-#define HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_HOURS, 12)
-
-/**
- * How often do we allow PINGing an address that we have not yet
- * validated?  This also determines how long we track an address that
- * we cannot validate (because after this time we can destroy the
- * validation record).
- */
-#define UNVALIDATED_PING_KEEPALIVE GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_MINUTES, 5)
-
-/**
- * How often do we PING an address that we have successfully validated
- * in the past but are not actively using?  Should be (significantly)
- * smaller than HELLO_ADDRESS_EXPIRATION.
- */
-#define VALIDATED_PING_FREQUENCY GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_MINUTES, 15)
-
-/**
- * How often do we PING an address that we are currently using?
- */
-#define CONNECTED_PING_FREQUENCY GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_MINUTES, 2)
-
-/**
- * How much delay is acceptable for sending the PING or PONG?
- */
-#define ACCEPTABLE_PING_DELAY GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 1)
-
-/**
- * Size of the validation map hashmap.
- */
-#define VALIDATION_MAP_SIZE 256
-
-/**
- * Priority to use for PINGs
- */
-#define PING_PRIORITY 2
-
-/**
- * Priority to use for PONGs
- */
-#define PONG_PRIORITY 4
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * Message used to ask a peer to validate receipt (to check an address
- * from a HELLO).  Followed by the address we are trying to validate,
- * or an empty address if we are just sending a PING to confirm that a
- * connection which the receiver (of the PING) initiated is still valid.
- */
-struct TransportPingMessage
-{
-  /**
-   * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_PING
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Challenge code (to ensure fresh reply).
-   */
-  uint32_t challenge GNUNET_PACKED;
-
-  /**
-   * Who is the intended recipient?
-   */
-  struct GNUNET_PeerIdentity target;
-};
-
-
-/**
- * Message used to validate a HELLO.  The challenge is included in the
- * confirmation to make matching of replies to requests possible.  The
- * signature signs our public key, an expiration time and our address.<p>
- *
- * This message is followed by our transport address that the PING tried
- * to confirm (if we liked it).  The address can be empty (zero bytes)
- * if the PING had not address either (and we received the request via
- * a connection that we initiated).
- */
-struct TransportPongMessage
-{
-  /**
-   * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_PONG
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Challenge code from PING (showing freshness).  Not part of what
-   * is signed so that we can re-use signatures.
-   */
-  uint32_t challenge GNUNET_PACKED;
-
-  /**
-   * Signature.
-   */
-  struct GNUNET_CRYPTO_EddsaSignature signature;
-
-  /**
-   * #GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN to confirm that this is a
-   * plausible address for the signing peer.
-   */
-  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
-
-  /**
-   * When does this signature expire?
-   */
-  struct GNUNET_TIME_AbsoluteNBO expiration;
-
-  /**
-   * Size of address appended to this message (part of what is
-   * being signed, hence not redundant).
-   */
-  uint32_t addrlen GNUNET_PACKED;
-};
-GNUNET_NETWORK_STRUCT_END
-
-/**
- * Information about an address under validation
- */
-struct ValidationEntry
-{
-  /**
-   * The address.
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Handle to the blacklist check (if we're currently in it).
-   */
-  struct GST_BlacklistCheck *bc;
-
-  /**
-   * Cached PONG signature
-   */
-  struct GNUNET_CRYPTO_EddsaSignature pong_sig_cache;
-
-  /**
-   * ID of task that will clean up this entry if nothing happens.
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * ID of task that will trigger address revalidation.
-   */
-  struct GNUNET_SCHEDULER_Task *revalidation_task;
-
-  /**
-   * At what time did we send the latest validation request (PING)?
-   */
-  struct GNUNET_TIME_Absolute send_time;
-
-  /**
-   * At what time do we send the next validation request (PING)?
-   */
-  struct GNUNET_TIME_Absolute next_validation;
-
-  /**
-   * Until when is this address valid?
-   * ZERO if it is not currently considered valid.
-   */
-  struct GNUNET_TIME_Absolute valid_until;
-
-  /**
-   * Until when is the cached PONG signature valid?
-   * ZERO if it is not currently considered valid.
-   */
-  struct GNUNET_TIME_Absolute pong_sig_valid_until;
-
-  /**
-   * How long until we can try to validate this address again?
-   * FOREVER if the address is for an unsupported plugin (from PEERINFO)
-   * ZERO if the address is considered valid (no validation needed)
-   * otherwise a time in the future if we're currently denying re-validation
-   */
-  struct GNUNET_TIME_Absolute revalidation_block;
-
-  /**
-   * Last observed latency for this address (round-trip), delay between
-   * last PING sent and PONG received; FOREVER if we never got a PONG.
-   */
-  struct GNUNET_TIME_Relative latency;
-
-  /**
-   * Current state of this validation entry
-   */
-  enum GNUNET_TRANSPORT_ValidationState state;
-
-  /**
-   * Challenge number we used.
-   */
-  uint32_t challenge;
-
-  /**
-   * When passing the address in #add_valid_peer_address(), did we
-   * copy the address to the HELLO yet?
-   */
-  int copied;
-
-  /**
-   * Are we currently using this address for a connection?
-   */
-  int in_use;
-
-  /**
-   * Are we expecting a PONG message for this validation entry?
-   */
-  int expecting_pong;
-
-  /**
-   * Is this address known to ATS as valid right now?
-   */
-  int known_to_ats;
-
-  /**
-   * Which network type does our address belong to?
-   */
-  enum GNUNET_NetworkType network;
-};
-
-
-/**
- * Map of PeerIdentities to 'struct ValidationEntry*'s (addresses
- * of the given peer that we are currently validating, have validated
- * or are blocked from re-validation for a while).
- */
-static struct GNUNET_CONTAINER_MultiPeerMap *validation_map;
-
-/**
- * Context for peerinfo iteration.
- */
-static struct GNUNET_PEERINFO_NotifyContext *pnc;
-
-/**
- * Minimum delay between to validations
- */
-static struct GNUNET_TIME_Relative validation_delay;
-
-/**
- * Number of validations running; any PING that was not yet
- * matched by a PONG and for which we have not yet hit the
- * timeout is considered a running 'validation'.
- */
-static unsigned int validations_running;
-
-/**
- * Validition fast start threshold
- */
-static unsigned int validations_fast_start_threshold;
-
-/**
- * When is next validation allowed
- */
-static struct GNUNET_TIME_Absolute validation_next;
-
-
-/**
- * Context for the validation entry match function.
- */
-struct ValidationEntryMatchContext
-{
-  /**
-   * Where to store the result?
-   */
-  struct ValidationEntry *ve;
-
-  /**
-   * Address we're interested in.
-   */
-  const struct GNUNET_HELLO_Address *address;
-};
-
-
-/**
- * Provide an update on the `validation_map` map size to statistics.
- * This function should be called whenever the `validation_map`
- * is changed.
- */
-static void
-publish_ve_stat_update ()
-{
-  GNUNET_STATISTICS_set (GST_stats,
-                         gettext_noop ("# Addresses in validation map"),
-                         GNUNET_CONTAINER_multipeermap_size (validation_map),
-                         GNUNET_NO);
-}
-
-
-/**
- * Iterate over validation entries until a matching one is found.
- *
- * @param cls the `struct ValidationEntryMatchContext *`
- * @param key peer identity (unused)
- * @param value a `struct ValidationEntry *` to match
- * @return #GNUNET_YES if the entry does not match,
- *         #GNUNET_NO if the entry does match
- */
-static int
-validation_entry_match (void *cls,
-                        const struct GNUNET_PeerIdentity *key,
-                        void *value)
-{
-  struct ValidationEntryMatchContext *vemc = cls;
-  struct ValidationEntry *ve = value;
-
-  if (0 == GNUNET_HELLO_address_cmp (ve->address,
-                                     vemc->address))
-  {
-    vemc->ve = ve;
-    return GNUNET_NO;
-  }
-  return GNUNET_YES;
-}
-
-
-/**
- * A validation entry changed.  Update the state and notify
- * monitors.
- *
- * @param ve validation entry that changed
- * @param state new state
- */
-static void
-validation_entry_changed (struct ValidationEntry *ve,
-                          enum GNUNET_TRANSPORT_ValidationState state)
-{
-  ve->state = state;
-}
-
-
-/**
- * Iterate over validation entries and free them.
- *
- * @param cls (unused)
- * @param key peer identity (unused)
- * @param value a `struct ValidationEntry *` to clean up
- * @return #GNUNET_YES (continue to iterate)
- */
-static int
-cleanup_validation_entry (void *cls,
-                          const struct GNUNET_PeerIdentity *key,
-                          void *value)
-{
-  struct ValidationEntry *ve = value;
-
-  ve->next_validation = GNUNET_TIME_UNIT_ZERO_ABS;
-  ve->valid_until = GNUNET_TIME_UNIT_ZERO_ABS;
-
-  /* Notify about deleted entry */
-  validation_entry_changed (ve,
-                            GNUNET_TRANSPORT_VS_REMOVE);
-
-  if (NULL != ve->bc)
-  {
-    GST_blacklist_test_cancel (ve->bc);
-    ve->bc = NULL;
-  }
-  GNUNET_break (GNUNET_OK ==
-                GNUNET_CONTAINER_multipeermap_remove (validation_map,
-                                                      &ve->address->peer,
-                                                      ve));
-  publish_ve_stat_update ();
-  if (GNUNET_YES == ve->known_to_ats)
-  {
-    GST_ats_expire_address (ve->address);
-    GNUNET_assert (GNUNET_NO ==
-                   GST_ats_is_known_no_session (ve->address));
-    ve->known_to_ats = GNUNET_NO;
-  }
-  GNUNET_HELLO_address_free (ve->address);
-  if (NULL != ve->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (ve->timeout_task);
-    ve->timeout_task = NULL;
-  }
-  if (NULL != ve->revalidation_task)
-  {
-    GNUNET_SCHEDULER_cancel (ve->revalidation_task);
-    ve->revalidation_task = NULL;
-  }
-  if ((GNUNET_YES == ve->expecting_pong) &&
-      (validations_running > 0))
-  {
-    validations_running--;
-    GNUNET_STATISTICS_set (GST_stats,
-                           gettext_noop ("# validations running"),
-                           validations_running,
-                           GNUNET_NO);
-  }
-  GNUNET_free (ve);
-  return GNUNET_OK;
-}
-
-
-/**
- * Address validation cleanup task.  Assesses if the record is no
- * longer valid and then possibly triggers its removal.
- *
- * @param cls the `struct ValidationEntry`
- */
-static void
-timeout_hello_validation (void *cls)
-{
-  struct ValidationEntry *ve = cls;
-  struct GNUNET_TIME_Absolute max;
-  struct GNUNET_TIME_Relative left;
-
-  ve->timeout_task = NULL;
-  /* For valid addresses, we want to wait until the expire;
-     for addresses under PING validation, we want to wait
-     until we give up on the PING */
-  max = GNUNET_TIME_absolute_max (ve->valid_until,
-                                  ve->revalidation_block);
-  left = GNUNET_TIME_absolute_get_remaining (max);
-  if (left.rel_value_us > 0)
-  {
-    /* We should wait a bit longer. This happens when
-       address lifetimes are extended due to successful
-       validations. */
-    ve->timeout_task =
-      GNUNET_SCHEDULER_add_delayed (left,
-                                    &timeout_hello_validation,
-                                    ve);
-    return;
-  }
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop (
-                              "# address records discarded (timeout)"),
-                            1,
-                            GNUNET_NO);
-  cleanup_validation_entry (NULL,
-                            &ve->address->peer,
-                            ve);
-}
-
-
-/**
- * Function called with the result from blacklisting.
- * Send a PING to the other peer if a communication is allowed.
- *
- * @param cls our `struct ValidationEntry`
- * @param pid identity of the other peer
- * @param address_null address associated with the request, always NULL
- * @param session_null session associated with the request, always NULL
- * @param result #GNUNET_OK if the connection is allowed,
- *               #GNUNET_NO if not,
- *               #GNUNET_SYSERR if operation was aborted
- */
-static void
-transmit_ping_if_allowed (void *cls,
-                          const struct GNUNET_PeerIdentity *pid,
-                          const struct GNUNET_HELLO_Address *address_null,
-                          struct GNUNET_ATS_Session *session_null,
-                          int result)
-{
-  struct ValidationEntry *ve = cls;
-  struct TransportPingMessage ping;
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-  struct GNUNET_TIME_Absolute next;
-  const struct GNUNET_MessageHeader *hello;
-  ssize_t ret;
-  size_t tsize;
-  size_t slen;
-  uint16_t hsize;
-  struct GNUNET_ATS_Session *session;
-
-  ve->bc = NULL;
-  if (GNUNET_OK != result)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Blacklist denies sending PING to `%s' `%s' `%s'\n",
-                GNUNET_i2s (pid),
-                GST_plugins_a2s (ve->address),
-                ve->address->transport_name);
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# address records discarded (blacklist)"),
-                              1,
-                              GNUNET_NO);
-    cleanup_validation_entry (NULL,
-                              pid,
-                              ve);
-    return;
-  }
-  hello = GST_hello_get ();
-  GNUNET_assert (NULL != hello);
-  slen = strlen (ve->address->transport_name) + 1;
-  hsize = ntohs (hello->size);
-  tsize = sizeof(struct TransportPingMessage)
-          + ve->address->address_length + slen + hsize;
-
-  ping.header.size =
-    htons (sizeof(struct TransportPingMessage)
-           + ve->address->address_length + slen);
-  ping.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_PING);
-  ping.challenge = htonl (ve->challenge);
-  ping.target = *pid;
-
-  if (tsize >= GNUNET_MAX_MESSAGE_SIZE)
-  {
-    GNUNET_break (0);
-    hsize = 0;
-    tsize =
-      sizeof(struct TransportPingMessage) + ve->address->address_length
-      + slen + hsize;
-  }
-  {
-    char message_buf[tsize] GNUNET_ALIGN;
-
-    GNUNET_memcpy (message_buf,
-                   hello,
-                   hsize);
-    GNUNET_memcpy (&message_buf[hsize],
-                   &ping,
-                   sizeof(struct TransportPingMessage));
-    GNUNET_memcpy (&message_buf[sizeof(struct TransportPingMessage) + hsize],
-                   ve->address->transport_name,
-                   slen);
-    GNUNET_memcpy (&message_buf[sizeof(struct TransportPingMessage) + slen
-                                + hsize],
-                   ve->address->address,
-                   ve->address->address_length);
-    papi = GST_plugins_find (ve->address->transport_name);
-    GNUNET_assert (NULL != papi);
-    session = papi->get_session (papi->cls,
-                                 ve->address);
-    if (NULL == session)
-    {
-      /* Could not get a valid session */
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Failed to get session to send PING to `%s' at `%s'\n",
-                  GNUNET_i2s (pid),
-                  GST_plugins_a2s (ve->address));
-      return;
-    }
-
-    ret = papi->send (papi->cls, session,
-                      message_buf, tsize,
-                      PING_PRIORITY,
-                      ACCEPTABLE_PING_DELAY,
-                      NULL, NULL);
-    if (-1 == ret)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Failed to send PING to `%s' at `%s'\n",
-                  GNUNET_i2s (pid),
-                  GST_plugins_a2s (ve->address));
-      return;
-    }
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Transmitted plain PING to `%s' `%s' `%s'\n",
-                GNUNET_i2s (pid),
-                GST_plugins_a2s (ve->address),
-                ve->address->transport_name);
-    ve->network = papi->get_network (papi->cls,
-                                     session);
-    GNUNET_break (GNUNET_NT_UNSPECIFIED != ve->network);
-    GST_neighbours_notify_data_sent (ve->address,
-                                     session,
-                                     tsize);
-    next = GNUNET_TIME_relative_to_absolute (validation_delay);
-    validation_next = GNUNET_TIME_absolute_max (next,
-                                                validation_next);
-    ve->send_time = GNUNET_TIME_absolute_get ();
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# PINGs for address validation sent"),
-                              1,
-                              GNUNET_NO);
-    ve->expecting_pong = GNUNET_YES;
-    validations_running++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Validation started, %u validation processes running\n",
-                validations_running);
-    GNUNET_STATISTICS_set (GST_stats,
-                           gettext_noop ("# validations running"),
-                           validations_running,
-                           GNUNET_NO);
-    /*  Notify about PING sent */
-    validation_entry_changed (ve,
-                              GNUNET_TRANSPORT_VS_UPDATE);
-  }
-}
-
-
-/**
- * Do address validation again to keep address valid.
- *
- * @param cls the `struct ValidationEntry`
- */
-static void
-revalidate_address (void *cls)
-{
-  struct ValidationEntry *ve = cls;
-  struct GNUNET_TIME_Relative canonical_delay;
-  struct GNUNET_TIME_Relative delay;
-  struct GNUNET_TIME_Relative blocked_for;
-  struct GST_BlacklistCheck *bc;
-  uint32_t rdelay;
-
-  ve->revalidation_task = NULL;
-  delay = GNUNET_TIME_absolute_get_remaining (ve->revalidation_block);
-  /* Considering current connectivity situation, what is the maximum
-     block period permitted? */
-  if (GNUNET_YES == ve->in_use)
-    canonical_delay = CONNECTED_PING_FREQUENCY;
-  else if (GNUNET_TIME_absolute_get_remaining (ve->valid_until).rel_value_us >
-           0)
-    canonical_delay = VALIDATED_PING_FREQUENCY;
-  else
-    canonical_delay = UNVALIDATED_PING_KEEPALIVE;
-  /* Use delay that is MIN of original delay and possibly adjusted
-     new maximum delay (which may be lower); the real delay
-     is originally randomized between "canonical_delay" and "2 * 
canonical_delay",
-     so continue to permit that window for the operation. */
-  delay = GNUNET_TIME_relative_min (delay,
-                                    GNUNET_TIME_relative_multiply (
-                                      canonical_delay,
-                                      2));
-  ve->revalidation_block = GNUNET_TIME_relative_to_absolute (delay);
-  if (delay.rel_value_us > 0)
-  {
-    /* should wait a bit longer */
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Waiting for %s longer before (re)validating address `%s'\n",
-                GNUNET_STRINGS_relative_time_to_string (delay,
-                                                        GNUNET_YES),
-                GST_plugins_a2s (ve->address));
-    ve->revalidation_task =
-      GNUNET_SCHEDULER_add_delayed (delay,
-                                    &revalidate_address, ve);
-    ve->next_validation = GNUNET_TIME_relative_to_absolute (delay);
-    return;
-  }
-  /* check if globally we have too many active validations at a
-     too high rate, if so, delay ours */
-  blocked_for = GNUNET_TIME_absolute_get_remaining (validation_next);
-  if ((validations_running > validations_fast_start_threshold) &&
-      (blocked_for.rel_value_us > 0))
-  {
-    /* Validations are blocked, have to wait for blocked_for time */
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Validations blocked for another %s, delaying validating 
address `%s'\n",
-                GNUNET_STRINGS_relative_time_to_string (blocked_for,
-                                                        GNUNET_YES),
-                GST_plugins_a2s (ve->address));
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop (
-                                "# validations delayed by global throttle"),
-                              1,
-                              GNUNET_NO);
-    ve->revalidation_task =
-      GNUNET_SCHEDULER_add_delayed (blocked_for,
-                                    &revalidate_address,
-                                    ve);
-    ve->next_validation = GNUNET_TIME_relative_to_absolute (blocked_for);
-    return;
-  }
-
-  /* We are good to go; remember to not go again for `canonical_delay` time;
-     add up to `canonical_delay` to randomize start time */
-  ve->revalidation_block = GNUNET_TIME_relative_to_absolute (canonical_delay);
-  /* schedule next PINGing with some extra random delay to avoid synchronous 
re-validations */
-  rdelay =
-    GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
-                              canonical_delay.rel_value_us);
-
-  delay = GNUNET_TIME_relative_add (canonical_delay,
-                                    GNUNET_TIME_relative_multiply
-                                      (GNUNET_TIME_UNIT_MICROSECONDS,
-                                      rdelay));
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Validating now, next scheduled for %s, now validating address 
`%s'\n",
-              GNUNET_STRINGS_relative_time_to_string (blocked_for,
-                                                      GNUNET_YES),
-              GST_plugins_a2s (ve->address));
-  ve->revalidation_task =
-    GNUNET_SCHEDULER_add_delayed (delay,
-                                  &revalidate_address,
-                                  ve);
-  ve->next_validation = GNUNET_TIME_relative_to_absolute (delay);
-
-  /* start PINGing by checking blacklist */
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop ("# address revalidations started"), 
1,
-                            GNUNET_NO);
-  if (NULL != ve->bc)
-  {
-    GST_blacklist_test_cancel (ve->bc);
-    ve->bc = NULL;
-  }
-  bc = GST_blacklist_test_allowed (&ve->address->peer,
-                                   ve->address->transport_name,
-                                   &transmit_ping_if_allowed,
-                                   ve,
-                                   NULL,
-                                   NULL);
-  if (NULL != bc)
-  {
-    /* If transmit_ping_if_allowed was already called it may have freed ve,
-     * so only set ve->bc if it has not been called.
-     */
-    ve->bc = bc;
-  }
-}
-
-
-/**
- * Find a ValidationEntry entry for the given neighbour that matches
- * the given address and transport.  If none exists, create one (but
- * without starting any validation).
- *
- * @param address address to find
- * @return validation entry matching the given specifications, NULL
- *         if we don't have an existing entry and no public key was given
- */
-static struct ValidationEntry *
-find_validation_entry (const struct GNUNET_HELLO_Address *address)
-{
-  struct ValidationEntryMatchContext vemc;
-  struct ValidationEntry *ve;
-
-  vemc.ve = NULL;
-  vemc.address = address;
-  GNUNET_CONTAINER_multipeermap_get_multiple (validation_map,
-                                              &address->peer,
-                                              &validation_entry_match, &vemc);
-  if (NULL != (ve = vemc.ve))
-    return ve;
-  GNUNET_assert (GNUNET_NO ==
-                 GST_ats_is_known_no_session (address));
-  ve = GNUNET_new (struct ValidationEntry);
-  ve->in_use = GNUNET_SYSERR; /* not defined */
-  ve->address = GNUNET_HELLO_address_copy (address);
-  ve->pong_sig_valid_until = GNUNET_TIME_UNIT_ZERO_ABS;
-  memset (&ve->pong_sig_cache,
-          '\0',
-          sizeof(struct GNUNET_CRYPTO_EddsaSignature));
-  ve->latency = GNUNET_TIME_UNIT_FOREVER_REL;
-  ve->challenge =
-    GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
-  ve->timeout_task =
-    GNUNET_SCHEDULER_add_delayed (UNVALIDATED_PING_KEEPALIVE,
-                                  &timeout_hello_validation,
-                                  ve);
-  GNUNET_CONTAINER_multipeermap_put (validation_map,
-                                     &address->peer,
-                                     ve,
-                                     
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  publish_ve_stat_update ();
-  validation_entry_changed (ve,
-                            GNUNET_TRANSPORT_VS_NEW);
-  return ve;
-}
-
-
-/**
- * Iterator which adds the given address to the set of validated
- * addresses.
- *
- * @param cls original HELLO message
- * @param address the address
- * @param expiration expiration time
- * @return #GNUNET_OK (keep the address), could return
- *         #GNUNET_NO (delete address, but this is ignored);
- *         #GNUNET_SYSERR would abort iteration (but we always iterate all)
- */
-static int
-add_valid_address (void *cls,
-                   const struct GNUNET_HELLO_Address *address,
-                   struct GNUNET_TIME_Absolute expiration)
-{
-  const struct GNUNET_HELLO_Message *hello = cls;
-  struct ValidationEntry *ve;
-  struct GNUNET_PeerIdentity pid;
-  struct GNUNET_ATS_Properties prop;
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-
-  if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
-    return GNUNET_OK;           /* expired */
-  if (GNUNET_OK != GNUNET_HELLO_get_id (hello, &pid))
-  {
-    GNUNET_break (0);
-    return GNUNET_OK;           /* invalid HELLO !? */
-  }
-  if (NULL == (papi = GST_plugins_find (address->transport_name)))
-  {
-    /* might have been valid in the past, but we don't have that
-       plugin loaded right now */
-    return GNUNET_OK;
-  }
-  if (NULL ==
-      papi->address_to_string (papi->cls,
-                               address->address,
-                               address->address_length))
-  {
-    /* Why do we try to add an ill-formed address? */
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Address with %u bytes for plugin %s and peer %s is 
malformed\n",
-                (unsigned int) address->address_length,
-                address->transport_name,
-                GNUNET_i2s (&pid));
-    return GNUNET_OK;
-  }
-
-  ve = find_validation_entry (address);
-  ve->network = papi->get_network_for_address (papi->cls,
-                                               address);
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != ve->network);
-  ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until,
-                                              expiration);
-  if (NULL == ve->revalidation_task)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Starting revalidations for valid address `%s'\n",
-                GST_plugins_a2s (ve->address));
-    ve->next_validation = GNUNET_TIME_absolute_get ();
-    ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address, ve);
-  }
-  validation_entry_changed (ve,
-                            GNUNET_TRANSPORT_VS_UPDATE);
-  memset (&prop, 0, sizeof(prop));
-  prop.scope = ve->network;
-  prop.delay = GNUNET_TIME_relative_divide (ve->latency, 2);
-  if (GNUNET_YES != ve->known_to_ats)
-  {
-    ve->known_to_ats = GNUNET_YES;
-    GST_ats_add_address (address, &prop);
-    GNUNET_assert (GNUNET_YES ==
-                   GST_ats_is_known_no_session (ve->address));
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Function called for any HELLO known to PEERINFO.
- *
- * @param cls unused (NULL)
- * @param peer id of the peer, NULL for last call (during iteration,
- *             as we are monitoring, this should never happen)
- * @param hello hello message for the peer (can be NULL)
- * @param err_msg error message
- */
-static void
-process_peerinfo_hello (void *cls,
-                        const struct GNUNET_PeerIdentity *peer,
-                        const struct GNUNET_HELLO_Message *hello,
-                        const char *err_msg)
-{
-  GNUNET_assert (NULL != peer);
-  if (NULL == hello)
-    return;
-  if (0 == memcmp (&GST_my_identity,
-                   peer,
-                   sizeof(struct GNUNET_PeerIdentity)))
-  {
-    /* Peerinfo returned own identity, skip validation */
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Handling HELLO for peer `%s'\n",
-              GNUNET_i2s (peer));
-  GNUNET_assert (NULL ==
-                 GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO,
-                                                 &add_valid_address,
-                                                 (void *) hello));
-}
-
-
-/**
- * Start the validation subsystem.
- *
- * @param max_fds maximum number of fds to use
- */
-void
-GST_validation_start (unsigned int max_fds)
-{
-  /**
-   * Initialization for validation throttling
-   *
-   * We have a maximum number max_fds of connections we can use for validation
-   * We monitor the number of validations in parallel and start to throttle it
-   * when doing to many validations in parallel:
-   * if (running validations < (max_fds / 2))
-   * - "fast start": run validation immediately
-   * - have delay of (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value_us) / 
(max_fds / 2)
-   *   (300 sec / ~150 == ~2 sec.) between two validations
-   */validation_next = GNUNET_TIME_absolute_get ();
-  validation_delay.rel_value_us =
-    (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value_us) / (max_fds / 2);
-  validations_fast_start_threshold = (max_fds / 2);
-  validations_running = 0;
-  GNUNET_STATISTICS_set (GST_stats,
-                         gettext_noop ("# validations running"),
-                         validations_running,
-                         GNUNET_NO);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Validation uses a fast start threshold of %u connections and a 
delay of %s\n",
-              validations_fast_start_threshold,
-              GNUNET_STRINGS_relative_time_to_string (validation_delay,
-                                                      GNUNET_YES));
-  validation_map = GNUNET_CONTAINER_multipeermap_create (VALIDATION_MAP_SIZE,
-                                                         GNUNET_NO);
-  pnc = GNUNET_PEERINFO_notify (GST_cfg, GNUNET_YES,
-                                &process_peerinfo_hello, NULL);
-}
-
-
-/**
- * Stop the validation subsystem.
- */
-void
-GST_validation_stop ()
-{
-  GNUNET_CONTAINER_multipeermap_iterate (validation_map,
-                                         &cleanup_validation_entry,
-                                         NULL);
-  GNUNET_CONTAINER_multipeermap_destroy (validation_map);
-  validation_map = NULL;
-  GNUNET_PEERINFO_notify_cancel (pnc);
-}
-
-
-/**
- * Send the given PONG to the given address.
- *
- * @param cls the PONG message
- * @param valid_until is ZERO if we never validated the address,
- *                    otherwise a time up to when we consider it (or was) valid
- * @param validation_block  is FOREVER if the address is for an unsupported 
plugin (from PEERINFO)
- *                          is ZERO if the address is considered valid (no 
validation needed)
- *                          otherwise a time in the future if we're currently 
denying re-validation
- * @param address target address
- */
-static void
-multicast_pong (void *cls,
-                struct GNUNET_TIME_Absolute valid_until,
-                struct GNUNET_TIME_Absolute validation_block,
-                const struct GNUNET_HELLO_Address *address)
-{
-  struct TransportPongMessage *pong = cls;
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-  struct GNUNET_ATS_Session *session;
-
-  papi = GST_plugins_find (address->transport_name);
-  if (NULL == papi)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Plugin %s not supported, cannot send PONG\n",
-                address->transport_name);
-    return;
-  }
-  GNUNET_assert (NULL != papi->send);
-  GNUNET_assert (NULL != papi->get_session);
-  session = papi->get_session (papi->cls, address);
-  if (NULL == session)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GST_ats_new_session (address, session);
-  papi->send (papi->cls, session,
-              (const char *) pong,
-              ntohs (pong->header.size),
-              PONG_PRIORITY,
-              ACCEPTABLE_PING_DELAY,
-              NULL, NULL);
-  GST_neighbours_notify_data_sent (address,
-                                   session,
-                                   pong->header.size);
-}
-
-
-/**
- * We've received a PING.  If appropriate, generate a PONG.
- *
- * @param sender peer sending the PING
- * @param hdr the PING
- * @param sender_address the sender address as we got it
- * @param session session we got the PING from
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
-                            const struct GNUNET_MessageHeader *hdr,
-                            const struct GNUNET_HELLO_Address *sender_address,
-                            struct GNUNET_ATS_Session *session)
-{
-  const struct TransportPingMessage *ping;
-  struct TransportPongMessage *pong;
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-  struct GNUNET_CRYPTO_EddsaSignature *sig_cache;
-  struct GNUNET_TIME_Absolute *sig_cache_exp;
-  const char *addr;
-  const char *addrend;
-  char *plugin_name;
-  char *pos;
-  size_t len_address;
-  size_t len_plugin;
-  ssize_t ret;
-  struct GNUNET_HELLO_Address address;
-
-  if (0 ==
-      memcmp (&GST_my_identity,
-              sender,
-              sizeof(struct GNUNET_PeerIdentity)))
-    return GNUNET_OK; /* our own, ignore! */
-  if (ntohs (hdr->size) < sizeof(struct TransportPingMessage))
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-  ping = (const struct TransportPingMessage *) hdr;
-  if (0 !=
-      memcmp (&ping->target,
-              &GST_my_identity,
-              sizeof(struct GNUNET_PeerIdentity)))
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                                ("# PING message for different peer received"),
-                              1,
-                              GNUNET_NO);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop ("# PING messages received"), 1,
-                            GNUNET_NO);
-  addr = (const char *) &ping[1];
-  len_address = ntohs (hdr->size) - sizeof(struct TransportPingMessage);
-  /* peer wants to confirm that this is one of our addresses, this is what is
-   * used for address validation */
-
-  sig_cache = NULL;
-  sig_cache_exp = NULL;
-  papi = NULL;
-  if (len_address > 0)
-  {
-    addrend = memchr (addr, '\0', len_address);
-    if (NULL == addrend)
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-    addrend++;
-    len_plugin = strlen (addr) + 1;
-    len_address -= len_plugin;
-    address.local_info = GNUNET_HELLO_ADDRESS_INFO_NONE;
-    address.address = addrend;
-    address.address_length = len_address;
-    address.transport_name = addr;
-    address.peer = GST_my_identity;
-
-    if (NULL == address.transport_name)
-    {
-      GNUNET_break (0);
-    }
-
-    if (0 != strstr (address.transport_name, "_client"))
-    {
-      plugin_name = GNUNET_strdup (address.transport_name);
-      pos = strstr (plugin_name, "_client");
-      GNUNET_assert (NULL != pos);
-      GNUNET_snprintf (pos, strlen ("_server") + 1, "%s", "_server");
-    }
-    else
-      plugin_name = GNUNET_strdup (address.transport_name);
-
-    if (NULL == (papi = GST_plugins_find (plugin_name)))
-    {
-      /* we don't have the plugin for this address */
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  _ (
-                    "Plugin `%s' not available, cannot confirm having this 
address\n"),
-                  plugin_name);
-      GNUNET_free (plugin_name);
-      return GNUNET_SYSERR;
-    }
-    GNUNET_free (plugin_name);
-    if (GNUNET_OK !=
-        papi->check_address (papi->cls,
-                             addrend,
-                             len_address))
-    {
-      GNUNET_STATISTICS_update (GST_stats,
-                                gettext_noop
-                                  ("# failed address checks during 
validation"),
-                                1,
-                                GNUNET_NO);
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  _ (
-                    "Address `%s' is not one of my addresses, not confirming 
PING\n"),
-                  GST_plugins_a2s (&address));
-      return GNUNET_SYSERR;
-    }
-    else
-    {
-      GNUNET_STATISTICS_update (GST_stats,
-                                gettext_noop
-                                (
-                                  "# successful address checks during 
validation"),
-                                1,
-                                GNUNET_NO);
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Address `%s' is one of my addresses, confirming PING\n",
-                  GST_plugins_a2s (&address));
-    }
-
-    if (GNUNET_YES !=
-        GST_hello_test_address (&address,
-                                &sig_cache,
-                                &sig_cache_exp))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  _ (
-                    "Not confirming PING from peer `%s' with address `%s' 
since I cannot confirm having this address.\n"),
-                  GNUNET_i2s (sender),
-                  GST_plugins_a2s (&address));
-      return GNUNET_SYSERR;
-    }
-  }
-  else
-  {
-    addrend = NULL;             /* make gcc happy */
-    len_plugin = 0;
-    static struct GNUNET_CRYPTO_EddsaSignature no_address_signature;
-    static struct GNUNET_TIME_Absolute no_address_signature_expiration;
-
-    sig_cache = &no_address_signature;
-    sig_cache_exp = &no_address_signature_expiration;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "I am `%s', sending PONG to peer `%s'\n",
-              GNUNET_i2s_full (&GST_my_identity),
-              GNUNET_i2s (sender));
-
-  /* message with structure:
-   * [TransportPongMessage][Transport name][Address] */
-
-  pong = GNUNET_malloc (sizeof(struct TransportPongMessage) + len_address
-                        + len_plugin);
-  pong->header.size =
-    htons (sizeof(struct TransportPongMessage) + len_address + len_plugin);
-  pong->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_PONG);
-  pong->purpose.size =
-    htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
-           + sizeof(uint32_t) + sizeof(struct GNUNET_TIME_AbsoluteNBO)
-           + len_address + len_plugin);
-  pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN);
-  GNUNET_memcpy (&pong->challenge, &ping->challenge, sizeof(ping->challenge));
-  pong->addrlen = htonl (len_address + len_plugin);
-  GNUNET_memcpy (&pong[1], addr, len_plugin);    /* Copy transport plugin */
-  if (len_address > 0)
-  {
-    GNUNET_assert (NULL != addrend);
-    GNUNET_memcpy (&((char *) &pong[1])[len_plugin], addrend, len_address);
-  }
-  if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value_us <
-      PONG_SIGNATURE_LIFETIME.rel_value_us / 4)
-  {
-    /* create / update cached sig */
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Creating PONG signature to indicate ownership.\n");
-    *sig_cache_exp = GNUNET_TIME_relative_to_absolute 
(PONG_SIGNATURE_LIFETIME);
-    pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp);
-    if (GNUNET_OK !=
-        GNUNET_CRYPTO_eddsa_sign_ (&GST_my_private_key,
-                                   &pong->purpose,
-                                   sig_cache))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Failed to create PONG signature for peer `%s'\n"),
-                  GNUNET_i2s (sender));
-    }
-  }
-  else
-  {
-    pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp);
-  }
-  pong->signature = *sig_cache;
-
-  GNUNET_assert (NULL != sender_address);
-
-  /* first see if the session we got this PING from can be used to transmit
-   * a response reliably */
-  if (NULL == papi)
-  {
-    ret = -1;
-  }
-  else
-  {
-    GNUNET_assert (NULL != papi->send);
-    GNUNET_assert (NULL != papi->get_session);
-    if (NULL == session)
-    {
-      session = papi->get_session (papi->cls, sender_address);
-    }
-    if (NULL == session)
-    {
-      GNUNET_break (0);
-      ret = -1;
-    }
-    else
-    {
-      ret = papi->send (papi->cls, session,
-                        (const char *) pong,
-                        ntohs (pong->header.size),
-                        PONG_PRIORITY, ACCEPTABLE_PING_DELAY,
-                        NULL, NULL);
-      if (-1 != ret)
-        GST_neighbours_notify_data_sent (sender_address,
-                                         session,
-                                         pong->header.size);
-    }
-  }
-  if (-1 != ret)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Transmitted PONG to `%s' via reliable mechanism\n",
-                GNUNET_i2s (sender));
-    /* done! */
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                                ("# PONGs unicast via reliable transport"), 1,
-                              GNUNET_NO);
-    GNUNET_free (pong);
-    return GNUNET_OK;
-  }
-
-  /* no reliable method found, try transmission via all known addresses */
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop
-                              ("# PONGs multicast to all available addresses"),
-                            1,
-                            GNUNET_NO);
-  GST_validation_get_addresses (sender,
-                                &multicast_pong, pong);
-  GNUNET_free (pong);
-  return GNUNET_OK;
-}
-
-
-/**
- * Validate an individual address.
- *
- * @param address address we should try to validate
- */
-void
-GST_validation_handle_address (const struct GNUNET_HELLO_Address *address)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *papi;
-  struct ValidationEntry *ve;
-
-  papi = GST_plugins_find (address->transport_name);
-  if (NULL == papi)
-  {
-    /* This plugin is currently unavailable ... ignore */
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "No plugin available for %s\n",
-                address->transport_name);
-    return;
-  }
-  ve = find_validation_entry (address);
-  if (NULL == ve->revalidation_task)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Validation process started for fresh address `%s' of %s\n",
-                GST_plugins_a2s (ve->address),
-                GNUNET_i2s (&ve->address->peer));
-    ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address, ve);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Validation already running for address `%s' of %s\n",
-                GST_plugins_a2s (ve->address),
-                GNUNET_i2s (&ve->address->peer));
-  }
-}
-
-
-/**
- * Iterator callback to go over all addresses and try to validate them
- * (unless blocked or already validated).
- *
- * @param cls NULL
- * @param address the address
- * @param expiration expiration time
- * @return #GNUNET_OK (keep the address)
- */
-static int
-validate_address_iterator (void *cls,
-                           const struct GNUNET_HELLO_Address *address,
-                           struct GNUNET_TIME_Absolute expiration)
-{
-  if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Skipping expired address from HELLO\n");
-    return GNUNET_OK;           /* expired */
-  }
-  GST_validation_handle_address (address);
-  return GNUNET_OK;
-}
-
-
-/**
- * Add the validated peer address to the HELLO.
- *
- * @param cls the `struct ValidationEntry *` with the validated address
- * @param max space in @a buf
- * @param buf where to add the address
- * @return number of bytes written, #GNUNET_SYSERR to signal the
- *         end of the iteration.
- */
-static ssize_t
-add_valid_peer_address (void *cls,
-                        size_t max,
-                        void *buf)
-{
-  struct ValidationEntry *ve = cls;
-
-  if (GNUNET_YES == ve->copied)
-    return GNUNET_SYSERR; /* Done */
-  ve->copied = GNUNET_YES;
-  return GNUNET_HELLO_add_address (ve->address,
-                                   ve->valid_until,
-                                   buf,
-                                   max);
-}
-
-
-/**
- * We've received a PONG.  Check if it matches a pending PING and
- * mark the respective address as confirmed.
- *
- * @param sender peer sending the PONG
- * @param hdr the PONG
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
-                            const struct GNUNET_MessageHeader *hdr)
-{
-  const struct TransportPongMessage *pong;
-  struct ValidationEntry *ve;
-  const char *tname;
-  const char *addr;
-  size_t addrlen;
-  size_t slen;
-  size_t size;
-  struct GNUNET_HELLO_Message *hello;
-  struct GNUNET_HELLO_Address address;
-  int sig_res;
-  int do_verify;
-
-  if (0 ==
-      memcmp (&GST_my_identity,
-              sender,
-              sizeof(struct GNUNET_PeerIdentity)))
-    return GNUNET_OK; /* our own, ignore! */
-
-  if (ntohs (hdr->size) < sizeof(struct TransportPongMessage))
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop ("# PONG messages received"), 1,
-                            GNUNET_NO);
-
-  /* message with structure:
-   * [TransportPongMessage][Transport name][Address] */
-
-  pong = (const struct TransportPongMessage *) hdr;
-  tname = (const char *) &pong[1];
-  size = ntohs (hdr->size) - sizeof(struct TransportPongMessage);
-  addr = memchr (tname, '\0', size);
-  if (NULL == addr)
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-  addr++;
-  slen = strlen (tname) + 1;
-  addrlen = size - slen;
-
-  if (NULL == GST_plugins_find (tname))
-  {
-    /* we got the PONG, but the transport plugin specified in it
-       is not supported by this peer, so this cannot be a good
-       PONG for us. */
-    GNUNET_break_op (0);
-    return GNUNET_OK;
-  }
-
-  address.peer = *sender;
-  address.address = addr;
-  address.address_length = addrlen;
-  address.transport_name = tname;
-  address.local_info = GNUNET_HELLO_ADDRESS_INFO_NONE;
-  ve = find_validation_entry (&address);
-  if ((NULL == ve) || (GNUNET_NO == ve->expecting_pong))
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                              (
-                                "# PONGs dropped, no matching pending 
validation"),
-                              1, GNUNET_NO);
-    return GNUNET_OK;
-  }
-  /* now check that PONG is well-formed */
-  if (0 != memcmp (&ve->address->peer,
-                   sender,
-                   sizeof(struct GNUNET_PeerIdentity)))
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-  if (0 ==
-      GNUNET_TIME_absolute_get_remaining
-        (GNUNET_TIME_absolute_ntoh (pong->expiration)).rel_value_us)
-  {
-    GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                                ("# PONGs dropped, signature expired"), 1,
-                              GNUNET_NO);
-    return GNUNET_SYSERR;
-  }
-
-  sig_res = GNUNET_SYSERR;
-  do_verify = GNUNET_YES;
-  if (0 != GNUNET_TIME_absolute_get_remaining (
-        ve->pong_sig_valid_until).rel_value_us)
-  {
-    /* We have a cached and valid signature for this peer,
-     * try to compare instead of verify */
-    if (0 == memcmp (&ve->pong_sig_cache,
-                     &pong->signature,
-                     sizeof(struct GNUNET_CRYPTO_EddsaSignature)))
-    {
-      /* signatures are identical, we can skip verification */
-      sig_res = GNUNET_OK;
-      do_verify = GNUNET_NO;
-    }
-    else
-    {
-      sig_res = GNUNET_SYSERR;
-      /* signatures do not match, we have to verify */
-    }
-  }
-
-  if (GNUNET_YES == do_verify)
-  {
-    /* Do expensive verification */
-    sig_res = GNUNET_CRYPTO_eddsa_verify_ (
-      GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN,
-      &pong->purpose,
-      &pong->signature,
-      &ve->address->peer.public_key);
-    if (sig_res == GNUNET_SYSERR)
-    {
-      GNUNET_break_op (0);
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                  "Failed to verify: invalid signature on address `%s':%s from 
peer `%s'\n",
-                  tname,
-                  GST_plugins_a2s (ve->address),
-                  GNUNET_i2s (sender));
-    }
-  }
-  if (sig_res == GNUNET_SYSERR)
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Validation process successful for peer `%s' with plugin `%s' 
address `%s'\n",
-              GNUNET_i2s (sender),
-              tname,
-              GST_plugins_a2s (ve->address));
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop ("# validations succeeded"),
-                            1,
-                            GNUNET_NO);
-  /* validity achieved, remember it! */
-  ve->expecting_pong = GNUNET_NO;
-  ve->valid_until = GNUNET_TIME_relative_to_absolute 
(HELLO_ADDRESS_EXPIRATION);
-  ve->pong_sig_cache = pong->signature;
-  ve->pong_sig_valid_until = GNUNET_TIME_absolute_ntoh (pong->expiration);
-  ve->latency = GNUNET_TIME_absolute_get_duration (ve->send_time);
-  {
-    if (GNUNET_YES == ve->known_to_ats)
-    {
-      GNUNET_assert (GNUNET_YES ==
-                     GST_ats_is_known_no_session (ve->address));
-      GST_ats_update_delay (ve->address,
-                            GNUNET_TIME_relative_divide (ve->latency, 2));
-    }
-    else
-    {
-      struct GNUNET_ATS_Properties prop;
-
-      memset (&prop, 0, sizeof(prop));
-      GNUNET_break (GNUNET_NT_UNSPECIFIED != ve->network);
-      prop.scope = ve->network;
-      prop.delay = GNUNET_TIME_relative_divide (ve->latency, 2);
-      GNUNET_assert (GNUNET_NO ==
-                     GST_ats_is_known_no_session (ve->address));
-      ve->known_to_ats = GNUNET_YES;
-      GST_ats_add_address (ve->address, &prop);
-      GNUNET_assert (GNUNET_YES ==
-                     GST_ats_is_known_no_session (ve->address));
-    }
-  }
-  if (validations_running > 0)
-  {
-    validations_running--;
-    GNUNET_STATISTICS_set (GST_stats,
-                           gettext_noop ("# validations running"),
-                           validations_running,
-                           GNUNET_NO);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Validation finished, %u validation processes running\n",
-                validations_running);
-  }
-  else
-  {
-    GNUNET_break (0);
-  }
-
-  /* Notify about new validity */
-  validation_entry_changed (ve,
-                            GNUNET_TRANSPORT_VS_UPDATE);
-
-  /* build HELLO to store in PEERINFO */
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop ("# HELLOs given to peerinfo"),
-                            1,
-                            GNUNET_NO);
-  ve->copied = GNUNET_NO;
-  hello = GNUNET_HELLO_create (&ve->address->peer.public_key,
-                               &add_valid_peer_address,
-                               ve,
-                               GNUNET_NO);
-  GNUNET_break (NULL !=
-                GNUNET_PEERINFO_add_peer (GST_peerinfo,
-                                          hello,
-                                          NULL,
-                                          NULL));
-  GNUNET_free (hello);
-  return GNUNET_OK;
-}
-
-
-/**
- * We've received a HELLO, check which addresses are new and trigger
- * validation.
- *
- * @param hello the HELLO we received
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello)
-{
-  const struct GNUNET_HELLO_Message *hm =
-    (const struct GNUNET_HELLO_Message *) hello;
-  struct GNUNET_PeerIdentity pid;
-  int friend;
-
-  friend = GNUNET_HELLO_is_friend_only (hm);
-  if (((GNUNET_YES != friend) &&
-       (GNUNET_NO != friend)) ||
-      (GNUNET_OK != GNUNET_HELLO_get_id (hm, &pid)))
-  {
-    /* malformed HELLO */
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-  if (0 ==
-      memcmp (&GST_my_identity,
-              &pid,
-              sizeof(struct GNUNET_PeerIdentity)))
-  {
-    /* got our own HELLO, how boring */
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Validation received our own HELLO (%s), ignoring\n",
-                GNUNET_i2s (&pid));
-    return GNUNET_OK;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Validation received HELLO message for peer `%s' with size %u, 
checking for new addresses\n",
-              GNUNET_i2s (&pid),
-              ntohs (hello->size));
-  GNUNET_assert (NULL ==
-                 GNUNET_HELLO_iterate_addresses (hm,
-                                                 GNUNET_NO,
-                                                 &validate_address_iterator,
-                                                 NULL));
-  return GNUNET_OK;
-}
-
-
-/**
- * Closure for #iterate_addresses().
- */
-struct IteratorContext
-{
-  /**
-   * Function to call on each address.
-   */
-  GST_ValidationAddressCallback cb;
-
-  /**
-   * Closure for @e cb.
-   */
-  void *cb_cls;
-};
-
-
-/**
- * Call the callback in the closure for each validation entry.
- *
- * @param cls the `struct IteratorContext`
- * @param key the peer's identity
- * @param value the `struct ValidationEntry`
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-iterate_addresses (void *cls,
-                   const struct GNUNET_PeerIdentity *key,
-                   void *value)
-{
-  struct IteratorContext *ic = cls;
-  struct ValidationEntry *ve = value;
-
-  ic->cb (ic->cb_cls,
-          ve->valid_until,
-          ve->revalidation_block,
-          ve->address);
-  return GNUNET_OK;
-}
-
-
-/**
- * Call the given function for each address for the given target.
- * Can either give a snapshot (synchronous API) or be continuous.
- *
- * @param target peer information is requested for
- * @param cb function to call; will not be called after this function returns
- * @param cb_cls closure for @a cb
- */
-void
-GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target,
-                              GST_ValidationAddressCallback cb,
-                              void *cb_cls)
-{
-  struct IteratorContext ic;
-
-  ic.cb = cb;
-  ic.cb_cls = cb_cls;
-  GNUNET_CONTAINER_multipeermap_get_multiple (validation_map,
-                                              target,
-                                              &iterate_addresses, &ic);
-}
-
-
-/**
- * Update if we are using an address for a connection actively right now.
- * Based on this, the validation module will measure latency for the
- * address more or less often.
- *
- * @param address the address that we are now using (or not)
- * @param in_use #GNUNET_YES if we are now using the address for a connection,
- *               #GNUNET_NO if we are no longer using the address for a 
connection
- */
-void
-GST_validation_set_address_use (const struct GNUNET_HELLO_Address *address,
-                                int in_use)
-{
-  struct ValidationEntry *ve;
-
-  if (GNUNET_HELLO_address_check_option (address,
-                                         GNUNET_HELLO_ADDRESS_INFO_INBOUND))
-    return; /* ignore inbound for validation */
-  if (NULL == GST_plugins_find (address->transport_name))
-  {
-    /* How can we use an address for which we don't have the plugin? */
-    GNUNET_break (0);
-    return;
-  }
-  ve = find_validation_entry (address);
-  if (NULL == ve)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if (in_use == ve->in_use)
-    return;
-  ve->in_use = in_use;
-  if (GNUNET_YES == in_use)
-  {
-    /* from now on, higher frequency, so reschedule now */
-    if (NULL != ve->revalidation_task)
-      GNUNET_SCHEDULER_cancel (ve->revalidation_task);
-    ve->revalidation_task = GNUNET_SCHEDULER_add_now (&revalidate_address,
-                                                      ve);
-  }
-}
-
-
-/* end of file gnunet-service-transport_validation.c */
diff --git a/src/transport/gnunet-service-transport_validation.h 
b/src/transport/gnunet-service-transport_validation.h
deleted file mode 100644
index 2a0428869..000000000
--- a/src/transport/gnunet-service-transport_validation.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010,2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/gnunet-service-transport_validation.h
- * @brief address validation API
- * @author Christian Grothoff
- */
-#ifndef GNUNET_SERVICE_TRANSPORT_VALIDATION_H
-#define GNUNET_SERVICE_TRANSPORT_VALIDATION_H
-
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_plugin.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-
-/**
- * Start the validation subsystem.
- *
- * @param max_fds maximum number of fds to use
- */
-void
-GST_validation_start (unsigned int max_fds);
-
-
-/**
- * Stop the validation subsystem.
- */
-void
-GST_validation_stop (void);
-
-
-/**
- * Update if we are using an address for a connection actively right now.
- * Based on this, the validation module will measure latency for the
- * address more or less often.
- *
- * @param address the address that we are now using (or not)
- * @param in_use #GNUNET_YES if we are now using the address for a connection,
- *               #GNUNET_NO if we are no longer using the address for a 
connection
- */
-void
-GST_validation_set_address_use (const struct GNUNET_HELLO_Address *address,
-                                int in_use);
-
-
-/**
- * We've received a PING.  If appropriate, generate a PONG.
- *
- * @param sender peer sending the PING
- * @param hdr the PING
- * @param sender_address address of the sender, NULL if we did not initiate
- * @param session session we got the PING from
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
-                            const struct GNUNET_MessageHeader *hdr,
-                            const struct GNUNET_HELLO_Address *sender_address,
-                            struct GNUNET_ATS_Session *session);
-
-
-/**
- * We've received a PONG.  Check if it matches a pending PING and
- * mark the respective address as confirmed.
- *
- * @param sender peer sending the PONG
- * @param hdr the PONG
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
-                            const struct GNUNET_MessageHeader *hdr);
-
-
-/**
- * We've received a HELLO, check which addresses are new and trigger
- * validation.
- *
- * @param hello the HELLO we received
- * @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
- */
-int
-GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello);
-
-
-/**
- * Validate an individual address.
- *
- * @param address address we should try to validate
- */
-void
-GST_validation_handle_address (const struct GNUNET_HELLO_Address *address);
-
-
-/**
- * Function called for each address (or address status change) that
- * the validation module is aware of (for the given target).
- *
- * @param cls closure
- * @param public_key public key for the peer, never NULL
- * @param valid_until is ZERO if we never validated the address,
- *                    otherwise a time up to when we consider it (or was) valid
- * @param validation_block  is FOREVER if the address is for an unsupported 
plugin (from PEERINFO)
- *                          is ZERO if the address is considered valid (no 
validation needed)
- *                          otherwise a time in the future if we're currently 
denying re-validation
- * @param address the address
- */
-typedef void
-(*GST_ValidationAddressCallback) (void *cls,
-                                  struct GNUNET_TIME_Absolute valid_until,
-                                  struct GNUNET_TIME_Absolute validation_block,
-                                  const struct GNUNET_HELLO_Address *address);
-
-
-/**
- * Call the given function for each address for the given target.
- *
- * @param target peer information is requested for
- * @param cb function to call; will not be called after this function returns
- * @param cb_cls closure for @a cb
- */
-void
-GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target,
-                              GST_ValidationAddressCallback cb, void *cb_cls);
-
-
-#endif
-/* end of file gnunet-service-transport_validation.h */
diff --git a/src/transport/gnunet-transport-wlan-receiver.c 
b/src/transport/gnunet-transport-wlan-receiver.c
deleted file mode 100644
index 7f34a957f..000000000
--- a/src/transport/gnunet-transport-wlan-receiver.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
-   This file is part of GNUnet
-   Copyright (C) 2012 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/gnunet-transport-wlan-receiver.c
- * @brief program to send via WLAN as much as possible (to test 
physical/theoretical throughput)
- * @author David Brodski
- */
-#include "platform.h"
-#include "gnunet_protocols.h"
-#include "plugin_transport_wlan.h"
-
-int
-main (int argc, char *argv[])
-{
-  char msg_buf[65536];
-  unsigned long long count;
-  double bytes_per_s;
-  time_t start;
-  time_t akt;
-  ssize_t ret;
-  pid_t pid;
-  int commpipe[2]; /* This holds the fd for the input & output of the pipe */
-
-  if (2 != argc)
-  {
-    fprintf (stderr,
-             "This program must be started with the interface name as 
argument.\n");
-    fprintf (stderr,
-             "Usage: %s interface-name\n"
-             "e.g. %s mon0\n",
-             argv[0],
-             argv[0]);
-    return 1;
-  }
-
-  /* Setup communication pipeline first */
-  if (pipe (commpipe))
-  {
-    fprintf (stderr, "Failed to create pipe: %s\n", strerror (errno));
-    exit (1);
-  }
-
-  /* Attempt to fork and check for errors */
-  if ((pid = fork ()) == -1)
-  {
-    fprintf (stderr, "Failed to fork: %s\n", strerror (errno));
-    exit (1);
-  }
-
-  if (pid)
-  {
-    /* A positive (non-negative) PID indicates the parent process */
-    if (0 != close (commpipe[1]))  /* Close unused side of pipe (in side) */
-      fprintf (stderr, "Failed to close fd: %s\n", strerror (errno));
-    start = time (NULL);
-    count = 0;
-    while (1)
-    {
-      ret = read (commpipe[0], msg_buf, sizeof(msg_buf));
-      if (0 > ret)
-      {
-        fprintf (stderr, "read failed: %s\n", strerror (errno));
-        break;
-      }
-      count += ret;
-      akt = time (NULL);
-      if (akt - start > 30)
-      {
-        bytes_per_s = count / (akt - start);
-        bytes_per_s /= 1024;
-        printf ("recv %f kb/s\n", bytes_per_s);
-        start = akt;
-        count = 0;
-      }
-    }
-  }
-  else
-  {
-    /* A zero PID indicates that this is the child process */
-    (void) close (1);
-    if (-1 ==
-        dup2 (commpipe[1], 1))  /* Replace stdin with the in side of the pipe 
*/
-      fprintf (stderr, "dup2 failed: %s\n", strerror (errno));
-    (void) close (commpipe[0]); /* Close unused side of pipe (in side) */
-    /* Replace the child fork with a new process */
-    if (execlp ("gnunet-helper-transport-wlan",
-                "gnunet-helper-transport-wlan",
-                argv[1],
-                NULL) == -1)
-    {
-      fprintf (stderr, "Could not start gnunet-helper-transport-wlan!");
-      _exit (1);
-    }
-  }
-  return 0;
-}
diff --git a/src/transport/gnunet-transport-wlan-sender.c 
b/src/transport/gnunet-transport-wlan-sender.c
deleted file mode 100644
index 5256ec7be..000000000
--- a/src/transport/gnunet-transport-wlan-sender.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
-   This file is part of GNUnet
-   Copyright (C) 2011 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/gnunet-transport-wlan-sender.c
- * @brief program to send via WLAN as much as possible (to test 
physical/theoretical throughput)
- * @author David Brodski
- */
-#include "platform.h"
-#include "plugin_transport_wlan.h"
-#include "gnunet_protocols.h"
-
-#define WLAN_MTU 1500
-
-/**
- * LLC fields for better compatibility
- */
-#define WLAN_LLC_DSAP_FIELD 0x1f
-#define WLAN_LLC_SSAP_FIELD 0x1f
-
-#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
-
-#define IEEE80211_FC0_VERSION_MASK 0x03
-#define IEEE80211_FC0_VERSION_SHIFT 0
-#define IEEE80211_FC0_VERSION_0 0x00
-#define IEEE80211_FC0_TYPE_MASK 0x0c
-#define IEEE80211_FC0_TYPE_SHIFT 2
-#define IEEE80211_FC0_TYPE_MGT 0x00
-#define IEEE80211_FC0_TYPE_CTL 0x04
-#define IEEE80211_FC0_TYPE_DATA 0x08
-
-
-/**
- * function to fill the radiotap header
- * @param header pointer to the radiotap header
- * @param size total message size
- * @return GNUNET_YES at success
- */
-static int
-getRadiotapHeader (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header,
-                   uint16_t size)
-{
-  header->header.size = htons (size);
-  header->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER);
-  header->rate = 255;
-  header->tx_power = 0;
-  header->antenna = 0;
-  return GNUNET_YES;
-}
-
-
-/**
- * function to generate the wlan hardware header for one packet
- * @param Header address to write the header to
- * @param to_mac_addr pointer to the address of the recipient
- * @param mac pointer to the mac address to send from (normally overwritten 
over by helper)
- * @param size size of the whole packet, needed to calculate the time to send 
the packet
- * @return GNUNET_YES if there was no error
- */
-static int
-getWlanHeader (struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *Header,
-               const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr,
-               const struct GNUNET_TRANSPORT_WLAN_MacAddress *mac,
-               unsigned int size)
-{
-  const int rate = 11000000;
-
-  Header->frame_control = htons (IEEE80211_FC0_TYPE_DATA);
-  Header->addr3 = mac_bssid_gnunet;
-  Header->addr2 = *mac;
-  Header->addr1 = *to_mac_addr;
-  Header->duration = GNUNET_htole16 ((size * 1000000) / rate + 290);
-  Header->llc[0] = WLAN_LLC_DSAP_FIELD;
-  Header->llc[1] = WLAN_LLC_SSAP_FIELD;
-  Header->llc[2] = 0; // FIXME
-  Header->llc[3] = 0; // FIXME
-  return GNUNET_YES;
-}
-
-
-int
-main (int argc, char *argv[])
-{
-  char msg_buf[WLAN_MTU];
-  struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *radiotap;
-  unsigned int temp[6];
-  struct GNUNET_TRANSPORT_WLAN_MacAddress inmac;
-  struct GNUNET_TRANSPORT_WLAN_MacAddress outmac;
-  struct GNUNET_TRANSPORT_WLAN_HelperControlMessage hcm;
-  unsigned long long count;
-  double bytes_per_s;
-  time_t start;
-  time_t akt;
-  int i;
-  ssize_t ret;
-  pid_t pid;
-  int commpipe[2]; /* This holds the fd for the input & output of the pipe */
-  int macpipe[2]; /* This holds the fd for the input & output of the pipe */
-
-  if (4 != argc)
-  {
-    fprintf (
-      stderr,
-      "This program must be started with the interface and the targets and 
source mac as argument.\n");
-    fprintf (stderr,
-             "Usage: interface-name mac-DST mac-SRC\n"
-             "e.g. mon0 11-22-33-44-55-66 12-34-56-78-90-ab\n");
-    return 1;
-  }
-  if (6 != sscanf (argv[2],
-                   "%x-%x-%x-%x-%x-%x",
-                   &temp[0],
-                   &temp[1],
-                   &temp[2],
-                   &temp[3],
-                   &temp[4],
-                   &temp[5]))
-  {
-    fprintf (stderr,
-             "Usage: interface-name mac-DST mac-SRC\n"
-             "e.g. mon0 11-22-33-44-55-66 12-34-56-78-90-ab\n");
-    return 1;
-  }
-  for (i = 0; i < 6; i++)
-    outmac.mac[i] = temp[i];
-  if (6 != sscanf (argv[3],
-                   "%x-%x-%x-%x-%x-%x",
-                   &temp[0],
-                   &temp[1],
-                   &temp[2],
-                   &temp[3],
-                   &temp[4],
-                   &temp[5]))
-  {
-    fprintf (stderr,
-             "Usage: interface-name mac-DST mac-SRC\n"
-             "e.g. mon0 11-22-33-44-55-66 12-34-56-78-90-ab\n");
-    return 1;
-  }
-  for (i = 0; i < 6; i++)
-    inmac.mac[i] = temp[i];
-
-
-  /* Setup communication pipeline first */
-  if (pipe (commpipe))
-  {
-    fprintf (stderr, "Failed to create pipe: %s\n", strerror (errno));
-    exit (1);
-  }
-  if (pipe (macpipe))
-  {
-    fprintf (stderr, "Failed to create pipe: %s\n", strerror (errno));
-    exit (1);
-  }
-
-  /* Attempt to fork and check for errors */
-  if ((pid = fork ()) == -1)
-  {
-    fprintf (stderr, "Failed to fork: %s\n", strerror (errno));
-    exit (1);
-  }
-  memset (msg_buf, 0x42, sizeof(msg_buf));
-  if (pid)
-  {
-    /* A positive (non-negative) PID indicates the parent process */
-    if (0 != close (commpipe[0]))  /* Close unused side of pipe (in side) */
-      fprintf (stderr, "Failed to close fd: %s\n", strerror (errno));
-    setvbuf (stdout,
-             (char *) NULL,
-             _IONBF,
-             0);  /* Set non-buffered output on stdout */
-
-    if (0 != close (macpipe[1]))
-      fprintf (stderr, "Failed to close fd: %s\n", strerror (errno));
-    if (sizeof(hcm) != read (macpipe[0], &hcm, sizeof(hcm)))
-      fprintf (stderr, "Failed to read hcm...\n");
-    fprintf (stderr,
-             "Got MAC %.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n",
-             hcm.mac.mac[0],
-             hcm.mac.mac[1],
-             hcm.mac.mac[2],
-             hcm.mac.mac[3],
-             hcm.mac.mac[4],
-             hcm.mac.mac[5]);
-    radiotap = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) msg_buf;
-    getRadiotapHeader (radiotap, WLAN_MTU);
-    getWlanHeader (&radiotap->frame, &outmac, &inmac, WLAN_MTU);
-    start = time (NULL);
-    count = 0;
-    while (1)
-    {
-      ret = write (commpipe[1], msg_buf, WLAN_MTU);
-      if (0 > ret)
-      {
-        fprintf (stderr, "write failed: %s\n", strerror (errno));
-        break;
-      }
-      count += ret;
-      akt = time (NULL);
-      if (akt - start > 30)
-      {
-        bytes_per_s = count / (akt - start);
-        bytes_per_s /= 1024;
-        printf ("send %f kbytes/s\n", bytes_per_s);
-        start = akt;
-        count = 0;
-      }
-    }
-  }
-  else
-  {
-    /* A zero PID indicates that this is the child process */
-    (void) close (0);
-    (void) close (1);
-    if (-1 ==
-        dup2 (commpipe[0], 0))  /* Replace stdin with the in side of the pipe 
*/
-      fprintf (stderr, "dup2 failed: %s\n", strerror (errno));
-    if (-1 ==
-        dup2 (macpipe[1], 1))  /* Replace stdout with the out side of the pipe 
*/
-      fprintf (stderr, "dup2 failed: %s\n", strerror (errno));
-    (void) close (commpipe[1]); /* Close unused side of pipe (out side) */
-    (void) close (macpipe[0]); /* Close unused side of pipe (in side) */
-    /* Replace the child fork with a new process */
-    if (execlp ("gnunet-helper-transport-wlan",
-                "gnunet-helper-transport-wlan",
-                argv[1],
-                NULL) == -1)
-    {
-      fprintf (stderr, "Could not start gnunet-helper-transport-wlan!");
-      _exit (1);
-    }
-  }
-  return 0;
-}
diff --git a/src/transport/meson.build b/src/transport/meson.build
index d997aad8a..6489db9af 100644
--- a/src/transport/meson.build
+++ b/src/transport/meson.build
@@ -40,36 +40,36 @@ if get_option('monolith')
   endforeach
 endif
 
-libgnunettransport = library('gnunettransport',
-        libgnunettransport_src,
-        soversion: '2',
-        version: '2.2.0',
-        dependencies: [libgnunetutil_dep, libgnunetats_dep, 
libgnunethello_dep],
-        include_directories: [incdir, configuration_inc],
-        install: true,
-        install_dir: get_option('libdir'))
-pkg.generate(libgnunettransport, url: 'https://www.gnunet.org',
-             description : 'Provides API for accessing the transport service')
-libgnunettransport_dep = declare_dependency(link_with : libgnunettransport)
+#libgnunettransport = library('gnunettransport',
+#        libgnunettransport_src,
+#        soversion: '2',
+#        version: '2.2.0',
+#        dependencies: [libgnunetutil_dep, libgnunetats_dep, 
libgnunethello_dep],
+#        include_directories: [incdir, configuration_inc],
+#        install: true,
+#        install_dir: get_option('libdir'))
+#pkg.generate(libgnunettransport, url: 'https://www.gnunet.org',
+#             description : 'Provides API for accessing the transport service')
+#libgnunettransport_dep = declare_dependency(link_with : libgnunettransport)
 
-libgnunettransporttesting = library('gnunettransporttesting',
-        [
-          'transport-testing.c',
-          'transport-testing-filenames.c',
-          'transport-testing-loggers.c',
-          'transport-testing-main.c',
-          'transport-testing-send.c'
-          ],
-        soversion: '0',
-        version: '0.0.0',
-        dependencies: [libgnunetutil_dep,
-                       libgnunettesting_dep,
-                       libgnunettransport_dep,
-                       libgnunetats_dep,
-                       libgnunethello_dep],
-        include_directories: [incdir, configuration_inc],
-        install: true,
-        install_dir: get_option('libdir'))
+#libgnunettransporttesting = library('gnunettransporttesting',
+#        [
+#          'transport-testing.c',
+#          'transport-testing-filenames.c',
+#          'transport-testing-loggers.c',
+#          'transport-testing-main.c',
+#          'transport-testing-send.c'
+#          ],
+#        soversion: '0',
+#        version: '0.0.0',
+#        dependencies: [libgnunetutil_dep,
+#                       libgnunettesting_dep,
+#                       libgnunettransport_dep,
+#                       libgnunetats_dep,
+#                       libgnunethello_dep],
+#        include_directories: [incdir, configuration_inc],
+#        install: true,
+#        install_dir: get_option('libdir'))
 
 
 libgnunettransportapplication = library('gnunettransportapplication',
@@ -129,20 +129,19 @@ libgnunettransporttesting2 = 
library('gnunettransporttesting2',
           'transport_api_cmd_stop_peer.c',
           'transport_api_cmd_send_simple.c',
           'transport_api_cmd_send_simple_performance.c',
-          'transport-testing2.c',
-          'transport-testing-filenames2.c',
-          'transport-testing-loggers2.c',
-          'transport-testing-main2.c',
-          'transport-testing-send2.c',
+          #'transport-testing2.c',
+          #'transport-testing-filenames2.c',
+          #'transport-testing-loggers2.c',
+          #'transport-testing-main2.c',
+          #'transport-testing-send2.c',
           'transport-testing-communicator.c',
           ],
         soversion: '0',
         version: '0.0.0',
         dependencies: [libgnunetutil_dep,
+                       libgnunettransportcore_dep,
                        libgnunettransportapplication_dep,
-                       libgnunettransport_dep,
                        libgnunetpeerstore_dep,
-                       libgnunetats_dep,
                        libgnunettesting_dep,
                        libgnunethello_dep],
         include_directories: [incdir, configuration_inc],
@@ -150,17 +149,17 @@ libgnunettransporttesting2 = 
library('gnunettransporttesting2',
         install_dir: get_option('libdir'))
 libgnunettransporttesting2_dep = declare_dependency(link_with : 
libgnunettransporttesting2)
 
-executable ('gnunet-service-transport',
-            gnunetservicetransport_src,
-            dependencies: [libgnunettransport_dep, libgnunetutil_dep,
-                           libgnunethello_dep,
-                           libgnunetpeerstore_dep,
-                           m_dep,
-                           libgnunetstatistics_dep,
-                           gcrypt_dep],
-            include_directories: [incdir, configuration_inc],
-            install: true,
-            install_dir: get_option('libdir') / 'gnunet' / 'libexec')
+#executable ('gnunet-service-transport',
+#            gnunetservicetransport_src,
+#            dependencies: [libgnunettransport_dep, libgnunetutil_dep,
+#                           libgnunethello_dep,
+#                           libgnunetpeerstore_dep,
+#                           m_dep,
+#                           libgnunetstatistics_dep,
+#                           gcrypt_dep],
+#            include_directories: [incdir, configuration_inc],
+#            install: true,
+#            install_dir: get_option('libdir') / 'gnunet' / 'libexec')
 
 executable ('gnunet-communicator-unix',
             gnunetcommunicatorunix_src,
@@ -200,23 +199,23 @@ executable ('gnunet-communicator-tcp',
             install: true,
             install_dir: get_option('libdir') / 'gnunet' / 'libexec')
 
-executable ('gnunet-transport',
-            ['gnunet-transport.c'],
-            dependencies: [libgnunettransportcommunicator_dep,
-                           libgnunethello_dep,
-                           libgnunettransport_dep,
-                           libgnunetpeerstore_dep,
-                           libgnunetutil_dep],
-            include_directories: [incdir, configuration_inc],
-            install: true,
-            install_dir: get_option('bindir'))
+#executable ('gnunet-transport',
+#            ['gnunet-transport.c'],
+#            dependencies: [libgnunettransportcommunicator_dep,
+#                           libgnunethello_dep,
+#                           libgnunettransport_dep,
+#                           libgnunetpeerstore_dep,
+#                           libgnunetutil_dep],
+#            include_directories: [incdir, configuration_inc],
+#            install: true,
+#            install_dir: get_option('bindir'))
 
 libgnunettesttransport_cmd_simplesend = 
library('gnunet_test_transport_plugin_cmd_simple_send',
     ['test_transport_plugin_cmd_simple_send.c'],
         dependencies: [
           libgnunetutil_dep,
-          libgnunettransporttesting2_dep,
           libgnunettransportapplication_dep,
+          libgnunettransporttesting2_dep,
           libgnunettransportcore_dep,
           libgnunettesting_dep,
           libgnunetpeerstore_dep,
@@ -233,8 +232,8 @@ libgnunettesttransport_cmd_simplesendbc = 
library('gnunet_test_transport_plugin_
     ['test_transport_plugin_cmd_simple_send_broadcast.c'],
         dependencies: [
           libgnunetutil_dep,
-          libgnunettransporttesting2_dep,
           libgnunettransportapplication_dep,
+          libgnunettransporttesting2_dep,
           libgnunettransportcore_dep,
           libgnunettesting_dep,
           libgnunetpeerstore_dep,
@@ -251,8 +250,8 @@ libgnunettesttransport_cmd_simplesenddv = 
library('gnunet_test_transport_plugin_
     ['test_transport_plugin_cmd_simple_send_dv.c'],
         dependencies: [
           libgnunetutil_dep,
-          libgnunettransporttesting2_dep,
           libgnunettransportapplication_dep,
+          libgnunettransporttesting2_dep,
           libgnunettransportcore_dep,
           libgnunettesting_dep,
           libgnunetpeerstore_dep,
@@ -269,8 +268,8 @@ libgnunettesttransport_cmd_simplesendperf = 
library('gnunet_test_transport_plugi
     ['test_transport_plugin_cmd_simple_send_performance.c'],
         dependencies: [
           libgnunetutil_dep,
-          libgnunettransporttesting2_dep,
           libgnunettransportapplication_dep,
+          libgnunettransporttesting2_dep,
           libgnunettransportcore_dep,
           libgnunettesting_dep,
           libgnunetpeerstore_dep,
@@ -305,8 +304,8 @@ libgnunettesttransport_cmd_natupnp = 
library('gnunet_test_transport_plugin_cmd_n
     ['test_transport_plugin_cmd_nat_upnp.c'],
         dependencies: [
           libgnunetutil_dep,
-          libgnunettransporttesting2_dep,
           libgnunettransportapplication_dep,
+          libgnunettransporttesting2_dep,
           libgnunettransportcore_dep,
           libgnunettesting_dep,
           libgnunetpeerstore_dep,
diff --git a/src/transport/perf_http_peer1.conf 
b/src/transport/perf_http_peer1.conf
deleted file mode 100644
index e97e16289..000000000
--- a/src/transport/perf_http_peer1.conf
+++ /dev/null
@@ -1,37 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = http_client
-
-[nat]
-# Disable IPv6 support
-DISABLEV6 = YES
-# Do we use addresses from localhost address ranges? (::1, 127.0.0.0/8)
-RETURN_LOCAL_ADDRESSES = NO
-
-[hostlist]
-OPTIONS = -b
-SERVERS = http://localhost:9080/
-
-[ats]
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
-# WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
-# ATS options
diff --git a/src/transport/perf_http_peer2.conf 
b/src/transport/perf_http_peer2.conf
deleted file mode 100644
index a1c83bde5..000000000
--- a/src/transport/perf_http_peer2.conf
+++ /dev/null
@@ -1,40 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = http_server
-
-[nat]
-# Disable IPv6 support
-DISABLEV6 = YES
-# Do we use addresses from localhost address ranges? (::1, 127.0.0.0/8)
-RETURN_LOCAL_ADDRESSES = NO
-
-[hostlist]
-HTTPPORT = 9080
-OPTIONS = -p
-BINDTOIPV4 = YES
-BINDTOIP = 127.0.0.1
-
-[ats]
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
-# WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
-# ATS options
-
diff --git a/src/transport/perf_https_peer1.conf 
b/src/transport/perf_https_peer1.conf
deleted file mode 100644
index e943671c2..000000000
--- a/src/transport/perf_https_peer1.conf
+++ /dev/null
@@ -1,37 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = https_client
-
-[nat]
-# Disable IPv6 support
-DISABLEV6 = YES
-# Do we use addresses from localhost address ranges? (::1, 127.0.0.0/8)
-RETURN_LOCAL_ADDRESSES = NO
-
-[hostlist]
-OPTIONS = -b
-SERVERS = http://localhost:9080/
-
-[ats]
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
-# WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
-# ATS options
diff --git a/src/transport/perf_https_peer2.conf 
b/src/transport/perf_https_peer2.conf
deleted file mode 100644
index 6e30f9e60..000000000
--- a/src/transport/perf_https_peer2.conf
+++ /dev/null
@@ -1,40 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = https_server
-
-[nat]
-# Disable IPv6 support
-DISABLEV6 = YES
-# Do we use addresses from localhost address ranges? (::1, 127.0.0.0/8)
-RETURN_LOCAL_ADDRESSES = NO
-
-[hostlist]
-HTTPPORT = 9080
-OPTIONS = -p
-BINDTOIPV4 = YES
-BINDTOIP = 127.0.0.1
-
-[ats]
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
-# WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
-# ATS options
-
diff --git a/src/transport/perf_tcp_peer1.conf 
b/src/transport/perf_tcp_peer1.conf
deleted file mode 100644
index e56c47ada..000000000
--- a/src/transport/perf_tcp_peer1.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = tcp
-
-[hostlist]
-OPTIONS = -b
-SERVERS = http://localhost:9080/
-
-[ats]
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
-# WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
-# ATS options
diff --git a/src/transport/perf_tcp_peer2.conf 
b/src/transport/perf_tcp_peer2.conf
deleted file mode 100644
index 3264161f5..000000000
--- a/src/transport/perf_tcp_peer2.conf
+++ /dev/null
@@ -1,34 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = tcp
-
-[hostlist]
-HTTPPORT = 9080
-OPTIONS = -p
-BINDTOIPV4 = YES
-BINDTOIP = 127.0.0.1
-
-[ats]
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
-# WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
-# ATS options
-
diff --git a/src/transport/perf_udp_peer1.conf 
b/src/transport/perf_udp_peer1.conf
deleted file mode 100644
index 68bf43908..000000000
--- a/src/transport/perf_udp_peer1.conf
+++ /dev/null
@@ -1,43 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = udp
-
-[transport-udp]
-BROADCAST = NO
-BROADCAST_RECEIVE = NO
-BROADCAST_INTERVAL = 30 s
-MAX_BPS = 1000000000
-
-[nat]
-# Disable IPv6 support
-DISABLEV6 = YES
-# Do we use addresses from localhost address ranges? (::1, 127.0.0.0/8)
-RETURN_LOCAL_ADDRESSES = NO
-
-[hostlist]
-OPTIONS = -b
-SERVERS = http://localhost:9080/
-
-[ats]
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
-# WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
-# ATS options
diff --git a/src/transport/perf_udp_peer2.conf 
b/src/transport/perf_udp_peer2.conf
deleted file mode 100644
index efed935f8..000000000
--- a/src/transport/perf_udp_peer2.conf
+++ /dev/null
@@ -1,48 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = udp
-
-
-[transport-udp]
-# Use PORT = 0 to autodetect a port available
-BROADCAST = NO
-BROADCAST_RECEIVE = NO
-BROADCAST_INTERVAL = 30 s
-MAX_BPS = 1000000000
-
-[nat]
-# Disable IPv6 support
-DISABLEV6 = YES
-# Do we use addresses from localhost address ranges? (::1, 127.0.0.0/8)
-RETURN_LOCAL_ADDRESSES = NO
-
-[hostlist]
-HTTPPORT = 9080
-OPTIONS = -p
-BINDTOIPV4 = YES
-BINDTOIP = 127.0.0.1
-
-[ats]
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
-# WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
-# ATS options
-
diff --git a/src/transport/perf_unix_peer1.conf 
b/src/transport/perf_unix_peer1.conf
deleted file mode 100644
index 06cd63fc6..000000000
--- a/src/transport/perf_unix_peer1.conf
+++ /dev/null
@@ -1,52 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PORT = 12001
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-PLUGINS = unix
-
-[transport-unix]
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-unix.sock
-
-[arm]
-PORT = 12005
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12004
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12003
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12002
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[hostlist]
-OPTIONS = -b
-SERVERS = http://localhost:9080/
-
-[ats]
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
-# WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
-# ATS options
diff --git a/src/transport/perf_unix_peer2.conf 
b/src/transport/perf_unix_peer2.conf
deleted file mode 100644
index feadb6fec..000000000
--- a/src/transport/perf_unix_peer2.conf
+++ /dev/null
@@ -1,56 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PORT = 12010
-PLUGINS = unix
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-
-[transport-unix]
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-unix.sock
-
-[arm]
-PORT = 12014
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12013
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12012
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12011
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[hostlist]
-HTTPPORT = 9080
-OPTIONS = -p
-BINDTOIPV4 = YES
-BINDTOIP = 127.0.0.1
-
-[ats]
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = unlimited
-UNSPECIFIED_QUOTA_OUT = unlimited
-# LOOPBACK
-LOOPBACK_QUOTA_IN = unlimited
-LOOPBACK_QUOTA_OUT = unlimited
-# LAN
-LAN_QUOTA_IN = unlimited
-LAN_QUOTA_OUT = unlimited
-# WAN
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
-# WLAN
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
-# ATS options
-
diff --git a/src/transport/plugin_transport_http.h 
b/src/transport/plugin_transport_http.h
deleted file mode 100644
index a3b59513e..000000000
--- a/src/transport/plugin_transport_http.h
+++ /dev/null
@@ -1,579 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_http.h
- * @brief http transport service plugin
- * @author Matthias Wachs
- */
-#ifndef PLUGIN_TRANSPORT_HTTP_H
-#define PLUGIN_TRANSPORT_HTTP_H
-
-#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_constants.h"
-#include "gnunet_protocols.h"
-#include "gnunet_connection_lib.h"
-#include "gnunet_service_lib.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_resolver_service.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_container_lib.h"
-#include "gnunet_transport_plugin.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_nat_lib.h"
-#include "microhttpd.h"
-/* Just included for the right curl.h */
-#include "gnunet_curl_lib.h"
-
-
-#define DEBUG_HTTP GNUNET_EXTRA_LOGGING
-#define VERBOSE_SERVER GNUNET_EXTRA_LOGGING
-#define VERBOSE_CLIENT GNUNET_EXTRA_LOGGING
-#define VERBOSE_CURL GNUNET_NO
-
-#if BUILD_HTTPS
-#define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_https_init
-#define LIBGNUNET_PLUGIN_TRANSPORT_DONE libgnunet_plugin_transport_https_done
-#else
-#define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_http_init
-#define LIBGNUNET_PLUGIN_TRANSPORT_DONE libgnunet_plugin_transport_http_done
-#endif
-
-#define INBOUND  GNUNET_YES
-#define OUTBOUND GNUNET_NO
-
-
-#define HTTP_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 15)
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct Plugin
-{
-  /**
-   * Our environment.
-   */
-  struct GNUNET_TRANSPORT_PluginEnvironment *env;
-
-  /**
-   * Head of linked list of open sessions.
-   */
-  struct GNUNET_ATS_Session *head;
-
-  /**
-   * Tail of linked list of open sessions.
-   */
-  struct GNUNET_ATS_Session *tail;
-
-  /**
-   * NAT handle & address management
-   */
-  struct GNUNET_NAT_Handle *nat;
-
-  /**
-   * Our own IPv4 addresses DLL head
-   */
-  struct HttpAddressWrapper *addr_head;
-
-  /**
-   * Our own IPv4 addresses DLL tail
-   */
-  struct HttpAddressWrapper *addr_tail;
-
-  /**
-   * External hostname the plugin can be connected to, can be different to
-   * the host's FQDN, used e.g. for reverse proxying
-   */
-  char *external_hostname;
-
-  /**
-   * External hostname the plugin can be connected to, can be different to
-   * the host's FQDN, used e.g. for reverse proxying
-   */
-  struct HttpAddress *ext_addr;
-
-  /**
-   * External address length
-   */
-  size_t ext_addr_len;
-
-  /**
-   * Task calling transport service about external address
-   */
-  struct GNUNET_SCHEDULER_Task *notify_ext_task;
-
-  /**
-   * Plugin name.
-   * Equals configuration section: transport-http, transport-https
-   */
-  char *name;
-
-  /**
-   * Plugin protocol
-   * http, https
-   */
-  char *protocol;
-
-  /**
-   * Use IPv4? #GNUNET_YES or #GNUNET_NO
-   */
-  int ipv4;
-
-  /**
-   * Use IPv6? #GNUNET_YES or #GNUNET_NO
-   */
-  int ipv6;
-
-  /**
-   * Does plugin just use outbound connections and not accept inbound?
-   */
-  int client_only;
-
-  /**
-   * Port used
-   */
-  uint16_t port;
-
-  /**
-   * Maximum number of sockets the plugin can use
-   * Each http inbound /outbound connections are two connections
-   */
-  int max_connections;
-
-  /**
-   * Number of outbound sessions
-   */
-  unsigned int outbound_sessions;
-
-  /**
-   * Number of inbound sessions
-   */
-  unsigned int inbound_sessions;
-
-  /**
-   * libCurl TLS crypto init string, can be set to enhance performance
-   *
-   * Example:
-   *
-   * Use RC4-128 instead of AES:
-   * NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL
-   */
-  char *crypto_init;
-
-  /**
-   * TLS key
-   */
-  char *key;
-
-  /**
-   * TLS certificate
-   */
-  char *cert;
-
-  /**
-   * Current number of establishes connections
-   */
-  int cur_connections;
-
-  /**
-   * Last used unique HTTP connection tag
-   */
-  uint32_t last_tag;
-
-  /**
-   * MHD IPv4 daemon
-   */
-  struct MHD_Daemon *server_v4;
-
-  /**
-   * MHD IPv4 task
-   */
-  struct GNUNET_SCHEDULER_Task *server_v4_task;
-
-  /**
-   * The IPv4 server is scheduled to run asap
-   */
-  int server_v4_immediately;
-
-  /**
-   * MHD IPv6 daemon
-   */
-  struct MHD_Daemon *server_v6;
-
-  /**
-   * MHD IPv4 task
-   */
-  struct GNUNET_SCHEDULER_Task *server_v6_task;
-
-  /**
-   * The IPv6 server is scheduled to run asap
-   */
-  int server_v6_immediately;
-
-  /**
-   * IPv4 server socket to bind to
-   */
-  struct sockaddr_in *server_addr_v4;
-
-  /**
-   * IPv6 server socket to bind to
-   */
-  struct sockaddr_in6 *server_addr_v6;
-
-  /**
-   * Head of server semi connections
-   * A full session consists of 2 semi-connections: send and receive
-   * If not both directions are established the server keeps this sessions here
-   */
-  struct GNUNET_ATS_Session *server_semi_head;
-
-  /**
-   * Tail of server semi connections
-   * A full session consists of 2 semi-connections: send and receive
-   * If not both directions are established the server keeps this sessions here
-   */
-  struct GNUNET_ATS_Session *server_semi_tail;
-
-  /**
-   * cURL Multihandle
-   */
-  CURLM *client_mh;
-
-  /**
-   * curl perform task
-   */
-  struct GNUNET_SCHEDULER_Task *client_perform_task;
-};
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * HTTP addresses including a full URI
- */
-struct HttpAddress
-{
-  /**
-   * Length of the address following in NBO
-   */
-  uint32_t addr_len GNUNET_PACKED;
-
-  /**
-   * Address following
-   */
-  void *addr GNUNET_PACKED;
-};
-
-/**
- * IPv4 addresses
- */
-struct IPv4HttpAddress
-{
-  /**
-   * IPv4 address, in network byte order.
-   */
-  uint32_t ipv4_addr GNUNET_PACKED;
-
-  /**
-   * Port number, in network byte order.
-   */
-  uint16_t u4_port GNUNET_PACKED;
-};
-
-/**
- * IPv4 addresses
- */
-struct IPv6HttpAddress
-{
-  /**
-   * IPv6 address.
-   */
-  struct in6_addr ipv6_addr GNUNET_PACKED;
-
-  /**
-   * Port number, in network byte order.
-   */
-  uint16_t u6_port GNUNET_PACKED;
-};
-GNUNET_NETWORK_STRUCT_END
-
-
-struct ServerRequest
-{
-  /**
-   * _RECV or _SEND
-   */
-  int direction;
-
-  /**
-   * Should this connection get disconnected? #GNUNET_YES / #GNUNET_NO
-   */
-  int disconnect;
-
-  /**
-   * The session this server connection belongs to
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * The MHD connection
-   */
-  struct MHD_Connection *mhd_conn;
-};
-
-
-/**
- * Session handle for connections.
- */
-struct GNUNET_ATS_Session
-{
-  /**
-   * To whom are we talking to
-   */
-  struct GNUNET_PeerIdentity target;
-
-  /**
-   * Stored in a linked list.
-   */
-  struct GNUNET_ATS_Session *next;
-
-  /**
-   * Stored in a linked list.
-   */
-  struct GNUNET_ATS_Session *prev;
-
-  /**
-   * Pointer to the global plugin struct.
-   */
-  struct Plugin *plugin;
-
-  /**
-   * Address
-   */
-  void *addr;
-
-  /**
-   * Address length
-   */
-  size_t addrlen;
-
-  /**
-   * ATS network type in NBO
-   */
-  uint32_t ats_address_network_type;
-
-  /**
-   * next pointer for double linked list
-   */
-  struct HTTP_Message *msg_head;
-
-  /**
-   * previous pointer for double linked list
-   */
-  struct HTTP_Message *msg_tail;
-
-  /**
-   * Message stream tokenizer for incoming data
-   */
-  struct GNUNET_SERVER_MessageStreamTokenizer *msg_tk;
-
-  /**
-   * Absolute time when to receive data again
-   * Used for receive throttling
-   */
-  struct GNUNET_TIME_Absolute next_receive;
-
-  /**
-   * Inbound or outbound connection
-   * Outbound: #GNUNET_NO (client is used to send and receive)
-   * Inbound : #GNUNET_YES (server is used to send and receive)
-   */
-  int inbound;
-
-  /**
-   * Unique HTTP/S connection tag for this connection
-   */
-  uint32_t tag;
-
-  /**
-   * Client send handle
-   */
-  void *client_put;
-
-  /**
-   * Client receive handle
-   */
-  void *client_get;
-
-  /**
-   * Task to wake up client receive handle when receiving is allowed again
-   */
-  struct GNUNET_SCHEDULER_Task *recv_wakeup_task;
-
-  /**
-   * Session timeout task
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * Is client send handle paused since there are no data to send?
-   * #GNUNET_YES or #GNUNET_NO
-   */
-  int client_put_paused;
-
-  /**
-   * Client send handle
-   */
-  struct ServerRequest *server_recv;
-
-  /**
-   * Client send handle
-   */
-  struct ServerRequest *server_send;
-};
-
-
-/**
- *  Message to send using http
- */
-struct HTTP_Message
-{
-  /**
-   * next pointer for double linked list
-   */
-  struct HTTP_Message *next;
-
-  /**
-   * previous pointer for double linked list
-   */
-  struct HTTP_Message *prev;
-
-  /**
-   * buffer containing data to send
-   */
-  char *buf;
-
-  /**
-   * amount of data already sent
-   */
-  size_t pos;
-
-  /**
-   * buffer length
-   */
-  size_t size;
-
-  /**
-   * Continuation function to call once the transmission buffer
-   * has again space available.  NULL if there is no
-   * continuation to call.
-   */
-  GNUNET_TRANSPORT_TransmitContinuation transmit_cont;
-
-  /**
-   * Closure for @e transmit_cont.
-   */
-  void *transmit_cont_cls;
-};
-
-
-struct GNUNET_ATS_Session *
-create_session (struct Plugin *plugin,
-                const struct GNUNET_PeerIdentity *target,
-                const void *addr,
-                size_t addrlen);
-
-
-int
-exist_session (struct Plugin *plugin,
-               struct GNUNET_ATS_Session *s);
-
-
-void
-delete_session (struct GNUNET_ATS_Session *s);
-
-
-int
-exist_session (struct Plugin *plugin,
-               struct GNUNET_ATS_Session *s);
-
-
-struct GNUNET_TIME_Relative
-http_plugin_receive (void *cls,
-                     const struct GNUNET_PeerIdentity *peer,
-                     const struct GNUNET_MessageHeader *message,
-                     struct GNUNET_ATS_Session *session,
-                     const char *sender_address,
-                     uint16_t sender_address_len);
-
-
-const char *
-http_plugin_address_to_string (void *cls,
-                               const void *addr,
-                               size_t addrlen);
-
-
-int
-client_disconnect (struct GNUNET_ATS_Session *s);
-
-
-int
-client_connect (struct GNUNET_ATS_Session *s);
-
-
-int
-client_send (struct GNUNET_ATS_Session *s, struct HTTP_Message *msg);
-
-
-int
-client_start (struct Plugin *plugin);
-
-
-void
-client_stop (struct Plugin *plugin);
-
-
-int
-server_disconnect (struct GNUNET_ATS_Session *s);
-
-
-int
-server_send (struct GNUNET_ATS_Session *s, struct HTTP_Message *msg);
-
-
-int
-server_start (struct Plugin *plugin);
-
-
-void
-server_stop (struct Plugin *plugin);
-
-
-void
-notify_session_end (void *cls,
-                    const struct GNUNET_PeerIdentity *peer,
-                    struct GNUNET_ATS_Session *s);
-
-
-/*#ifndef PLUGIN_TRANSPORT_HTTP_H*/
-#endif
-/* end of plugin_transport_http.h */
diff --git a/src/transport/plugin_transport_http_client.c 
b/src/transport/plugin_transport_http_client.c
deleted file mode 100644
index 82468992b..000000000
--- a/src/transport/plugin_transport_http_client.c
+++ /dev/null
@@ -1,2523 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2002-2014 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_http_client.c
- * @brief HTTP/S client transport plugin
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-
-#if BUILD_HTTPS
-#define PLUGIN_NAME "https_client"
-#define HTTP_STAT_STR_CONNECTIONS "# HTTPS client connections"
-#define LIBGNUNET_PLUGIN_TRANSPORT_INIT \
-  libgnunet_plugin_transport_https_client_init
-#define LIBGNUNET_PLUGIN_TRANSPORT_DONE \
-  libgnunet_plugin_transport_https_client_done
-#else
-#define PLUGIN_NAME "http_client"
-#define HTTP_STAT_STR_CONNECTIONS "# HTTP client connections"
-#define LIBGNUNET_PLUGIN_TRANSPORT_INIT \
-  libgnunet_plugin_transport_http_client_init
-#define LIBGNUNET_PLUGIN_TRANSPORT_DONE \
-  libgnunet_plugin_transport_http_client_done
-#endif
-
-#define VERBOSE_CURL GNUNET_NO
-
-#define PUT_DISCONNECT_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 1)
-
-#define ENABLE_PUT GNUNET_YES
-#define ENABLE_GET GNUNET_YES
-
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_transport_plugin.h"
-#include "plugin_transport_http_common.h"
-/* Just included for the right curl.h */
-#include "gnunet_curl_lib.h"
-
-
-#define LOG(kind, ...) GNUNET_log_from (kind, PLUGIN_NAME, __VA_ARGS__)
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct HTTP_Client_Plugin;
-
-/**
- * State of a HTTP PUT request
- */
-enum HTTP_PUT_REQUEST_STATE
-{
-  /**
-   *  Just created, not yet connected
-   */
-  H_NOT_CONNECTED,
-
-  /**
-   *  Connected
-   */
-  H_CONNECTED,
-
-  /**
-   *  Paused, nothing to send
-   */
-  H_PAUSED,
-
-  /**
-   * Temporary disconnect in progress due to inactivity
-   */
-  H_TMP_DISCONNECTING,
-
-  /**
-   * Send request while temporary disconnect, reconnect
-   */
-  H_TMP_RECONNECT_REQUIRED,
-
-  /**
-   * Temporarily disconnected
-   */
-  H_TMP_DISCONNECTED,
-
-  /**
-   * Disconnected
-   */
-  H_DISCONNECTED
-};
-
-/**
- *  Message to send using http
- */
-struct HTTP_Message
-{
-  /**
-   * next pointer for double linked list
-   */
-  struct HTTP_Message *next;
-
-  /**
-   * previous pointer for double linked list
-   */
-  struct HTTP_Message *prev;
-
-  /**
-   * buffer containing data to send
-   */
-  char *buf;
-
-  /**
-   * Continuation function to call once the transmission buffer
-   * has again space available.  NULL if there is no
-   * continuation to call.
-   */
-  GNUNET_TRANSPORT_TransmitContinuation transmit_cont;
-
-  /**
-   * Closure for @e transmit_cont.
-   */
-  void *transmit_cont_cls;
-
-  /**
-   * amount of data already sent
-   */
-  size_t pos;
-
-  /**
-   * buffer length
-   */
-  size_t size;
-};
-
-
-/**
- * Session handle for HTTP(S) connections.
- */
-struct GNUNET_ATS_Session;
-
-
-/**
- * A request handle
- *
- */
-struct RequestHandle
-{
-  /**
-   * Current state of this request
-   */
-  enum HTTP_PUT_REQUEST_STATE state;
-
-  /**
-   * The curl easy handle
-   */
-  CURL *easyhandle;
-
-  /**
-   * The related session
-   */
-  struct GNUNET_ATS_Session *s;
-};
-
-
-/**
- * Session handle for connections.
- */
-struct GNUNET_ATS_Session
-{
-  /**
-   * The URL to connect to
-   */
-  char *url;
-
-  /**
-   * Address
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Pointer to the global plugin struct.
-   */
-  struct HTTP_Client_Plugin *plugin;
-
-  /**
-   * Handle for the HTTP PUT request.
-   */
-  struct RequestHandle put;
-
-  /**
-   * Handle for the HTTP GET request.
-   */
-  struct RequestHandle get;
-
-  /**
-   * next pointer for double linked list
-   */
-  struct HTTP_Message *msg_head;
-
-  /**
-   * previous pointer for double linked list
-   */
-  struct HTTP_Message *msg_tail;
-
-  /**
-   * Message stream tokenizer for incoming data
-   */
-  struct GNUNET_MessageStreamTokenizer *msg_tk;
-
-  /**
-   * Session timeout task
-   */
-  struct GNUNET_SCHEDULER_Task *put_disconnect_task;
-
-  /**
-   * Session timeout task
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * Task to wake up client receive handle when receiving is allowed again
-   */
-  struct GNUNET_SCHEDULER_Task *recv_wakeup_task;
-
-  /**
-   * Absolute time when to receive data again.
-   * Used for receive throttling.
-   */
-  struct GNUNET_TIME_Absolute next_receive;
-
-  /**
-   * When does this session time out.
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * Number of bytes waiting for transmission to this peer.
-   */
-  unsigned long long bytes_in_queue;
-
-  /**
-   * Outbound overhead due to HTTP connection
-   * Add to next message of this session when calling callback
-   */
-  size_t overhead;
-
-  /**
-   * Number of messages waiting for transmission to this peer.
-   */
-  unsigned int msgs_in_queue;
-
-  /**
-   * ATS network type.
-   */
-  enum GNUNET_NetworkType scope;
-};
-
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct HTTP_Client_Plugin
-{
-  /**
-   * Our environment.
-   */
-  struct GNUNET_TRANSPORT_PluginEnvironment *env;
-
-  /**
-   * Open sessions.
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *sessions;
-
-  /**
-   * Function to call about session status changes.
-   */
-  GNUNET_TRANSPORT_SessionInfoCallback sic;
-
-  /**
-   * Closure for @e sic.
-   */
-  void *sic_cls;
-
-  /**
-   * Plugin name
-   */
-  char *name;
-
-  /**
-   * Protocol
-   */
-  char *protocol;
-
-  /**
-   * Proxy configuration: hostname or ip of the proxy server
-   */
-  char *proxy_hostname;
-
-  /**
-   * Username for the proxy server
-   */
-  char *proxy_username;
-
-  /**
-   * Password for the proxy server
-   */
-  char *proxy_password;
-
-  /**
-   * cURL Multihandle
-   */
-  CURLM *curl_multi_handle;
-
-  /**
-   * curl perform task
-   */
-  struct GNUNET_SCHEDULER_Task *client_perform_task;
-
-  /**
-   * Type of proxy server:
-   *
-   * Valid values as supported by curl:
-   * CURLPROXY_HTTP, CURLPROXY_HTTP_1_0 CURLPROXY_SOCKS4, CURLPROXY_SOCKS5,
-   * CURLPROXY_SOCKS4A, CURLPROXY_SOCKS5_HOSTNAME
-   */
-  curl_proxytype proxytype;
-
-  /**
-   * Use proxy tunneling:
-   * Tunnel all operations through a given HTTP instead of have the proxy
-   * evaluate the HTTP request
-   *
-   * Default: #GNUNET_NO, #GNUNET_YES experimental
-   */
-  int proxy_use_httpproxytunnel;
-
-  /**
-   * My options to be included in the address
-   */
-  uint32_t options;
-
-  /**
-   * Maximum number of sockets the plugin can use
-   * Each http connections are two requests
-   */
-  unsigned int max_requests;
-
-  /**
-   * Current number of sockets the plugin can use
-   * Each http connections are two requests
-   */
-  unsigned int cur_requests;
-
-  /**
-   * Last used unique HTTP connection tag
-   */
-  uint32_t last_tag;
-
-  /**
-   * use IPv6
-   */
-  uint16_t use_ipv6;
-
-  /**
-   * use IPv4
-   */
-  uint16_t use_ipv4;
-
-  /**
-   * Should we emulate an XHR client for testing?
-   */
-  int emulate_xhr;
-};
-
-
-/**
- * Disconnect a session
- *
- * @param cls the `struct HTTP_Client_Plugin *`
- * @param s session
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-static int
-http_client_plugin_session_disconnect (void *cls, struct GNUNET_ATS_Session 
*s);
-
-
-/**
- * If a session monitor is attached, notify it about the new
- * session state.
- *
- * @param plugin our plugin
- * @param session session that changed state
- * @param state new state of the session
- */
-static void
-notify_session_monitor (struct HTTP_Client_Plugin *plugin,
-                        struct GNUNET_ATS_Session *session,
-                        enum GNUNET_TRANSPORT_SessionState state)
-{
-  struct GNUNET_TRANSPORT_SessionInfo info;
-
-  if (NULL == plugin->sic)
-    return;
-  memset (&info, 0, sizeof(info));
-  info.state = state;
-  info.is_inbound = GNUNET_NO;
-  info.num_msg_pending = session->msgs_in_queue;
-  info.num_bytes_pending = session->bytes_in_queue;
-  info.receive_delay = session->next_receive;
-  info.session_timeout = session->timeout;
-  info.address = session->address;
-  plugin->sic (plugin->sic_cls,
-               session,
-               &info);
-}
-
-
-/**
- * Delete session @a s.
- *
- * @param s the session to delete
- */
-static void
-client_delete_session (struct GNUNET_ATS_Session *s)
-{
-  struct HTTP_Client_Plugin *plugin = s->plugin;
-  struct HTTP_Message *pos;
-  struct HTTP_Message *next;
-  CURLMcode mret;
-
-  if (NULL != s->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (s->timeout_task);
-    s->timeout_task = NULL;
-    s->timeout = GNUNET_TIME_UNIT_ZERO_ABS;
-  }
-  if (NULL != s->put_disconnect_task)
-  {
-    GNUNET_SCHEDULER_cancel (s->put_disconnect_task);
-    s->put_disconnect_task = NULL;
-  }
-  if (NULL != s->recv_wakeup_task)
-  {
-    GNUNET_SCHEDULER_cancel (s->recv_wakeup_task);
-    s->recv_wakeup_task = NULL;
-  }
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
-                                                       &s->address->peer,
-                                                       s));
-  if (NULL != s->put.easyhandle)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Session %p/request %p: disconnecting PUT request to peer `%s'\n",
-         s,
-         s->put.easyhandle,
-         GNUNET_i2s (&s->address->peer));
-
-    /* remove curl handle from multi handle */
-    mret = curl_multi_remove_handle (plugin->curl_multi_handle,
-                                     s->put.easyhandle);
-    GNUNET_break (CURLM_OK == mret);
-    curl_easy_cleanup (s->put.easyhandle);
-    GNUNET_assert (plugin->cur_requests > 0);
-    plugin->cur_requests--;
-    s->put.easyhandle = NULL;
-  }
-  if (NULL != s->get.easyhandle)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Session %p/request %p: disconnecting GET request to peer `%s'\n",
-         s, s->get.easyhandle,
-         GNUNET_i2s (&s->address->peer));
-    /* remove curl handle from multi handle */
-    mret = curl_multi_remove_handle (plugin->curl_multi_handle,
-                                     s->get.easyhandle);
-    GNUNET_break (CURLM_OK == mret);
-    curl_easy_cleanup (s->get.easyhandle);
-    GNUNET_assert (plugin->cur_requests > 0);
-    plugin->cur_requests--;
-    s->get.easyhandle = NULL;
-  }
-
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         HTTP_STAT_STR_CONNECTIONS,
-                         plugin->cur_requests,
-                         GNUNET_NO);
-  next = s->msg_head;
-  while (NULL != (pos = next))
-  {
-    next = pos->next;
-    GNUNET_CONTAINER_DLL_remove (s->msg_head,
-                                 s->msg_tail,
-                                 pos);
-    GNUNET_assert (0 < s->msgs_in_queue);
-    s->msgs_in_queue--;
-    GNUNET_assert (pos->size <= s->bytes_in_queue);
-    s->bytes_in_queue -= pos->size;
-    if (NULL != pos->transmit_cont)
-      pos->transmit_cont (pos->transmit_cont_cls,
-                          &s->address->peer,
-                          GNUNET_SYSERR,
-                          pos->size,
-                          pos->pos + s->overhead);
-    s->overhead = 0;
-    GNUNET_free (pos);
-  }
-  GNUNET_assert (0 == s->msgs_in_queue);
-  GNUNET_assert (0 == s->bytes_in_queue);
-  notify_session_monitor (plugin,
-                          s,
-                          GNUNET_TRANSPORT_SS_DONE);
-  if (NULL != s->msg_tk)
-  {
-    GNUNET_MST_destroy (s->msg_tk);
-    s->msg_tk = NULL;
-  }
-  GNUNET_HELLO_address_free (s->address);
-  GNUNET_free (s->url);
-  GNUNET_free (s);
-}
-
-
-/**
- * Increment session timeout due to activity for session @a s.
- *
- * @param s the session
- */
-static void
-client_reschedule_session_timeout (struct GNUNET_ATS_Session *s)
-{
-  GNUNET_assert (NULL != s->timeout_task);
-  s->timeout = GNUNET_TIME_relative_to_absolute (
-    GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-}
-
-
-/**
- * Task performing curl operations
- *
- * @param cls plugin as closure
- */
-static void
-client_run (void *cls);
-
-
-/**
- * Function setting up file descriptors and scheduling task to run
- *
- * @param plugin the plugin as closure
- * @param now schedule task in 1ms, regardless of what curl may say
- * @return #GNUNET_SYSERR for hard failure, #GNUNET_OK for ok
- */
-static int
-client_schedule (struct HTTP_Client_Plugin *plugin,
-                 int now)
-{
-  fd_set rs;
-  fd_set ws;
-  fd_set es;
-  int max;
-  struct GNUNET_NETWORK_FDSet *grs;
-  struct GNUNET_NETWORK_FDSet *gws;
-  long to;
-  CURLMcode mret;
-  struct GNUNET_TIME_Relative timeout;
-
-  /* Cancel previous scheduled task */
-  if (plugin->client_perform_task != NULL)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->client_perform_task);
-    plugin->client_perform_task = NULL;
-  }
-  max = -1;
-  FD_ZERO (&rs);
-  FD_ZERO (&ws);
-  FD_ZERO (&es);
-  mret = curl_multi_fdset (plugin->curl_multi_handle, &rs, &ws, &es, &max);
-  if (mret != CURLM_OK)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ ("%s failed at %s:%d: `%s'\n"),
-         "curl_multi_fdset",
-         __FILE__,
-         __LINE__,
-         curl_multi_strerror (mret));
-    return GNUNET_SYSERR;
-  }
-  mret = curl_multi_timeout (plugin->curl_multi_handle, &to);
-  if (-1 == to)
-    timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1);
-  else
-    timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 
to);
-  if (now == GNUNET_YES)
-    timeout = GNUNET_TIME_UNIT_MILLISECONDS;
-
-  if (CURLM_OK != mret)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ ("%s failed at %s:%d: `%s'\n"),
-         "curl_multi_timeout", __FILE__, __LINE__,
-         curl_multi_strerror (mret));
-    return GNUNET_SYSERR;
-  }
-
-  grs = GNUNET_NETWORK_fdset_create ();
-  gws = GNUNET_NETWORK_fdset_create ();
-  GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1);
-  GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1);
-
-  /* Schedule task to run when select is ready to read or write */
-  plugin->client_perform_task =
-    GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                 timeout, grs, gws,
-                                 &client_run, plugin);
-  GNUNET_NETWORK_fdset_destroy (gws);
-  GNUNET_NETWORK_fdset_destroy (grs);
-  return GNUNET_OK;
-}
-
-
-#if VERBOSE_CURL
-/**
- * Logging function
- *
- * @param curl the curl easy handle
- * @param type message type
- * @param data data to log, NOT a 0-terminated string
- * @param size data length
- * @param cls the closure
- * @return always 0
- */
-static int
-client_log (CURL *curl,
-            curl_infotype type,
-            const char *data,
-            size_t size,
-            void *cls)
-{
-  struct RequestHandle *ch = cls;
-  const char *ttype = "UNSPECIFIED";
-  char text[size + 2];
-
-  if (! ((CURLINFO_TEXT == type) ||
-         (CURLINFO_HEADER_IN == type) ||
-         (CURLINFO_HEADER_OUT == type)))
-    return 0;
-  switch (type)
-  {
-  case CURLINFO_TEXT:
-    ttype = "TEXT";
-    break;
-
-  case CURLINFO_HEADER_IN:
-    ttype = "HEADER_IN";
-    break;
-
-  case CURLINFO_HEADER_OUT:
-    ttype = "HEADER_OUT";
-    /* Overhead*/
-    GNUNET_assert (NULL != ch);
-    GNUNET_assert (NULL != ch->easyhandle);
-    GNUNET_assert (NULL != ch->s);
-    ch->s->overhead += size;
-    break;
-
-  default:
-    ttype = "UNSPECIFIED";
-    break;
-  }
-  GNUNET_memcpy (text, data, size);
-  if (text[size - 1] == '\n')
-  {
-    text[size] = '\0';
-  }
-  else
-  {
-    text[size] = '\n';
-    text[size + 1] = '\0';
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Request %p %s: %s",
-       ch->easyhandle,
-       ttype,
-       text);
-  return 0;
-}
-
-
-#endif
-
-/**
- * Connect GET request
- *
- * @param s the session to connect
- * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
- */
-static int
-client_connect_get (struct GNUNET_ATS_Session *s);
-
-
-/**
- * Connect a HTTP put request
- *
- * @param s the session to connect
- * @return #GNUNET_SYSERR for hard failure, #GNUNET_OK for success
- */
-static int
-client_connect_put (struct GNUNET_ATS_Session *s);
-
-
-/**
- * Function that can be used by the transport service to transmit
- * a message using the plugin.   Note that in the case of a
- * peer disconnecting, the continuation MUST be called
- * prior to the disconnect notification itself.  This function
- * will be called with this peer's HELLO message to initiate
- * a fresh connection to another peer.
- *
- * @param cls closure
- * @param s which session must be used
- * @param msgbuf the message to transmit
- * @param msgbuf_size number of bytes in @a msgbuf
- * @param priority how important is the message (most plugins will
- *                 ignore message priority and just FIFO)
- * @param to how long to wait at most for the transmission (does not
- *                require plugins to discard the message after the timeout,
- *                just advisory for the desired delay; most plugins will ignore
- *                this as well)
- * @param cont continuation to call once the message has
- *        been transmitted (or if the transport is ready
- *        for the next transmission call; or if the
- *        peer disconnected...); can be NULL
- * @param cont_cls closure for @a cont
- * @return number of bytes used (on the physical network, with overheads);
- *         -1 on hard errors (i.e. address invalid); 0 is a legal value
- *         and does NOT mean that the message was not transmitted (DV)
- */
-static ssize_t
-http_client_plugin_send (void *cls,
-                         struct GNUNET_ATS_Session *s,
-                         const char *msgbuf,
-                         size_t msgbuf_size,
-                         unsigned int priority,
-                         struct GNUNET_TIME_Relative to,
-                         GNUNET_TRANSPORT_TransmitContinuation cont,
-                         void *cont_cls)
-{
-  struct HTTP_Client_Plugin *plugin = cls;
-  struct HTTP_Message *msg;
-  char *stat_txt;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p/request %p: Sending message with %lu to peer `%s' \n",
-       s,
-       s->put.easyhandle,
-       (unsigned long) msgbuf_size,
-       GNUNET_i2s (&s->address->peer));
-
-  /* create new message and schedule */
-  msg = GNUNET_malloc (sizeof(struct HTTP_Message) + msgbuf_size);
-  msg->size = msgbuf_size;
-  msg->buf = (char *) &msg[1];
-  msg->transmit_cont = cont;
-  msg->transmit_cont_cls = cont_cls;
-  GNUNET_memcpy (msg->buf,
-                 msgbuf,
-                 msgbuf_size);
-  GNUNET_CONTAINER_DLL_insert_tail (s->msg_head,
-                                    s->msg_tail,
-                                    msg);
-  s->msgs_in_queue++;
-  s->bytes_in_queue += msg->size;
-
-  GNUNET_asprintf (&stat_txt,
-                   "# bytes currently in %s_client buffers",
-                   plugin->protocol);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            stat_txt, msgbuf_size, GNUNET_NO);
-  GNUNET_free (stat_txt);
-  notify_session_monitor (plugin,
-                          s,
-                          GNUNET_TRANSPORT_SS_UPDATE);
-  if (H_TMP_DISCONNECTING == s->put.state)
-  {
-    /* PUT request is currently getting disconnected */
-    s->put.state = H_TMP_RECONNECT_REQUIRED;
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Session %p/request %p: currently disconnecting, reconnecting 
immediately\n",
-         s,
-         s->put.easyhandle);
-    return msgbuf_size;
-  }
-  if (H_PAUSED == s->put.state)
-  {
-    /* PUT request was paused, unpause */
-    GNUNET_assert (s->put_disconnect_task != NULL);
-    GNUNET_SCHEDULER_cancel (s->put_disconnect_task);
-    s->put_disconnect_task = NULL;
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Session %p/request %p: unpausing request\n",
-         s, s->put.easyhandle);
-    s->put.state = H_CONNECTED;
-    if (NULL != s->put.easyhandle)
-      curl_easy_pause (s->put.easyhandle, CURLPAUSE_CONT);
-  }
-  else if (H_TMP_DISCONNECTED == s->put.state)
-  {
-    /* PUT request was disconnected, reconnect */
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Session %p: Reconnecting PUT request\n", s);
-    GNUNET_break (NULL == s->put.easyhandle);
-    if (GNUNET_SYSERR == client_connect_put (s))
-    {
-      /* Could not reconnect */
-      http_client_plugin_session_disconnect (plugin, s);
-      return GNUNET_SYSERR;
-    }
-  }
-  client_schedule (s->plugin, GNUNET_YES);
-  return msgbuf_size;
-}
-
-
-/**
- * Disconnect a session
- *
- * @param cls the `struct HTTP_Client_Plugin *`
- * @param s session
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-static int
-http_client_plugin_session_disconnect (void *cls,
-                                       struct GNUNET_ATS_Session *s)
-{
-  struct HTTP_Client_Plugin *plugin = cls;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p: notifying transport about ending session\n",
-       s);
-  plugin->env->session_end (plugin->env->cls,
-                            s->address,
-                            s);
-  client_delete_session (s);
-
-  /* Re-schedule since handles have changed */
-  if (NULL != plugin->client_perform_task)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->client_perform_task);
-    plugin->client_perform_task = NULL;
-  }
-  client_schedule (plugin, GNUNET_YES);
-
-  return GNUNET_OK;
-}
-
-
-/**
- * Function that is called to get the keepalive factor.
- * #GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
- * calculate the interval between keepalive packets.
- *
- * @param cls closure with the `struct Plugin`
- * @return keepalive factor
- */
-static unsigned int
-http_client_query_keepalive_factor (void *cls)
-{
-  return 3;
-}
-
-
-/**
- * Callback to destroys all sessions on exit.
- *
- * @param cls the `struct HTTP_Client_Plugin *`
- * @param peer identity of the peer
- * @param value the `struct GNUNET_ATS_Session *`
- * @return #GNUNET_OK (continue iterating)
- */
-static int
-destroy_session_cb (void *cls,
-                    const struct GNUNET_PeerIdentity *peer,
-                    void *value)
-{
-  struct HTTP_Client_Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session = value;
-
-  http_client_plugin_session_disconnect (plugin, session);
-  return GNUNET_OK;
-}
-
-
-/**
- * Function that can be used to force the plugin to disconnect
- * from the given peer and cancel all previous transmissions
- * (and their continuationc).
- *
- * @param cls closure
- * @param target peer from which to disconnect
- */
-static void
-http_client_plugin_peer_disconnect (void *cls,
-                                    const struct GNUNET_PeerIdentity *target)
-{
-  struct HTTP_Client_Plugin *plugin = cls;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Transport tells me to disconnect `%s'\n",
-       GNUNET_i2s (target));
-  GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions,
-                                              target,
-                                              &destroy_session_cb,
-                                              plugin);
-}
-
-
-/**
- * Closure for #session_lookup_client_by_address().
- */
-struct GNUNET_ATS_SessionClientCtx
-{
-  /**
-   * Address we are looking for.
-   */
-  const struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Session that was found.
-   */
-  struct GNUNET_ATS_Session *ret;
-};
-
-
-/**
- * Locate the seession object for a given address.
- *
- * @param cls the `struct GNUNET_ATS_SessionClientCtx *`
- * @param key peer identity
- * @param value the `struct GNUNET_ATS_Session` to check
- * @return #GNUNET_NO if found, #GNUNET_OK if not
- */
-static int
-session_lookup_client_by_address (void *cls,
-                                  const struct GNUNET_PeerIdentity *key,
-                                  void *value)
-{
-  struct GNUNET_ATS_SessionClientCtx *sc_ctx = cls;
-  struct GNUNET_ATS_Session *s = value;
-
-  if (0 == GNUNET_HELLO_address_cmp (sc_ctx->address,
-                                     s->address))
-  {
-    sc_ctx->ret = s;
-    return GNUNET_NO;
-  }
-  return GNUNET_YES;
-}
-
-
-/**
- * Check if a sessions exists for an specific address
- *
- * @param plugin the plugin
- * @param address the address
- * @return the session or NULL
- */
-static struct GNUNET_ATS_Session *
-client_lookup_session (struct HTTP_Client_Plugin *plugin,
-                       const struct GNUNET_HELLO_Address *address)
-{
-  struct GNUNET_ATS_SessionClientCtx sc_ctx;
-
-  sc_ctx.address = address;
-  sc_ctx.ret = NULL;
-  GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions,
-                                         &session_lookup_client_by_address,
-                                         &sc_ctx);
-  return sc_ctx.ret;
-}
-
-
-/**
- * When we have nothing to transmit, we pause the HTTP PUT
- * after a while (so that gnurl stops asking).  This task
- * is the delayed task that actually disconnects the PUT.
- *
- * @param cls the `struct GNUNET_ATS_Session *` with the put
- */
-static void
-client_put_disconnect (void *cls)
-{
-  struct GNUNET_ATS_Session *s = cls;
-
-  s->put_disconnect_task = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p/request %p: will be disconnected due to no activity\n",
-       s, s->put.easyhandle);
-  s->put.state = H_TMP_DISCONNECTING;
-  if (NULL != s->put.easyhandle)
-    curl_easy_pause (s->put.easyhandle,
-                     CURLPAUSE_CONT);
-  client_schedule (s->plugin, GNUNET_YES);
-}
-
-
-/**
- * Callback method used with libcurl
- * Method is called when libcurl needs to read data during sending
- *
- * @param stream pointer where to write data
- * @param size size of an individual element
- * @param nmemb count of elements that can be written to the buffer
- * @param cls our `struct GNUNET_ATS_Session`
- * @return bytes written to stream, returning 0 will terminate request!
- */
-static size_t
-client_send_cb (void *stream,
-                size_t size,
-                size_t nmemb,
-                void *cls)
-{
-  struct GNUNET_ATS_Session *s = cls;
-  struct HTTP_Client_Plugin *plugin = s->plugin;
-  struct HTTP_Message *msg = s->msg_head;
-  size_t len;
-  char *stat_txt;
-
-  if (H_TMP_DISCONNECTING == s->put.state)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Session %p/request %p: disconnect due to inactivity\n",
-         s, s->put.easyhandle);
-    return 0;
-  }
-
-  if (NULL == msg)
-  {
-    if (GNUNET_YES == plugin->emulate_xhr)
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Session %p/request %p: PUT request finished\n",
-           s,
-           s->put.easyhandle);
-      s->put.state = H_TMP_DISCONNECTING;
-      return 0;
-    }
-
-    /* We have nothing to send, so pause PUT request */
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Session %p/request %p: nothing to send, suspending\n",
-         s,
-         s->put.easyhandle);
-    s->put_disconnect_task
-      = GNUNET_SCHEDULER_add_delayed (PUT_DISCONNECT_TIMEOUT,
-                                      &client_put_disconnect,
-                                      s);
-    s->put.state = H_PAUSED;
-    return CURL_READFUNC_PAUSE;
-  }
-  /* data to send */
-  GNUNET_assert (msg->pos < msg->size);
-  /* calculate how much fits in buffer */
-  len = GNUNET_MIN (msg->size - msg->pos,
-                    size * nmemb);
-  GNUNET_memcpy (stream,
-                 &msg->buf[msg->pos],
-                 len);
-  msg->pos += len;
-  if (msg->pos == msg->size)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Session %p/request %p: sent message with %lu bytes sent, removing 
message from queue\n",
-         s,
-         s->put.easyhandle,
-         (unsigned long) msg->size);
-    /* Calling transmit continuation  */
-    GNUNET_CONTAINER_DLL_remove (s->msg_head,
-                                 s->msg_tail,
-                                 msg);
-    GNUNET_assert (0 < s->msgs_in_queue);
-    s->msgs_in_queue--;
-    GNUNET_assert (msg->size <= s->bytes_in_queue);
-    s->bytes_in_queue -= msg->size;
-    if (NULL != msg->transmit_cont)
-      msg->transmit_cont (msg->transmit_cont_cls,
-                          &s->address->peer,
-                          GNUNET_OK,
-                          msg->size,
-                          msg->size + s->overhead);
-    s->overhead = 0;
-    GNUNET_free (msg);
-  }
-  notify_session_monitor (plugin,
-                          s,
-                          GNUNET_TRANSPORT_SS_UPDATE);
-  GNUNET_asprintf (&stat_txt,
-                   "# bytes currently in %s_client buffers",
-                   plugin->protocol);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            stat_txt,
-                            -len,
-                            GNUNET_NO);
-  GNUNET_free (stat_txt);
-  GNUNET_asprintf (&stat_txt,
-                   "# bytes transmitted via %s_client",
-                   plugin->protocol);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            stat_txt,
-                            len,
-                            GNUNET_NO);
-  GNUNET_free (stat_txt);
-  return len;
-}
-
-
-/**
- * Wake up a curl handle which was suspended
- *
- * @param cls the session
- */
-static void
-client_wake_up (void *cls)
-{
-  struct GNUNET_ATS_Session *s = cls;
-
-  s->recv_wakeup_task = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p/request %p: Waking up GET handle\n",
-       s, s->get.easyhandle);
-  if (H_PAUSED == s->put.state)
-  {
-    /* PUT request was paused, unpause */
-    GNUNET_assert (s->put_disconnect_task != NULL);
-    GNUNET_SCHEDULER_cancel (s->put_disconnect_task);
-    s->put_disconnect_task = NULL;
-    s->put.state = H_CONNECTED;
-    if (NULL != s->put.easyhandle)
-      curl_easy_pause (s->put.easyhandle, CURLPAUSE_CONT);
-  }
-  if (NULL != s->get.easyhandle)
-    curl_easy_pause (s->get.easyhandle, CURLPAUSE_CONT);
-}
-
-
-/**
- * Callback for message stream tokenizer
- *
- * @param cls the session
- * @param message the message received
- * @return always #GNUNET_OK
- */
-static int
-client_receive_mst_cb (void *cls,
-                       const struct GNUNET_MessageHeader *message)
-{
-  struct GNUNET_ATS_Session *s = cls;
-  struct HTTP_Client_Plugin *plugin;
-  struct GNUNET_TIME_Relative delay;
-  char *stat_txt;
-
-  plugin = s->plugin;
-  delay = s->plugin->env->receive (plugin->env->cls,
-                                   s->address,
-                                   s,
-                                   message);
-  GNUNET_asprintf (&stat_txt,
-                   "# bytes received via %s_client",
-                   plugin->protocol);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            stat_txt,
-                            ntohs (message->size),
-                            GNUNET_NO);
-  GNUNET_free (stat_txt);
-
-  s->next_receive = GNUNET_TIME_relative_to_absolute (delay);
-  if (GNUNET_TIME_absolute_get ().abs_value_us < s->next_receive.abs_value_us)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Client: peer `%s' address `%s' next read delayed for %s\n",
-         GNUNET_i2s (&s->address->peer),
-         http_common_plugin_address_to_string (s->plugin->protocol,
-                                               s->address->address,
-                                               s->address->address_length),
-         GNUNET_STRINGS_relative_time_to_string (delay,
-                                                 GNUNET_YES));
-  }
-  client_reschedule_session_timeout (s);
-  return GNUNET_OK;
-}
-
-
-/**
- * Callback method used with libcurl when data for a PUT request are
- * received.  We do not expect data here, so we just discard it.
- *
- * @param stream pointer where to write data
- * @param size size of an individual element
- * @param nmemb count of elements that can be written to the buffer
- * @param cls destination pointer, passed to the libcurl handle
- * @return bytes read from stream
- */
-static size_t
-client_receive_put (void *stream,
-                    size_t size,
-                    size_t nmemb,
-                    void *cls)
-{
-  return size * nmemb;
-}
-
-
-/**
- * Callback method used with libcurl when data for a GET request are
- * received. Forward to MST
- *
- * @param stream pointer where to write data
- * @param size size of an individual element
- * @param nmemb count of elements that can be written to the buffer
- * @param cls destination pointer, passed to the libcurl handle
- * @return bytes read from stream
- */
-static size_t
-client_receive (void *stream,
-                size_t size,
-                size_t nmemb,
-                void *cls)
-{
-  struct GNUNET_ATS_Session *s = cls;
-  struct GNUNET_TIME_Absolute now;
-  size_t len = size * nmemb;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p / request %p: Received %lu bytes from peer `%s'\n",
-       s,
-       s->get.easyhandle,
-       (unsigned long) len,
-       GNUNET_i2s (&s->address->peer));
-  now = GNUNET_TIME_absolute_get ();
-  if (now.abs_value_us < s->next_receive.abs_value_us)
-  {
-    struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
-    struct GNUNET_TIME_Relative delta
-      = GNUNET_TIME_absolute_get_difference (now, s->next_receive);
-
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Session %p / request %p: No inbound bandwidth available! Next read 
was delayed for %s\n",
-         s,
-         s->get.easyhandle,
-         GNUNET_STRINGS_relative_time_to_string (delta,
-                                                 GNUNET_YES));
-    if (s->recv_wakeup_task != NULL)
-    {
-      GNUNET_SCHEDULER_cancel (s->recv_wakeup_task);
-      s->recv_wakeup_task = NULL;
-    }
-    s->recv_wakeup_task
-      = GNUNET_SCHEDULER_add_delayed (delta,
-                                      &client_wake_up,
-                                      s);
-    return CURL_WRITEFUNC_PAUSE;
-  }
-  if (NULL == s->msg_tk)
-    s->msg_tk = GNUNET_MST_create (&client_receive_mst_cb,
-                                   s);
-  GNUNET_MST_from_buffer (s->msg_tk,
-                          stream,
-                          len,
-                          GNUNET_NO,
-                          GNUNET_NO);
-  return len;
-}
-
-
-static void
-client_run (void *cls)
-{
-  struct HTTP_Client_Plugin *plugin = cls;
-  int running;
-  long http_statuscode;
-  CURLMcode mret;
-  CURLMsg *msg;
-  int put_request; /* GNUNET_YES if easy handle is put, GNUNET_NO for get */
-  int msgs_left;
-
-  plugin->client_perform_task = NULL;
-  /* While data are available or timeouts occurred */
-  do
-  {
-    running = 0;
-    /* Perform operations for all handles */
-    mret = curl_multi_perform (plugin->curl_multi_handle, &running);
-
-    /* Get additional information for all handles */
-    while (NULL != (msg = curl_multi_info_read (plugin->curl_multi_handle,
-                                                &msgs_left)))
-    {
-      CURL *easy_h = msg->easy_handle;
-      struct GNUNET_ATS_Session *s = NULL;
-      char *d = NULL;     /* curl requires 'd' to be a 'char *' */
-
-      GNUNET_assert (NULL != easy_h);
-
-      /* Obtain session from easy handle */
-      GNUNET_assert (CURLE_OK == curl_easy_getinfo (easy_h, CURLINFO_PRIVATE,
-                                                    &d));
-      s = (struct GNUNET_ATS_Session *) d;
-      GNUNET_assert (NULL != s);
-
-      if (msg->msg != CURLMSG_DONE)
-        continue;     /* This should not happen */
-
-      /* Get HTTP response code */
-      GNUNET_break (CURLE_OK == curl_easy_getinfo (easy_h,
-                                                   CURLINFO_RESPONSE_CODE,
-                                                   &http_statuscode));
-
-      if (easy_h == s->put.easyhandle)
-        put_request = GNUNET_YES;
-      else
-        put_request = GNUNET_NO;
-
-      /* Log status of terminated request */
-      if ((0 != msg->data.result) || (http_statuscode != 200))
-        LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "Session %p/request %p: %s request to `%s' ended with status %li 
reason %i: `%s'\n",
-             s, msg->easy_handle,
-             (GNUNET_YES == put_request) ? "PUT" : "GET",
-             GNUNET_i2s (&s->address->peer),
-             http_statuscode,
-             msg->data.result,
-             curl_easy_strerror (msg->data.result));
-      else
-        LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "Session %p/request %p: %s request to `%s' ended normal\n",
-             s, msg->easy_handle,
-             (GNUNET_YES == put_request) ? "PUT" : "GET",
-             GNUNET_i2s (&s->address->peer));
-
-      /* Remove easy handle from multi handle */
-      curl_multi_remove_handle (plugin->curl_multi_handle, easy_h);
-
-      /* Clean up easy handle */
-      curl_easy_cleanup (easy_h);
-
-      /* Remove information */
-      GNUNET_assert (plugin->cur_requests > 0);
-      plugin->cur_requests--;
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           "%s request to %s done, number of requests decreased to %u\n",
-           (GNUNET_YES == put_request) ? "PUT" : "GET",
-           s->url,
-           plugin->cur_requests);
-
-      if (GNUNET_YES == put_request)
-      {
-        /* Clean up a PUT request */
-        s->put.easyhandle = NULL;
-        s->put.s = NULL;
-
-        switch (s->put.state)
-        {
-        case H_NOT_CONNECTED:
-        case H_DISCONNECTED:
-        case H_TMP_DISCONNECTED:
-          /* This must not happen */
-          GNUNET_break (0);
-          break;
-
-        case H_TMP_RECONNECT_REQUIRED:
-          /* Transport called send while disconnect in progress, reconnect */
-          if (GNUNET_SYSERR == client_connect_put (s))
-          {
-            /* Reconnect failed, disconnect session */
-            http_client_plugin_session_disconnect (plugin, s);
-          }
-          break;
-
-        case H_TMP_DISCONNECTING:
-          /* PUT gets temporarily disconnected */
-          s->put.state = H_TMP_DISCONNECTED;
-          break;
-
-        case H_PAUSED:
-        case H_CONNECTED:
-          /* PUT gets permanently disconnected */
-          s->put.state = H_DISCONNECTED;
-          http_client_plugin_session_disconnect (plugin, s);
-          break;
-
-        default:
-          GNUNET_break (0);
-          break;
-        }
-      }
-      else if (GNUNET_NO == put_request)
-      {
-        /* Clean up a GET request */
-        s->get.easyhandle = NULL;
-        s->get.s = NULL;
-
-        /* If we are emulating an XHR client we need to make another GET
-         * request.
-         */
-        if (GNUNET_YES == plugin->emulate_xhr)
-        {
-          if (GNUNET_SYSERR == client_connect_get (s))
-            http_client_plugin_session_disconnect (plugin, s);
-        }
-        else
-        {
-          /* GET request was terminated, so disconnect session */
-          http_client_plugin_session_disconnect (plugin, s);
-        }
-      }
-      else
-        GNUNET_break (0);    /* Must not happen */
-
-      GNUNET_STATISTICS_set (plugin->env->stats,
-                             HTTP_STAT_STR_CONNECTIONS,
-                             plugin->cur_requests,
-                             GNUNET_NO);
-    }
-  }
-  while (mret == CURLM_CALL_MULTI_PERFORM);
-  client_schedule (plugin, GNUNET_NO);
-}
-
-
-#ifdef TCP_STEALTH
-/**
- * Open TCP socket with TCP STEALTH enabled.
- *
- * @param clientp our `struct GNUNET_ATS_Session *`
- * @param purpose why does curl want to open a socket
- * @param address what kind of socket does curl want to have opened?
- * @return opened socket
- */
-static curl_socket_t
-open_tcp_stealth_socket_cb (void *clientp,
-                            curlsocktype purpose,
-                            struct curl_sockaddr *address)
-{
-  struct GNUNET_ATS_Session *s = clientp;
-  int ret;
-
-  switch (purpose)
-  {
-  case CURLSOCKTYPE_IPCXN:
-    ret = socket (address->family,
-                  address->socktype,
-                  address->protocol);
-    if (-1 == ret)
-      return CURL_SOCKET_BAD;
-    if (((SOCK_STREAM != address->socktype) ||
-         ((0 != address->protocol) &&
-          (IPPROTO_TCP != address->protocol))))
-      return (curl_socket_t) ret;
-    if ((0 != setsockopt (ret,
-                          IPPROTO_TCP,
-                          TCP_STEALTH,
-                          &s->address->peer,
-                          sizeof(struct GNUNET_PeerIdentity))))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("TCP_STEALTH not supported on this platform.\n"));
-      (void) close (ret);
-      return CURL_SOCKET_BAD;
-    }
-    return (curl_socket_t) ret;
-
-  case CURLSOCKTYPE_ACCEPT:
-    GNUNET_break (0);
-    return CURL_SOCKET_BAD;
-    break;
-
-  case CURLSOCKTYPE_LAST:
-    GNUNET_break (0);
-    return CURL_SOCKET_BAD;
-
-  default:
-    GNUNET_break (0);
-    return CURL_SOCKET_BAD;
-  }
-}
-
-
-#endif
-
-
-/**
- * Connect GET request for a session
- *
- * @param s the session to connect
- * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
- */
-static int
-client_connect_get (struct GNUNET_ATS_Session *s)
-{
-  CURLMcode mret;
-  struct HttpAddress *ha;
-  uint32_t options;
-
-  ha = (struct HttpAddress *) s->address->address;
-  options = ntohl (ha->options);
-  /* create get request */
-  s->get.easyhandle = curl_easy_init ();
-  s->get.s = s;
-  if (0 != (options & HTTP_OPTIONS_TCP_STEALTH))
-  {
-#ifdef TCP_STEALTH
-    curl_easy_setopt (s->get.easyhandle,
-                      CURLOPT_OPENSOCKETFUNCTION,
-                      &open_tcp_stealth_socket_cb);
-    curl_easy_setopt (s->get.easyhandle,
-                      CURLOPT_OPENSOCKETDATA,
-                      s);
-#else
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Cannot connect, TCP STEALTH needed and not supported by 
kernel.\n");
-    curl_easy_cleanup (s->get.easyhandle);
-    s->get.easyhandle = NULL;
-    s->get.s = NULL;
-    return GNUNET_SYSERR;
-#endif
-  }
-
-#if VERBOSE_CURL
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_VERBOSE,
-                    1L);
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_DEBUGFUNCTION,
-                    &client_log);
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_DEBUGDATA,
-                    &s->get);
-#endif
-#if BUILD_HTTPS
-  curl_easy_setopt (s->get.easyhandle, CURLOPT_SSLVERSION,
-                    CURL_SSLVERSION_TLSv1);
-  {
-    if (HTTP_OPTIONS_VERIFY_CERTIFICATE ==
-        (options & HTTP_OPTIONS_VERIFY_CERTIFICATE))
-    {
-      curl_easy_setopt (s->get.easyhandle,
-                        CURLOPT_SSL_VERIFYPEER, 1L);
-      curl_easy_setopt (s->get.easyhandle,
-                        CURLOPT_SSL_VERIFYHOST,
-                        2L);
-    }
-    else
-    {
-      curl_easy_setopt (s->get.easyhandle,
-                        CURLOPT_SSL_VERIFYPEER,
-                        0L);
-      curl_easy_setopt (s->get.easyhandle,
-                        CURLOPT_SSL_VERIFYHOST,
-                        0L);
-    }
-  }
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_PROTOCOLS,
-                    CURLPROTO_HTTPS);
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_REDIR_PROTOCOLS,
-                    CURLPROTO_HTTPS);
-#else
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_PROTOCOLS,
-                    CURLPROTO_HTTP);
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_REDIR_PROTOCOLS,
-                    CURLPROTO_HTTP);
-#endif
-
-  if (NULL != s->plugin->proxy_hostname)
-  {
-    curl_easy_setopt (s->get.easyhandle,
-                      CURLOPT_PROXY,
-                      s->plugin->proxy_hostname);
-    curl_easy_setopt (s->get.easyhandle,
-                      CURLOPT_PROXYTYPE,
-                      s->plugin->proxytype);
-    if (NULL != s->plugin->proxy_username)
-      curl_easy_setopt (s->get.easyhandle,
-                        CURLOPT_PROXYUSERNAME,
-                        s->plugin->proxy_username);
-    if (NULL != s->plugin->proxy_password)
-      curl_easy_setopt (s->get.easyhandle,
-                        CURLOPT_PROXYPASSWORD,
-                        s->plugin->proxy_password);
-    if (GNUNET_YES == s->plugin->proxy_use_httpproxytunnel)
-      curl_easy_setopt (s->get.easyhandle,
-                        CURLOPT_HTTPPROXYTUNNEL,
-                        s->plugin->proxy_use_httpproxytunnel);
-  }
-
-  if (GNUNET_YES == s->plugin->emulate_xhr)
-  {
-    char *url;
-
-    GNUNET_asprintf (&url,
-                     "%s,1",
-                     s->url);
-    curl_easy_setopt (s->get.easyhandle,
-                      CURLOPT_URL,
-                      url);
-    GNUNET_free (url);
-  }
-  else
-  {
-    curl_easy_setopt (s->get.easyhandle,
-                      CURLOPT_URL,
-                      s->url);
-  }
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_READFUNCTION,
-                    &client_send_cb);
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_READDATA,
-                    s);
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_WRITEFUNCTION,
-                    &client_receive);
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_WRITEDATA,
-                    s);
-  /* No timeout by default, timeout done with session timeout */
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_TIMEOUT,
-                    0L);
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_PRIVATE, s);
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_CONNECTTIMEOUT_MS,
-                    (long) (HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value_us
-                            / 1000LL));
-  curl_easy_setopt (s->get.easyhandle, CURLOPT_BUFFERSIZE,
-                    2 * GNUNET_MAX_MESSAGE_SIZE);
-#if CURL_TCP_NODELAY
-  curl_easy_setopt (ps->recv_endpoint,
-                    CURLOPT_TCP_NODELAY,
-                    1L);
-#endif
-  curl_easy_setopt (s->get.easyhandle,
-                    CURLOPT_FOLLOWLOCATION,
-                    0L);
-
-  mret = curl_multi_add_handle (s->plugin->curl_multi_handle,
-                                s->get.easyhandle);
-  if (CURLM_OK != mret)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Session %p : Failed to add GET handle to multihandle: `%s'\n",
-         s,
-         curl_multi_strerror (mret));
-    curl_easy_cleanup (s->get.easyhandle);
-    s->get.easyhandle = NULL;
-    s->get.s = NULL;
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  s->plugin->cur_requests++;
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "GET request `%s' established, number of requests increased to %u\n",
-       s->url,
-       s->plugin->cur_requests);
-  return GNUNET_OK;
-}
-
-
-static int
-client_connect_put (struct GNUNET_ATS_Session *s)
-{
-  CURLMcode mret;
-  struct HttpAddress *ha;
-  uint32_t options;
-
-  ha = (struct HttpAddress *) s->address->address;
-  options = ntohl (ha->options);
-  /* create put request */
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p: Init PUT handle\n",
-       s);
-  s->put.easyhandle = curl_easy_init ();
-  s->put.s = s;
-#if VERBOSE_CURL
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_VERBOSE,
-                    1L);
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_DEBUGFUNCTION,
-                    &client_log);
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_DEBUGDATA,
-                    &s->put);
-#endif
-  if (0 != (options & HTTP_OPTIONS_TCP_STEALTH))
-  {
-#ifdef TCP_STEALTH
-    curl_easy_setopt (s->put.easyhandle,
-                      CURLOPT_OPENSOCKETFUNCTION,
-                      &open_tcp_stealth_socket_cb);
-    curl_easy_setopt (s->put.easyhandle,
-                      CURLOPT_OPENSOCKETDATA,
-                      s);
-#else
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Cannot connect, TCP STEALTH needed and not supported by 
kernel.\n");
-    curl_easy_cleanup (s->put.easyhandle);
-    s->put.easyhandle = NULL;
-    s->put.s = NULL;
-    s->put.state = H_DISCONNECTED;
-    return GNUNET_SYSERR;
-#endif
-  }
-#if BUILD_HTTPS
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_SSLVERSION,
-                    CURL_SSLVERSION_TLSv1);
-  {
-    struct HttpAddress *ha;
-    ha = (struct HttpAddress *) s->address->address;
-
-    if (HTTP_OPTIONS_VERIFY_CERTIFICATE ==
-        (ntohl (ha->options) & HTTP_OPTIONS_VERIFY_CERTIFICATE))
-    {
-      curl_easy_setopt (s->put.easyhandle,
-                        CURLOPT_SSL_VERIFYPEER,
-                        1L);
-      curl_easy_setopt (s->put.easyhandle,
-                        CURLOPT_SSL_VERIFYHOST,
-                        2L);
-    }
-    else
-    {
-      curl_easy_setopt (s->put.easyhandle,
-                        CURLOPT_SSL_VERIFYPEER,
-                        0L);
-      curl_easy_setopt (s->put.easyhandle,
-                        CURLOPT_SSL_VERIFYHOST,
-                        0L);
-    }
-  }
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_PROTOCOLS,
-                    CURLPROTO_HTTPS);
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_REDIR_PROTOCOLS,
-                    CURLPROTO_HTTPS);
-#else
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_PROTOCOLS,
-                    CURLPROTO_HTTP);
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_REDIR_PROTOCOLS,
-                    CURLPROTO_HTTP);
-#endif
-  if (NULL != s->plugin->proxy_hostname)
-  {
-    curl_easy_setopt (s->put.easyhandle,
-                      CURLOPT_PROXY,
-                      s->plugin->proxy_hostname);
-    curl_easy_setopt (s->put.easyhandle,
-                      CURLOPT_PROXYTYPE,
-                      s->plugin->proxytype);
-    if (NULL != s->plugin->proxy_username)
-      curl_easy_setopt (s->put.easyhandle,
-                        CURLOPT_PROXYUSERNAME,
-                        s->plugin->proxy_username);
-    if (NULL != s->plugin->proxy_password)
-      curl_easy_setopt (s->put.easyhandle,
-                        CURLOPT_PROXYPASSWORD,
-                        s->plugin->proxy_password);
-    if (GNUNET_YES == s->plugin->proxy_use_httpproxytunnel)
-      curl_easy_setopt (s->put.easyhandle,
-                        CURLOPT_HTTPPROXYTUNNEL,
-                        s->plugin->proxy_use_httpproxytunnel);
-  }
-
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_URL,
-                    s->url);
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_UPLOAD,
-                    1L);
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_READFUNCTION,
-                    &client_send_cb);
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_READDATA,
-                    s);
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_WRITEFUNCTION,
-                    &client_receive_put);
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_WRITEDATA,
-                    s);
-  /* No timeout by default, timeout done with session timeout */
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_TIMEOUT,
-                    0L);
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_PRIVATE,
-                    s);
-  curl_easy_setopt (s->put.easyhandle,
-                    CURLOPT_CONNECTTIMEOUT_MS,
-                    (long) (HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value_us
-                            / 1000LL));
-  curl_easy_setopt (s->put.easyhandle, CURLOPT_BUFFERSIZE,
-                    2 * GNUNET_MAX_MESSAGE_SIZE);
-#if CURL_TCP_NODELAY
-  curl_easy_setopt (s->put.easyhandle, CURLOPT_TCP_NODELAY, 1);
-#endif
-  mret = curl_multi_add_handle (s->plugin->curl_multi_handle,
-                                s->put.easyhandle);
-  if (CURLM_OK != mret)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Session %p : Failed to add PUT handle to multihandle: `%s'\n",
-         s, curl_multi_strerror (mret));
-    curl_easy_cleanup (s->put.easyhandle);
-    s->put.easyhandle = NULL;
-    s->put.s = NULL;
-    s->put.state = H_DISCONNECTED;
-    return GNUNET_SYSERR;
-  }
-  s->put.state = H_CONNECTED;
-  s->plugin->cur_requests++;
-
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "PUT request `%s' established, number of requests increased to %u\n",
-       s->url, s->plugin->cur_requests);
-
-  return GNUNET_OK;
-}
-
-
-/**
- * Connect both PUT and GET request for a session
- *
- * @param s the session to connect
- * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
- */
-static int
-client_connect (struct GNUNET_ATS_Session *s)
-{
-  struct HTTP_Client_Plugin *plugin = s->plugin;
-  int res = GNUNET_OK;
-
-  /* create url */
-  if (NULL ==
-      http_common_plugin_address_to_string (plugin->protocol,
-                                            s->address->address,
-                                            s->address->address_length))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Invalid address peer `%s'\n",
-         GNUNET_i2s (&s->address->peer));
-    return GNUNET_SYSERR;
-  }
-
-  GNUNET_asprintf (&s->url,
-                   "%s/%s;%u",
-                   http_common_plugin_address_to_url (NULL,
-                                                      s->address->address,
-                                                      
s->address->address_length),
-                   GNUNET_i2s_full (plugin->env->my_identity),
-                   plugin->last_tag);
-
-  plugin->last_tag++;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Initiating outbound session peer `%s' using address `%s'\n",
-       GNUNET_i2s (&s->address->peer), s->url);
-
-  if (GNUNET_SYSERR == client_connect_get (s))
-    return GNUNET_SYSERR;
-  /* If we are emulating an XHR client then delay sending a PUT request until
-   * there is something to send.
-   */
-  if (GNUNET_YES == plugin->emulate_xhr)
-  {
-    s->put.state = H_TMP_DISCONNECTED;
-  }
-  else if (GNUNET_SYSERR == client_connect_put (s))
-    return GNUNET_SYSERR;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p: connected with GET %p and PUT %p\n",
-       s, s->get.easyhandle,
-       s->put.easyhandle);
-  /* Perform connect */
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         HTTP_STAT_STR_CONNECTIONS,
-                         plugin->cur_requests,
-                         GNUNET_NO);
-  /* Re-schedule since handles have changed */
-  if (NULL != plugin->client_perform_task)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->client_perform_task);
-    plugin->client_perform_task = NULL;
-  }
-
-  /* Schedule task to run immediately */
-  plugin->client_perform_task = GNUNET_SCHEDULER_add_now (client_run,
-                                                          plugin);
-  return res;
-}
-
-
-/**
- * Function obtain the network type for a session
- *
- * @param cls closure (`struct Plugin*`)
- * @param session the session
- * @return the network type
- */
-static enum GNUNET_NetworkType
-http_client_plugin_get_network (void *cls,
-                                struct GNUNET_ATS_Session *session)
-{
-  return session->scope;
-}
-
-
-/**
- * Function obtain the network type for an address.
- *
- * @param cls closure (`struct Plugin *`)
- * @param address the address
- * @return the network type
- */
-static enum GNUNET_NetworkType
-http_client_plugin_get_network_for_address (void *cls,
-                                            const struct
-                                            GNUNET_HELLO_Address *address)
-{
-  struct HTTP_Client_Plugin *plugin = cls;
-
-  return http_common_get_network_for_address (plugin->env,
-                                              address);
-}
-
-
-/**
- * Session was idle, so disconnect it
- *
- * @param cls the `struct GNUNET_ATS_Session` of the idle session
- */
-static void
-client_session_timeout (void *cls)
-{
-  struct GNUNET_ATS_Session *s = cls;
-  struct GNUNET_TIME_Relative left;
-
-  s->timeout_task = NULL;
-  left = GNUNET_TIME_absolute_get_remaining (s->timeout);
-  if (0 != left.rel_value_us)
-  {
-    /* not actually our turn yet, but let's at least update
-       the monitor, it may think we're about to die ... */
-    notify_session_monitor (s->plugin,
-                            s,
-                            GNUNET_TRANSPORT_SS_UPDATE);
-    s->timeout_task = GNUNET_SCHEDULER_add_delayed (left,
-                                                    &client_session_timeout,
-                                                    s);
-    return;
-  }
-  LOG (TIMEOUT_LOG,
-       "Session %p was idle for %s, disconnecting\n",
-       s,
-       GNUNET_STRINGS_relative_time_to_string (HTTP_CLIENT_SESSION_TIMEOUT,
-                                               GNUNET_YES));
-  GNUNET_assert (GNUNET_OK ==
-                 http_client_plugin_session_disconnect (s->plugin,
-                                                        s));
-}
-
-
-/**
- * Creates a new outbound session the transport service will use to
- * send data to the peer
- *
- * @param cls the plugin
- * @param address the address
- * @return the session or NULL of max connections exceeded
- */
-static struct GNUNET_ATS_Session *
-http_client_plugin_get_session (void *cls,
-                                const struct GNUNET_HELLO_Address *address)
-{
-  struct HTTP_Client_Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *s;
-  struct sockaddr *sa;
-  enum GNUNET_NetworkType net_type;
-  size_t salen = 0;
-  int res;
-
-  GNUNET_assert (NULL != address->address);
-
-  /* find existing session */
-  s = client_lookup_session (plugin, address);
-  if (NULL != s)
-    return s;
-
-  /* create a new session */
-  if (plugin->max_requests <= plugin->cur_requests)
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         "Maximum number of requests (%u) reached: "
-         "cannot connect to peer `%s'\n",
-         plugin->max_requests,
-         GNUNET_i2s (&address->peer));
-    return NULL;
-  }
-
-  /* Determine network location */
-  net_type = GNUNET_NT_UNSPECIFIED;
-  sa = http_common_socket_from_address (address->address,
-                                        address->address_length,
-                                        &res);
-  if (GNUNET_SYSERR == res)
-    return NULL;
-  if (GNUNET_YES == res)
-  {
-    GNUNET_assert (NULL != sa);
-    if (AF_INET == sa->sa_family)
-    {
-      salen = sizeof(struct sockaddr_in);
-    }
-    else if (AF_INET6 == sa->sa_family)
-    {
-      salen = sizeof(struct sockaddr_in6);
-    }
-    net_type = plugin->env->get_address_type (plugin->env->cls, sa, salen);
-    GNUNET_free (sa);
-  }
-  else if (GNUNET_NO == res)
-  {
-    /* Cannot convert to sockaddr -> is external hostname */
-    net_type = GNUNET_NT_WAN;
-  }
-  if (GNUNET_NT_UNSPECIFIED == net_type)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-
-  s = GNUNET_new (struct GNUNET_ATS_Session);
-  s->plugin = plugin;
-  s->address = GNUNET_HELLO_address_copy (address);
-  s->scope = net_type;
-
-  s->put.state = H_NOT_CONNECTED;
-  s->timeout = GNUNET_TIME_relative_to_absolute (HTTP_CLIENT_SESSION_TIMEOUT);
-  s->timeout_task = GNUNET_SCHEDULER_add_delayed (HTTP_CLIENT_SESSION_TIMEOUT,
-                                                  &client_session_timeout,
-                                                  s);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Created new session %p for `%s' address `%s''\n",
-       s,
-       http_common_plugin_address_to_string (plugin->protocol,
-                                             s->address->address,
-                                             s->address->address_length),
-       GNUNET_i2s (&s->address->peer));
-
-  /* add new session */
-  (void) GNUNET_CONTAINER_multipeermap_put (plugin->sessions,
-                                            &s->address->peer,
-                                            s,
-                                            
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  /* initiate new connection */
-  if (GNUNET_SYSERR == client_connect (s))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Cannot connect to peer `%s' address `%s''\n",
-         http_common_plugin_address_to_string (plugin->protocol,
-                                               s->address->address,
-                                               s->address->address_length),
-         GNUNET_i2s (&s->address->peer));
-    client_delete_session (s);
-    return NULL;
-  }
-  notify_session_monitor (plugin,
-                          s,
-                          GNUNET_TRANSPORT_SS_INIT);
-  notify_session_monitor (plugin,
-                          s,
-                          GNUNET_TRANSPORT_SS_UP); /* or handshake? */
-  return s;
-}
-
-
-/**
- * Setup http_client plugin
- *
- * @param plugin the plugin handle
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-static int
-client_start (struct HTTP_Client_Plugin *plugin)
-{
-  curl_global_init (CURL_GLOBAL_ALL);
-  plugin->curl_multi_handle = curl_multi_init ();
-
-  if (NULL == plugin->curl_multi_handle)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ (
-           "Could not initialize curl multi handle, failed to start %s 
plugin!\n"),
-         plugin->name);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Another peer has suggested an address for this
- * peer and transport plugin.  Check that this could be a valid
- * address.  If so, consider adding it to the list
- * of addresses.
- *
- * @param cls closure with the `struct Plugin`
- * @param addr pointer to the address
- * @param addrlen length of @a addr
- * @return #GNUNET_OK if this is a plausible address for this peer
- *         and transport; always returns #GNUNET_NO (this is the client!)
- */
-static int
-http_client_plugin_address_suggested (void *cls,
-                                      const void *addr,
-                                      size_t addrlen)
-{
-  /* A HTTP/S client does not have any valid address so:*/
-  return GNUNET_NO;
-}
-
-
-/**
- * Exit point from the plugin.
- *
- * @param cls api as closure
- * @return NULL
- */
-void *
-LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
-  struct HTTP_Client_Plugin *plugin = api->cls;
-
-  if (NULL == api->cls)
-  {
-    /* Stub shutdown */
-    GNUNET_free (api);
-    return NULL;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       _ ("Shutting down plugin `%s'\n"),
-       plugin->name);
-  GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions,
-                                         &destroy_session_cb,
-                                         plugin);
-  if (NULL != plugin->client_perform_task)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->client_perform_task);
-    plugin->client_perform_task = NULL;
-  }
-  if (NULL != plugin->curl_multi_handle)
-  {
-    curl_multi_cleanup (plugin->curl_multi_handle);
-    plugin->curl_multi_handle = NULL;
-  }
-  curl_global_cleanup ();
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       _ ("Shutdown for plugin `%s' complete\n"),
-       plugin->name);
-  GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions);
-  GNUNET_free (plugin->proxy_hostname);
-  GNUNET_free (plugin->proxy_username);
-  GNUNET_free (plugin->proxy_password);
-  GNUNET_free (plugin);
-  GNUNET_free (api);
-  return NULL;
-}
-
-
-/**
- * Configure plugin
- *
- * @param plugin the plugin handle
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-static int
-client_configure_plugin (struct HTTP_Client_Plugin *plugin)
-{
-  unsigned long long max_requests;
-  char *proxy_type;
-
-  /* Optional parameters */
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_number (plugin->env->cfg,
-                                             plugin->name,
-                                             "MAX_CONNECTIONS",
-                                             &max_requests))
-    max_requests = 128;
-  plugin->max_requests = max_requests;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       _ ("Maximum number of requests is %u\n"),
-       plugin->max_requests);
-
-  /* Read proxy configuration */
-  if (GNUNET_OK ==
-      GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg,
-                                             plugin->name,
-                                             "PROXY",
-                                             &plugin->proxy_hostname))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Found proxy host: `%s'\n",
-         plugin->proxy_hostname);
-    /* proxy username */
-    if (GNUNET_OK ==
-        GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg,
-                                               plugin->name,
-                                               "PROXY_USERNAME",
-                                               &plugin->proxy_username))
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Found proxy username name: `%s'\n",
-           plugin->proxy_username);
-    }
-
-    /* proxy password */
-    if (GNUNET_OK ==
-        GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg,
-                                               plugin->name,
-                                               "PROXY_PASSWORD",
-                                               &plugin->proxy_password))
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Found proxy password name: `%s'\n",
-           plugin->proxy_password);
-    }
-
-    /* proxy type */
-    if (GNUNET_OK ==
-        GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg,
-                                               plugin->name,
-                                               "PROXY_TYPE",
-                                               &proxy_type))
-    {
-      GNUNET_STRINGS_utf8_toupper (proxy_type, proxy_type);
-
-      if (0 == strcmp (proxy_type, "HTTP"))
-        plugin->proxytype = CURLPROXY_HTTP;
-      else if (0 == strcmp (proxy_type, "SOCKS4"))
-        plugin->proxytype = CURLPROXY_SOCKS4;
-      else if (0 == strcmp (proxy_type, "SOCKS5"))
-        plugin->proxytype = CURLPROXY_SOCKS5;
-      else if (0 == strcmp (proxy_type, "SOCKS4A"))
-        plugin->proxytype = CURLPROXY_SOCKS4A;
-      else if (0 == strcmp (proxy_type, "SOCKS5_HOSTNAME "))
-        plugin->proxytype = CURLPROXY_SOCKS5_HOSTNAME;
-      else
-      {
-        LOG (GNUNET_ERROR_TYPE_ERROR,
-             _ (
-               "Invalid proxy type: `%s', disabling proxy! Check 
configuration!\n"),
-             proxy_type);
-
-        GNUNET_free (proxy_type);
-        GNUNET_free (plugin->proxy_hostname);
-        plugin->proxy_hostname = NULL;
-        GNUNET_free (plugin->proxy_username);
-        plugin->proxy_username = NULL;
-        GNUNET_free (plugin->proxy_password);
-        plugin->proxy_password = NULL;
-
-        return GNUNET_SYSERR;
-      }
-
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Found proxy type: `%s'\n",
-           proxy_type);
-    }
-
-    /* proxy http tunneling */
-    plugin->proxy_use_httpproxytunnel
-      = GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg,
-                                              plugin->name,
-                                              "PROXY_HTTP_TUNNELING");
-    if (GNUNET_SYSERR == plugin->proxy_use_httpproxytunnel)
-      plugin->proxy_use_httpproxytunnel = GNUNET_NO;
-
-    GNUNET_free (proxy_type);
-  }
-
-  /* Should we emulate an XHR client for testing? */
-  plugin->emulate_xhr
-    = GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg,
-                                            plugin->name,
-                                            "EMULATE_XHR");
-  return GNUNET_OK;
-}
-
-
-/**
- * Function to convert an address to a human-readable string.
- *
- * @param cls closure
- * @param addr address to convert
- * @param addrlen address length
- * @return res string if conversion was successful, NULL otherwise
- */
-static const char *
-http_client_plugin_address_to_string (void *cls,
-                                      const void *addr,
-                                      size_t addrlen)
-{
-  return http_common_plugin_address_to_string (PLUGIN_NAME,
-                                               addr,
-                                               addrlen);
-}
-
-
-/**
- * Function that will be called whenever the transport service wants to
- * notify the plugin that a session is still active and in use and
- * therefore the session timeout for this session has to be updated
- *
- * @param cls closure
- * @param peer which peer was the session for
- * @param session which session is being updated
- */
-static void
-http_client_plugin_update_session_timeout (void *cls,
-                                           const struct
-                                           GNUNET_PeerIdentity *peer,
-                                           struct GNUNET_ATS_Session *session)
-{
-  client_reschedule_session_timeout (session);
-}
-
-
-/**
- * Function that will be called whenever the transport service wants to
- * notify the plugin that the inbound quota changed and that the plugin
- * should update it's delay for the next receive value
- *
- * @param cls closure
- * @param peer which peer was the session for
- * @param s which session is being updated
- * @param delay new delay to use for receiving
- */
-static void
-http_client_plugin_update_inbound_delay (void *cls,
-                                         const struct GNUNET_PeerIdentity 
*peer,
-                                         struct GNUNET_ATS_Session *s,
-                                         struct GNUNET_TIME_Relative delay)
-{
-  s->next_receive = GNUNET_TIME_relative_to_absolute (delay);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "New inbound delay %s\n",
-       GNUNET_STRINGS_relative_time_to_string (delay,
-                                               GNUNET_NO));
-  if (s->recv_wakeup_task != NULL)
-  {
-    GNUNET_SCHEDULER_cancel (s->recv_wakeup_task);
-    s->recv_wakeup_task
-      = GNUNET_SCHEDULER_add_delayed (delay,
-                                      &client_wake_up,
-                                      s);
-  }
-}
-
-
-/**
- * Return information about the given session to the
- * monitor callback.
- *
- * @param cls the `struct Plugin` with the monitor callback (`sic`)
- * @param peer peer we send information about
- * @param value our `struct GNUNET_ATS_Session` to send information about
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-send_session_info_iter (void *cls,
-                        const struct GNUNET_PeerIdentity *peer,
-                        void *value)
-{
-  struct HTTP_Client_Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session = value;
-
-  notify_session_monitor (plugin,
-                          session,
-                          GNUNET_TRANSPORT_SS_INIT);
-  notify_session_monitor (plugin,
-                          session,
-                          GNUNET_TRANSPORT_SS_UP); /* FIXME: or handshake? */
-  return GNUNET_OK;
-}
-
-
-/**
- * Begin monitoring sessions of a plugin.  There can only
- * be one active monitor per plugin (i.e. if there are
- * multiple monitors, the transport service needs to
- * multiplex the generated events over all of them).
- *
- * @param cls closure of the plugin
- * @param sic callback to invoke, NULL to disable monitor;
- *            plugin will being by iterating over all active
- *            sessions immediately and then enter monitor mode
- * @param sic_cls closure for @a sic
- */
-static void
-http_client_plugin_setup_monitor (void *cls,
-                                  GNUNET_TRANSPORT_SessionInfoCallback sic,
-                                  void *sic_cls)
-{
-  struct HTTP_Client_Plugin *plugin = cls;
-
-  plugin->sic = sic;
-  plugin->sic_cls = sic_cls;
-  if (NULL != sic)
-  {
-    GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions,
-                                           &send_session_info_iter,
-                                           plugin);
-    /* signal end of first iteration */
-    sic (sic_cls, NULL, NULL);
-  }
-}
-
-
-/**
- * Entry point for the plugin.
- */
-void *
-LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginEnvironment *env = cls;
-  struct GNUNET_TRANSPORT_PluginFunctions *api;
-  struct HTTP_Client_Plugin *plugin;
-
-  if (NULL == env->receive)
-  {
-    /* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully
-       initialize the plugin or the API */
-    api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-    api->cls = NULL;
-    api->address_to_string = &http_client_plugin_address_to_string;
-    api->string_to_address = &http_common_plugin_string_to_address;
-    api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
-    return api;
-  }
-
-  plugin = GNUNET_new (struct HTTP_Client_Plugin);
-  plugin->env = env;
-  plugin->sessions = GNUNET_CONTAINER_multipeermap_create (128,
-                                                           GNUNET_YES);
-  api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-  api->cls = plugin;
-  api->send = &http_client_plugin_send;
-  api->disconnect_session = &http_client_plugin_session_disconnect;
-  api->query_keepalive_factor = &http_client_query_keepalive_factor;
-  api->disconnect_peer = &http_client_plugin_peer_disconnect;
-  api->check_address = &http_client_plugin_address_suggested;
-  api->get_session = &http_client_plugin_get_session;
-  api->address_to_string = &http_client_plugin_address_to_string;
-  api->string_to_address = &http_common_plugin_string_to_address;
-  api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
-  api->get_network = &http_client_plugin_get_network;
-  api->get_network_for_address = &http_client_plugin_get_network_for_address;
-  api->update_session_timeout = &http_client_plugin_update_session_timeout;
-  api->update_inbound_delay = &http_client_plugin_update_inbound_delay;
-  api->setup_monitor = &http_client_plugin_setup_monitor;
-#if BUILD_HTTPS
-  plugin->name = "transport-https_client";
-  plugin->protocol = "https";
-#else
-  plugin->name = "transport-http_client";
-  plugin->protocol = "http";
-#endif
-  plugin->last_tag = 1;
-
-  if (GNUNET_SYSERR == client_configure_plugin (plugin))
-  {
-    LIBGNUNET_PLUGIN_TRANSPORT_DONE (api);
-    return NULL;
-  }
-
-  /* Start client */
-  if (GNUNET_SYSERR == client_start (plugin))
-  {
-    LIBGNUNET_PLUGIN_TRANSPORT_DONE (api);
-    return NULL;
-  }
-  return api;
-}
-
-
-/* end of plugin_transport_http_client.c */
diff --git a/src/transport/plugin_transport_http_common.c 
b/src/transport/plugin_transport_http_common.c
deleted file mode 100644
index a033985e1..000000000
--- a/src/transport/plugin_transport_http_common.c
+++ /dev/null
@@ -1,903 +0,0 @@
-/*
-   This file is part of GNUnet
-   Copyright (C) 2002-2013 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_http_common.c
- * @brief functionality shared between http(s)client plugins
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_transport_plugin.h"
-#include "plugin_transport_http_common.h"
-#include "gnunet_resolver_service.h"
-
-static void
-http_clean_splitted (struct SplittedHTTPAddress *spa)
-{
-  if (NULL != spa)
-  {
-    GNUNET_free (spa->protocol);
-    GNUNET_free (spa->host);
-    GNUNET_free (spa->path);
-    GNUNET_free (spa);
-  }
-}
-
-
-struct SplittedHTTPAddress *
-http_split_address (const char *addr)
-{
-  struct SplittedHTTPAddress *sp;
-  char *src = GNUNET_strdup (addr);
-  char *protocol_start = NULL;
-  char *host_start = NULL;
-  char *v6_end = NULL;
-  char *port_start = NULL;
-  char *path_start = NULL;
-
-  protocol_start = src;
-
-  sp = GNUNET_new (struct SplittedHTTPAddress);
-  /* Address string consists of protocol://host[:port]path*/
-
-  host_start = strstr (src, "://");
-  if (NULL == host_start)
-  {
-    GNUNET_free (src);
-    GNUNET_free (sp);
-    return NULL;
-  }
-  host_start[0] = '\0';
-  sp->protocol = GNUNET_strdup (protocol_start);
-
-  host_start += strlen ("://");
-  if (strlen (host_start) == 0)
-  {
-    GNUNET_free (src);
-    GNUNET_free (sp->protocol);
-    GNUNET_free (sp);
-    return NULL;
-  }
-
-  /* Find path start */
-  path_start = strchr (host_start, '/');
-  if (NULL != path_start)
-  {
-    sp->path = GNUNET_strdup (path_start);
-    path_start[0] = '\0';
-  }
-  else
-    sp->path = GNUNET_strdup ("");
-
-  if (strlen (host_start) < 1)
-  {
-    GNUNET_free (src);
-    GNUNET_free (sp->protocol);
-    GNUNET_free (sp->path);
-    GNUNET_free (sp);
-    return NULL;
-  }
-
-  if (NULL != (port_start = strrchr (host_start, ':')))
-  {
-    /* *We COULD have a port, but also an IPv6 address! */
-    if (NULL != (v6_end = strchr (host_start, ']')))
-    {
-      if (v6_end < port_start)
-      {
-        /* IPv6 address + port */
-        port_start[0] = '\0';
-        port_start++;
-        sp->port = atoi (port_start);
-        if ((0 == sp->port) || (65535 < sp->port))
-        {
-          GNUNET_free (src);
-          GNUNET_free (sp->protocol);
-          GNUNET_free (sp->path);
-          GNUNET_free (sp);
-          return NULL;
-        }
-      }
-      else
-      {
-        /* IPv6 address + no port */
-        if (0 == strcmp (sp->protocol, "https"))
-          sp->port = HTTPS_DEFAULT_PORT;
-        else if (0 == strcmp (sp->protocol, "http"))
-          sp->port = HTTP_DEFAULT_PORT;
-      }
-    }
-    else
-    {
-      /* No IPv6 address */
-      port_start[0] = '\0';
-      port_start++;
-      sp->port = atoi (port_start);
-      if ((0 == sp->port) || (65535 < sp->port))
-      {
-        GNUNET_free (src);
-        GNUNET_free (sp->protocol);
-        GNUNET_free (sp->path);
-        GNUNET_free (sp);
-        return NULL;
-      }
-    }
-  }
-  else
-  {
-    /* No ':' as port separator, default port for protocol */
-    if (0 == strcmp (sp->protocol, "https"))
-      sp->port = HTTPS_DEFAULT_PORT;
-    else if (0 == strcmp (sp->protocol, "http"))
-      sp->port = HTTP_DEFAULT_PORT;
-    else
-    {
-      GNUNET_break (0);
-      GNUNET_free (src);
-      GNUNET_free (sp->protocol);
-      GNUNET_free (sp->path);
-      GNUNET_free (sp);
-      return NULL;
-    }
-  }
-  if (strlen (host_start) > 0)
-    sp->host = GNUNET_strdup (host_start);
-  else
-  {
-    GNUNET_break (0);
-    GNUNET_free (src);
-    GNUNET_free (sp->protocol);
-    GNUNET_free (sp->path);
-    GNUNET_free (sp);
-    return NULL;
-  }
-  GNUNET_free (src);
-  return sp;
-}
-
-
-/**
- * Closure for #append_port().
- */
-struct PrettyPrinterContext
-{
-  /**
-   * DLL
-   */
-  struct PrettyPrinterContext *next;
-
-  /**
-   * DLL
-   */
-  struct PrettyPrinterContext *prev;
-
-  /**
-   * Resolver handle
-   */
-  struct GNUNET_RESOLVER_RequestHandle *resolver_handle;
-
-  /**
-   * Function to call with the result.
-   */
-  GNUNET_TRANSPORT_AddressStringCallback asc;
-
-  /**
-   * Clsoure for @e asc.
-   */
-  void *asc_cls;
-
-  /**
-   * Timeout task
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * Split Address
-   */
-  struct SplittedHTTPAddress *saddr;
-
-  /**
-   * Plugin String
-   */
-  char *plugin;
-
-  /**
-   * Was conversion successful
-   */
-  int success;
-
-  /**
-   * Address options
-   */
-  uint32_t options;
-};
-
-/**
- * Head of PPC list
- */
-static struct PrettyPrinterContext *dll_ppc_head;
-
-/**
- * Tail of PPC list
- */
-static struct PrettyPrinterContext *dll_ppc_tail;
-
-/**
- * Function called for a quick conversion of the binary address to
- * a numeric address.  Note that the caller must not free the
- * address and that the next call to this function is allowed
- * to override the address again.
- *
- * @param plugin the name of the plugin
- * @param saddr the split http address
- * @param options address options
- * @param dnsresult dns name to include in address
- * @return string representing the same address or NULL on error
- */
-static const char *
-http_common_plugin_dnsresult_to_address (const char *plugin,
-                                         const struct
-                                         SplittedHTTPAddress *saddr,
-                                         uint32_t options,
-                                         const char *dnsresult)
-{
-  static char rbuf[1024];
-  char *res;
-
-  GNUNET_asprintf (&res, "%s.%u.%s://%s:%u%s", plugin, options, 
saddr->protocol,
-                   dnsresult, saddr->port, saddr->path);
-  if (strlen (res) + 1 < 500)
-  {
-    GNUNET_memcpy (rbuf, res, strlen (res) + 1);
-    GNUNET_free (res);
-    return rbuf;
-  }
-  GNUNET_break (0);
-  GNUNET_free (res);
-  return NULL;
-}
-
-
-static void
-http_common_dns_reverse_lookup_cb (void *cls, const char *hostname)
-{
-  struct PrettyPrinterContext *ppc = cls;
-
-  if (NULL != hostname)
-  {
-    ppc->asc (ppc->asc_cls,
-              http_common_plugin_dnsresult_to_address (ppc->plugin, ppc->saddr,
-                                                       ppc->options,
-                                                       hostname), GNUNET_OK);
-    ppc->success = GNUNET_YES;
-  }
-  else
-  {
-    ppc->asc (ppc->asc_cls, NULL,
-              (GNUNET_NO == ppc->success) ? GNUNET_SYSERR : GNUNET_OK);
-
-    GNUNET_CONTAINER_DLL_remove (dll_ppc_head, dll_ppc_tail, ppc);
-    http_clean_splitted (ppc->saddr);
-    GNUNET_free (ppc->plugin);
-    GNUNET_free (ppc);
-  }
-}
-
-
-static int
-http_common_dns_reverse_lookup (const struct sockaddr *sockaddr,
-                                socklen_t sockaddr_len,
-                                const char *type,
-                                struct SplittedHTTPAddress *saddr,
-                                uint32_t options,
-                                struct GNUNET_TIME_Relative timeout,
-                                GNUNET_TRANSPORT_AddressStringCallback asc,
-                                void *asc_cls)
-{
-  struct PrettyPrinterContext *ppc;
-
-  ppc = GNUNET_new (struct PrettyPrinterContext);
-  ppc->saddr = saddr;
-  ppc->asc = asc;
-  ppc->asc_cls = asc_cls;
-  ppc->plugin = GNUNET_strdup (type);
-  ppc->options = options;
-  ppc->resolver_handle = GNUNET_RESOLVER_hostname_get (sockaddr,
-                                                       sockaddr_len,
-                                                       GNUNET_YES,
-                                                       timeout,
-                                                       &
-                                                       
http_common_dns_reverse_lookup_cb,
-                                                       ppc);
-  if (NULL == ppc->resolver_handle)
-  {
-    GNUNET_free (ppc->plugin);
-    GNUNET_free (ppc);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_CONTAINER_DLL_insert (dll_ppc_head,
-                               dll_ppc_tail,
-                               ppc);
-  return GNUNET_OK;
-}
-
-
-static void
-http_common_dns_ip_lookup_cb (void *cls,
-                              const struct sockaddr *addr,
-                              socklen_t addrlen)
-{
-  struct PrettyPrinterContext *ppc = cls;
-
-  if (NULL != addr)
-  {
-    ppc->asc (ppc->asc_cls,
-              http_common_plugin_dnsresult_to_address (ppc->plugin, ppc->saddr,
-                                                       ppc->options,
-                                                       GNUNET_a2s (addr,
-                                                                   addrlen)),
-              GNUNET_OK);
-    ppc->success = GNUNET_YES;
-    ppc->asc (ppc->asc_cls, GNUNET_a2s (addr, addrlen), GNUNET_OK);
-  }
-  else
-  {
-    ppc->asc (ppc->asc_cls, NULL,
-              (GNUNET_NO == ppc->success) ? GNUNET_SYSERR : GNUNET_OK);
-
-    GNUNET_CONTAINER_DLL_remove (dll_ppc_head, dll_ppc_tail, ppc);
-    GNUNET_free (ppc->plugin);
-    http_clean_splitted (ppc->saddr);
-    GNUNET_free (ppc);
-  }
-}
-
-
-static int
-http_common_dns_ip_lookup (const char *name,
-                           const char *type,
-                           struct SplittedHTTPAddress *saddr,
-                           uint32_t options,
-                           struct GNUNET_TIME_Relative timeout,
-                           GNUNET_TRANSPORT_AddressStringCallback asc,
-                           void *asc_cls)
-{
-  struct PrettyPrinterContext *ppc;
-
-  ppc = GNUNET_new (struct PrettyPrinterContext);
-  ppc->success = GNUNET_NO;
-  ppc->saddr = saddr;
-  ppc->asc = asc;
-  ppc->asc_cls = asc_cls;
-  ppc->plugin = GNUNET_strdup (type);
-  ppc->options = options;
-  ppc->resolver_handle = GNUNET_RESOLVER_ip_get (name,
-                                                 AF_UNSPEC,
-                                                 timeout,
-                                                 &http_common_dns_ip_lookup_cb,
-                                                 ppc);
-  if (NULL == ppc->resolver_handle)
-  {
-    GNUNET_free (ppc->plugin);
-    GNUNET_free (ppc);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_CONTAINER_DLL_insert (dll_ppc_head,
-                               dll_ppc_tail,
-                               ppc);
-  return GNUNET_OK;
-}
-
-
-void
-http_common_plugin_address_pretty_printer (void *cls, const char *type,
-                                           const void *addr,
-                                           size_t addrlen,
-                                           int numeric,
-                                           struct GNUNET_TIME_Relative timeout,
-                                           
GNUNET_TRANSPORT_AddressStringCallback
-                                           asc,
-                                           void *asc_cls)
-{
-  const struct HttpAddress *address = addr;
-  struct SplittedHTTPAddress *saddr;
-  struct sockaddr *sock_addr;
-  const char *ret;
-  char *addr_str;
-  int res;
-  int have_ip;
-
-  saddr = NULL;
-  sock_addr = NULL;
-  if ((addrlen < sizeof(struct HttpAddress)) ||
-      (addrlen != http_common_address_get_size (address)))
-  {
-    GNUNET_break (0);
-    goto handle_error;
-  }
-
-  addr_str = (char *) &address[1];
-  if (addr_str[ntohl (address->urlen) - 1] != '\0')
-  {
-    GNUNET_break (0);
-    goto handle_error;
-  }
-
-  saddr = http_split_address (addr_str);
-  if (NULL == saddr)
-  {
-    GNUNET_break (0);
-    goto handle_error;
-  }
-
-  sock_addr = http_common_socket_from_address (addr, addrlen, &res);
-  if (GNUNET_SYSERR == res)
-  {
-    /* Malformed address */
-    GNUNET_break (0);
-    goto handle_error;
-  }
-  else if (GNUNET_NO == res)
-  {
-    /* Could not convert to IP */
-    have_ip = GNUNET_NO;
-  }
-  else if (GNUNET_YES == res)
-  {
-    /* Converted to IP */
-    have_ip = GNUNET_YES;
-  }
-  else
-  {
-    /* Must not happen */
-    GNUNET_break (0);
-    goto handle_error;
-  }
-
-  if ((GNUNET_YES == numeric) &&
-      (GNUNET_YES == have_ip))
-  {
-    /* No lookup required */
-    ret = http_common_plugin_address_to_string (type, address, addrlen);
-    asc (asc_cls, ret, (NULL == ret) ? GNUNET_SYSERR : GNUNET_OK);
-    asc (asc_cls, NULL, GNUNET_OK);
-    http_clean_splitted (saddr);
-    GNUNET_free (sock_addr);
-    return;
-  }
-  if ((GNUNET_YES == numeric) &&
-      (GNUNET_NO == have_ip))
-  {
-    /* Forward lookup */
-    if (GNUNET_SYSERR ==
-        http_common_dns_ip_lookup (saddr->host, type, saddr,
-                                   address->options, timeout,
-                                   asc, asc_cls))
-    {
-      GNUNET_break (0);
-      goto handle_error;
-    }
-    /* Wait for resolver callback */
-    GNUNET_free (sock_addr);
-    return;
-  }
-  if ((GNUNET_NO == numeric) &&
-      (GNUNET_YES == have_ip))
-  {
-    /* Reverse lookup */
-    if (GNUNET_SYSERR ==
-        http_common_dns_reverse_lookup (sock_addr,
-                                        (AF_INET == sock_addr->sa_family)
-                                        ? sizeof(struct sockaddr_in)
-                                        : sizeof(struct sockaddr_in6),
-                                        type,
-                                        saddr,
-                                        address->options, timeout,
-                                        asc, asc_cls))
-    {
-      GNUNET_break (0);
-      goto handle_error;
-    }
-    /* Wait for resolver callback */
-    GNUNET_free (sock_addr);
-    return;
-  }
-  if ((GNUNET_NO == numeric) &&
-      (GNUNET_NO == have_ip))
-  {
-    /* No lookup required */
-    ret = http_common_plugin_address_to_string (type, address, addrlen);
-    asc (asc_cls, ret, (NULL == ret) ? GNUNET_SYSERR : GNUNET_OK);
-    asc (asc_cls, NULL, GNUNET_OK);
-    GNUNET_free (sock_addr);
-    http_clean_splitted (saddr);
-    return;
-  }
-  /* Error (argument supplied not GNUNET_YES or GNUNET_NO) */
-  GNUNET_break (0);
-  goto handle_error;
-
-handle_error:
-  /* Report error */
-  asc (asc_cls, NULL, GNUNET_SYSERR);
-  asc (asc_cls, NULL, GNUNET_OK);
-  GNUNET_free (sock_addr);
-  if (NULL != saddr)
-    http_clean_splitted (saddr);
-}
-
-
-/**
- * FIXME.
- */
-const char *
-http_common_plugin_address_to_url (void *cls,
-                                   const void *addr,
-                                   size_t addrlen)
-{
-  static char rbuf[1024];
-  const struct HttpAddress *address = addr;
-  const char *addr_str;
-
-  if (NULL == addr)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  if (0 == addrlen)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  if (addrlen != http_common_address_get_size (address))
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  addr_str = (char *) &address[1];
-  if (addr_str[ntohl (address->urlen) - 1] != '\0')
-    return NULL;
-
-  GNUNET_memcpy (rbuf,
-                 &address[1],
-                 ntohl (address->urlen));
-  return rbuf;
-}
-
-
-const char *
-http_common_plugin_address_to_string (const char *plugin,
-                                      const void *addr,
-                                      size_t addrlen)
-{
-  static char rbuf[1024];
-  const struct HttpAddress *address = addr;
-  const char *addr_str;
-  char *res;
-
-  GNUNET_assert (NULL != plugin);
-  if (NULL == addr)
-    return NULL;
-  if (0 == addrlen)
-    return NULL;
-  if (addrlen != http_common_address_get_size (address))
-    return NULL;
-  addr_str = (char *) &address[1];
-  if (addr_str[ntohl (address->urlen) - 1] != '\0')
-    return NULL;
-  GNUNET_asprintf (&res, "%s.%u.%s", plugin, ntohl (address->options),
-                   (char*) &address[1]);
-  if (strlen (res) + 1 < 500)
-  {
-    GNUNET_memcpy (rbuf, res, strlen (res) + 1);
-    GNUNET_free (res);
-    return rbuf;
-  }
-  GNUNET_break (0);
-  GNUNET_free (res);
-  return NULL;
-}
-
-
-int
-http_common_plugin_string_to_address (void *cls,
-                                      const char *addr,
-                                      uint16_t addrlen,
-                                      void **buf,
-                                      size_t *added)
-{
-  struct HttpAddress *a;
-  char *address;
-  char *plugin;
-  char *optionstr;
-  size_t urlen;
-  uint32_t options;
-
-  /* Format protocol.options.address:port */
-  address = NULL;
-  plugin = NULL;
-  optionstr = NULL;
-  if ((NULL == addr) || (addrlen == 0))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if ('\0' != addr[addrlen - 1])
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if (strlen (addr) != addrlen - 1)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  plugin = GNUNET_strdup (addr);
-  optionstr = strchr (plugin, '.');
-  if (NULL == optionstr)
-  {
-    GNUNET_break (0);
-    GNUNET_free (plugin);
-    return GNUNET_SYSERR;
-  }
-  optionstr[0] = '\0';
-  optionstr++;
-  options = atol (optionstr);  /* 0 on conversion error, that's ok */
-  address = strchr (optionstr, '.');
-  if (NULL == address)
-  {
-    GNUNET_break (0);
-    GNUNET_free (plugin);
-    return GNUNET_SYSERR;
-  }
-  address[0] = '\0';
-  address++;
-  urlen = strlen (address) + 1;
-
-  a = GNUNET_malloc (sizeof(struct HttpAddress) + urlen);
-  a->options = htonl (options);
-  a->urlen = htonl (urlen);
-  GNUNET_memcpy (&a[1], address, urlen);
-
-  (*buf) = a;
-  (*added) = sizeof(struct HttpAddress) + urlen;
-  GNUNET_free (plugin);
-  return GNUNET_OK;
-}
-
-
-struct HttpAddress *
-http_common_address_from_socket (const char *protocol,
-                                 const struct sockaddr *addr,
-                                 socklen_t addrlen)
-{
-  struct HttpAddress *address = NULL;
-  char *res;
-  size_t len;
-
-  GNUNET_asprintf (&res,
-                   "%s://%s",
-                   protocol,
-                   GNUNET_a2s (addr,
-                               addrlen));
-  len = strlen (res) + 1;
-  address = GNUNET_malloc (sizeof(struct HttpAddress) + len);
-  address->options = htonl (HTTP_OPTIONS_NONE);
-  address->urlen = htonl (len);
-  GNUNET_memcpy (&address[1], res, len);
-  GNUNET_free (res);
-  return address;
-}
-
-
-/**
- * Create a socketaddr from a HTTP address
- *
- * @param addr a `sockaddr *` address
- * @param addrlen length of the @a addr
- * @param res the result:
- *   #GNUNET_SYSERR, invalid input,
- *   #GNUNET_YES: could convert to ip,
- *   #GNUNET_NO: valid input but could not convert to ip (hostname?)
- * @return the string
- */
-struct sockaddr *
-http_common_socket_from_address (const void *addr,
-                                 size_t addrlen,
-                                 int *res)
-{
-  const struct HttpAddress *ha;
-  struct SplittedHTTPAddress *spa;
-  struct sockaddr_storage *s;
-  char *to_conv;
-  size_t urlen;
-
-  (*res) = GNUNET_SYSERR;
-  ha = (const struct HttpAddress *) addr;
-  if (NULL == addr)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  if (0 == addrlen)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  if (addrlen < sizeof(struct HttpAddress))
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  urlen = ntohl (ha->urlen);
-  if (sizeof(struct HttpAddress) + urlen != addrlen)
-  {
-    /* This is a legacy addresses */
-    return NULL;
-  }
-  if (addrlen < sizeof(struct HttpAddress) + urlen)
-  {
-    /* This is a legacy addresses */
-    return NULL;
-  }
-  if (((char *) addr)[addrlen - 1] != '\0')
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  spa = http_split_address ((const char *) &ha[1]);
-  if (NULL == spa)
-  {
-    (*res) = GNUNET_SYSERR;
-    return NULL;
-  }
-
-  s = GNUNET_new (struct sockaddr_storage);
-  GNUNET_asprintf (&to_conv, "%s:%u", spa->host, spa->port);
-  if (GNUNET_SYSERR
-      == GNUNET_STRINGS_to_address_ip (to_conv, strlen (to_conv), s))
-  {
-    /* could be a hostname */
-    GNUNET_free (s);
-    (*res) = GNUNET_NO;
-    s = NULL;
-  }
-  else if ((AF_INET != s->ss_family) && (AF_INET6 != s->ss_family))
-  {
-    GNUNET_free (s);
-    (*res) = GNUNET_SYSERR;
-    s = NULL;
-  }
-  else
-  {
-    (*res) = GNUNET_YES;
-  }
-  http_clean_splitted (spa);
-  GNUNET_free (to_conv);
-  return (struct sockaddr *) s;
-}
-
-
-/**
- * Get the length of an address
- *
- * @param addr address
- * @return the size
- */
-size_t
-http_common_address_get_size (const struct HttpAddress *addr)
-{
-  return sizeof(struct HttpAddress) + ntohl (addr->urlen);
-}
-
-
-/**
- * Compare addr1 to addr2
- *
- * @param addr1 address1
- * @param addrlen1 address 1 length
- * @param addr2 address2
- * @param addrlen2 address 2 length
- * @return #GNUNET_YES if equal, #GNUNET_NO if not, #GNUNET_SYSERR on error
- */
-size_t
-http_common_cmp_addresses (const void *addr1,
-                           size_t addrlen1,
-                           const void *addr2,
-                           size_t addrlen2)
-{
-  const char *a1 = addr1;
-  const char *a2 = addr2;
-  const struct HttpAddress *ha1;
-  const struct HttpAddress *ha2;
-
-  ha1 = (const struct HttpAddress *) a1;
-  ha2 = (const struct HttpAddress *) a2;
-
-  if (NULL == a1)
-    return GNUNET_SYSERR;
-  if (0 == addrlen1)
-    return GNUNET_SYSERR;
-  if (a1[addrlen1 - 1] != '\0')
-    return GNUNET_SYSERR;
-
-  if (NULL == a2)
-    return GNUNET_SYSERR;
-  if (0 == addrlen2)
-    return GNUNET_SYSERR;
-  if (a2[addrlen2 - 1] != '\0')
-    return GNUNET_SYSERR;
-
-  if (addrlen1 != addrlen2)
-    return GNUNET_NO;
-  if (ha1->urlen != ha2->urlen)
-    return GNUNET_NO;
-
-  if (0 == strcmp ((const char *) &ha1[1], (const char *) &ha2[1]))
-    return GNUNET_YES;
-  return GNUNET_NO;
-}
-
-
-/**
- * Function obtain the network type for an address.
- *
- * @param env the environment
- * @param address the address
- * @return the network type
- */
-enum GNUNET_NetworkType
-http_common_get_network_for_address (struct
-                                     GNUNET_TRANSPORT_PluginEnvironment *env,
-                                     const struct GNUNET_HELLO_Address 
*address)
-{
-  struct sockaddr *sa;
-  enum GNUNET_NetworkType net_type;
-  size_t salen = 0;
-  int res;
-
-  net_type = GNUNET_NT_UNSPECIFIED;
-  sa = http_common_socket_from_address (address->address,
-                                        address->address_length,
-                                        &res);
-  if (GNUNET_SYSERR == res)
-    return net_type;
-  if (GNUNET_YES == res)
-  {
-    GNUNET_assert (NULL != sa);
-    if (AF_INET == sa->sa_family)
-    {
-      salen = sizeof(struct sockaddr_in);
-    }
-    else if (AF_INET6 == sa->sa_family)
-    {
-      salen = sizeof(struct sockaddr_in6);
-    }
-    net_type = env->get_address_type (env->cls,
-                                      sa,
-                                      salen);
-    GNUNET_free (sa);
-  }
-  return net_type;
-}
-
-
-/* end of plugin_transport_http_common.c */
diff --git a/src/transport/plugin_transport_http_common.h 
b/src/transport/plugin_transport_http_common.h
deleted file mode 100644
index 7a532249d..000000000
--- a/src/transport/plugin_transport_http_common.h
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2002-2014 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/plugin_transport_http_common.c
- * @brief functionality shared by http client and server transport service 
plugin
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_transport_plugin.h"
-
-/**
- * Timeout values for testing
- */
-#define TESTING GNUNET_NO
-
-#if TESTING
-#define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 3)
-#define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 3)
-#define HTTP_CLIENT_SESSION_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 7)
-#define SERVER_SESSION_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 7)
-#define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG
-
-#else
-
-#if BUILD_HTTPS
-#define PROTOCOL "https"
-#else
-#define PROTOCOL "http"
-#endif
-
-#define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 15)
-#define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 15)
-#define HTTP_CLIENT_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT
-#define HTTP_SERVER_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT
-#define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG
-
-#endif
-
-#define HTTP_DEFAULT_PORT 80
-#define HTTPS_DEFAULT_PORT 443
-
-/**
- * Bits in the `options` field of HTTP addresses.
- */
-enum HttpAddressOptions
-{
-  /**
-   * No bits set.
-   */
-  HTTP_OPTIONS_NONE = 0,
-
-  /**
-   * Verify X509 server certificate, it should be valid.
-   * (if this bit is not set, it is probably just self-
-   * signed and not expected to be verified).
-   */
-  HTTP_OPTIONS_VERIFY_CERTIFICATE = 1,
-
-  /**
-   * Enable TCP Stealth-style port knocking.
-   */
-  HTTP_OPTIONS_TCP_STEALTH = 2
-};
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * HttpAddress
- */
-struct HttpAddress
-{
-  /**
-   * Address options
-   * see `enum HttpAddressOptions`
-   */
-  uint32_t options GNUNET_PACKED;
-
-  /**
-   * Length of URL located after struct
-   */
-  uint32_t urlen GNUNET_PACKED;
-};
-
-GNUNET_NETWORK_STRUCT_END
-
-/**
- * Representation of HTTP URL split into its components.
- */
-struct SplittedHTTPAddress
-{
-  char *protocol;
-  char *host;
-  char *path;
-  int port;
-};
-
-
-/**
- * Split an HTTP address into protocol, hostname, port
- * and path components.
- */
-struct SplittedHTTPAddress *
-http_split_address (const char *addr);
-
-
-/**
- * Convert the transports address to a nice, human-readable
- * format.
- *
- * @param cls closure
- * @param type name of the transport that generated the address
- * @param addr one of the addresses of the host, NULL for the last address
- *        the specific address format depends on the transport
- * @param addrlen length of @a addr
- * @param numeric should (IP) addresses be displayed in numeric form?
- * @param timeout after how long should we give up?
- * @param asc function to call on each string
- * @param asc_cls closure for @a asc
- */
-void
-http_common_plugin_address_pretty_printer (void *cls,
-                                           const char *type,
-                                           const void *addr,
-                                           size_t addrlen,
-                                           int numeric,
-                                           struct GNUNET_TIME_Relative timeout,
-                                           
GNUNET_TRANSPORT_AddressStringCallback
-                                           asc,
-                                           void *asc_cls);
-
-
-/**
- * Function called for a quick conversion of the binary address to
- * a numeric address.  Note that the caller must not free the
- * address and that the next call to this function is allowed
- * to override the address again.
- *
- * @param plugin name of the plugin
- * @param addr binary address
- * @param addrlen length of @a addr
- * @return string representing the same address
- */
-const char *
-http_common_plugin_address_to_string (const char *plugin,
-                                      const void *addr,
-                                      size_t addrlen);
-
-
-/**
- * Function called to convert a string address to
- * a binary address.
- *
- * @param cls closure (`struct Plugin*`)
- * @param addr string address
- * @param addrlen length of @a addr
- * @param buf location to store the buffer
- *        If the function returns #GNUNET_SYSERR, its contents are undefined.
- * @param added length of created address
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-int
-http_common_plugin_string_to_address (void *cls,
-                                      const char *addr,
-                                      uint16_t addrlen,
-                                      void **buf,
-                                      size_t *added);
-
-
-/**
- * Create a HTTP address from a socketaddr
- *
- * @param protocol protocol
- * @param addr `sockaddr *` address
- * @param addrlen length of the @a addr
- * @return A pointer to a `struct HttpAddress` derived from @a addr
- */
-struct HttpAddress *
-http_common_address_from_socket (const char *protocol,
-                                 const struct sockaddr *addr,
-                                 socklen_t addrlen);
-
-
-/**
- * Create a socketaddr from a HTTP address
- *
- * @param addr a `sockaddr *` address
- * @param addrlen length of the @a addr
- * @param res the result:
- *   #GNUNET_SYSERR, invalid input,
- *   #GNUNET_YES: could convert to ip,
- *   #GNUNET_NO: valid input but could not convert to ip (hostname?)
- * @return the string
- */
-struct sockaddr *
-http_common_socket_from_address (const void *addr,
-                                 size_t addrlen,
-                                 int *res);
-
-
-const char *
-http_common_plugin_address_to_url (void *cls,
-                                   const void *addr,
-                                   size_t addrlen);
-
-
-/**
- * Get the length of an address
- *
- * @param addr address
- * @return the size
- */
-size_t
-http_common_address_get_size (const struct HttpAddress *addr);
-
-
-/**
- * Compare addr1 to addr2
- *
- * @param addr1 address1
- * @param addrlen1 length of @a address1
- * @param addr2 address2
- * @param addrlen2 length of @a address2
- * @return #GNUNET_YES if equal, #GNUNET_NO else
- */
-size_t
-http_common_cmp_addresses (const void *addr1,
-                           size_t addrlen1,
-                           const void *addr2,
-                           size_t addrlen2);
-
-
-/**
- * Function obtain the network type for an address.
- *
- * @param env the environment
- * @param address the address
- * @return the network type
- */
-enum GNUNET_NetworkType
-http_common_get_network_for_address (struct
-                                     GNUNET_TRANSPORT_PluginEnvironment *env,
-                                     const struct
-                                     GNUNET_HELLO_Address *address);
-
-
-/* end of plugin_transport_http_common.h */
diff --git a/src/transport/plugin_transport_http_server.c 
b/src/transport/plugin_transport_http_server.c
deleted file mode 100644
index 3ad2356b0..000000000
--- a/src/transport/plugin_transport_http_server.c
+++ /dev/null
@@ -1,3603 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2002-2014, 2017 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_http_server.c
- * @brief HTTP/S server transport plugin
- * @author Matthias Wachs
- * @author David Barksdale
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_plugin.h"
-#include "gnunet_nat_service.h"
-#include "plugin_transport_http_common.h"
-#include <microhttpd.h>
-#include <regex.h>
-#include "gnunet_mhd_compat.h"
-
-#if BUILD_HTTPS
-#define PLUGIN_NAME "https_server"
-#define LIBGNUNET_PLUGIN_TRANSPORT_INIT \
-  libgnunet_plugin_transport_https_server_init
-#define LIBGNUNET_PLUGIN_TRANSPORT_DONE \
-  libgnunet_plugin_transport_https_server_done
-#else
-#define PLUGIN_NAME "http_server"
-#define LIBGNUNET_PLUGIN_TRANSPORT_INIT \
-  libgnunet_plugin_transport_http_server_init
-#define LIBGNUNET_PLUGIN_TRANSPORT_DONE \
-  libgnunet_plugin_transport_http_server_done
-#endif
-
-#define HTTP_ERROR_RESPONSE \
-  "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"><HTML><HEAD><TITLE>404 
Not Found</TITLE></HEAD><BODY><H1>Not Found</H1>The requested URL was not found 
on this server.<P><HR><ADDRESS></ADDRESS></BODY></HTML>"
-#define _RECEIVE 0
-#define _SEND 1
-
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-" PLUGIN_NAME, \
-                                        __VA_ARGS__)
-
-
-/**
- * Information we keep with MHD for an HTTP request.
- */
-struct ServerRequest
-{
-  /**
-   * The session this server request belongs to
-   * Can be NULL, when session was disconnected and freed
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * The MHD connection
-   */
-  struct MHD_Connection *mhd_conn;
-
-  /**
-   * The MHD daemon
-   */
-  struct MHD_Daemon *mhd_daemon;
-
-  /**
-   * Options requested by peer
-   */
-  uint32_t options;
-#define OPTION_LONG_POLL 1 /* GET request wants long-poll semantics */
-
-  /**
-   * _RECV or _SEND
-   */
-  int direction;
-
-  /**
-   * For PUT requests: Is this the first or last callback with size 0
-   * For GET requests: Have we sent a message
-   */
-  int connected;
-
-  /**
-   * Currently suspended
-   */
-  bool suspended;
-};
-
-
-/**
- * Wrapper to manage addresses
- */
-struct HttpAddressWrapper
-{
-  /**
-   * Linked list next
-   */
-  struct HttpAddressWrapper *next;
-
-  /**
-   * Linked list previous
-   */
-  struct HttpAddressWrapper *prev;
-
-  /**
-   * An address we are using.
-   */
-  struct HttpAddress *address;
-
-  /**
-   * Length of the address.
-   */
-  size_t addrlen;
-};
-
-
-/**
- *  Message to send using http
- */
-struct HTTP_Message
-{
-  /**
-   * next pointer for double linked list
-   */
-  struct HTTP_Message *next;
-
-  /**
-   * previous pointer for double linked list
-   */
-  struct HTTP_Message *prev;
-
-  /**
-   * buffer containing data to send
-   */
-  char *buf;
-
-  /**
-   * amount of data already sent
-   */
-  size_t pos;
-
-  /**
-   * buffer length
-   */
-  size_t size;
-
-  /**
-   * HTTP/S specific overhead
-   */
-  size_t overhead;
-
-  /**
-   * Continuation function to call once the transmission buffer
-   * has again space available.  NULL if there is no
-   * continuation to call.
-   */
-  GNUNET_TRANSPORT_TransmitContinuation transmit_cont;
-
-  /**
-   * Closure for transmit_cont.
-   */
-  void *transmit_cont_cls;
-};
-
-
-/**
- * Session handle for connections.
- */
-struct GNUNET_ATS_Session
-{
-  /**
-   * To whom are we talking to (set to our identity
-   * if we are still waiting for the welcome message)
-   */
-  struct GNUNET_PeerIdentity target;
-
-  /**
-   * Pointer to the global plugin struct.
-   */
-  struct HTTP_Server_Plugin *plugin;
-
-  /**
-   * next pointer for double linked list
-   */
-  struct HTTP_Message *msg_head;
-
-  /**
-   * previous pointer for double linked list
-   */
-  struct HTTP_Message *msg_tail;
-
-  /**
-   * Message stream tokenizer for incoming data
-   */
-  struct GNUNET_MessageStreamTokenizer *msg_tk;
-
-  /**
-   * Client recv handle
-   */
-  struct ServerRequest *server_recv;
-
-  /**
-   * Client send handle
-   */
-  struct ServerRequest *server_send;
-
-  /**
-   * Address
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Absolute time when to receive data again
-   * Used for receive throttling
-   */
-  struct GNUNET_TIME_Absolute next_receive;
-
-  /**
-   * Absolute time when this connection will time out.
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * Session timeout task
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * Task to resume MHD handling when receiving is allowed again
-   */
-  struct GNUNET_SCHEDULER_Task *recv_wakeup_task;
-
-  /**
-   * Number of bytes waiting for transmission to this peer.
-   */
-  unsigned long long bytes_in_queue;
-
-  /**
-   * Number of messages waiting for transmission to this peer.
-   */
-  unsigned int msgs_in_queue;
-
-  /**
-   * Unique HTTP/S connection tag for this connection
-   */
-  uint32_t tag;
-
-  /**
-   * ATS network type.
-   */
-  enum GNUNET_NetworkType scope;
-
-  /**
-   * #GNUNET_YES if this session is known to the service.
-   */
-  int known_to_service;
-};
-
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct HTTP_Server_Plugin
-{
-  /**
-   * Our environment.
-   */
-  struct GNUNET_TRANSPORT_PluginEnvironment *env;
-
-  /**
-   * Hash map of open sessions.
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *sessions;
-
-  /**
-   * Function to call about session status changes.
-   */
-  GNUNET_TRANSPORT_SessionInfoCallback sic;
-
-  /**
-   * Closure for @e sic.
-   */
-  void *sic_cls;
-
-  /**
-   * Plugin name
-   */
-  char *name;
-
-  /**
-   * Protocol
-   */
-  char *protocol;
-
-  /**
-   * External address
-   */
-  char *external_hostname;
-
-  /**
-   * External hostname the plugin can be connected to, can be different to
-   * the host's FQDN, used e.g. for reverse proxying
-   */
-  struct GNUNET_HELLO_Address *ext_addr;
-
-  /**
-   * NAT handle & address management
-   */
-  struct GNUNET_NAT_Handle *nat;
-
-  /**
-   * IPv4 addresses DLL head
-   */
-  struct HttpAddressWrapper *addr_head;
-
-  /**
-   * IPv4 addresses DLL tail
-   */
-  struct HttpAddressWrapper *addr_tail;
-
-  /**
-   * IPv4 server socket to bind to
-   */
-  struct sockaddr_in *server_addr_v4;
-
-  /**
-   * IPv6 server socket to bind to
-   */
-  struct sockaddr_in6 *server_addr_v6;
-
-  /**
-   * MHD IPv4 daemon
-   */
-  struct MHD_Daemon *server_v4;
-
-  /**
-   * MHD IPv4 daemon
-   */
-  struct MHD_Daemon *server_v6;
-
-#if BUILD_HTTPS
-  /**
-   * Crypto related
-   *
-   * Example:
-   *
-   * Use RC4-128 instead of AES:
-   * NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL
-   *
-   */
-  char *crypto_init;
-
-  /**
-   * TLS key
-   */
-  char *key;
-
-  /**
-   * TLS certificate
-   */
-  char *cert;
-#endif
-
-  /**
-   * MHD IPv4 task
-   */
-  struct GNUNET_SCHEDULER_Task *server_v4_task;
-
-  /**
-   * MHD IPv6 task
-   */
-  struct GNUNET_SCHEDULER_Task *server_v6_task;
-
-  /**
-   * Task calling transport service about external address
-   */
-  struct GNUNET_SCHEDULER_Task *notify_ext_task;
-
-  /**
-   * Notify transport only about external address
-   */
-  unsigned int external_only;
-
-  /**
-   * The IPv4 server is scheduled to run asap
-   */
-  int server_v4_immediately;
-
-  /**
-   * The IPv6 server is scheduled to run asap
-   */
-  int server_v6_immediately;
-
-  /**
-   * Verify external address
-   */
-  int verify_external_hostname;
-
-  /**
-   * Maximum number of sockets the plugin can use
-   * Each http request /request connections are two connections
-   */
-  unsigned int max_request;
-
-  /**
-   * Current number of sockets the plugin can use
-   * Each http connection are two requests
-   */
-  unsigned int cur_request;
-
-  /**
-   * Did we immediately end the session in disconnect_cb
-   */
-  int in_shutdown;
-
-  /**
-   * Length of peer id
-   */
-  int peer_id_length;
-
-  /**
-   * My options to be included in the address
-   */
-  uint32_t options;
-
-  /**
-   * use IPv6
-   */
-  uint16_t use_ipv6;
-
-  /**
-   * use IPv4
-   */
-  uint16_t use_ipv4;
-
-  /**
-   * Port used
-   */
-  uint16_t port;
-
-  /**
-   * Regex for parsing URLs. FIXME: this seems overkill.
-   */
-  regex_t url_regex;
-};
-
-
-/**
- * If a session monitor is attached, notify it about the new
- * session state.
- *
- * @param plugin our plugin
- * @param session session that changed state
- * @param state new state of the session
- */
-static void
-notify_session_monitor (struct HTTP_Server_Plugin *plugin,
-                        struct GNUNET_ATS_Session *session,
-                        enum GNUNET_TRANSPORT_SessionState state)
-{
-  struct GNUNET_TRANSPORT_SessionInfo info;
-
-  if (NULL == plugin->sic)
-    return;
-  memset (&info, 0, sizeof(info));
-  info.state = state;
-  info.is_inbound = GNUNET_YES;
-  info.num_msg_pending = session->msgs_in_queue;
-  info.num_bytes_pending = session->bytes_in_queue;
-  info.receive_delay = session->next_receive;
-  info.session_timeout = session->timeout;
-  info.address = session->address;
-  plugin->sic (plugin->sic_cls,
-               session,
-               &info);
-}
-
-
-/**
- * Wake up an MHD connection which was suspended
- *
- * @param cls the session
- */
-static void
-server_wake_up (void *cls)
-{
-  struct GNUNET_ATS_Session *s = cls;
-
-  s->recv_wakeup_task = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p: Waking up PUT handle\n",
-       s);
-  GNUNET_assert (s->server_recv->suspended);
-  MHD_resume_connection (s->server_recv->mhd_conn);
-  s->server_recv->suspended = false;
-}
-
-
-/**
- * Reschedule the execution of both IPv4 and IPv6 server.
- *
- * @param plugin the plugin
- * @param server which server to schedule v4 or v6?
- * @param now #GNUNET_YES to schedule execution immediately, #GNUNET_NO to wait
- * until timeout
- */
-static void
-server_reschedule (struct HTTP_Server_Plugin *plugin,
-                   struct MHD_Daemon *server,
-                   int now);
-
-
-/**
- * Deletes the session.  Must not be used afterwards.
- *
- * @param s the session to delete
- */
-static void
-server_delete_session (struct GNUNET_ATS_Session *s)
-{
-  struct HTTP_Server_Plugin *plugin = s->plugin;
-  struct HTTP_Message *msg;
-
-  if (NULL != s->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (s->timeout_task);
-    s->timeout_task = NULL;
-    s->timeout = GNUNET_TIME_UNIT_ZERO_ABS;
-  }
-  if (NULL != s->recv_wakeup_task)
-  {
-    GNUNET_SCHEDULER_cancel (s->recv_wakeup_task);
-    s->recv_wakeup_task = NULL;
-    if (NULL != s->server_recv)
-    {
-      GNUNET_assert (s->server_recv->suspended);
-      s->server_recv->suspended = false;
-      MHD_resume_connection (s->server_recv->mhd_conn);
-    }
-  }
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
-                                                       &s->target,
-                                                       s));
-  while (NULL != (msg = s->msg_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (s->msg_head,
-                                 s->msg_tail,
-                                 msg);
-    if (NULL != msg->transmit_cont)
-      msg->transmit_cont (msg->transmit_cont_cls,
-                          &s->target,
-                          GNUNET_SYSERR,
-                          msg->size,
-                          msg->pos + msg->overhead);
-    GNUNET_assert (s->msgs_in_queue > 0);
-    s->msgs_in_queue--;
-    GNUNET_assert (s->bytes_in_queue >= msg->size);
-    s->bytes_in_queue -= msg->size;
-    GNUNET_free (msg);
-  }
-
-  GNUNET_assert (0 == s->msgs_in_queue);
-  GNUNET_assert (0 == s->bytes_in_queue);
-
-  if (NULL != s->server_send)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Server: %p / %p Terminating inbound PUT session to peer `%s'\n",
-         s, s->server_send,
-         GNUNET_i2s (&s->target));
-    s->server_send->session = NULL;
-    MHD_set_connection_option (s->server_send->mhd_conn,
-                               MHD_CONNECTION_OPTION_TIMEOUT,
-                               1 /* 0 = no timeout, so this is MIN */);
-    if (s->server_send->suspended)
-    {
-      s->server_send->suspended = false;
-      MHD_resume_connection (s->server_send->mhd_conn);
-    }
-    server_reschedule (plugin,
-                       s->server_send->mhd_daemon,
-                       GNUNET_YES);
-  }
-
-  if (NULL != s->server_recv)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Server: %p / %p Terminating inbound GET session to peer `%s'\n",
-         s, s->server_recv, GNUNET_i2s (&s->target));
-    s->server_recv->session = NULL;
-    MHD_set_connection_option (s->server_recv->mhd_conn,
-                               MHD_CONNECTION_OPTION_TIMEOUT,
-                               1 /* 0 = no timeout, so this is MIN */);
-    server_reschedule (plugin,
-                       s->server_recv->mhd_daemon,
-                       GNUNET_YES);
-  }
-  notify_session_monitor (plugin,
-                          s,
-                          GNUNET_TRANSPORT_SS_DONE);
-  if (GNUNET_YES == s->known_to_service)
-  {
-    plugin->env->session_end (plugin->env->cls,
-                              s->address,
-                              s);
-    s->known_to_service = GNUNET_NO;
-  }
-  if (NULL != s->msg_tk)
-  {
-    GNUNET_MST_destroy (s->msg_tk);
-    s->msg_tk = NULL;
-  }
-  GNUNET_HELLO_address_free (s->address);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p destroyed\n",
-       s);
-  GNUNET_free (s);
-}
-
-
-/**
- * Disconnect session @a s by telling MHD to close the
- * connections (reducing timeout, etc.).
- *
- * @param cls closure with the `struct HTTP_Server_Plugin`
- * @param s the session
- * @return #GNUNET_OK on success
- */
-static int
-http_server_plugin_disconnect_session (void *cls,
-                                       struct GNUNET_ATS_Session *s)
-{
-  server_delete_session (s);
-  return GNUNET_OK;
-}
-
-
-/**
- * Session was idle, so disconnect it
- *
- * @param cls the session
- */
-static void
-server_session_timeout (void *cls)
-{
-  struct GNUNET_ATS_Session *s = cls;
-  struct GNUNET_TIME_Relative left;
-
-  s->timeout_task = NULL;
-  left = GNUNET_TIME_absolute_get_remaining (s->timeout);
-  if (0 != left.rel_value_us)
-  {
-    /* not actually our turn yet, but let's at least update
-       the monitor, it may think we're about to die ... */
-    notify_session_monitor (s->plugin,
-                            s,
-                            GNUNET_TRANSPORT_SS_UP);
-    s->timeout_task = GNUNET_SCHEDULER_add_delayed (left,
-                                                    &server_session_timeout,
-                                                    s);
-    return;
-  }
-  GNUNET_log (TIMEOUT_LOG,
-              "Session %p was idle for %s, disconnecting\n",
-              s,
-              GNUNET_STRINGS_relative_time_to_string (
-                HTTP_SERVER_SESSION_TIMEOUT,
-                GNUNET_YES));
-  server_delete_session (s);
-}
-
-
-/**
- * Increment session timeout due to activity session @a s
- *
- * @param s the session
- */
-static void
-server_reschedule_session_timeout (struct GNUNET_ATS_Session *s)
-{
-  GNUNET_assert (NULL != s->timeout_task);
-  s->timeout = GNUNET_TIME_relative_to_absolute (
-    GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-}
-
-
-/**
- * Function that can be used by the transport service to transmit
- * a message using the plugin.   Note that in the case of a
- * peer disconnecting, the continuation MUST be called
- * prior to the disconnect notification itself.  This function
- * will be called with this peer's HELLO message to initiate
- * a fresh connection to another peer.
- *
- * @param cls closure
- * @param session which session must be used
- * @param msgbuf the message to transmit
- * @param msgbuf_size number of bytes in @a msgbuf
- * @param priority how important is the message (most plugins will
- *                 ignore message priority and just FIFO)
- * @param to how long to wait at most for the transmission (does not
- *                require plugins to discard the message after the timeout,
- *                just advisory for the desired delay; most plugins will ignore
- *                this as well)
- * @param cont continuation to call once the message has
- *        been transmitted (or if the transport is ready
- *        for the next transmission call; or if the
- *        peer disconnected...); can be NULL
- * @param cont_cls closure for @a cont
- * @return number of bytes used (on the physical network, with overheads);
- *         -1 on hard errors (i.e. address invalid); 0 is a legal value
- *         and does NOT mean that the message was not transmitted (DV)
- */
-static ssize_t
-http_server_plugin_send (void *cls,
-                         struct GNUNET_ATS_Session *session,
-                         const char *msgbuf,
-                         size_t msgbuf_size,
-                         unsigned int priority,
-                         struct GNUNET_TIME_Relative to,
-                         GNUNET_TRANSPORT_TransmitContinuation cont,
-                         void *cont_cls)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-  struct HTTP_Message *msg;
-  ssize_t bytes_sent = 0;
-  char *stat_txt;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p/request %p: Sending message with %lu to peer `%s'\n",
-       session,
-       session->server_send,
-       (unsigned long) msgbuf_size,
-       GNUNET_i2s (&session->target));
-
-  /* create new message and schedule */
-  bytes_sent = sizeof(struct HTTP_Message) + msgbuf_size;
-  msg = GNUNET_malloc (bytes_sent);
-  msg->next = NULL;
-  msg->size = msgbuf_size;
-  msg->pos = 0;
-  msg->buf = (char *) &msg[1];
-  msg->transmit_cont = cont;
-  msg->transmit_cont_cls = cont_cls;
-  GNUNET_memcpy (msg->buf,
-                 msgbuf,
-                 msgbuf_size);
-  GNUNET_CONTAINER_DLL_insert_tail (session->msg_head,
-                                    session->msg_tail,
-                                    msg);
-  session->msgs_in_queue++;
-  session->bytes_in_queue += msg->size;
-  notify_session_monitor (plugin,
-                          session,
-                          GNUNET_TRANSPORT_SS_UP);
-  GNUNET_asprintf (&stat_txt,
-                   "# bytes currently in %s_server buffers",
-                   plugin->protocol);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            stat_txt, msgbuf_size, GNUNET_NO);
-  GNUNET_free (stat_txt);
-
-  if (NULL != session->server_send)
-  {
-    if (session->server_send->suspended)
-    {
-      MHD_resume_connection (session->server_send->mhd_conn);
-      session->server_send->suspended = false;
-    }
-    server_reschedule (session->plugin,
-                       session->server_send->mhd_daemon,
-                       GNUNET_YES);
-  }
-  return bytes_sent;
-}
-
-
-/**
- * Terminate session during shutdown.
- *
- * @param cls the `struct HTTP_Server_Plugin *`
- * @param peer for which this is a session
- * @param value the `struct GNUNET_ATS_Session` to clean up
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-destroy_session_shutdown_cb (void *cls,
-                             const struct GNUNET_PeerIdentity *peer,
-                             void *value)
-{
-  struct GNUNET_ATS_Session *s = value;
-  struct ServerRequest *sc_send;
-  struct ServerRequest *sc_recv;
-
-  sc_send = s->server_send;
-  sc_recv = s->server_recv;
-  server_delete_session (s);
-  if (NULL != sc_send)
-    sc_send->session = NULL;
-  if (NULL != sc_recv)
-    sc_recv->session = NULL;
-
-  return GNUNET_OK;
-}
-
-
-/**
- * Terminate session.
- *
- * @param cls the `struct HTTP_Server_Plugin *`
- * @param peer for which this is a session
- * @param value the `struct GNUNET_ATS_Session` to clean up
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-destroy_session_cb (void *cls,
-                    const struct GNUNET_PeerIdentity *peer,
-                    void *value)
-{
-  struct GNUNET_ATS_Session *s = value;
-
-  server_delete_session (s);
-  return GNUNET_OK;
-}
-
-
-/**
- * Function that can be used to force the plugin to disconnect
- * from the given peer and cancel all previous transmissions
- * (and their continuationc).
- *
- * @param cls closure
- * @param target peer from which to disconnect
- */
-static void
-http_server_plugin_disconnect_peer (void *cls,
-                                    const struct GNUNET_PeerIdentity *target)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Transport tells me to disconnect `%s'\n",
-       GNUNET_i2s (target));
-  GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions,
-                                              target,
-                                              &destroy_session_cb,
-                                              plugin);
-}
-
-
-/**
- * Another peer has suggested an address for this
- * peer and transport plugin.  Check that this could be a valid
- * address.  If so, consider adding it to the list
- * of addresses.
- *
- * @param cls closure
- * @param addr pointer to the address
- * @param addrlen length of @a addr
- * @return #GNUNET_OK if this is a plausible address for this peer
- *         and transport
- */
-static int
-http_server_plugin_address_suggested (void *cls,
-                                      const void *addr,
-                                      size_t addrlen)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-  struct HttpAddressWrapper *next;
-  struct HttpAddressWrapper *pos;
-  const struct HttpAddress *haddr = addr;
-
-  if ((NULL != plugin->ext_addr) &&
-      (GNUNET_YES == (http_common_cmp_addresses (addr, addrlen,
-                                                 plugin->ext_addr->address,
-                                                 plugin->ext_addr->
-                                                 address_length))) )
-  {
-    /* Checking HTTP_OPTIONS_VERIFY_CERTIFICATE option for external hostname */
-    if ((ntohl (haddr->options) & HTTP_OPTIONS_VERIFY_CERTIFICATE) !=
-        (plugin->options & HTTP_OPTIONS_VERIFY_CERTIFICATE))
-      return GNUNET_NO;   /* VERIFY option not set as required! */
-    return GNUNET_OK;
-  }
-  next = plugin->addr_head;
-  while (NULL != (pos = next))
-  {
-    next = pos->next;
-    if (GNUNET_YES == (http_common_cmp_addresses (addr,
-                                                  addrlen,
-                                                  pos->address,
-                                                  pos->addrlen)))
-      return GNUNET_OK;
-  }
-  return GNUNET_NO;
-}
-
-
-/**
- * Creates a new outbound session the transport
- * service will use to send data to the peer.
- *
- * Since HTTP/S server cannot create sessions, always returns NULL.
- *
- * @param cls the plugin
- * @param address the address
- * @return always NULL
- */
-static struct GNUNET_ATS_Session *
-http_server_plugin_get_session (void *cls,
-                                const struct GNUNET_HELLO_Address *address)
-{
-  return NULL;
-}
-
-
-/**
- * Call MHD IPv4 to process pending requests and then go back
- * and schedule the next run.
- *
- * @param cls plugin as closure
- */
-static void
-server_v4_run (void *cls)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-
-  plugin->server_v4_task = NULL;
-  plugin->server_v4_immediately = GNUNET_NO;
-  GNUNET_assert (MHD_YES == MHD_run (plugin->server_v4));
-  server_reschedule (plugin, plugin->server_v4, GNUNET_NO);
-}
-
-
-/**
- * Call MHD IPv6 to process pending requests and then go back
- * and schedule the next run.
- *
- * @param cls plugin as closure
- */
-static void
-server_v6_run (void *cls)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-
-  plugin->server_v6_task = NULL;
-  plugin->server_v6_immediately = GNUNET_NO;
-  GNUNET_assert (MHD_YES == MHD_run (plugin->server_v6));
-  server_reschedule (plugin, plugin->server_v6, GNUNET_NO);
-}
-
-
-/**
- * Function that queries MHD's select sets and
- * starts the task waiting for them.
- *
- * @param plugin plugin
- * @param daemon_handle the MHD daemon handle
- * @param now schedule now
- * @return gnunet task identifier
- */
-static struct GNUNET_SCHEDULER_Task *
-server_schedule (struct HTTP_Server_Plugin *plugin,
-                 struct MHD_Daemon *daemon_handle,
-                 int now)
-{
-  struct GNUNET_SCHEDULER_Task *ret;
-  fd_set rs;
-  fd_set ws;
-  fd_set es;
-  struct GNUNET_NETWORK_FDSet *wrs;
-  struct GNUNET_NETWORK_FDSet *wws;
-  int max;
-  MHD_UNSIGNED_LONG_LONG timeout;
-  static unsigned long long last_timeout = 0;
-  int haveto;
-  struct GNUNET_TIME_Relative tv;
-
-  if (GNUNET_YES == plugin->in_shutdown)
-    return NULL;
-
-  ret = NULL;
-  FD_ZERO (&rs);
-  FD_ZERO (&ws);
-  FD_ZERO (&es);
-  wrs = GNUNET_NETWORK_fdset_create ();
-  wws = GNUNET_NETWORK_fdset_create ();
-  max = -1;
-  GNUNET_assert (MHD_YES ==
-                 MHD_get_fdset (daemon_handle,
-                                &rs,
-                                &ws,
-                                &es,
-                                &max));
-  haveto = MHD_get_timeout (daemon_handle, &timeout);
-  if (haveto == MHD_YES)
-  {
-    if (timeout != last_timeout)
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "SELECT Timeout changed from %llu to %llu (ms)\n",
-           last_timeout, timeout);
-      last_timeout = timeout;
-    }
-    if (timeout <= GNUNET_TIME_UNIT_SECONDS.rel_value_us / 1000LL)
-      tv.rel_value_us = (uint64_t) timeout * 1000LL;
-    else
-      tv = GNUNET_TIME_UNIT_SECONDS;
-  }
-  else
-    tv = GNUNET_TIME_UNIT_SECONDS;
-  /* Force immediate run, since we have outbound data to send */
-  if (now == GNUNET_YES)
-    tv = GNUNET_TIME_UNIT_MILLISECONDS;
-  GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1);
-  GNUNET_NETWORK_fdset_copy_native (wws, &ws, max + 1);
-
-  if (daemon_handle == plugin->server_v4)
-  {
-    if (plugin->server_v4_task != NULL)
-    {
-      GNUNET_SCHEDULER_cancel (plugin->server_v4_task);
-      plugin->server_v4_task = NULL;
-    }
-#if 0
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Scheduling IPv4 server task in %llu ms\n",
-         tv);
-#endif
-    ret =
-      GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   tv, wrs, wws,
-                                   &server_v4_run, plugin);
-  }
-  if (daemon_handle == plugin->server_v6)
-  {
-    if (plugin->server_v6_task != NULL)
-    {
-      GNUNET_SCHEDULER_cancel (plugin->server_v6_task);
-      plugin->server_v6_task = NULL;
-    }
-#if 0
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Scheduling IPv6 server task in %llu ms\n", tv);
-#endif
-    ret =
-      GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   tv, wrs, wws,
-                                   &server_v6_run, plugin);
-  }
-  GNUNET_NETWORK_fdset_destroy (wrs);
-  GNUNET_NETWORK_fdset_destroy (wws);
-  return ret;
-}
-
-
-/**
- * Reschedule the execution of both IPv4 and IPv6 server
- *
- * @param plugin the plugin
- * @param server which server to schedule v4 or v6?
- * @param now #GNUNET_YES to schedule execution immediately, #GNUNET_NO to wait
- * until timeout
- */
-static void
-server_reschedule (struct HTTP_Server_Plugin *plugin,
-                   struct MHD_Daemon *server,
-                   int now)
-{
-  if ((server == plugin->server_v4) && (plugin->server_v4 != NULL))
-  {
-    if (GNUNET_YES == plugin->server_v4_immediately)
-      return;   /* No rescheduling, server will run asap */
-
-    if (GNUNET_YES == now)
-      plugin->server_v4_immediately = GNUNET_YES;
-
-    if (plugin->server_v4_task != NULL)
-    {
-      GNUNET_SCHEDULER_cancel (plugin->server_v4_task);
-      plugin->server_v4_task = NULL;
-    }
-    plugin->server_v4_task = server_schedule (plugin, plugin->server_v4, now);
-  }
-
-  if ((server == plugin->server_v6) && (plugin->server_v6 != NULL))
-  {
-    if (GNUNET_YES == plugin->server_v6_immediately)
-      return;   /* No rescheduling, server will run asap */
-
-    if (GNUNET_YES == now)
-      plugin->server_v6_immediately = GNUNET_YES;
-
-    if (plugin->server_v6_task != NULL)
-    {
-      GNUNET_SCHEDULER_cancel (plugin->server_v6_task);
-      plugin->server_v6_task = NULL;
-    }
-    plugin->server_v6_task = server_schedule (plugin, plugin->server_v6, now);
-  }
-}
-
-
-/**
- * Function that is called to get the keepalive factor.
- * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
- * calculate the interval between keepalive packets.
- *
- * @param cls closure with the `struct HTTP_Server_Plugin`
- * @return keepalive factor
- */
-static unsigned int
-http_server_query_keepalive_factor (void *cls)
-{
-  return 3;
-}
-
-
-/**
- * Function that will be called whenever the transport service wants to
- * notify the plugin that a session is still active and in use and
- * therefore the session timeout for this session has to be updated
- *
- * @param cls closure
- * @param peer which peer was the session for
- * @param session which session is being updated
- */
-static void
-http_server_plugin_update_session_timeout (void *cls,
-                                           const struct
-                                           GNUNET_PeerIdentity *peer,
-                                           struct GNUNET_ATS_Session *session)
-{
-  server_reschedule_session_timeout (session);
-}
-
-
-/**
- * Tell MHD that the connection should timeout after @a to seconds.
- *
- * @param plugin our plugin
- * @param s session for which the timeout changes
- * @param to timeout in seconds
- */
-static void
-server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin,
-                               struct GNUNET_ATS_Session *s,
-                               unsigned int to)
-{
-  /* Setting timeouts for other connections */
-  if (NULL != s->server_recv)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Setting timeout for %p to %u sec.\n",
-         s->server_recv, to);
-    MHD_set_connection_option (s->server_recv->mhd_conn,
-                               MHD_CONNECTION_OPTION_TIMEOUT,
-                               to);
-    server_reschedule (plugin, s->server_recv->mhd_daemon, GNUNET_NO);
-  }
-  if (NULL != s->server_send)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Setting timeout for %p to %u sec.\n",
-         s->server_send, to);
-    MHD_set_connection_option (s->server_send->mhd_conn,
-                               MHD_CONNECTION_OPTION_TIMEOUT,
-                               to);
-    server_reschedule (plugin, s->server_send->mhd_daemon, GNUNET_NO);
-  }
-}
-
-
-/**
- * Parse incoming URL for tag and target
- *
- * @param plugin plugin
- * @param url incoming url
- * @param target where to store the target
- * @param tag where to store the tag
- * @param options where to store the options
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-static int
-server_parse_url (struct HTTP_Server_Plugin *plugin,
-                  const char *url,
-                  struct GNUNET_PeerIdentity *target,
-                  uint32_t *tag,
-                  uint32_t *options)
-{
-  regmatch_t matches[4];
-  const char *tag_start;
-  const char *target_start;
-  char *tag_end;
-  char *options_end;
-  size_t hash_length;
-  unsigned long int rc;
-
-  /* URL parsing */
-#define URL_REGEX \
-  ("^.*/([0-9A-Z]+);([0-9]+)(,[0-9]+)?$")
-
-  if (NULL == url)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-
-  if (regexec (&plugin->url_regex, url, 4, matches, 0))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "URL `%s' did not match regex\n", url);
-    return GNUNET_SYSERR;
-  }
-
-  target_start = &url[matches[1].rm_so];
-  tag_start = &url[matches[2].rm_so];
-
-  /* convert tag */
-  rc = strtoul (tag_start, &tag_end, 10);
-  if (&url[matches[2].rm_eo] != tag_end)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "URL tag did not line up with submatch\n");
-    return GNUNET_SYSERR;
-  }
-  if (rc == 0)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "URL tag is zero\n");
-    return GNUNET_SYSERR;
-  }
-  if ((rc == ULONG_MAX) && (ERANGE == errno))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "URL tag > ULONG_MAX\n");
-    return GNUNET_SYSERR;
-  }
-  if (rc > UINT32_MAX)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "URL tag > UINT32_MAX\n");
-    return GNUNET_SYSERR;
-  }
-  (*tag) = (uint32_t) rc;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Found tag `%u' in url\n",
-       *tag);
-
-  /* convert peer id */
-  hash_length = matches[1].rm_eo - matches[1].rm_so;
-  if (hash_length != plugin->peer_id_length)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "URL target is %lu bytes, expecting %u\n",
-         (unsigned long) hash_length, plugin->peer_id_length);
-    return GNUNET_SYSERR;
-  }
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_eddsa_public_key_from_string (target_start,
-                                                  hash_length,
-                                                  &target->public_key))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "URL target conversion failed\n");
-    return GNUNET_SYSERR;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Found target `%s' in URL\n",
-       GNUNET_i2s_full (target));
-
-  /* convert options */
-  if (-1 == matches[3].rm_so)
-  {
-    *options = 0;
-  }
-  else
-  {
-    rc = strtoul (&url[matches[3].rm_so + 1], &options_end, 10);
-    if (&url[matches[3].rm_eo] != options_end)
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "URL options did not line up with submatch\n");
-      return GNUNET_SYSERR;
-    }
-    if ((rc == ULONG_MAX) && (ERANGE == errno))
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "URL options > ULONG_MAX\n");
-      return GNUNET_SYSERR;
-    }
-    if (rc > UINT32_MAX)
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "URL options > UINT32_MAX\n");
-      return GNUNET_SYSERR;
-    }
-    (*options) = (uint32_t) rc;
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Found options `%u' in url\n",
-         *options);
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Closure for #session_tag_it().
- */
-struct GNUNET_ATS_SessionTagContext
-{
-  /**
-   * Set to session matching the tag.
-   */
-  struct GNUNET_ATS_Session *res;
-
-  /**
-   * Tag we are looking for.
-   */
-  uint32_t tag;
-};
-
-
-/**
- * Find a session with a matching tag.
- *
- * @param cls the `struct GNUNET_ATS_SessionTagContext *`
- * @param key peer identity (unused)
- * @param value the `struct GNUNET_ATS_Session *`
- * @return #GNUNET_NO if we found the session, #GNUNET_OK if not
- */
-static int
-session_tag_it (void *cls,
-                const struct GNUNET_PeerIdentity *key,
-                void *value)
-{
-  struct GNUNET_ATS_SessionTagContext *stc = cls;
-  struct GNUNET_ATS_Session *s = value;
-
-  if (s->tag == stc->tag)
-  {
-    stc->res = s;
-    return GNUNET_NO;
-  }
-  return GNUNET_YES;
-}
-
-
-/**
- * Lookup a mhd connection and create one if none is found
- *
- * @param plugin the plugin handle
- * @param mhd_connection the incoming mhd_connection
- * @param url incoming requested URL
- * @param method PUT or GET
- * @return the server connecetion
- */
-static struct ServerRequest *
-server_lookup_connection (struct HTTP_Server_Plugin *plugin,
-                          struct MHD_Connection *mhd_connection,
-                          const char *url,
-                          const char *method)
-{
-  struct GNUNET_ATS_Session *s = NULL;
-  struct ServerRequest *sc = NULL;
-  const union MHD_ConnectionInfo *conn_info;
-  struct HttpAddress *addr;
-  struct GNUNET_PeerIdentity target;
-  size_t addr_len;
-  struct GNUNET_ATS_SessionTagContext stc;
-  uint32_t options;
-  int direction = GNUNET_SYSERR;
-  unsigned int to;
-  enum GNUNET_NetworkType scope;
-
-  conn_info = MHD_get_connection_info (mhd_connection,
-                                       MHD_CONNECTION_INFO_CLIENT_ADDRESS);
-  if ((conn_info->client_addr->sa_family != AF_INET) &&
-      (conn_info->client_addr->sa_family != AF_INET6))
-    return NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "New %s request from %s\n",
-       method,
-       url);
-  stc.tag = 0;
-  options = 0; /* make gcc happy */
-  if (GNUNET_SYSERR ==
-      server_parse_url (plugin, url, &target, &stc.tag, &options))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Invalid url %s\n", url);
-    return NULL;
-  }
-  if (0 == strcmp (MHD_HTTP_METHOD_PUT, method))
-    direction = _RECEIVE;
-  else if (0 == strcmp (MHD_HTTP_METHOD_GET, method))
-    direction = _SEND;
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Invalid method %s for request from %s\n",
-         method, url);
-    return NULL;
-  }
-
-  plugin->cur_request++;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "New %s request from %s with tag %u (%u of %u)\n",
-       method,
-       GNUNET_i2s (&target),
-       stc.tag,
-       plugin->cur_request, plugin->max_request);
-  /* find existing session */
-  stc.res = NULL;
-  GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions,
-                                              &target,
-                                              &session_tag_it,
-                                              &stc);
-  if (NULL == (s = stc.res))
-  {
-    /* create new session */
-    addr = NULL;
-    switch (conn_info->client_addr->sa_family)
-    {
-    case (AF_INET):
-      addr = http_common_address_from_socket (plugin->protocol,
-                                              conn_info->client_addr,
-                                              sizeof(struct sockaddr_in));
-      addr_len = http_common_address_get_size (addr);
-      scope = plugin->env->get_address_type (plugin->env->cls,
-                                             conn_info->client_addr,
-                                             sizeof(struct sockaddr_in));
-      break;
-
-    case (AF_INET6):
-      addr = http_common_address_from_socket (plugin->protocol,
-                                              conn_info->client_addr,
-                                              sizeof(struct sockaddr_in6));
-      addr_len = http_common_address_get_size (addr);
-      scope = plugin->env->get_address_type (plugin->env->cls,
-                                             conn_info->client_addr,
-                                             sizeof(struct sockaddr_in6));
-      break;
-
-    default:
-      /* external host name */
-      return NULL;
-    }
-    s = GNUNET_new (struct GNUNET_ATS_Session);
-    s->target = target;
-    s->plugin = plugin;
-    s->scope = scope;
-    s->address = GNUNET_HELLO_address_allocate (&s->target,
-                                                PLUGIN_NAME,
-                                                addr,
-                                                addr_len,
-                                                
GNUNET_HELLO_ADDRESS_INFO_INBOUND);
-    s->next_receive = GNUNET_TIME_UNIT_ZERO_ABS;
-    s->tag = stc.tag;
-    s->timeout = GNUNET_TIME_relative_to_absolute 
(HTTP_SERVER_SESSION_TIMEOUT);
-    s->timeout_task = GNUNET_SCHEDULER_add_delayed 
(HTTP_SERVER_SESSION_TIMEOUT,
-                                                    &server_session_timeout,
-                                                    s);
-    (void) GNUNET_CONTAINER_multipeermap_put (plugin->sessions,
-                                              &s->target,
-                                              s,
-                                              
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-    notify_session_monitor (plugin,
-                            s,
-                            GNUNET_TRANSPORT_SS_INIT);
-    notify_session_monitor (plugin,
-                            s,
-                            GNUNET_TRANSPORT_SS_HANDSHAKE);
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Creating new session %p for peer `%s' connecting from `%s'\n",
-         s, GNUNET_i2s (&target),
-         http_common_plugin_address_to_string (plugin->protocol,
-                                               addr,
-                                               addr_len));
-    GNUNET_free (addr);
-  }
-
-  if ((_RECEIVE == direction) &&
-      (NULL != s->server_recv))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Duplicate PUT request from `%s' tag %u, dismissing new request\n",
-         GNUNET_i2s (&target),
-         stc.tag);
-    return NULL;
-  }
-  if ((_SEND == direction) && (NULL != s->server_send))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Duplicate GET request from `%s' tag %u, dismissing new request\n",
-         GNUNET_i2s (&target),
-         stc.tag);
-    return NULL;
-  }
-  sc = GNUNET_new (struct ServerRequest);
-  if (conn_info->client_addr->sa_family == AF_INET)
-    sc->mhd_daemon = plugin->server_v4;
-  if (conn_info->client_addr->sa_family == AF_INET6)
-    sc->mhd_daemon = plugin->server_v6;
-  sc->mhd_conn = mhd_connection;
-  sc->direction = direction;
-  sc->connected = GNUNET_NO;
-  sc->session = s;
-  sc->options = options;
-  if (direction == _SEND)
-  {
-    s->server_send = sc;
-  }
-  if (direction == _RECEIVE)
-  {
-    s->server_recv = sc;
-  }
-
-  if ((GNUNET_NO == s->known_to_service) &&
-      (NULL != s->server_send) &&
-      (NULL != s->server_recv))
-  {
-    s->known_to_service = GNUNET_YES;
-    notify_session_monitor (plugin,
-                            s,
-                            GNUNET_TRANSPORT_SS_UP);
-    plugin->env->session_start (plugin->env->cls,
-                                s->address,
-                                s,
-                                s->scope);
-  }
-
-  to = (HTTP_SERVER_SESSION_TIMEOUT.rel_value_us / 1000LL / 1000LL);
-  server_mhd_connection_timeout (plugin, s, to);
-  return sc;
-}
-
-
-/**
- * Callback called by MHD when it needs data to send
- *
- * @param cls current session
- * @param pos position in buffer
- * @param buf the buffer to write data to
- * @param max max number of bytes available in @a buf
- * @return bytes written to @a buf
- */
-static ssize_t
-server_send_callback (void *cls,
-                      uint64_t pos,
-                      char *buf,
-                      size_t max)
-{
-  struct ServerRequest *sc = cls;
-  struct GNUNET_ATS_Session *s = sc->session;
-  ssize_t bytes_read = 0;
-  struct HTTP_Message *msg;
-  char *stat_txt;
-
-  if (NULL == s)
-  {
-    /* session is disconnecting */
-    return 0;
-  }
-
-  sc = s->server_send;
-  if (NULL == sc)
-    return 0;
-  msg = s->msg_head;
-  if (NULL != msg)
-  {
-    /* sending */
-    bytes_read = GNUNET_MIN (msg->size - msg->pos,
-                             max);
-    GNUNET_memcpy (buf, &msg->buf[msg->pos], bytes_read);
-    msg->pos += bytes_read;
-
-    /* removing message */
-    if (msg->pos == msg->size)
-    {
-      GNUNET_CONTAINER_DLL_remove (s->msg_head,
-                                   s->msg_tail,
-                                   msg);
-      if (NULL != msg->transmit_cont)
-        msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_OK,
-                            msg->size, msg->size + msg->overhead);
-      GNUNET_assert (s->msgs_in_queue > 0);
-      s->msgs_in_queue--;
-      GNUNET_assert (s->bytes_in_queue >= msg->size);
-      s->bytes_in_queue -= msg->size;
-      GNUNET_free (msg);
-      notify_session_monitor (s->plugin,
-                              s,
-                              GNUNET_TRANSPORT_SS_UPDATE);
-    }
-  }
-  if (0 < bytes_read)
-  {
-    sc->connected = GNUNET_YES;
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Sent %lu bytes to peer `%s' with session %p \n",
-         (unsigned long) bytes_read,
-         GNUNET_i2s (&s->target),
-         s);
-    GNUNET_asprintf (&stat_txt,
-                     "# bytes currently in %s_server buffers",
-                     s->plugin->protocol);
-    GNUNET_STATISTICS_update (s->plugin->env->stats,
-                              stat_txt,
-                              -bytes_read,
-                              GNUNET_NO);
-    GNUNET_free (stat_txt);
-    GNUNET_asprintf (&stat_txt,
-                     "# bytes transmitted via %s_server",
-                     s->plugin->protocol);
-    GNUNET_STATISTICS_update (s->plugin->env->stats,
-                              stat_txt, bytes_read, GNUNET_NO);
-    GNUNET_free (stat_txt);
-  }
-  else if ((sc->options & OPTION_LONG_POLL) && sc->connected)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Completing GET response to peer `%s' with session %p\n",
-         GNUNET_i2s (&s->target),
-         s);
-    return MHD_CONTENT_READER_END_OF_STREAM;
-  }
-  else
-  {
-    MHD_suspend_connection (s->server_send->mhd_conn);
-    s->server_send->suspended = true;
-    return 0;
-  }
-  return bytes_read;
-}
-
-
-/**
- * Callback called by MessageStreamTokenizer when a message has arrived
- *
- * @param cls current session as closure
- * @param message the message to be forwarded to transport service
- * @return #GNUNET_OK (all OK)
- */
-static int
-server_receive_mst_cb (void *cls,
-                       const struct GNUNET_MessageHeader *message)
-{
-  struct GNUNET_ATS_Session *s = cls;
-  struct HTTP_Server_Plugin *plugin = s->plugin;
-  struct GNUNET_TIME_Relative delay;
-  char *stat_txt;
-
-  if (GNUNET_NO == s->known_to_service)
-  {
-    s->known_to_service = GNUNET_YES;
-    plugin->env->session_start (plugin->env->cls,
-                                s->address,
-                                s,
-                                s->scope);
-    notify_session_monitor (plugin,
-                            s,
-                            GNUNET_TRANSPORT_SS_UP);
-  }
-  delay = plugin->env->receive (plugin->env->cls,
-                                s->address,
-                                s,
-                                message);
-  GNUNET_asprintf (&stat_txt,
-                   "# bytes received via %s_server",
-                   plugin->protocol);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            stat_txt,
-                            ntohs (message->size),
-                            GNUNET_NO);
-  GNUNET_free (stat_txt);
-  s->next_receive = GNUNET_TIME_relative_to_absolute (delay);
-  if (delay.rel_value_us > 0)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Peer `%s' address `%s' next read delayed for %s\n",
-         GNUNET_i2s (&s->target),
-         http_common_plugin_address_to_string (plugin->protocol,
-                                               s->address->address,
-                                               s->address->address_length),
-         GNUNET_STRINGS_relative_time_to_string (delay,
-                                                 GNUNET_YES));
-  }
-  server_reschedule_session_timeout (s);
-  return GNUNET_OK;
-}
-
-
-/**
- * Add headers to a request indicating that we allow Cross-Origin Resource
- * Sharing.
- *
- * @param response response object to modify
- */
-static void
-add_cors_headers (struct MHD_Response *response)
-{
-  MHD_add_response_header (response,
-                           "Access-Control-Allow-Origin",
-                           "*");
-  MHD_add_response_header (response,
-                           "Access-Control-Allow-Methods",
-                           "GET, PUT, OPTIONS");
-  MHD_add_response_header (response,
-                           "Access-Control-Max-Age",
-                           "86400");
-}
-
-
-/**
- * MHD callback for a new incoming connection
- *
- * @param cls the plugin handle
- * @param mhd_connection the mhd connection
- * @param url the requested URL
- * @param method GET or PUT
- * @param version HTTP version
- * @param upload_data upload data
- * @param upload_data_size size of @a upload_data
- * @param httpSessionCache the session cache to remember the connection
- * @return #MHD_YES if connection is accepted, #MHD_NO on reject
- */
-static MHD_RESULT
-server_access_cb (void *cls,
-                  struct MHD_Connection *mhd_connection,
-                  const char *url,
-                  const char *method,
-                  const char *version,
-                  const char *upload_data,
-                  size_t *upload_data_size,
-                  void **httpSessionCache)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-  struct ServerRequest *sc = *httpSessionCache;
-  struct GNUNET_ATS_Session *s;
-  struct MHD_Response *response;
-  MHD_RESULT res = MHD_YES;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       _ (
-         "Access from connection %p (%u of %u) for `%s' `%s' url `%s' with 
upload data size %lu\n"),
-       sc,
-       plugin->cur_request,
-       plugin->max_request,
-       method,
-       version,
-       url,
-       (unsigned long) (*upload_data_size));
-  if (NULL == sc)
-  {
-    /* CORS pre-flight request */
-    if (0 == strcmp (MHD_HTTP_METHOD_OPTIONS, method))
-    {
-      response = MHD_create_response_from_buffer (0, NULL,
-                                                  MHD_RESPMEM_PERSISTENT);
-      add_cors_headers (response);
-      res = MHD_queue_response (mhd_connection, MHD_HTTP_OK, response);
-      MHD_destroy_response (response);
-      return res;
-    }
-    /* new connection */
-    sc = server_lookup_connection (plugin, mhd_connection, url, method);
-    if (NULL != sc)
-    {
-      /* attach to new / existing session */
-      (*httpSessionCache) = sc;
-    }
-    else
-    {
-      /* existing session already has matching connection, refuse */
-      response = MHD_create_response_from_buffer (strlen (HTTP_ERROR_RESPONSE),
-                                                  HTTP_ERROR_RESPONSE,
-                                                  MHD_RESPMEM_PERSISTENT);
-      MHD_add_response_header (response,
-                               MHD_HTTP_HEADER_CONTENT_TYPE,
-                               "text/html");
-      add_cors_headers (response);
-      res = MHD_queue_response (mhd_connection, MHD_HTTP_NOT_FOUND, response);
-      MHD_destroy_response (response);
-      return res;
-    }
-  }
-  /* 'old' connection */
-  if (NULL == (s = sc->session))
-  {
-    /* Session was already disconnected;
-       sent HTTP/1.1: 200 OK as response */
-    response = MHD_create_response_from_buffer (strlen ("Thank you!"),
-                                                "Thank you!",
-                                                MHD_RESPMEM_PERSISTENT);
-    add_cors_headers (response);
-    MHD_queue_response (mhd_connection, MHD_HTTP_OK, response);
-    MHD_destroy_response (response);
-    return MHD_YES;
-  }
-
-  if (sc->direction == _SEND)
-  {
-    response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 32 * 1024,
-                                                  &server_send_callback, sc,
-                                                  NULL);
-    add_cors_headers (response);
-    MHD_queue_response (mhd_connection, MHD_HTTP_OK, response);
-    MHD_destroy_response (response);
-    return MHD_YES;
-  }
-  if (sc->direction == _RECEIVE)
-  {
-    if ((*upload_data_size == 0) && (sc->connected == GNUNET_NO))
-    {
-      /* (*upload_data_size == 0) first callback when header are passed */
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Session %p / Connection %p: Peer `%s' PUT on address `%s' 
connected\n",
-           s, sc,
-           GNUNET_i2s (&s->target),
-           http_common_plugin_address_to_string (plugin->protocol,
-                                                 s->address->address,
-                                                 s->address->address_length));
-      sc->connected = GNUNET_YES;
-      return MHD_YES;
-    }
-    else if ((*upload_data_size == 0) && (sc->connected == GNUNET_YES))
-    {
-      /* (*upload_data_size == 0) when upload is complete */
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Session %p / Connection %p: Peer `%s' PUT on address `%s' finished 
upload\n",
-           s, sc,
-           GNUNET_i2s (&s->target),
-           http_common_plugin_address_to_string (plugin->protocol,
-                                                 s->address->address,
-                                                 s->address->address_length));
-      sc->connected = GNUNET_NO;
-      /* Sent HTTP/1.1: 200 OK as PUT Response\ */
-      response = MHD_create_response_from_buffer (strlen ("Thank you!"),
-                                                  "Thank you!",
-                                                  MHD_RESPMEM_PERSISTENT);
-      add_cors_headers (response);
-      MHD_queue_response (mhd_connection, MHD_HTTP_OK, response);
-      MHD_destroy_response (response);
-      return MHD_YES;
-    }
-    else if ((*upload_data_size > 0) && (sc->connected == GNUNET_YES))
-    {
-      struct GNUNET_TIME_Relative delay;
-
-      /* (*upload_data_size > 0) for every segment received */
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Session %p / Connection %p: Peer `%s' PUT on address `%s' received 
%lu bytes\n",
-           s, sc,
-           GNUNET_i2s (&s->target),
-           http_common_plugin_address_to_string (plugin->protocol,
-                                                 s->address->address,
-                                                 s->address->address_length),
-           (unsigned long) *upload_data_size);
-      delay = GNUNET_TIME_absolute_get_remaining (s->next_receive);
-      if (0 == delay.rel_value_us)
-      {
-        LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "PUT with %lu bytes forwarded to MST\n",
-             (unsigned long) *upload_data_size);
-        if (s->msg_tk == NULL)
-        {
-          s->msg_tk = GNUNET_MST_create (&server_receive_mst_cb,
-                                         s);
-        }
-        GNUNET_MST_from_buffer (s->msg_tk,
-                                upload_data,
-                                *upload_data_size,
-                                GNUNET_NO, GNUNET_NO);
-        server_mhd_connection_timeout (plugin, s,
-                                       
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.
-                                       rel_value_us / 1000LL
-                                       / 1000LL);
-        (*upload_data_size) = 0;
-      }
-      else
-      {
-        /* delay processing */
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Session %p / Connection %p: no inbound bandwidth 
available! Next read was delayed by %s\n",
-                    s,
-                    sc,
-                    GNUNET_STRINGS_relative_time_to_string (delay,
-                                                            GNUNET_YES));
-        GNUNET_assert (s->server_recv->mhd_conn == mhd_connection);
-        MHD_suspend_connection (s->server_recv->mhd_conn);
-        s->server_recv->suspended = true;
-        if (NULL == s->recv_wakeup_task)
-          s->recv_wakeup_task
-            = GNUNET_SCHEDULER_add_delayed (delay,
-                                            &server_wake_up,
-                                            s);
-      }
-      return MHD_YES;
-    }
-    else
-    {
-      GNUNET_break (0);
-      return MHD_NO;
-    }
-  }
-  return res;
-}
-
-
-/**
- * Callback from MHD when a connection disconnects
- *
- * @param cls closure with the `struct HTTP_Server_Plugin *`
- * @param connection the disconnected MHD connection
- * @param httpSessionCache the pointer to distinguish
- */
-static void
-server_disconnect_cb (void *cls,
-                      struct MHD_Connection *connection,
-                      void **httpSessionCache)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-  struct ServerRequest *sc = *httpSessionCache;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Disconnect for connection %p\n",
-       sc);
-  if (NULL == sc)
-  {
-    /* CORS pre-flight request finished */
-    return;
-  }
-
-  if (NULL != sc->session)
-  {
-    if (sc->direction == _SEND)
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Peer `%s' connection  %p, GET on address `%s' disconnected\n",
-           GNUNET_i2s (&sc->session->target),
-           sc->session->server_send,
-           http_common_plugin_address_to_string (plugin->protocol,
-                                                 sc->session->address->address,
-                                                 sc->session->address->
-                                                 address_length));
-
-      sc->session->server_send = NULL;
-    }
-    else if (sc->direction == _RECEIVE)
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Peer `%s' connection %p PUT on address `%s' disconnected\n",
-           GNUNET_i2s (&sc->session->target),
-           sc->session->server_recv,
-           http_common_plugin_address_to_string (plugin->protocol,
-                                                 sc->session->address->address,
-                                                 sc->session->address->
-                                                 address_length));
-      sc->session->server_recv = NULL;
-      if (NULL != sc->session->msg_tk)
-      {
-        GNUNET_MST_destroy (sc->session->msg_tk);
-        sc->session->msg_tk = NULL;
-      }
-    }
-  }
-  GNUNET_free (sc);
-  plugin->cur_request--;
-}
-
-
-/**
- * Callback from MHD when a connection starts/stops
- *
- * @param cls closure with the `struct HTTP_Server_Plugin *`
- * @param connection connection handle
- * @param socket_context socket-specific pointer
- * @param toe reason for connection notification
- * @see #MHD_OPTION_NOTIFY_CONNECTION
- */
-static void
-server_connection_cb (void *cls,
-                      struct MHD_Connection *connection,
-                      void **socket_context,
-                      enum MHD_ConnectionNotificationCode toe)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-  const union MHD_ConnectionInfo *info;
-
-  if (MHD_CONNECTION_NOTIFY_STARTED == toe)
-    return;
-
-  /* Reschedule to remove closed socket from our select set */
-  info = MHD_get_connection_info (connection,
-                                  MHD_CONNECTION_INFO_DAEMON);
-  GNUNET_assert (NULL != info);
-  server_reschedule (plugin,
-                     info->daemon,
-                     GNUNET_YES);
-}
-
-
-/**
- * Check if incoming connection is accepted.
- *
- * @param cls plugin as closure
- * @param addr address of incoming connection
- * @param addr_len number of bytes in @a addr
- * @return #MHD_YES if connection is accepted, #MHD_NO if connection is 
rejected
- */
-static MHD_RESULT
-server_accept_cb (void *cls,
-                  const struct sockaddr *addr,
-                  socklen_t addr_len)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-
-  if (plugin->cur_request <= plugin->max_request)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         _ ("Accepting connection (%u of %u) from `%s'\n"),
-         plugin->cur_request, plugin->max_request,
-         GNUNET_a2s (addr, addr_len));
-    return MHD_YES;
-  }
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         _ (
-           "Server reached maximum number connections (%u), rejecting new 
connection\n"),
-         plugin->max_request);
-    return MHD_NO;
-  }
-}
-
-
-/**
- * Log function called by MHD.
- *
- * @param arg NULL
- * @param fmt format string
- * @param ap arguments for the format string (va_start() and va_end()
- *           will be called by MHD)
- */
-static void
-server_log (void *arg,
-            const char *fmt,
-            va_list ap)
-{
-  char text[1024];
-
-  vsnprintf (text,
-             sizeof(text),
-             fmt,
-             ap);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Server: %s\n",
-              text);
-}
-
-
-#if BUILD_HTTPS
-/**
- * Load ssl certificate from file
- *
- * @param file filename
- * @return content of the file
- */
-static char *
-server_load_file (const char *file)
-{
-  struct GNUNET_DISK_FileHandle *gn_file;
-  uint64_t fsize;
-  char *text = NULL;
-
-  if (GNUNET_OK != GNUNET_DISK_file_size (file,
-                                          &fsize, GNUNET_NO, GNUNET_YES))
-    return NULL;
-  text = GNUNET_malloc (fsize + 1);
-  gn_file =
-    GNUNET_DISK_file_open (file, GNUNET_DISK_OPEN_READ,
-                           GNUNET_DISK_PERM_USER_READ);
-  if (NULL == gn_file)
-  {
-    GNUNET_free (text);
-    return NULL;
-  }
-  if (GNUNET_SYSERR == GNUNET_DISK_file_read (gn_file, text, fsize))
-  {
-    GNUNET_free (text);
-    GNUNET_DISK_file_close (gn_file);
-    return NULL;
-  }
-  text[fsize] = '\0';
-  GNUNET_DISK_file_close (gn_file);
-  return text;
-}
-
-
-#endif
-
-
-#if BUILD_HTTPS
-/**
- * Load ssl certificate
- *
- * @param plugin the plugin
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-static int
-server_load_certificate (struct HTTP_Server_Plugin *plugin)
-{
-  int res = GNUNET_OK;
-  char *key_file;
-  char *cert_file;
-
-
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_filename (plugin->env->cfg,
-                                               plugin->name,
-                                               "KEY_FILE", &key_file))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               plugin->name, "CERT_FILE");
-    return GNUNET_SYSERR;
-  }
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_filename (plugin->env->cfg,
-                                               plugin->name,
-                                               "CERT_FILE", &cert_file))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               plugin->name, "CERT_FILE");
-    GNUNET_free (key_file);
-    return GNUNET_SYSERR;
-  }
-  /* Get crypto init string from config. If not present, use
-   * default values */
-  if (GNUNET_OK ==
-      GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg,
-                                             plugin->name,
-                                             "CRYPTO_INIT",
-                                             &plugin->crypto_init))
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Using crypto init string `%s'\n",
-         plugin->crypto_init);
-  else
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Using default crypto init string \n");
-
-  /* read key & certificates from file */
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Trying to loading TLS certificate from key-file `%s' 
cert-file`%s'\n",
-              key_file, cert_file);
-
-  plugin->key = server_load_file (key_file);
-  plugin->cert = server_load_file (cert_file);
-
-  if ((plugin->key == NULL) || (plugin->cert == NULL))
-  {
-    struct GNUNET_OS_Process *cert_creation;
-
-    GNUNET_free (plugin->key);
-    plugin->key = NULL;
-    GNUNET_free (plugin->cert);
-    plugin->cert = NULL;
-
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "No usable TLS certificate found, creating certificate\n");
-    errno = 0;
-    cert_creation =
-      GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
-                               NULL, NULL, NULL,
-                               "gnunet-transport-certificate-creation",
-                               "gnunet-transport-certificate-creation",
-                               key_file,
-                               cert_file,
-                               NULL);
-    if (NULL == cert_creation)
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ (
-             "Could not create a new TLS certificate, program 
`gnunet-transport-certificate-creation' could not be started!\n"));
-      GNUNET_free (key_file);
-      GNUNET_free (cert_file);
-
-      GNUNET_free (plugin->key);
-      plugin->key = NULL;
-      GNUNET_free (plugin->cert);
-      plugin->cert = NULL;
-      GNUNET_free (plugin->crypto_init);
-      plugin->crypto_init = NULL;
-
-      return GNUNET_SYSERR;
-    }
-    GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (cert_creation));
-    GNUNET_OS_process_destroy (cert_creation);
-
-    plugin->key = server_load_file (key_file);
-    plugin->cert = server_load_file (cert_file);
-  }
-
-  if ((plugin->key == NULL) || (plugin->cert == NULL))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ (
-           "No usable TLS certificate found and creating one at `%s/%s' 
failed!\n"),
-         key_file, cert_file);
-    GNUNET_free (key_file);
-    GNUNET_free (cert_file);
-
-    GNUNET_free (plugin->key);
-    plugin->key = NULL;
-    GNUNET_free (plugin->cert);
-    plugin->cert = NULL;
-    GNUNET_free (plugin->crypto_init);
-    plugin->crypto_init = NULL;
-
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (key_file);
-  GNUNET_free (cert_file);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "TLS certificate loaded\n");
-  return res;
-}
-
-
-#endif
-
-
-/**
- * Invoke `MHD_start_daemon` with the various options we need to
- * setup the HTTP server with the given listen address.
- *
- * @param plugin our plugin
- * @param addr listen address to use
- * @param v6 MHD_NO_FLAG or MHD_USE_IPv6, depending on context
- * @return NULL on error
- */
-static struct MHD_Daemon *
-run_mhd_start_daemon (struct HTTP_Server_Plugin *plugin,
-                      const struct sockaddr_in *addr,
-                      int v6)
-{
-  struct MHD_Daemon *server;
-  unsigned int timeout;
-
-#if MHD_VERSION >= 0x00090E00
-  timeout = HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL / 1000LL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "MHD can set timeout per connection! Default time out %u sec.\n",
-       timeout);
-#else
-  timeout = HTTP_SERVER_SESSION_TIMEOUT.rel_value_us / 1000LL / 1000LL;
-  LOG (GNUNET_ERROR_TYPE_WARNING,
-       "MHD cannot set timeout per connection! Default time out %u sec.\n",
-       timeout);
-#endif
-  server = MHD_start_daemon (
-#if VERBOSE_SERVER
-    MHD_USE_DEBUG |
-#endif
-#if BUILD_HTTPS
-    MHD_USE_SSL |
-#endif
-    MHD_USE_SUSPEND_RESUME
-    | v6,
-    plugin->port,
-    &server_accept_cb, plugin,
-    &server_access_cb, plugin,
-    MHD_OPTION_SOCK_ADDR,
-    addr,
-    MHD_OPTION_CONNECTION_LIMIT,
-    (unsigned int) plugin->max_request,
-#if BUILD_HTTPS
-    MHD_OPTION_HTTPS_PRIORITIES,
-    plugin->crypto_init,
-    MHD_OPTION_HTTPS_MEM_KEY,
-    plugin->key,
-    MHD_OPTION_HTTPS_MEM_CERT,
-    plugin->cert,
-#endif
-    MHD_OPTION_CONNECTION_TIMEOUT,
-    timeout,
-    MHD_OPTION_CONNECTION_MEMORY_LIMIT,
-    (size_t) (2
-              * GNUNET_MAX_MESSAGE_SIZE),
-    MHD_OPTION_NOTIFY_COMPLETED,
-    &server_disconnect_cb, plugin,
-    MHD_OPTION_NOTIFY_CONNECTION,
-    &server_connection_cb, plugin,
-    MHD_OPTION_EXTERNAL_LOGGER,
-    &server_log, NULL,
-    MHD_OPTION_END);
-#ifdef TCP_STEALTH
-  if ((NULL != server) &&
-      (0 != (plugin->options & HTTP_OPTIONS_TCP_STEALTH)))
-  {
-    const union MHD_DaemonInfo *di;
-
-    di = MHD_get_daemon_info (server,
-                              MHD_DAEMON_INFO_LISTEN_FD,
-                              NULL);
-    if ((0 != setsockopt ((int) di->listen_fd,
-                          IPPROTO_TCP,
-                          TCP_STEALTH,
-                          plugin->env->my_identity,
-                          sizeof(struct GNUNET_PeerIdentity))))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("TCP_STEALTH not supported on this platform.\n"));
-      MHD_stop_daemon (server);
-      server = NULL;
-    }
-  }
-#endif
-  return server;
-}
-
-
-/**
- * Start the HTTP server
- *
- * @param plugin the plugin handle
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-static int
-server_start (struct HTTP_Server_Plugin *plugin)
-{
-  const char *msg;
-
-  GNUNET_assert (NULL != plugin);
-#if BUILD_HTTPS
-  if (GNUNET_SYSERR == server_load_certificate (plugin))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ (
-           "Could not load or create server certificate! Loading plugin 
failed!\n"));
-    return GNUNET_SYSERR;
-  }
-#endif
-
-
-  plugin->server_v4 = NULL;
-  if (GNUNET_YES == plugin->use_ipv4)
-  {
-    plugin->server_v4
-      = run_mhd_start_daemon (plugin,
-                              (const struct
-                               sockaddr_in *) plugin->server_addr_v4,
-                              MHD_NO_FLAG);
-
-    if (NULL == plugin->server_v4)
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           "Failed to start %s IPv4 server component on port %u\n",
-           plugin->name,
-           plugin->port);
-    }
-    else
-      server_reschedule (plugin,
-                         plugin->server_v4,
-                         GNUNET_NO);
-  }
-
-
-  plugin->server_v6 = NULL;
-  if (GNUNET_YES == plugin->use_ipv6)
-  {
-    plugin->server_v6
-      = run_mhd_start_daemon (plugin,
-                              (const struct
-                               sockaddr_in *) plugin->server_addr_v6,
-                              MHD_USE_IPv6);
-    if (NULL == plugin->server_v6)
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           "Failed to start %s IPv6 server component on port %u\n",
-           plugin->name,
-           plugin->port);
-    }
-    else
-    {
-      server_reschedule (plugin,
-                         plugin->server_v6,
-                         GNUNET_NO);
-    }
-  }
-  msg = "No";
-  if ((NULL == plugin->server_v6) &&
-      (NULL == plugin->server_v4))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "%s %s server component started on port %u\n",
-         msg,
-         plugin->name,
-         plugin->port);
-    return GNUNET_SYSERR;
-  }
-  if ((NULL != plugin->server_v6) &&
-      (NULL != plugin->server_v4))
-    msg = "IPv4 and IPv6";
-  else if (NULL != plugin->server_v6)
-    msg = "IPv6";
-  else if (NULL != plugin->server_v4)
-    msg = "IPv4";
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "%s %s server component started on port %u\n",
-       msg,
-       plugin->name,
-       plugin->port);
-  return GNUNET_OK;
-}
-
-
-/**
- * Add an address to the server's set of addresses and notify transport
- *
- * @param cls the plugin handle
- * @param add_remove #GNUNET_YES on add, #GNUNET_NO on remove
- * @param addr the address
- * @param addrlen address length
- */
-static void
-server_add_address (void *cls,
-                    int add_remove,
-                    const struct sockaddr *addr,
-                    socklen_t addrlen)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-  struct GNUNET_HELLO_Address *address;
-  struct HttpAddressWrapper *w = NULL;
-
-  w = GNUNET_new (struct HttpAddressWrapper);
-  w->address = http_common_address_from_socket (plugin->protocol,
-                                                addr,
-                                                addrlen);
-  if (NULL == w->address)
-  {
-    GNUNET_free (w);
-    return;
-  }
-  w->addrlen = http_common_address_get_size (w->address);
-
-  GNUNET_CONTAINER_DLL_insert (plugin->addr_head,
-                               plugin->addr_tail,
-                               w);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Notifying transport to add address `%s'\n",
-       http_common_plugin_address_to_string (plugin->protocol,
-                                             w->address,
-                                             w->addrlen));
-  /* modify our published address list */
-#if BUILD_HTTPS
-  address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                           "https_client", w->address,
-                                           w->addrlen,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-#else
-  address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                           "http_client", w->address,
-                                           w->addrlen,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-#endif
-
-  plugin->env->notify_address (plugin->env->cls,
-                               add_remove,
-                               address);
-  GNUNET_HELLO_address_free (address);
-}
-
-
-/**
- * Remove an address from the server's set of addresses and notify transport
- *
- * @param cls the plugin handle
- * @param add_remove #GNUNET_YES on add, #GNUNET_NO on remove
- * @param addr the address
- * @param addrlen address length
- */
-static void
-server_remove_address (void *cls,
-                       int add_remove,
-                       const struct sockaddr *addr,
-                       socklen_t addrlen)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-  struct GNUNET_HELLO_Address *address;
-  struct HttpAddressWrapper *w = plugin->addr_head;
-  size_t saddr_len;
-  void *saddr;
-
-  saddr = http_common_address_from_socket (plugin->protocol,
-                                           addr,
-                                           addrlen);
-  if (NULL == saddr)
-    return;
-  saddr_len = http_common_address_get_size (saddr);
-
-  while (NULL != w)
-  {
-    if (GNUNET_YES ==
-        http_common_cmp_addresses (w->address,
-                                   w->addrlen,
-                                   saddr,
-                                   saddr_len))
-      break;
-    w = w->next;
-  }
-  GNUNET_free (saddr);
-
-  if (NULL == w)
-    return;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Notifying transport to remove address `%s'\n",
-       http_common_plugin_address_to_string (plugin->protocol,
-                                             w->address,
-                                             w->addrlen));
-  GNUNET_CONTAINER_DLL_remove (plugin->addr_head,
-                               plugin->addr_tail,
-                               w);
-  /* modify our published address list */
-#if BUILD_HTTPS
-  address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                           "https_client", w->address,
-                                           w->addrlen,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-#else
-  address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                           "http_client", w->address,
-                                           w->addrlen,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-#endif
-  plugin->env->notify_address (plugin->env->cls, add_remove, address);
-  GNUNET_HELLO_address_free (address);
-  GNUNET_free (w->address);
-  GNUNET_free (w);
-}
-
-
-/**
- * Our external IP address/port mapping has changed.
- *
- * @param cls closure, the 'struct LocalAddrList'
- * @param[in,out] app_ctx location where the app can store stuff
- *                  on add and retrieve it on remove
- * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO 
to mean
- *     the previous (now invalid) one
- * @param ac address class the address belongs to
- * @param addr either the previous or the new public IP address
- * @param addrlen actual length of the address
- */
-static void
-server_nat_port_map_callback (void *cls,
-                              void **app_ctx,
-                              int add_remove,
-                              enum GNUNET_NAT_AddressClass ac,
-                              const struct sockaddr *addr,
-                              socklen_t addrlen)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-
-  (void) app_ctx;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "NAT called to %s address `%s'\n",
-       (add_remove == GNUNET_NO) ? "remove" : "add",
-       GNUNET_a2s (addr, addrlen));
-
-  if (AF_INET == addr->sa_family)
-  {
-    struct sockaddr_in *s4 = (struct sockaddr_in *) addr;
-
-    if (GNUNET_NO == plugin->use_ipv4)
-      return;
-
-    if ((NULL != plugin->server_addr_v4) &&
-        (0 != memcmp (&plugin->server_addr_v4->sin_addr,
-                      &s4->sin_addr,
-                      sizeof(struct in_addr))))
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Skipping address `%s' (not bindto address)\n",
-           GNUNET_a2s (addr, addrlen));
-      return;
-    }
-  }
-
-  if (AF_INET6 == addr->sa_family)
-  {
-    struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) addr;
-    if (GNUNET_NO == plugin->use_ipv6)
-      return;
-
-    if ((NULL != plugin->server_addr_v6) &&
-        (0 != memcmp (&plugin->server_addr_v6->sin6_addr,
-                      &s6->sin6_addr, sizeof(struct in6_addr))))
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Skipping address `%s' (not bindto address)\n",
-           GNUNET_a2s (addr, addrlen));
-      return;
-    }
-  }
-
-  switch (add_remove)
-  {
-  case GNUNET_YES:
-    server_add_address (cls, add_remove, addr, addrlen);
-    break;
-
-  case GNUNET_NO:
-    server_remove_address (cls, add_remove, addr, addrlen);
-    break;
-  }
-}
-
-
-/**
- * Get valid server addresses
- *
- * @param plugin the plugin handle
- * @param service_name the servicename
- * @param cfg configuration handle
- * @param addrs addresses
- * @param addr_lens address length
- * @return number of addresses
- */
-static int
-server_get_addresses (struct HTTP_Server_Plugin *plugin,
-                      const char *service_name,
-                      const struct GNUNET_CONFIGURATION_Handle *cfg,
-                      struct sockaddr ***addrs,
-                      socklen_t **addr_lens)
-{
-  int disablev6;
-  unsigned long long port;
-  struct addrinfo hints;
-  struct addrinfo *res;
-  struct addrinfo *pos;
-  struct addrinfo *next;
-  unsigned int i;
-  int resi;
-  int ret;
-  struct sockaddr **saddrs;
-  socklen_t *saddrlens;
-  char *hostname;
-
-  *addrs = NULL;
-  *addr_lens = NULL;
-
-  disablev6 = ! plugin->use_ipv6;
-
-  port = 0;
-  if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT"))
-  {
-    GNUNET_break (GNUNET_OK ==
-                  GNUNET_CONFIGURATION_get_value_number (cfg, service_name,
-                                                         "PORT", &port));
-    if (port > 65535)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ (
-                    "Require valid port number for service in 
configuration!\n"));
-      return GNUNET_SYSERR;
-    }
-  }
-  if (0 == port)
-  {
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         "Starting in listen only mode\n");
-    return -1;   /* listen only */
-  }
-
-
-  if (GNUNET_CONFIGURATION_have_value (cfg, service_name,
-                                       "BINDTO"))
-  {
-    GNUNET_break (GNUNET_OK ==
-                  GNUNET_CONFIGURATION_get_value_string (cfg, service_name,
-                                                         "BINDTO", &hostname));
-  }
-  else
-    hostname = NULL;
-
-  if (NULL != hostname)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Resolving `%s' since that is where `%s' will bind to.\n",
-         hostname, service_name);
-    memset (&hints, 0, sizeof(struct addrinfo));
-    if (disablev6)
-      hints.ai_family = AF_INET;
-    if ((0 != (ret = getaddrinfo (hostname, NULL, &hints, &res))) ||
-        (NULL == res))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Failed to resolve `%s': %s\n"),
-                  hostname,
-                  gai_strerror (ret));
-      GNUNET_free (hostname);
-      return GNUNET_SYSERR;
-    }
-    next = res;
-    i = 0;
-    while (NULL != (pos = next))
-    {
-      next = pos->ai_next;
-      if ((disablev6) && (pos->ai_family == AF_INET6))
-        continue;
-      i++;
-    }
-    if (0 == i)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Failed to find %saddress for `%s'.\n"),
-                  disablev6 ? "IPv4 " : "", hostname);
-      freeaddrinfo (res);
-      GNUNET_free (hostname);
-      return GNUNET_SYSERR;
-    }
-    resi = i;
-    saddrs = GNUNET_malloc ((resi + 1) * sizeof(struct sockaddr *));
-    saddrlens = GNUNET_malloc ((resi + 1) * sizeof(socklen_t));
-    i = 0;
-    next = res;
-    while (NULL != (pos = next))
-    {
-      next = pos->ai_next;
-      if ((disablev6) && (pos->ai_family == AF_INET6))
-        continue;
-      if ((pos->ai_protocol != IPPROTO_TCP) && (0 != pos->ai_protocol))
-        continue;               /* not TCP */
-      if ((pos->ai_socktype != SOCK_STREAM) && (0 != pos->ai_socktype))
-        continue;               /* huh? */
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Service will bind to `%s'\n",
-           GNUNET_a2s (pos->ai_addr,
-                       pos->ai_addrlen));
-      if (pos->ai_family == AF_INET)
-      {
-        GNUNET_assert (pos->ai_addrlen == sizeof(struct sockaddr_in));
-        saddrlens[i] = pos->ai_addrlen;
-        saddrs[i] = GNUNET_malloc (saddrlens[i]);
-        GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
-        ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
-      }
-      else
-      {
-        GNUNET_assert (pos->ai_family == AF_INET6);
-        GNUNET_assert (pos->ai_addrlen == sizeof(struct sockaddr_in6));
-        saddrlens[i] = pos->ai_addrlen;
-        saddrs[i] = GNUNET_malloc (saddrlens[i]);
-        GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
-        ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
-      }
-      i++;
-    }
-    GNUNET_free (hostname);
-    freeaddrinfo (res);
-    resi = i;
-  }
-  else
-  {
-    /* will bind against everything, just set port */
-    if (disablev6)
-    {
-      /* V4-only */
-      resi = 1;
-      i = 0;
-      saddrs = GNUNET_malloc ((resi + 1) * sizeof(struct sockaddr *));
-      saddrlens = GNUNET_malloc ((resi + 1) * sizeof(socklen_t));
-
-      saddrlens[i] = sizeof(struct sockaddr_in);
-      saddrs[i] = GNUNET_malloc (saddrlens[i]);
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[i];
-#endif
-      ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET;
-      ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
-    }
-    else
-    {
-      /* dual stack */
-      resi = 2;
-      saddrs = GNUNET_malloc ((resi + 1) * sizeof(struct sockaddr *));
-      saddrlens = GNUNET_malloc ((resi + 1) * sizeof(socklen_t));
-      i = 0;
-      saddrlens[i] = sizeof(struct sockaddr_in6);
-      saddrs[i] = GNUNET_malloc (saddrlens[i]);
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      ((struct sockaddr_in6 *) saddrs[i])->sin6_len = saddrlens[0];
-#endif
-      ((struct sockaddr_in6 *) saddrs[i])->sin6_family = AF_INET6;
-      ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
-      i++;
-      saddrlens[i] = sizeof(struct sockaddr_in);
-      saddrs[i] = GNUNET_malloc (saddrlens[i]);
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[1];
-#endif
-      ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET;
-      ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
-    }
-  }
-  *addrs = saddrs;
-  *addr_lens = saddrlens;
-  return resi;
-}
-
-
-/**
- * Ask NAT for addresses
- *
- * @param plugin the plugin handle
- */
-static void
-server_start_report_addresses (struct HTTP_Server_Plugin *plugin)
-{
-  int res = GNUNET_OK;
-  struct sockaddr **addrs;
-  socklen_t *addrlens;
-
-  res = server_get_addresses (plugin,
-                              plugin->name,
-                              plugin->env->cfg,
-                              &addrs, &addrlens);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       _ ("Found %u addresses to report to NAT service\n"),
-       res);
-
-  if (GNUNET_SYSERR == res)
-  {
-    plugin->nat = NULL;
-    return;
-  }
-
-  plugin->nat
-    = GNUNET_NAT_register (plugin->env->cfg,
-                           plugin->name,
-                           IPPROTO_TCP,
-                           (unsigned int) res,
-                           (const struct sockaddr **) addrs,
-                           addrlens,
-                           &server_nat_port_map_callback,
-                           NULL,
-                           plugin);
-  while (res > 0)
-  {
-    res--;
-    GNUNET_assert (NULL != addrs[res]);
-    GNUNET_free (addrs[res]);
-  }
-  GNUNET_free (addrs);
-  GNUNET_free (addrlens);
-}
-
-
-/**
- * Stop NAT for addresses
- *
- * @param plugin the plugin handle
- */
-static void
-server_stop_report_addresses (struct HTTP_Server_Plugin *plugin)
-{
-  struct HttpAddressWrapper *w;
-
-  /* Stop NAT handle */
-  if (NULL != plugin->nat)
-  {
-    GNUNET_NAT_unregister (plugin->nat);
-    plugin->nat = NULL;
-  }
-  /* Clean up addresses */
-  while (NULL != plugin->addr_head)
-  {
-    w = plugin->addr_head;
-    GNUNET_CONTAINER_DLL_remove (plugin->addr_head,
-                                 plugin->addr_tail,
-                                 w);
-    GNUNET_free (w->address);
-    GNUNET_free (w);
-  }
-}
-
-
-/**
- * Check if IPv6 supported on this system
- *
- * @param plugin the plugin handle
- * @return #GNUNET_YES on success, else #GNUNET_NO
- */
-static int
-server_check_ipv6_support (struct HTTP_Server_Plugin *plugin)
-{
-  struct GNUNET_NETWORK_Handle *desc = NULL;
-  int res = GNUNET_NO;
-
-  /* Probe IPv6 support */
-  desc = GNUNET_NETWORK_socket_create (PF_INET6,
-                                       SOCK_STREAM,
-                                       0);
-  if (NULL == desc)
-  {
-    if ((errno == ENOBUFS) ||
-        (errno == ENOMEM) ||
-        (errno == ENFILE) ||
-        (errno == EACCES))
-    {
-      GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
-                           "socket");
-    }
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         _ ("Disabling IPv6 since it is not supported on this system!\n"));
-    res = GNUNET_NO;
-  }
-  else
-  {
-    GNUNET_break (GNUNET_OK ==
-                  GNUNET_NETWORK_socket_close (desc));
-    desc = NULL;
-    res = GNUNET_YES;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Testing IPv6 on this system: %s\n",
-       (res == GNUNET_YES) ? "successful" : "failed");
-  return res;
-}
-
-
-/**
- * Notify server about our external hostname
- *
- * @param cls plugin
- */
-static void
-server_notify_external_hostname (void *cls)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-  struct HttpAddress *ext_addr;
-  size_t ext_addr_len;
-  unsigned int urlen;
-  char *url;
-
-  plugin->notify_ext_task = NULL;
-  GNUNET_asprintf (&url,
-                   "%s://%s",
-                   plugin->protocol,
-                   plugin->external_hostname);
-  urlen = strlen (url) + 1;
-  ext_addr = GNUNET_malloc (sizeof(struct HttpAddress) + urlen);
-  ext_addr->options = htonl (plugin->options);
-  ext_addr->urlen = htonl (urlen);
-  ext_addr_len = sizeof(struct HttpAddress) + urlen;
-  GNUNET_memcpy (&ext_addr[1], url, urlen);
-  GNUNET_free (url);
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Notifying transport about external hostname address `%s'\n",
-       plugin->external_hostname);
-
-#if BUILD_HTTPS
-  if (GNUNET_YES == plugin->verify_external_hostname)
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         "Enabling SSL verification for external hostname address `%s'\n",
-         plugin->external_hostname);
-  plugin->ext_addr
-    = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                     "https_client",
-                                     ext_addr,
-                                     ext_addr_len,
-                                     GNUNET_HELLO_ADDRESS_INFO_NONE);
-  plugin->env->notify_address (plugin->env->cls,
-                               GNUNET_YES,
-                               plugin->ext_addr);
-  GNUNET_free (ext_addr);
-#else
-  plugin->ext_addr
-    = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                     "http_client",
-                                     ext_addr,
-                                     ext_addr_len,
-                                     GNUNET_HELLO_ADDRESS_INFO_NONE);
-  plugin->env->notify_address (plugin->env->cls,
-                               GNUNET_YES,
-                               plugin->ext_addr);
-  GNUNET_free (ext_addr);
-#endif
-}
-
-
-/**
- * Configure the plugin
- *
- * @param plugin plugin handle
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-static int
-server_configure_plugin (struct HTTP_Server_Plugin *plugin)
-{
-  unsigned long long port;
-  unsigned long long max_connections;
-  char *bind4_address = NULL;
-  char *bind6_address = NULL;
-  char *eh_tmp = NULL;
-  int external_hostname_use_port;
-
-  /* Use IPv4? */
-  if (GNUNET_CONFIGURATION_have_value
-        (plugin->env->cfg, plugin->name, "USE_IPv4"))
-  {
-    plugin->use_ipv4 =
-      GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg,
-                                            plugin->name,
-                                            "USE_IPv4");
-  }
-  else
-    plugin->use_ipv4 = GNUNET_YES;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       _ ("IPv4 support is %s\n"),
-       (plugin->use_ipv4 == GNUNET_YES) ? "enabled" : "disabled");
-
-  /* Use IPv6? */
-  if (GNUNET_CONFIGURATION_have_value
-        (plugin->env->cfg, plugin->name, "USE_IPv6"))
-  {
-    plugin->use_ipv6 =
-      GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg,
-                                            plugin->name,
-                                            "USE_IPv6");
-  }
-  else
-    plugin->use_ipv6 = GNUNET_YES;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       _ ("IPv6 support is %s\n"),
-       (plugin->use_ipv6 == GNUNET_YES) ? "enabled" : "disabled");
-
-  if ((plugin->use_ipv4 == GNUNET_NO) && (plugin->use_ipv6 == GNUNET_NO))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ ("Neither IPv4 nor IPv6 are enabled! Fix in configuration\n"));
-    return GNUNET_SYSERR;
-  }
-
-  /* Reading port number from config file */
-  if ((GNUNET_OK !=
-       GNUNET_CONFIGURATION_get_value_number (plugin->env->cfg,
-                                              plugin->name,
-                                              "PORT", &port)) || (port > 
65535))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ ("Port is required! Fix in configuration\n"));
-    return GNUNET_SYSERR;
-  }
-  plugin->port = port;
-
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       _ ("Using port %u\n"), plugin->port);
-
-  if ((plugin->use_ipv4 == GNUNET_YES) &&
-      (GNUNET_YES ==
-       GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg,
-                                              plugin->name,
-                                              "BINDTO",
-                                              &bind4_address)))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Binding %s plugin to specific IPv4 address: `%s'\n",
-         plugin->protocol,
-         bind4_address);
-    plugin->server_addr_v4 = GNUNET_new (struct sockaddr_in);
-    if (1 != inet_pton (AF_INET,
-                        bind4_address,
-                        &plugin->server_addr_v4->sin_addr))
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Specific IPv4 address `%s' in configuration file is 
invalid!\n"),
-           bind4_address);
-      GNUNET_free (bind4_address);
-      GNUNET_free (plugin->server_addr_v4);
-      plugin->server_addr_v4 = NULL;
-      return GNUNET_SYSERR;
-    }
-    else
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Binding to IPv4 address %s\n",
-           bind4_address);
-      plugin->server_addr_v4->sin_family = AF_INET;
-      plugin->server_addr_v4->sin_port = htons (plugin->port);
-    }
-    GNUNET_free (bind4_address);
-  }
-
-  if ((plugin->use_ipv6 == GNUNET_YES) &&
-      (GNUNET_YES ==
-       GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg,
-                                              plugin->name,
-                                              "BINDTO6",
-                                              &bind6_address)))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Binding %s plugin to specific IPv6 address: `%s'\n",
-         plugin->protocol, bind6_address);
-    plugin->server_addr_v6 = GNUNET_new (struct sockaddr_in6);
-    if (1 !=
-        inet_pton (AF_INET6,
-                   bind6_address,
-                   &plugin->server_addr_v6->sin6_addr))
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Specific IPv6 address `%s' in configuration file is 
invalid!\n"),
-           bind6_address);
-      GNUNET_free (bind6_address);
-      GNUNET_free (plugin->server_addr_v6);
-      plugin->server_addr_v6 = NULL;
-      return GNUNET_SYSERR;
-    }
-    else
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Binding to IPv6 address %s\n",
-           bind6_address);
-      plugin->server_addr_v6->sin6_family = AF_INET6;
-      plugin->server_addr_v6->sin6_port = htons (plugin->port);
-    }
-    GNUNET_free (bind6_address);
-  }
-
-  plugin->verify_external_hostname = GNUNET_NO;
-#if BUILD_HTTPS
-  plugin->verify_external_hostname
-    = GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg,
-                                            plugin->name,
-                                            "VERIFY_EXTERNAL_HOSTNAME");
-  if (GNUNET_SYSERR == plugin->verify_external_hostname)
-    plugin->verify_external_hostname = GNUNET_NO;
-  if (GNUNET_YES == plugin->verify_external_hostname)
-    plugin->options |= HTTP_OPTIONS_VERIFY_CERTIFICATE;
-#endif
-  external_hostname_use_port
-    = GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg,
-                                            plugin->name,
-                                            "EXTERNAL_HOSTNAME_USE_PORT");
-  if (GNUNET_SYSERR == external_hostname_use_port)
-    external_hostname_use_port = GNUNET_NO;
-
-
-  if (GNUNET_YES ==
-      GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg,
-                                             plugin->name,
-                                             "EXTERNAL_HOSTNAME",
-                                             &eh_tmp))
-  {
-    char *tmp;
-    char *pos = NULL;
-    char *pos_url = NULL;
-
-    if (NULL != strstr (eh_tmp, "://"))
-      tmp = &strstr (eh_tmp, "://")[3];
-    else
-      tmp = eh_tmp;
-
-    if (GNUNET_YES == external_hostname_use_port)
-    {
-      if ((strlen (tmp) > 1) && (NULL != (pos = strchr (tmp, '/'))))
-      {
-        pos_url = pos + 1;
-        pos[0] = '\0';
-        GNUNET_asprintf (&plugin->external_hostname,
-                         "%s:%u/%s",
-                         tmp,
-                         (uint16_t) port,
-                         pos_url);
-      }
-      else
-        GNUNET_asprintf (&plugin->external_hostname,
-                         "%s:%u",
-                         tmp,
-                         (uint16_t) port);
-    }
-    else
-      plugin->external_hostname = GNUNET_strdup (tmp);
-    GNUNET_free (eh_tmp);
-
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         _ ("Using external hostname `%s'\n"),
-         plugin->external_hostname);
-    plugin->notify_ext_task = GNUNET_SCHEDULER_add_now (
-      &server_notify_external_hostname,
-      plugin);
-
-    /* Use only configured external hostname */
-    if (GNUNET_CONFIGURATION_have_value
-          (plugin->env->cfg,
-          plugin->name,
-          "EXTERNAL_HOSTNAME_ONLY"))
-    {
-      plugin->external_only =
-        GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg,
-                                              plugin->name,
-                                              "EXTERNAL_HOSTNAME_ONLY");
-    }
-    else
-      plugin->external_only = GNUNET_NO;
-
-    if (GNUNET_YES == plugin->external_only)
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           _ ("Notifying transport only about hostname `%s'\n"),
-           plugin->external_hostname);
-  }
-  else
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "No external hostname configured\n");
-
-  /* Optional parameters */
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_number (plugin->env->cfg,
-                                             plugin->name,
-                                             "MAX_CONNECTIONS",
-                                             &max_connections))
-    max_connections = 128;
-  plugin->max_request = max_connections;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       _ ("Maximum number of connections is %u\n"),
-       plugin->max_request);
-
-  plugin->peer_id_length = strlen (GNUNET_i2s_full (plugin->env->my_identity));
-
-  return GNUNET_OK;
-}
-
-
-/**
- * Exit point from the plugin.
- *
- * @param cls api
- * @return NULL
- */
-void *
-LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
-  struct HTTP_Server_Plugin *plugin = api->cls;
-
-  if (NULL == api->cls)
-  {
-    /* Free for stub mode */
-    GNUNET_free (api);
-    return NULL;
-  }
-  plugin->in_shutdown = GNUNET_YES;
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       _ ("Shutting down plugin `%s'\n"),
-       plugin->name);
-
-  if (NULL != plugin->notify_ext_task)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->notify_ext_task);
-    plugin->notify_ext_task = NULL;
-  }
-
-  if (NULL != plugin->ext_addr)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Notifying transport to remove address `%s'\n",
-         http_common_plugin_address_to_string (plugin->protocol,
-                                               plugin->ext_addr->address,
-                                               
plugin->ext_addr->address_length));
-#if BUILD_HTTPS
-    plugin->env->notify_address (plugin->env->cls,
-                                 GNUNET_NO,
-                                 plugin->ext_addr);
-#else
-    plugin->env->notify_address (plugin->env->cls,
-                                 GNUNET_NO,
-                                 plugin->ext_addr);
-#endif
-    GNUNET_HELLO_address_free (plugin->ext_addr);
-    plugin->ext_addr = NULL;
-  }
-
-  /* Stop to report addresses to transport service */
-  server_stop_report_addresses (plugin);
-  if (NULL != plugin->server_v4_task)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->server_v4_task);
-    plugin->server_v4_task = NULL;
-  }
-
-  if (NULL != plugin->server_v6_task)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->server_v6_task);
-    plugin->server_v6_task = NULL;
-  }
-#if BUILD_HTTPS
-  GNUNET_free (plugin->crypto_init);
-  GNUNET_free (plugin->cert);
-  GNUNET_free (plugin->key);
-#endif
-  GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions,
-                                         &destroy_session_shutdown_cb,
-                                         plugin);
-  GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions);
-  plugin->sessions = NULL;
-  if (NULL != plugin->server_v4)
-  {
-    MHD_stop_daemon (plugin->server_v4);
-    plugin->server_v4 = NULL;
-  }
-  if (NULL != plugin->server_v6)
-  {
-    MHD_stop_daemon (plugin->server_v6);
-    plugin->server_v6 = NULL;
-  }
-  /* Clean up */
-  GNUNET_free (plugin->external_hostname);
-  GNUNET_free (plugin->ext_addr);
-  GNUNET_free (plugin->server_addr_v4);
-  GNUNET_free (plugin->server_addr_v6);
-  regfree (&plugin->url_regex);
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       _ ("Shutdown for plugin `%s' complete\n"),
-       plugin->name);
-
-  GNUNET_free (plugin);
-  GNUNET_free (api);
-  return NULL;
-}
-
-
-/**
- * Function called for a quick conversion of the binary address to
- * a numeric address.  Note that the caller must not free the
- * address and that the next call to this function is allowed
- * to override the address again.
- *
- * @param cls unused
- * @param addr binary address
- * @param addrlen length of the address
- * @return string representing the same address
- */
-static const char *
-http_server_plugin_address_to_string (void *cls,
-                                      const void *addr,
-                                      size_t addrlen)
-{
-  return http_common_plugin_address_to_string (PLUGIN_NAME,
-                                               addr,
-                                               addrlen);
-}
-
-
-/**
- * Function obtain the network type for a session
- *
- * @param cls closure (`struct HTTP_Server_Plugin *`)
- * @param session the session
- * @return the network type in HBO or #GNUNET_SYSERR
- */
-static enum GNUNET_NetworkType
-http_server_plugin_get_network (void *cls,
-                                struct GNUNET_ATS_Session *session)
-{
-  return session->scope;
-}
-
-
-/**
- * Function obtain the network type for an address.
- *
- * @param cls closure (`struct Plugin *`)
- * @param address the address
- * @return the network type
- */
-static enum GNUNET_NetworkType
-http_server_plugin_get_network_for_address (void *cls,
-                                            const struct
-                                            GNUNET_HELLO_Address *address)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-
-  return http_common_get_network_for_address (plugin->env,
-                                              address);
-}
-
-
-/**
- * Function that will be called whenever the transport service wants to
- * notify the plugin that the inbound quota changed and that the plugin
- * should update it's delay for the next receive value
- *
- * @param cls closure
- * @param peer which peer was the session for
- * @param session which session is being updated
- * @param delay new delay to use for receiving
- */
-static void
-http_server_plugin_update_inbound_delay (void *cls,
-                                         const struct GNUNET_PeerIdentity 
*peer,
-                                         struct GNUNET_ATS_Session *session,
-                                         struct GNUNET_TIME_Relative delay)
-{
-  session->next_receive = GNUNET_TIME_relative_to_absolute (delay);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "New inbound delay %s\n",
-       GNUNET_STRINGS_relative_time_to_string (delay,
-                                               GNUNET_NO));
-  if (NULL != session->recv_wakeup_task)
-  {
-    GNUNET_SCHEDULER_cancel (session->recv_wakeup_task);
-    session->recv_wakeup_task
-      = GNUNET_SCHEDULER_add_delayed (delay,
-                                      &server_wake_up,
-                                      session);
-  }
-}
-
-
-/**
- * Return information about the given session to the
- * monitor callback.
- *
- * @param cls the `struct Plugin` with the monitor callback (`sic`)
- * @param peer peer we send information about
- * @param value our `struct GNUNET_ATS_Session` to send information about
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-send_session_info_iter (void *cls,
-                        const struct GNUNET_PeerIdentity *peer,
-                        void *value)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session = value;
-
-  notify_session_monitor (plugin,
-                          session,
-                          GNUNET_TRANSPORT_SS_INIT);
-  return GNUNET_OK;
-}
-
-
-/**
- * Begin monitoring sessions of a plugin.  There can only
- * be one active monitor per plugin (i.e. if there are
- * multiple monitors, the transport service needs to
- * multiplex the generated events over all of them).
- *
- * @param cls closure of the plugin
- * @param sic callback to invoke, NULL to disable monitor;
- *            plugin will being by iterating over all active
- *            sessions immediately and then enter monitor mode
- * @param sic_cls closure for @a sic
- */
-static void
-http_server_plugin_setup_monitor (void *cls,
-                                  GNUNET_TRANSPORT_SessionInfoCallback sic,
-                                  void *sic_cls)
-{
-  struct HTTP_Server_Plugin *plugin = cls;
-
-  plugin->sic = sic;
-  plugin->sic_cls = sic_cls;
-  if (NULL != sic)
-  {
-    GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions,
-                                           &send_session_info_iter,
-                                           plugin);
-    /* signal end of first iteration */
-    sic (sic_cls, NULL, NULL);
-  }
-}
-
-
-/**
- * Entry point for the plugin.
- *
- * @param cls env
- * @return api
- */
-void *
-LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginEnvironment *env = cls;
-  struct GNUNET_TRANSPORT_PluginFunctions *api;
-  struct HTTP_Server_Plugin *plugin;
-
-  if (NULL == env->receive)
-  {
-    /* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully
-       initialize the plugin or the API */
-    api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-    api->cls = NULL;
-    api->address_to_string = &http_server_plugin_address_to_string;
-    api->string_to_address = &http_common_plugin_string_to_address;
-    api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
-    return api;
-  }
-  plugin = GNUNET_new (struct HTTP_Server_Plugin);
-  plugin->env = env;
-  plugin->sessions = GNUNET_CONTAINER_multipeermap_create (128,
-                                                           GNUNET_YES);
-
-  api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-  api->cls = plugin;
-  api->send = &http_server_plugin_send;
-  api->disconnect_peer = &http_server_plugin_disconnect_peer;
-  api->disconnect_session = &http_server_plugin_disconnect_session;
-  api->query_keepalive_factor = &http_server_query_keepalive_factor;
-  api->check_address = &http_server_plugin_address_suggested;
-  api->get_session = &http_server_plugin_get_session;
-
-  api->address_to_string = &http_server_plugin_address_to_string;
-  api->string_to_address = &http_common_plugin_string_to_address;
-  api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
-  api->get_network = &http_server_plugin_get_network;
-  api->get_network_for_address = &http_server_plugin_get_network_for_address;
-  api->update_session_timeout = &http_server_plugin_update_session_timeout;
-  api->update_inbound_delay = &http_server_plugin_update_inbound_delay;
-  api->setup_monitor = &http_server_plugin_setup_monitor;
-#if BUILD_HTTPS
-  plugin->name = "transport-https_server";
-  plugin->protocol = "https";
-#else
-  plugin->name = "transport-http_server";
-  plugin->protocol = "http";
-#endif
-
-  if (GNUNET_YES ==
-      GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                            plugin->name,
-                                            "TCP_STEALTH"))
-  {
-#ifdef TCP_STEALTH
-    plugin->options |= HTTP_OPTIONS_TCP_STEALTH;
-#else
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ ("TCP_STEALTH not supported on this platform.\n"));
-    LIBGNUNET_PLUGIN_TRANSPORT_DONE (api);
-    return NULL;
-#endif
-  }
-
-  /* Compile URL regex */
-  if (regcomp (&plugin->url_regex,
-               URL_REGEX,
-               REG_EXTENDED))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ ("Unable to compile URL regex\n"));
-    LIBGNUNET_PLUGIN_TRANSPORT_DONE (api);
-    return NULL;
-  }
-
-  /* Configure plugin */
-  if (GNUNET_SYSERR == server_configure_plugin (plugin))
-  {
-    LIBGNUNET_PLUGIN_TRANSPORT_DONE (api);
-    return NULL;
-  }
-
-  /* Check IPv6 support */
-  if (GNUNET_YES == plugin->use_ipv6)
-    plugin->use_ipv6 = server_check_ipv6_support (plugin);
-
-  /* Report addresses to transport service */
-  if (GNUNET_NO == plugin->external_only)
-    server_start_report_addresses (plugin);
-
-  if (GNUNET_SYSERR == server_start (plugin))
-  {
-    LIBGNUNET_PLUGIN_TRANSPORT_DONE (api);
-    return NULL;
-  }
-  return api;
-}
-
-
-/* end of plugin_transport_http_server.c */
diff --git a/src/transport/plugin_transport_smtp.c 
b/src/transport/plugin_transport_smtp.c
deleted file mode 100644
index f3db4fc5a..000000000
--- a/src/transport/plugin_transport_smtp.c
+++ /dev/null
@@ -1,750 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2003-2013 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_smtp.c
- * @brief Implementation of the SMTP transport service
- * @author Christian Grothoff
- * @author Renaldo Ferreira
- */
-
-#include "platform.h"
-#include "gnunet_util.h"
-#include "gnunet_constants.h"
-#include "gnunet_protocols.h"
-#include "gnunet_transport.h"
-#include "gnunet_stats_service.h"
-#include <libesmtp.h>
-#include <signal.h>
-
-
-/**
- * The default maximum size of each outbound SMTP message.
- */
-#define SMTP_MESSAGE_SIZE 65528
-
-#define DEBUG_SMTP GNUNET_EXTRA_LOGGING
-
-#define FILTER_STRING_SIZE 64
-
-/* how long can a line in base64 encoded
-   mime text be? (in characters, excluding "\n") */
-#define MAX_CHAR_PER_LINE 76
-
-#define EBUF_LEN 128
-
-/**
- * Host-Address in a SMTP network.
- */
-typedef struct
-{
-  /**
-   * Filter line that every sender must include in the E-mails such
-   * that the receiver can effectively filter out the GNUnet traffic
-   * from the E-mail.
-   */
-  char filter[FILTER_STRING_SIZE];
-
-  /**
-   * Claimed E-mail address of the sender.
-   * Format is "foo@bar.com" with null termination, padded to be
-   * of a multiple of 8 bytes long.
-   */
-  char senderAddress[0];
-} EmailAddress;
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * Encapsulation of a GNUnet message in the SMTP mail body (before
- * base64 encoding).
- */
-typedef struct
-{
-  GNUNET_MessageHeader header;
-
-  /**
-   * What is the identity of the sender (GNUNET_hash of public key)
-   */
-  GNUNET_PeerIdentity sender;
-} SMTPMessage;
-GNUNET_NETWORK_STRUCT_END
-
-/* *********** globals ************* */
-
-/**
- * apis (our advertised API and the core api )
- */
-static GNUNET_CoreAPIForTransport *core_api;
-
-static struct GNUNET_GE_Context *ectx;
-
-/**
- * Thread that listens for inbound messages
- */
-static struct GNUNET_ThreadHandle *dispatchThread;
-
-/**
- * Flag to indicate that server has been shut down.
- */
-static int smtp_shutdown = GNUNET_YES;
-
-/**
- * Set to the SMTP server hostname (and port) for outgoing messages.
- */
-static char *smtp_server_name;
-
-static char *pipename;
-
-/**
- * Lock for uses of libesmtp (not thread-safe).
- */
-static struct GNUNET_Mutex *lock;
-
-/**
- * Old handler for SIGPIPE (kept to be able to restore).
- */
-static struct sigaction old_handler;
-
-static char *email;
-
-static GNUNET_TransportAPI smtpAPI;
-
-static GNUNET_Stats_ServiceAPI *stats;
-
-static int stat_bytesReceived;
-
-static int stat_bytesSent;
-
-static int stat_bytesDropped;
-
-/**
- * How many e-mails are we allowed to send per hour?
- */
-static unsigned long long rate_limit;
-
-static GNUNET_CronTime last_transmission;
-
-
-/* ********************* the real stuff ******************* */
-
-#define strAUTOncmp(a, b) strncmp (a, b, strlen (b))
-
-/**
- * Listen to the pipe, decode messages and send to core.
- */
-static void *
-listenAndDistribute (void *unused)
-{
-  char *line;
-  unsigned int linesize;
-  SMTPMessage *mp;
-  FILE *fdes;
-  char *retl;
-  char *out;
-  unsigned int size;
-  GNUNET_TransportPacket *coreMP;
-  int fd;
-  unsigned int pos;
-
-  linesize = ((GNUNET_MAX_BUFFER_SIZE * 4 / 3) + 8) * (MAX_CHAR_PER_LINE + 2)
-             / MAX_CHAR_PER_LINE;                                              
                         /* maximum size of a line supported */
-  line = GNUNET_malloc (linesize + 2);   /* 2 bytes for off-by-one errors, 
just to be safe... */
-
-#define READLINE(l, limit) \
-  do { retl = fgets (l, (limit), fdes);                          \
-       if ((retl == NULL) || (smtp_shutdown == GNUNET_YES)) { \
-         goto END; \
-       } \
-       if (core_api->load_monitor != NULL) \
-       GNUNET_network_monitor_notify_transmission (core_api->load_monitor, \
-                                                   GNUNET_ND_DOWNLOAD, \
-                                                   strlen (retl)); \
-  } while (0)
-
-
-  while (smtp_shutdown == GNUNET_NO)
-  {
-    fd = OPEN (pipename, O_RDONLY | O_ASYNC);
-    if (fd == -1)
-    {
-      if (smtp_shutdown == GNUNET_NO)
-        GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS);
-      continue;
-    }
-    fdes = fdopen (fd, "r");
-    while (smtp_shutdown == GNUNET_NO)
-    {
-      /* skip until end of header */
-      do
-      {
-        READLINE (line, linesize);
-      }
-      while ((line[0] != '\r') && (line[0] != '\n'));     /* expect newline */
-      READLINE (line, linesize);        /* read base64 encoded message; 
decode, process */
-      pos = 0;
-      while (1)
-      {
-        pos = strlen (line) - 1;        /* ignore new line */
-        READLINE (&line[pos], linesize - pos);      /* read base64 encoded 
message; decode, process */
-        if ((line[pos] == '\r') || (line[pos] == '\n'))
-          break;                /* empty line => end of message! */
-      }
-      size = GNUNET_STRINGS_base64_decode (line, pos, &out);
-      if (size < sizeof(SMTPMessage))
-      {
-        GNUNET_GE_BREAK (ectx, 0);
-        GNUNET_free (out);
-        goto END;
-      }
-
-      mp = (SMTPMessage *) &out[size - sizeof(SMTPMessage)];
-      if (ntohs (mp->header.size) != size)
-      {
-        GNUNET_GE_LOG (ectx,
-                       GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
-                       _ ("Received malformed message via %s. Ignored.\n"),
-                       "SMTP");
-#if DEBUG_SMTP
-        GNUNET_GE_LOG (ectx,
-                       GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
-                       "Size returned by base64=%d, in the msg=%d.\n", size,
-                       ntohl (mp->size));
-#endif
-        GNUNET_free (out);
-        goto END;
-      }
-      if (stats != NULL)
-        stats->change (stat_bytesReceived, size);
-      coreMP = GNUNET_new (GNUNET_TransportPacket);
-      coreMP->msg = out;
-      coreMP->size = size - sizeof(SMTPMessage);
-      coreMP->tsession = NULL;
-      coreMP->sender = mp->sender;
-#if DEBUG_SMTP
-      GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | 
GNUNET_GE_USER,
-                     "SMTP message passed to the core.\n");
-#endif
-
-      core_api->receive (coreMP);
-    }
-END:
-#if DEBUG_SMTP
-    GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
-                   "SMTP message processed.\n");
-#endif
-    if (fdes != NULL)
-      fclose (fdes);
-  }
-  GNUNET_free (line);
-  return NULL;
-}
-
-
-/* *************** API implementation *************** */
-
-/**
- * Verify that a hello-Message is correct (a node is reachable at that
- * address). Since the reply will be asynchronous, a method must be
- * called on success.
- *
- * @param hello the hello message to verify
- *        (the signature/crc have been verified before)
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */
-static int
-api_verify_hello (const GNUNET_MessageHello *hello)
-{
-  const EmailAddress *maddr;
-
-  maddr = (const EmailAddress *) &hello[1];
-  if ((ntohs (hello->header.size) !=
-       sizeof(GNUNET_MessageHello) + ntohs (hello->senderAddressSize)) ||
-      (maddr->senderAddress
-       [ntohs (hello->senderAddressSize) - 1 - FILTER_STRING_SIZE] != '\0'))
-  {
-    GNUNET_GE_BREAK (ectx, 0);
-    return GNUNET_SYSERR;       /* obviously invalid */
-  }
-  if (NULL == strstr (maddr->filter, ": "))
-    return GNUNET_SYSERR;
-  return GNUNET_OK;
-}
-
-
-/**
- * Create a hello-Message for the current node. The hello is created
- * without signature and without a timestamp. The GNUnet core will
- * GNUNET_RSA_sign the message and add an expiration time.
- *
- * @return hello on success, NULL on error
- */
-static GNUNET_MessageHello *
-api_create_hello ()
-{
-  GNUNET_MessageHello *msg;
-  char *filter;
-  EmailAddress *haddr;
-  int i;
-
-  GNUNET_GC_get_configuration_value_string (core_api->cfg, "SMTP", "FILTER",
-                                            "X-mailer: GNUnet", &filter);
-  if (NULL == strstr (filter, ": "))
-  {
-    GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
-                   _ ("SMTP filter string to invalid, lacks ': '\n"));
-    GNUNET_free (filter);
-    return NULL;
-  }
-
-  if (strlen (filter) > FILTER_STRING_SIZE)
-  {
-    filter[FILTER_STRING_SIZE] = '\0';
-    GNUNET_GE_LOG (ectx, GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
-                   _ ("SMTP filter string to long, capped to `%s'\n"), filter);
-  }
-  i = (strlen (email) + 8) & (~7);       /* make multiple of 8 */
-  msg =
-    GNUNET_malloc (sizeof(GNUNET_MessageHello) + sizeof(EmailAddress) + i);
-  memset (msg, 0, sizeof(GNUNET_MessageHello) + sizeof(EmailAddress) + i);
-  haddr = (EmailAddress *) &msg[1];
-  memset (&haddr->filter[0], 0, FILTER_STRING_SIZE);
-  strcpy (&haddr->filter[0], filter);
-  GNUNET_memcpy (&haddr->senderAddress[0], email, strlen (email) + 1);
-  msg->senderAddressSize = htons (strlen (email) + 1 + sizeof(EmailAddress));
-  msg->protocol = htons (GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP);
-  msg->MTU = htonl (smtpAPI.mtu);
-  msg->header.size = htons (GNUNET_sizeof_hello (msg));
-  if (api_verify_hello (msg) == GNUNET_SYSERR)
-    GNUNET_GE_ASSERT (ectx, 0);
-  GNUNET_free (filter);
-  return msg;
-}
-
-
-struct GetMessageClosure
-{
-  unsigned int esize;
-  unsigned int pos;
-  char *ebody;
-};
-
-static const char *
-get_message (void **buf, int *len, void *cls)
-{
-  struct GetMessageClosure *gmc = cls;
-
-  *buf = NULL;
-  if (len == NULL)
-  {
-    gmc->pos = 0;
-    return NULL;
-  }
-  if (gmc->pos == gmc->esize)
-    return NULL;                /* done */
-  *len = gmc->esize;
-  gmc->pos = gmc->esize;
-  return gmc->ebody;
-}
-
-
-/**
- * Send a message to the specified remote node.
- *
- * @param tsession the GNUNET_MessageHello identifying the remote node
- * @param msg what to send
- * @param size the size of the message
- * @param important is this message important enough to override typical 
limits?
- * @return GNUNET_SYSERR on error, GNUNET_OK on success
- */
-static int
-api_send (GNUNET_TSession *tsession, const void *msg, const unsigned int size,
-          int important)
-{
-  const GNUNET_MessageHello *hello;
-  const EmailAddress *haddr;
-  char *m;
-  char *filter;
-  char *fvalue;
-  SMTPMessage *mp;
-  struct GetMessageClosure gm_cls;
-  smtp_session_t session;
-  smtp_message_t message;
-  smtp_recipient_t recipient;
-
-#define EBUF_LEN 128
-  char ebuf[EBUF_LEN];
-  GNUNET_CronTime now;
-
-  if (smtp_shutdown == GNUNET_YES)
-    return GNUNET_SYSERR;
-  if ((size == 0) || (size > smtpAPI.mtu))
-  {
-    GNUNET_GE_BREAK (ectx, 0);
-    return GNUNET_SYSERR;
-  }
-  now = GNUNET_get_time ();
-  if ((important != GNUNET_YES) &&
-      ( ((now - last_transmission) * rate_limit) < GNUNET_CRON_HOURS) )
-    return GNUNET_NO;           /* rate too high */
-  last_transmission = now;
-
-  hello = (const GNUNET_MessageHello *) tsession->internal;
-  if (hello == NULL)
-    return GNUNET_SYSERR;
-  GNUNET_mutex_lock (lock);
-  session = smtp_create_session ();
-  if (session == NULL)
-  {
-    GNUNET_GE_LOG (ectx,
-                   GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER
-                   | GNUNET_GE_IMMEDIATE, _ ("SMTP: `%s' failed: %s.\n"),
-                   "smtp_create_session", smtp_strerror (smtp_errno (), ebuf,
-                                                         EBUF_LEN));
-    GNUNET_mutex_unlock (lock);
-    return GNUNET_SYSERR;
-  }
-  if (0 == smtp_set_server (session, smtp_server_name))
-  {
-    GNUNET_GE_LOG (ectx,
-                   GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_USER
-                   | GNUNET_GE_IMMEDIATE, _ ("SMTP: `%s' failed: %s.\n"),
-                   "smtp_set_server", smtp_strerror (smtp_errno (), ebuf,
-                                                     EBUF_LEN));
-    smtp_destroy_session (session);
-    GNUNET_mutex_unlock (lock);
-    return GNUNET_SYSERR;
-  }
-  haddr = (const EmailAddress *) &hello[1];
-  message = smtp_add_message (session);
-  if (message == NULL)
-  {
-    GNUNET_GE_LOG (ectx,
-                   GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
-                   | GNUNET_GE_BULK, _ ("SMTP: `%s' failed: %s.\n"),
-                   "smtp_add_message", smtp_strerror (smtp_errno (), ebuf,
-                                                      EBUF_LEN));
-    smtp_destroy_session (session);
-    GNUNET_mutex_unlock (lock);
-    return GNUNET_SYSERR;
-  }
-  smtp_set_header (message, "To", NULL, haddr->senderAddress);
-  smtp_set_header (message, "From", NULL, email);
-
-  filter = GNUNET_strdup (haddr->filter);
-  fvalue = strstr (filter, ": ");
-  GNUNET_GE_ASSERT (NULL, NULL != fvalue);
-  fvalue[0] = '\0';
-  fvalue += 2;
-  if (0 == smtp_set_header (message, filter, fvalue))
-  {
-    GNUNET_GE_LOG (ectx,
-                   GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
-                   | GNUNET_GE_BULK, _ ("SMTP: `%s' failed: %s.\n"),
-                   "smtp_set_header", smtp_strerror (smtp_errno (), ebuf,
-                                                     EBUF_LEN));
-    smtp_destroy_session (session);
-    GNUNET_mutex_unlock (lock);
-    GNUNET_free (filter);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (filter);
-  m = GNUNET_malloc (size + sizeof(SMTPMessage));
-  GNUNET_memcpy (m, msg, size);
-  mp = (SMTPMessage *) &m[size];
-  mp->header.size = htons (size + sizeof(SMTPMessage));
-  mp->header.type = htons (0);
-  mp->sender = *core_api->my_identity;
-  gm_cls.ebody = NULL;
-  gm_cls.pos = 0;
-  gm_cls.esize = GNUNET_STRINGS_base64_encode (m, size + sizeof(SMTPMessage),
-                                               &gm_cls.ebody);
-  GNUNET_free (m);
-  if (0 == smtp_size_set_estimate (message, gm_cls.esize))
-  {
-    GNUNET_GE_LOG (ectx,
-                   GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
-                   | GNUNET_GE_BULK, _ ("SMTP: `%s' failed: %s.\n"),
-                   "smtp_size_set_estimate", smtp_strerror (smtp_errno (), 
ebuf,
-                                                            EBUF_LEN));
-  }
-  if (0 == smtp_set_messagecb (message, &get_message, &gm_cls))
-  {
-    GNUNET_GE_LOG (ectx,
-                   GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
-                   | GNUNET_GE_BULK, _ ("SMTP: `%s' failed: %s.\n"),
-                   "smtp_set_messagecb", smtp_strerror (smtp_errno (), ebuf,
-                                                        EBUF_LEN));
-    smtp_destroy_session (session);
-    GNUNET_mutex_unlock (lock);
-    GNUNET_free (gm_cls.ebody);
-    return GNUNET_SYSERR;
-  }
-  recipient = smtp_add_recipient (message, haddr->senderAddress);
-  if (recipient == NULL)
-  {
-    GNUNET_GE_LOG (ectx,
-                   GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
-                   | GNUNET_GE_BULK, _ ("SMTP: `%s' failed: %s.\n"),
-                   "smtp_add_recipient", smtp_strerror (smtp_errno (), ebuf,
-                                                        EBUF_LEN));
-    smtp_destroy_session (session);
-    GNUNET_mutex_unlock (lock);
-    return GNUNET_SYSERR;
-  }
-  if (0 == smtp_start_session (session))
-  {
-    GNUNET_GE_LOG (ectx,
-                   GNUNET_GE_WARNING | GNUNET_GE_ADMIN | GNUNET_GE_USER
-                   | GNUNET_GE_BULK, _ ("SMTP: `%s' failed: %s.\n"),
-                   "smtp_start_session", smtp_strerror (smtp_errno (), ebuf,
-                                                        EBUF_LEN));
-    smtp_destroy_session (session);
-    GNUNET_mutex_unlock (lock);
-    GNUNET_free (gm_cls.ebody);
-    return GNUNET_SYSERR;
-  }
-  if (stats != NULL)
-    stats->change (stat_bytesSent, size);
-  if (core_api->load_monitor != NULL)
-    GNUNET_network_monitor_notify_transmission (core_api->load_monitor,
-                                                GNUNET_ND_UPLOAD, 
gm_cls.esize);
-  smtp_message_reset_status (message);   /* this is needed to plug a 
28-byte/message memory leak in libesmtp */
-  smtp_destroy_session (session);
-  GNUNET_mutex_unlock (lock);
-  GNUNET_free (gm_cls.ebody);
-  return GNUNET_OK;
-}
-
-
-/**
- * Establish a connection to a remote node.
- * @param hello the hello-Message for the target node
- * @param tsessionPtr the session handle that is to be set
- * @param may_reuse can we re-use an existing connection?
- * @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
- */
-static int
-api_connect (const GNUNET_MessageHello *hello, GNUNET_TSession **tsessionPtr,
-             int may_reuse)
-{
-  GNUNET_TSession *tsession;
-
-  tsession = GNUNET_new (GNUNET_TSession);
-  tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello));
-  tsession->peer = hello->senderIdentity;
-  GNUNET_memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello));
-  tsession->ttype = smtpAPI.protocol_number;
-  (*tsessionPtr) = tsession;
-  return GNUNET_OK;
-}
-
-
-/**
- * Disconnect from a remote node.
- *
- * @param tsession the session that is closed
- * @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
- */
-static int
-api_disconnect (GNUNET_TSession *tsession)
-{
-  if (tsession != NULL)
-  {
-    if (tsession->internal != NULL)
-      GNUNET_free (tsession->internal);
-    GNUNET_free (tsession);
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Start the server process to receive inbound traffic.
- * @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
- */
-static int
-api_start_transport_server ()
-{
-  smtp_shutdown = GNUNET_NO;
-  /* initialize SMTP network */
-  dispatchThread = GNUNET_thread_create (&listenAndDistribute, NULL, 1024 * 4);
-  if (dispatchThread == NULL)
-  {
-    GNUNET_GE_DIE_STRERROR (ectx,
-                            GNUNET_GE_ADMIN | GNUNET_GE_BULK | GNUNET_GE_FATAL,
-                            "pthread_create");
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Shutdown the server process (stop receiving inbound traffic). Maybe
- * restarted later!
- */
-static int
-api_stop_transport_server ()
-{
-  void *unused;
-
-  smtp_shutdown = GNUNET_YES;
-  GNUNET_thread_stop_sleep (dispatchThread);
-  GNUNET_thread_join (dispatchThread, &unused);
-  return GNUNET_OK;
-}
-
-
-/**
- * Convert SMTP hello to an IP address (always fails).
- */
-static int
-api_hello_to_address (const GNUNET_MessageHello *hello, void **sa,
-                      unsigned int *sa_len)
-{
-  return GNUNET_SYSERR;
-}
-
-
-/**
- * Always fails.
- */
-static int
-api_associate (GNUNET_TSession *tsession)
-{
-  return GNUNET_SYSERR;         /* SMTP connections can never be associated */
-}
-
-
-/**
- * Always succeeds (for now; we should look at adding
- * frequency limits to SMTP in the future!).
- */
-static int
-api_test_would_try (GNUNET_TSession *tsession, unsigned int size,
-                    int important)
-{
-  return GNUNET_OK;             /* we always try... */
-}
-
-
-/**
- * The exported method. Makes the core api available via a global and
- * returns the smtp transport API.
- */
-GNUNET_TransportAPI *
-inittransport_smtp (struct GNUNET_CoreAPIForTransport *core)
-{
-  unsigned long long mtu;
-  struct sigaction sa;
-
-  core_api = core;
-  ectx = core->ectx;
-  if (! GNUNET_GC_have_configuration_value (core_api->cfg, "SMTP", "EMAIL"))
-  {
-    GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
-                   _
-                   (
-                     "No email-address specified, can not start SMTP 
transport.\n"));
-    return NULL;
-  }
-  GNUNET_GC_get_configuration_value_number (core_api->cfg, "SMTP", "MTU", 1200,
-                                            SMTP_MESSAGE_SIZE,
-                                            SMTP_MESSAGE_SIZE, &mtu);
-  GNUNET_GC_get_configuration_value_number (core_api->cfg, "SMTP", "RATELIMIT",
-                                            0, 0, 1024 * 1024, &rate_limit);
-  stats = core_api->service_request ("stats");
-  if (stats != NULL)
-  {
-    stat_bytesReceived =
-      stats->create (gettext_noop ("# bytes received via SMTP"));
-    stat_bytesSent = stats->create (gettext_noop ("# bytes sent via SMTP"));
-    stat_bytesDropped =
-      stats->create (gettext_noop ("# bytes dropped by SMTP (outgoing)"));
-  }
-  GNUNET_GC_get_configuration_value_filename (core_api->cfg, "SMTP", "PIPE",
-                                              &pipename);
-  unlink (pipename);
-  if (0 != mkfifo (pipename, S_IWUSR | S_IRUSR | S_IWGRP | S_IWOTH))
-  {
-    GNUNET_GE_LOG_STRERROR (ectx,
-                            GNUNET_GE_ADMIN | GNUNET_GE_BULK | GNUNET_GE_FATAL,
-                            "mkfifo");
-    GNUNET_free (pipename);
-    core_api->service_release (stats);
-    stats = NULL;
-    return NULL;
-  }
-  /* we need to allow the mailer program to send us messages;
-   * easiest done by giving it write permissions (see Mantis #1142) */
-  if (0 != chmod (pipename, S_IWUSR | S_IRUSR | S_IWGRP | S_IWOTH))
-    GNUNET_GE_LOG_STRERROR (ectx,
-                            GNUNET_GE_ADMIN | GNUNET_GE_BULK
-                            | GNUNET_GE_WARNING, "chmod");
-  GNUNET_GC_get_configuration_value_string (core_api->cfg, "SMTP", "EMAIL",
-                                            NULL,
-                                            &email);
-  lock = GNUNET_mutex_create (GNUNET_NO);
-  GNUNET_GC_get_configuration_value_string (core_api->cfg, "SMTP", "SERVER",
-                                            "localhost:25", &smtp_server_name);
-  sa.sa_handler = SIG_IGN;
-  sigemptyset (&sa.sa_mask);
-  sa.sa_flags = 0;
-  sigaction (SIGPIPE, &sa, &old_handler);
-
-  smtpAPI.protocol_number = GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP;
-  smtpAPI.mtu = mtu - sizeof(SMTPMessage);
-  smtpAPI.cost = 50;
-  smtpAPI.hello_verify = &api_verify_hello;
-  smtpAPI.hello_create = &api_create_hello;
-  smtpAPI.connect = &api_connect;
-  smtpAPI.send = &api_send;
-  smtpAPI.associate = &api_associate;
-  smtpAPI.disconnect = &api_disconnect;
-  smtpAPI.server_start = &api_start_transport_server;
-  smtpAPI.server_stop = &api_stop_transport_server;
-  smtpAPI.hello_to_address = &api_hello_to_address;
-  smtpAPI.send_now_test = &api_test_would_try;
-  return &smtpAPI;
-}
-
-
-void
-donetransport_smtp ()
-{
-  sigaction (SIGPIPE, &old_handler, NULL);
-  GNUNET_free (smtp_server_name);
-  if (stats != NULL)
-  {
-    core_api->service_release (stats);
-    stats = NULL;
-  }
-  GNUNET_mutex_destroy (lock);
-  lock = NULL;
-  unlink (pipename);
-  GNUNET_free (pipename);
-  pipename = NULL;
-  GNUNET_free (email);
-  email = NULL;
-}
-
-
-/* end of smtp.c */
diff --git a/src/transport/plugin_transport_tcp.c 
b/src/transport/plugin_transport_tcp.c
deleted file mode 100644
index ceae64709..000000000
--- a/src/transport/plugin_transport_tcp.c
+++ /dev/null
@@ -1,3967 +0,0 @@
-/*
-   This file is part of GNUnet
-   Copyright (C) 2002--2015 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/plugin_transport_tcp.c
- * @brief Implementation of the TCP transport service
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_constants.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_nat_service.h"
-#include "gnunet_protocols.h"
-#include "gnunet_resolver_service.h"
-#include "gnunet_signatures.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_transport_plugin.h"
-#include "transport.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-tcp", __VA_ARGS__)
-
-#define PLUGIN_NAME "tcp"
-
-/**
- * How long until we give up on establishing an NAT connection?
- * Must be > 4 RTT
- */
-#define NAT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 
10)
-
-/**
- * Opaque handle that can be used to cancel
- * a transmit-ready notification.
- */
-struct GNUNET_CONNECTION_TransmitHandle;
-
-/**
- * @brief handle for a server
- */
-struct GNUNET_SERVER_Handle;
-
-/**
- * @brief opaque handle for a client of the server
- */
-struct GNUNET_SERVER_Client;
-
-/**
- * @brief opaque handle server returns for aborting transmission to a client.
- */
-struct GNUNET_SERVER_TransmitHandle;
-
-/**
- * @brief handle for a network connection
- */
-struct GNUNET_CONNECTION_Handle;
-
-/**
- * @brief handle for a network service
- */
-struct LEGACY_SERVICE_Context;
-
-
-/**
- * Stops a service that was started with #GNUNET_SERVICE_start().
- *
- * @param srv service to stop
- */
-void
-LEGACY_SERVICE_stop (struct LEGACY_SERVICE_Context *srv);
-
-
-/**
- * Function called to notify a client about the connection begin ready
- * to queue more data.  @a buf will be NULL and @a size zero if the
- * connection was closed for writing in the meantime.
- *
- * @param cls closure
- * @param size number of bytes available in @a buf
- * @param buf where the callee should write the message
- * @return number of bytes written to @a buf
- */
-typedef size_t (*GNUNET_CONNECTION_TransmitReadyNotify) (void *cls,
-                                                         size_t size,
-                                                         void *buf);
-
-/**
- * Credentials for UNIX domain sockets.
- */
-struct GNUNET_CONNECTION_Credentials
-{
-  /**
-   * UID of the other end of the connection.
-   */
-  uid_t uid;
-
-  /**
-   * GID of the other end of the connection.
-   */
-  gid_t gid;
-};
-
-
-/**
- * Functions with this signature are called whenever a client
- * is disconnected on the network level.
- *
- * @param cls closure
- * @param client identification of the client; NULL
- *        for the last call when the server is destroyed
- */
-typedef void (*GNUNET_SERVER_DisconnectCallback) (
-  void *cls,
-  struct GNUNET_SERVER_Client *client);
-
-
-/**
- * Functions with this signature are called whenever a client
- * is connected on the network level.
- *
- * @param cls closure
- * @param client identification of the client
- */
-typedef void (*GNUNET_SERVER_ConnectCallback) (
-  void *cls,
-  struct GNUNET_SERVER_Client *client);
-
-
-/**
- * Function to call for access control checks.
- *
- * @param cls closure
- * @param ucred credentials, if available, otherwise NULL
- * @param addr address
- * @param addrlen length of address
- * @return GNUNET_YES to allow, GNUNET_NO to deny, GNUNET_SYSERR
- *   for unknown address family (will be denied).
- */
-typedef int (*GNUNET_CONNECTION_AccessCheck) (
-  void *cls,
-  const struct GNUNET_CONNECTION_Credentials *ucred,
-  const struct sockaddr *addr,
-  socklen_t addrlen);
-
-/**
- * Callback function for data received from the network.  Note that
- * both "available" and "err" would be 0 if the read simply timed out.
- *
- * @param cls closure
- * @param buf pointer to received data
- * @param available number of bytes available in "buf",
- *        possibly 0 (on errors)
- * @param addr address of the sender
- * @param addrlen size of addr
- * @param errCode value of errno (on errors receiving)
- */
-typedef void (*GNUNET_CONNECTION_Receiver) (void *cls,
-                                            const void *buf,
-                                            size_t available,
-                                            const struct sockaddr *addr,
-                                            socklen_t addrlen,
-                                            int errCode);
-
-
-/**
- * Close the connection and free associated resources.  There must
- * not be any pending requests for reading or writing to the
- * connection at this time.
- *
- * @param connection connection to destroy
- */
-void
-GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *connection);
-
-
-/**
- * Signature of a function to create a custom tokenizer.
- *
- * @param cls closure from #GNUNET_SERVER_set_callbacks
- * @param client handle to client the tokenzier will be used for
- * @return handle to custom tokenizer ('mst')
- */
-typedef void *(*GNUNET_SERVER_MstCreateCallback) (
-  void *cls,
-  struct GNUNET_SERVER_Client *client);
-
-
-/**
- * Signature of a function to destroy a custom tokenizer.
- *
- * @param cls closure from #GNUNET_SERVER_set_callbacks
- * @param mst custom tokenizer handle
- */
-typedef void (*GNUNET_SERVER_MstDestroyCallback) (void *cls, void *mst);
-
-/**
- * Signature of a function to receive data for a custom tokenizer.
- *
- * @param cls closure from #GNUNET_SERVER_set_callbacks
- * @param mst custom tokenizer handle
- * @param client_identity ID of client for which this is a buffer,
- *        can be NULL (will be passed back to 'cb')
- * @param buf input data to add
- * @param size number of bytes in @a buf
- * @param purge should any excess bytes in the buffer be discarded
- *       (i.e. for packet-based services like UDP)
- * @param one_shot only call callback once, keep rest of message in buffer
- * @return #GNUNET_OK if we are done processing (need more data)
- *         #GNUNET_NO if one_shot was set and we have another message ready
- *         #GNUNET_SYSERR if the data stream is corrupt
- */
-typedef int (*GNUNET_SERVER_MstReceiveCallback) (
-  void *cls,
-  void *mst,
-  struct GNUNET_SERVER_Client *client,
-  const char *buf,
-  size_t size,
-  int purge,
-  int one_shot);
-/**
- * Functions with this signature are called whenever a message is
- * received.
- *
- * @param cls closure
- * @param client identification of the client
- * @param message the actual message
- */
-typedef void (*GNUNET_SERVER_MessageCallback) (
-  void *cls,
-  struct GNUNET_SERVER_Client *client,
-  const struct GNUNET_MessageHeader *message);
-
-/**
- * Message handler.  Each struct specifies how to handle on particular
- * type of message received.
- */
-struct GNUNET_SERVER_MessageHandler
-{
-  /**
-   * Function to call for messages of "type".
-   */
-  GNUNET_SERVER_MessageCallback callback;
-
-  /**
-   * Closure argument for @e callback.
-   */
-  void *callback_cls;
-
-  /**
-   * Type of the message this handler covers.
-   */
-  uint16_t type;
-
-  /**
-   * Expected size of messages of this type.  Use 0 for
-   * variable-size.  If non-zero, messages of the given
-   * type will be discarded (and the connection closed)
-   * if they do not have the right size.
-   */
-  uint16_t expected_size;
-};
-
-
-/**
- * Options for the service (bitmask).
- */
-enum LEGACY_SERVICE_Options
-{
-  /**
-   * Use defaults.  Terminates all client connections and the listen
-   * sockets immediately upon receiving the shutdown signal.
-   */
-  LEGACY_SERVICE_OPTION_NONE = 0,
-
-  /**
-   * Do not trigger server shutdown on signal at all; instead, allow
-   * for the user to terminate the server explicitly when needed
-   * by calling #LEGACY_SERVICE_shutdown().
-   */
-  LEGACY_SERVICE_OPTION_MANUAL_SHUTDOWN = 1,
-
-  /**
-   * Trigger a SOFT server shutdown on signals, allowing active
-   * non-monitor clients to complete their transactions.
-   */
-  LEGACY_SERVICE_OPTION_SOFT_SHUTDOWN = 2
-};
-
-
-/**
- * Ask the server to disconnect from the given client.  This is the
- * same as passing #GNUNET_SYSERR to #GNUNET_SERVER_receive_done,
- * except that it allows dropping of a client even when not handling a
- * message from that client.
- *
- * @param client the client to disconnect from
- */
-void
-GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client);
-
-/**
- * Return user context associated with the given client.
- * Note: you should probably use the macro (call without the underscore).
- *
- * @param client client to query
- * @param size number of bytes in user context struct (for verification only)
- * @return pointer to user context
- */
-void *
-GNUNET_SERVER_client_get_user_context_ (struct GNUNET_SERVER_Client *client,
-                                        size_t size);
-
-
-/**
- * Functions with this signature are called whenever a
- * complete message is received by the tokenizer.
- *
- * Do not call #GNUNET_SERVER_mst_destroy from within
- * the scope of this callback.
- *
- * @param cls closure
- * @param client identification of the client
- * @param message the actual message
- * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
- */
-typedef int (*GNUNET_SERVER_MessageTokenizerCallback) (
-  void *cls,
-  void *client,
-  const struct GNUNET_MessageHeader *message);
-
-
-/**
- * Create a message stream tokenizer.
- *
- * @param cb function to call on completed messages
- * @param cb_cls closure for @a cb
- * @return handle to tokenizer
- */
-struct GNUNET_SERVER_MessageStreamTokenizer *
-GNUNET_SERVER_mst_create (GNUNET_SERVER_MessageTokenizerCallback cb,
-                          void *cb_cls);
-
-/**
- * Add incoming data to the receive buffer and call the
- * callback for all complete messages.
- *
- * @param mst tokenizer to use
- * @param client_identity ID of client for which this is a buffer,
- *        can be NULL (will be passed back to 'cb')
- * @param buf input data to add
- * @param size number of bytes in @a buf
- * @param purge should any excess bytes in the buffer be discarded
- *       (i.e. for packet-based services like UDP)
- * @param one_shot only call callback once, keep rest of message in buffer
- * @return #GNUNET_OK if we are done processing (need more data)
- *         #GNUNET_NO if one_shot was set and we have another message ready
- *         #GNUNET_SYSERR if the data stream is corrupt
- */
-int
-GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst,
-                           void *client_identity,
-                           const char *buf,
-                           size_t size,
-                           int purge,
-                           int one_shot);
-
-
-/**
- * Destroys a tokenizer.
- *
- * @param mst tokenizer to destroy
- */
-void
-GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer *mst);
-
-
-/**
- * Set user context to be associated with the given client.
- * Note: you should probably use the macro (call without the underscore).
- *
- * @param client client to query
- * @param ptr pointer to user context
- * @param size number of bytes in user context struct (for verification only)
- */
-void
-GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client,
-                                        void *ptr,
-                                        size_t size);
-
-/**
- * Return user context associated with the given client.
- *
- * @param client client to query
- * @param type expected return type (i.e. 'struct Foo')
- * @return pointer to user context of type 'type *'.
- */
-#define GNUNET_SERVER_client_get_user_context(client, type) \
-  (type *) GNUNET_SERVER_client_get_user_context_ (client, sizeof(type))
-
-/**
- * Set user context to be associated with the given client.
- *
- * @param client client to query
- * @param value pointer to user context
- */
-#define GNUNET_SERVER_client_set_user_context(client, value) \
-  GNUNET_SERVER_client_set_user_context_ (client, value, sizeof(*value))
-
-
-/**
- * Notify us when the server has enough space to transmit
- * a message of the given size to the given client.
- *
- * @param client client to transmit message to
- * @param size requested amount of buffer space
- * @param timeout after how long should we give up (and call
- *        notify with buf NULL and size 0)?
- * @param callback function to call when space is available
- * @param callback_cls closure for @a callback
- * @return non-NULL if the notify callback was queued; can be used
- *           to cancel the request using
- *           #GNUNET_SERVER_notify_transmit_ready_cancel.
- *         NULL if we are already going to notify someone else (busy)
- */
-struct GNUNET_SERVER_TransmitHandle *
-GNUNET_SERVER_notify_transmit_ready (
-  struct GNUNET_SERVER_Client *client,
-  size_t size,
-  struct GNUNET_TIME_Relative timeout,
-  GNUNET_CONNECTION_TransmitReadyNotify callback,
-  void *callback_cls);
-
-/**
- * Abort transmission request.
- *
- * @param th request to abort
- */
-void
-GNUNET_SERVER_notify_transmit_ready_cancel (
-  struct GNUNET_SERVER_TransmitHandle *th);
-
-
-/**
- * Notify the server that the given client handle should
- * be kept (keeps the connection up if possible, increments
- * the internal reference counter).
- *
- * @param client the client to keep
- */
-void
-GNUNET_SERVER_client_keep (struct GNUNET_SERVER_Client *client);
-
-
-/**
- * Notify the server that the given client handle is no
- * longer required.  Decrements the reference counter.  If
- * that counter reaches zero an inactive connection maybe
- * closed.
- *
- * @param client the client to drop
- */
-void
-GNUNET_SERVER_client_drop (struct GNUNET_SERVER_Client *client);
-
-
-/**
- * Function called by the service's run
- * method to run service-specific setup code.
- *
- * @param cls closure
- * @param server the initialized server
- * @param cfg configuration to use
- */
-typedef void (*LEGACY_SERVICE_Main) (
-  void *cls,
-  struct GNUNET_SERVER_Handle *server,
-  const struct GNUNET_CONFIGURATION_Handle *cfg);
-
-
-/**
- * Suspend accepting connections from the listen socket temporarily.
- * Resume activity using #GNUNET_SERVER_resume.
- *
- * @param server server to stop accepting connections.
- */
-void
-GNUNET_SERVER_suspend (struct GNUNET_SERVER_Handle *server);
-
-/**
- * Notify us when the server has enough space to transmit
- * a message of the given size to the given client.
- *
- * @param client client to transmit message to
- * @param size requested amount of buffer space
- * @param timeout after how long should we give up (and call
- *        notify with buf NULL and size 0)?
- * @param callback function to call when space is available
- * @param callback_cls closure for @a callback
- * @return non-NULL if the notify callback was queued; can be used
- *           to cancel the request using
- *           #GNUNET_SERVER_notify_transmit_ready_cancel.
- *         NULL if we are already going to notify someone else (busy)
- */
-struct GNUNET_SERVER_TransmitHandle *
-GNUNET_SERVER_notify_transmit_ready (
-  struct GNUNET_SERVER_Client *client,
-  size_t size,
-  struct GNUNET_TIME_Relative timeout,
-  GNUNET_CONNECTION_TransmitReadyNotify callback,
-  void *callback_cls);
-
-
-/**
- * Add a TCP socket-based connection to the set of handles managed by
- * this server.  Use this function for outgoing (P2P) connections that
- * we initiated (and where this server should process incoming
- * messages).
- *
- * @param server the server to use
- * @param connection the connection to manage (client must
- *        stop using this connection from now on)
- * @return the client handle
- */
-struct GNUNET_SERVER_Client *
-GNUNET_SERVER_connect_socket (struct GNUNET_SERVER_Handle *server,
-                              struct GNUNET_CONNECTION_Handle *connection);
-
-
-/**
- * Resume accepting connections from the listen socket.
- *
- * @param server server to resume accepting connections.
- */
-void
-GNUNET_SERVER_resume (struct GNUNET_SERVER_Handle *server);
-
-/**
- * Free resources held by this server.
- *
- * @param server server to destroy
- */
-void
-GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *server);
-
-
-#include "tcp_connection_legacy.c"
-#include "tcp_server_mst_legacy.c"
-#include "tcp_server_legacy.c"
-#include "tcp_service_legacy.c"
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * Initial handshake message for a session.
- */
-struct WelcomeMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Identity of the node connecting (TCP client)
-   */
-  struct GNUNET_PeerIdentity clientIdentity;
-};
-
-/**
- * Basically a WELCOME message, but with the purpose
- * of giving the waiting peer a client handle to use
- */
-struct TCP_NAT_ProbeMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Identity of the sender of the message.
-   */
-  struct GNUNET_PeerIdentity clientIdentity;
-};
-GNUNET_NETWORK_STRUCT_END
-
-/**
- * Context for sending a NAT probe via TCP.
- */
-struct TCPProbeContext
-{
-  /**
-   * Active probes are kept in a DLL.
-   */
-  struct TCPProbeContext *next;
-
-  /**
-   * Active probes are kept in a DLL.
-   */
-  struct TCPProbeContext *prev;
-
-  /**
-   * Probe connection.
-   */
-  struct GNUNET_CONNECTION_Handle *sock;
-
-  /**
-   * Message to be sent.
-   */
-  struct TCP_NAT_ProbeMessage message;
-
-  /**
-   * Handle to the transmission.
-   */
-  struct GNUNET_CONNECTION_TransmitHandle *transmit_handle;
-
-  /**
-   * Transport plugin handle.
-   */
-  struct Plugin *plugin;
-};
-
-/**
- * Bits in the `options` field of TCP addresses.
- */
-enum TcpAddressOptions
-{
-  /**
-   * No bits set.
-   */
-  TCP_OPTIONS_NONE = 0,
-
-  /**
-   * See #HTTP_OPTIONS_VERIFY_CERTIFICATE.
-   */
-  TCP_OPTIONS_RESERVED = 1,
-
-  /**
-   * Enable TCP Stealth-style port knocking.
-   */
-  TCP_OPTIONS_TCP_STEALTH = 2
-};
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * Network format for IPv4 addresses.
- */
-struct IPv4TcpAddress
-{
-  /**
-   * Optional options and flags for this address,
-   * see `enum TcpAddressOptions`
-   */
-  uint32_t options GNUNET_PACKED;
-
-  /**
-   * IPv4 address, in network byte order.
-   */
-  uint32_t ipv4_addr GNUNET_PACKED;
-
-  /**
-   * Port number, in network byte order.
-   */
-  uint16_t t4_port GNUNET_PACKED;
-};
-
-/**
- * Network format for IPv6 addresses.
- */
-struct IPv6TcpAddress
-{
-  /**
-   * Optional flags for this address
-   * see `enum TcpAddressOptions`
-   */
-  uint32_t options GNUNET_PACKED;
-
-  /**
-   * IPv6 address.
-   */
-  struct in6_addr ipv6_addr GNUNET_PACKED;
-
-  /**
-   * Port number, in network byte order.
-   */
-  uint16_t t6_port GNUNET_PACKED;
-};
-GNUNET_NETWORK_STRUCT_END
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct Plugin;
-
-/**
- * Information kept for each message that is yet to
- * be transmitted.
- */
-struct PendingMessage
-{
-  /**
-   * This is a doubly-linked list.
-   */
-  struct PendingMessage *next;
-
-  /**
-   * This is a doubly-linked list.
-   */
-  struct PendingMessage *prev;
-
-  /**
-   * The pending message
-   */
-  const char *msg;
-
-  /**
-   * Continuation function to call once the message
-   * has been sent.  Can be NULL if there is no
-   * continuation to call.
-   */
-  GNUNET_TRANSPORT_TransmitContinuation transmit_cont;
-
-  /**
-   * Closure for @e transmit_cont.
-   */
-  void *transmit_cont_cls;
-
-  /**
-   * Timeout value for the pending message.
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * So that the gnunet-service-transport can group messages together,
-   * these pending messages need to accept a message buffer and size
-   * instead of just a `struct GNUNET_MessageHeader`.
-   */
-  size_t message_size;
-};
-
-/**
- * Session handle for TCP connections.
- */
-struct GNUNET_ATS_Session
-{
-  /**
-   * To whom are we talking to (set to our identity
-   * if we are still waiting for the welcome message)
-   */
-  struct GNUNET_PeerIdentity target;
-
-  /**
-   * Pointer to the global plugin struct.
-   */
-  struct Plugin *plugin;
-
-  /**
-   * The client (used to identify this connection)
-   */
-  struct GNUNET_SERVER_Client *client;
-
-  /**
-   * Task cleaning up a NAT client connection establishment attempt;
-   */
-  struct GNUNET_SCHEDULER_Task *nat_connection_timeout;
-
-  /**
-   * Messages currently pending for transmission
-   * to this peer, if any.
-   */
-  struct PendingMessage *pending_messages_head;
-
-  /**
-   * Messages currently pending for transmission
-   * to this peer, if any.
-   */
-  struct PendingMessage *pending_messages_tail;
-
-  /**
-   * Handle for pending transmission request.
-   */
-  struct GNUNET_SERVER_TransmitHandle *transmit_handle;
-
-  /**
-   * Address of the other peer.
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * ID of task used to delay receiving more to throttle sender.
-   */
-  struct GNUNET_SCHEDULER_Task *receive_delay_task;
-
-  /**
-   * Session timeout task
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * When will this session time out?
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * When will we continue to read from the socket?
-   * (used to enforce inbound quota).
-   */
-  struct GNUNET_TIME_Absolute receive_delay;
-
-  /**
-   * Last activity on this connection.  Used to select preferred
-   * connection.
-   */
-  struct GNUNET_TIME_Absolute last_activity;
-
-  /**
-   * Number of bytes waiting for transmission to this peer.
-   */
-  unsigned long long bytes_in_queue;
-
-  /**
-   * Number of messages waiting for transmission to this peer.
-   */
-  unsigned int msgs_in_queue;
-
-  /**
-   * Network type of the address.
-   */
-  enum GNUNET_NetworkType scope;
-
-  /**
-   * Are we still expecting the welcome message? (#GNUNET_YES/#GNUNET_NO)
-   */
-  int expecting_welcome;
-
-  /**
-   * Was this session created using NAT traversal?
-   */
-  int is_nat;
-};
-
-
-/**
- * Context for address to string conversion, closure
- * for #append_port().
- */
-struct PrettyPrinterContext
-{
-  /**
-   * DLL
-   */
-  struct PrettyPrinterContext *next;
-
-  /**
-   * DLL
-   */
-  struct PrettyPrinterContext *prev;
-
-  /**
-   * Our plugin.
-   */
-  struct Plugin *plugin;
-
-  /**
-   * Timeout task
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * Resolver handle
-   */
-  struct GNUNET_RESOLVER_RequestHandle *resolver_handle;
-
-  /**
-   * Function to call with the result.
-   */
-  GNUNET_TRANSPORT_AddressStringCallback asc;
-
-  /**
-   * Clsoure for @e asc.
-   */
-  void *asc_cls;
-
-  /**
-   * IPv6 address
-   */
-  int ipv6;
-
-  /**
-   * Options
-   */
-  uint32_t options;
-
-  /**
-   * Port to add after the IP address.
-   */
-  uint16_t port;
-};
-
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct Plugin
-{
-  /**
-   * Our environment.
-   */
-  struct GNUNET_TRANSPORT_PluginEnvironment *env;
-
-  /**
-   * The listen socket.
-   */
-  struct GNUNET_CONNECTION_Handle *lsock;
-
-  /**
-   * Our handle to the NAT module.
-   */
-  struct GNUNET_NAT_Handle *nat;
-
-  /**
-   * Map from peer identities to sessions for the given peer.
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *sessionmap;
-
-  /**
-   * Handle to the network service.
-   */
-  struct LEGACY_SERVICE_Context *service;
-
-  /**
-   * Handle to the server for this service.
-   */
-  struct GNUNET_SERVER_Handle *server;
-
-  /**
-   * Copy of the handler array where the closures are
-   * set to this struct's instance.
-   */
-  struct GNUNET_SERVER_MessageHandler *handlers;
-
-  /**
-   * Map of peers we have tried to contact behind a NAT
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *nat_wait_conns;
-
-  /**
-   * List of active TCP probes.
-   */
-  struct TCPProbeContext *probe_head;
-
-  /**
-   * List of active TCP probes.
-   */
-  struct TCPProbeContext *probe_tail;
-
-  /**
-   * Function to call about session status changes.
-   */
-  GNUNET_TRANSPORT_SessionInfoCallback sic;
-
-  /**
-   * Closure for @e sic.
-   */
-  void *sic_cls;
-
-  /**
-   * ID of task used to update our addresses when one expires.
-   */
-  struct GNUNET_SCHEDULER_Task *address_update_task;
-
-  /**
-   * Running pretty printers: head
-   */
-  struct PrettyPrinterContext *ppc_dll_head;
-
-  /**
-   * Running pretty printers: tail
-   */
-  struct PrettyPrinterContext *ppc_dll_tail;
-
-  /**
-   * Welcome message used by this peer.
-   */
-  struct WelcomeMessage my_welcome;
-
-  /**
-   * How many more TCP sessions are we allowed to open right now?
-   */
-  unsigned long long max_connections;
-
-  /**
-   * How many more TCP sessions do we have right now?
-   */
-  unsigned long long cur_connections;
-
-  /**
-   * Address options
-   */
-  uint32_t myoptions;
-
-  /**
-   * Port that we are actually listening on.
-   */
-  uint16_t open_port;
-
-  /**
-   * Port that the user said we would have visible to the
-   * rest of the world.
-   */
-  uint16_t adv_port;
-};
-
-
-/**
- * Get the list of addresses that a server for the given service
- * should bind to.
- *
- * @param service_name name of the service
- * @param cfg configuration (which specifies the addresses)
- * @param addrs set (call by reference) to an array of pointers to the
- *              addresses the server should bind to and listen on; the
- *              array will be NULL-terminated (on success)
- * @param addr_lens set (call by reference) to an array of the lengths
- *              of the respective `struct sockaddr` struct in the @a addrs
- *              array (on success)
- * @return number of addresses found on success,
- *              #GNUNET_SYSERR if the configuration
- *              did not specify reasonable finding information or
- *              if it specified a hostname that could not be resolved;
- *              #GNUNET_NO if the number of addresses configured is
- *              zero (in this case, `*addrs` and `*addr_lens` will be
- *              set to NULL).
- */
-static int
-get_server_addresses (const char *service_name,
-                      const struct GNUNET_CONFIGURATION_Handle *cfg,
-                      struct sockaddr ***addrs,
-                      socklen_t **addr_lens)
-{
-  int disablev6;
-  struct GNUNET_NETWORK_Handle *desc;
-  unsigned long long port;
-  char *unixpath;
-  struct addrinfo hints;
-  struct addrinfo *res;
-  struct addrinfo *pos;
-  struct addrinfo *next;
-  unsigned int i;
-  int resi;
-  int ret;
-  int abstract;
-  struct sockaddr **saddrs;
-  socklen_t *saddrlens;
-  char *hostname;
-
-  *addrs = NULL;
-  *addr_lens = NULL;
-  desc = NULL;
-  if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "DISABLEV6"))
-  {
-    if (GNUNET_SYSERR ==
-        (disablev6 = GNUNET_CONFIGURATION_get_value_yesno (cfg,
-                                                           service_name,
-                                                           "DISABLEV6")))
-      return GNUNET_SYSERR;
-  }
-  else
-    disablev6 = GNUNET_NO;
-
-  if (! disablev6)
-  {
-    /* probe IPv6 support */
-    desc = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0);
-    if (NULL == desc)
-    {
-      if ((ENOBUFS == errno) || (ENOMEM == errno) || (ENFILE == errno) ||
-          (EACCES == errno))
-      {
-        GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
-        return GNUNET_SYSERR;
-      }
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           _ (
-             "Disabling IPv6 support for service `%s', failed to create IPv6 
socket: %s\n"),
-           service_name,
-           strerror (errno));
-      disablev6 = GNUNET_YES;
-    }
-    else
-    {
-      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (desc));
-      desc = NULL;
-    }
-  }
-
-  port = 0;
-  if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT"))
-  {
-    if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                            service_name,
-                                                            "PORT",
-                                                            &port))
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Require valid port number for service `%s' in 
configuration!\n"),
-           service_name);
-    }
-    if (port > 65535)
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Require valid port number for service `%s' in 
configuration!\n"),
-           service_name);
-      return GNUNET_SYSERR;
-    }
-  }
-
-  if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "BINDTO"))
-  {
-    GNUNET_break (GNUNET_OK ==
-                  GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                         service_name,
-                                                         "BINDTO",
-                                                         &hostname));
-  }
-  else
-    hostname = NULL;
-
-  unixpath = NULL;
-  abstract = GNUNET_NO;
-#ifdef AF_UNIX
-  if ((GNUNET_YES ==
-       GNUNET_CONFIGURATION_have_value (cfg, service_name, "UNIXPATH")) &&
-      (GNUNET_OK == GNUNET_CONFIGURATION_get_value_filename (cfg,
-                                                             service_name,
-                                                             "UNIXPATH",
-                                                             &unixpath)) &&
-      (0 < strlen (unixpath)))
-  {
-    /* probe UNIX support */
-    struct sockaddr_un s_un;
-
-    if (strlen (unixpath) >= sizeof(s_un.sun_path))
-    {
-      LOG (GNUNET_ERROR_TYPE_WARNING,
-           _ ("UNIXPATH `%s' too long, maximum length is %llu\n"),
-           unixpath,
-           (unsigned long long) sizeof(s_un.sun_path));
-      unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath);
-      LOG (GNUNET_ERROR_TYPE_INFO, _ ("Using `%s' instead\n"), unixpath);
-    }
-#ifdef __linux__
-    abstract = GNUNET_CONFIGURATION_get_value_yesno (cfg,
-                                                     "TESTING",
-                                                     "USE_ABSTRACT_SOCKETS");
-    if (GNUNET_SYSERR == abstract)
-      abstract = GNUNET_NO;
-#endif
-    if ((GNUNET_YES != abstract) &&
-        (GNUNET_OK != GNUNET_DISK_directory_create_for_file (unixpath)))
-      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "mkdir", unixpath);
-  }
-  if (NULL != unixpath)
-  {
-    desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0);
-    if (NULL == desc)
-    {
-      if ((ENOBUFS == errno) || (ENOMEM == errno) || (ENFILE == errno) ||
-          (EACCES == errno))
-      {
-        GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
-        GNUNET_free (hostname);
-        GNUNET_free (unixpath);
-        return GNUNET_SYSERR;
-      }
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           _ (
-             "Disabling UNIX domain socket support for service `%s', failed to 
create UNIX domain socket: %s\n"),
-           service_name,
-           strerror (errno));
-      GNUNET_free (unixpath);
-      unixpath = NULL;
-    }
-    else
-    {
-      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (desc));
-      desc = NULL;
-    }
-  }
-#endif
-
-  if ((0 == port) && (NULL == unixpath))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ (
-           "Have neither PORT nor UNIXPATH for service `%s', but one is 
required\n"),
-         service_name);
-    GNUNET_free (hostname);
-    return GNUNET_SYSERR;
-  }
-  if (0 == port)
-  {
-    saddrs = GNUNET_malloc (2 * sizeof(struct sockaddr *));
-    saddrlens = GNUNET_malloc (2 * sizeof(socklen_t));
-    add_unixpath (saddrs, saddrlens, unixpath, abstract);
-    GNUNET_free (unixpath);
-    GNUNET_free (hostname);
-    *addrs = saddrs;
-    *addr_lens = saddrlens;
-    return 1;
-  }
-
-  if (NULL != hostname)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Resolving `%s' since that is where `%s' will bind to.\n",
-         hostname,
-         service_name);
-    memset (&hints, 0, sizeof(struct addrinfo));
-    if (disablev6)
-      hints.ai_family = AF_INET;
-    hints.ai_protocol = IPPROTO_TCP;
-    if ((0 != (ret = getaddrinfo (hostname, NULL, &hints, &res))) ||
-        (NULL == res))
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Failed to resolve `%s': %s\n"),
-           hostname,
-           gai_strerror (ret));
-      GNUNET_free (hostname);
-      GNUNET_free (unixpath);
-      return GNUNET_SYSERR;
-    }
-    next = res;
-    i = 0;
-    while (NULL != (pos = next))
-    {
-      next = pos->ai_next;
-      if ((disablev6) && (pos->ai_family == AF_INET6))
-        continue;
-      i++;
-    }
-    if (0 == i)
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Failed to find %saddress for `%s'.\n"),
-           disablev6 ? "IPv4 " : "",
-           hostname);
-      freeaddrinfo (res);
-      GNUNET_free (hostname);
-      GNUNET_free (unixpath);
-      return GNUNET_SYSERR;
-    }
-    resi = i;
-    if (NULL != unixpath)
-      resi++;
-    saddrs = GNUNET_malloc ((resi + 1) * sizeof(struct sockaddr *));
-    saddrlens = GNUNET_malloc ((resi + 1) * sizeof(socklen_t));
-    i = 0;
-    if (NULL != unixpath)
-    {
-      add_unixpath (saddrs, saddrlens, unixpath, abstract);
-      i++;
-    }
-    next = res;
-    while (NULL != (pos = next))
-    {
-      next = pos->ai_next;
-      if ((disablev6) && (AF_INET6 == pos->ai_family))
-        continue;
-      if ((IPPROTO_TCP != pos->ai_protocol) && (0 != pos->ai_protocol))
-        continue;     /* not TCP */
-      if ((SOCK_STREAM != pos->ai_socktype) && (0 != pos->ai_socktype))
-        continue;     /* huh? */
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Service `%s' will bind to `%s'\n",
-           service_name,
-           GNUNET_a2s (pos->ai_addr, pos->ai_addrlen));
-      if (AF_INET == pos->ai_family)
-      {
-        GNUNET_assert (sizeof(struct sockaddr_in) == pos->ai_addrlen);
-        saddrlens[i] = pos->ai_addrlen;
-        saddrs[i] = GNUNET_malloc (saddrlens[i]);
-        GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
-        ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
-      }
-      else
-      {
-        GNUNET_assert (AF_INET6 == pos->ai_family);
-        GNUNET_assert (sizeof(struct sockaddr_in6) == pos->ai_addrlen);
-        saddrlens[i] = pos->ai_addrlen;
-        saddrs[i] = GNUNET_malloc (saddrlens[i]);
-        GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
-        ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
-      }
-      i++;
-    }
-    GNUNET_free (hostname);
-    freeaddrinfo (res);
-    resi = i;
-  }
-  else
-  {
-    /* will bind against everything, just set port */
-    if (disablev6)
-    {
-      /* V4-only */
-      resi = 1;
-      if (NULL != unixpath)
-        resi++;
-      i = 0;
-      saddrs = GNUNET_malloc ((resi + 1) * sizeof(struct sockaddr *));
-      saddrlens = GNUNET_malloc ((resi + 1) * sizeof(socklen_t));
-      if (NULL != unixpath)
-      {
-        add_unixpath (saddrs, saddrlens, unixpath, abstract);
-        i++;
-      }
-      saddrlens[i] = sizeof(struct sockaddr_in);
-      saddrs[i] = GNUNET_malloc (saddrlens[i]);
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[i];
-#endif
-      ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET;
-      ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
-    }
-    else
-    {
-      /* dual stack */
-      resi = 2;
-      if (NULL != unixpath)
-        resi++;
-      saddrs = GNUNET_malloc ((resi + 1) * sizeof(struct sockaddr *));
-      saddrlens = GNUNET_malloc ((resi + 1) * sizeof(socklen_t));
-      i = 0;
-      if (NULL != unixpath)
-      {
-        add_unixpath (saddrs, saddrlens, unixpath, abstract);
-        i++;
-      }
-      saddrlens[i] = sizeof(struct sockaddr_in6);
-      saddrs[i] = GNUNET_malloc (saddrlens[i]);
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      ((struct sockaddr_in6 *) saddrs[i])->sin6_len = saddrlens[0];
-#endif
-      ((struct sockaddr_in6 *) saddrs[i])->sin6_family = AF_INET6;
-      ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
-      i++;
-      saddrlens[i] = sizeof(struct sockaddr_in);
-      saddrs[i] = GNUNET_malloc (saddrlens[i]);
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[1];
-#endif
-      ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET;
-      ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
-    }
-  }
-  GNUNET_free (unixpath);
-  *addrs = saddrs;
-  *addr_lens = saddrlens;
-  return resi;
-}
-
-
-/* end ancient copy-and-paste */
-
-
-/**
- * If a session monitor is attached, notify it about the new
- * session state.
- *
- * @param plugin our plugin
- * @param session session that changed state
- * @param state new state of the session
- */
-static void
-notify_session_monitor (struct Plugin *plugin,
-                        struct GNUNET_ATS_Session *session,
-                        enum GNUNET_TRANSPORT_SessionState state)
-{
-  struct GNUNET_TRANSPORT_SessionInfo info;
-
-  if (NULL == plugin->sic)
-    return;
-  memset (&info, 0, sizeof(info));
-  info.state = state;
-  info.is_inbound =
-    GNUNET_HELLO_address_check_option (session->address,
-                                       GNUNET_HELLO_ADDRESS_INFO_INBOUND);
-  info.num_msg_pending = session->msgs_in_queue;
-  info.num_bytes_pending = session->bytes_in_queue;
-  if (NULL != session->receive_delay_task)
-    info.receive_delay = session->receive_delay;
-  info.session_timeout = session->timeout;
-  info.address = session->address;
-  plugin->sic (plugin->sic_cls, session, &info);
-}
-
-
-/**
- * Our external IP address/port mapping has changed.
- *
- * @param cls closure, the `struct Plugin`
- * @param[in,out] app_ctx location where the app can store stuff
- *                  on add and retrieve it on remove
- * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO 
to mean
- *     the previous (now invalid) one
- * @param ac address class the address belongs to
- * @param addr either the previous or the new public IP address
- * @param addrlen actual length of @a addr
- */
-static void
-tcp_nat_port_map_callback (void *cls,
-                           void **app_ctx,
-                           int add_remove,
-                           enum GNUNET_NAT_AddressClass ac,
-                           const struct sockaddr *addr,
-                           socklen_t addrlen)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_HELLO_Address *address;
-  struct IPv4TcpAddress t4;
-  struct IPv6TcpAddress t6;
-  void *arg;
-  size_t args;
-
-  (void) app_ctx;
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "NAT notification to %s address `%s'\n",
-       (GNUNET_YES == add_remove) ? "add" : "remove",
-       GNUNET_a2s (addr, addrlen));
-  /* convert 'addr' to our internal format */
-  switch (addr->sa_family)
-  {
-  case AF_INET:
-    GNUNET_assert (addrlen == sizeof(struct sockaddr_in));
-    memset (&t4, 0, sizeof(t4));
-    t4.options = htonl (plugin->myoptions);
-    t4.ipv4_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr;
-    t4.t4_port = ((struct sockaddr_in *) addr)->sin_port;
-    arg = &t4;
-    args = sizeof(t4);
-    break;
-
-  case AF_INET6:
-    if (IN6_IS_ADDR_LINKLOCAL (&((struct sockaddr_in6 *) addr)->sin6_addr))
-    {
-      /* skip link local, we don't allow them in
-       #tcp_plugin_check_address() */
-      return;
-    }
-    GNUNET_assert (addrlen == sizeof(struct sockaddr_in6));
-    memset (&t6, 0, sizeof(t6));
-    GNUNET_memcpy (&t6.ipv6_addr,
-                   &((struct sockaddr_in6 *) addr)->sin6_addr,
-                   sizeof(struct in6_addr));
-    t6.options = htonl (plugin->myoptions);
-    t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port;
-    arg = &t6;
-    args = sizeof(t6);
-    break;
-
-  default:
-    GNUNET_break (0);
-    return;
-  }
-  /* modify our published address list */
-  GNUNET_assert ((args == sizeof(struct IPv4TcpAddress)) ||
-                 (args == sizeof(struct IPv6TcpAddress)));
-  /* TODO: use 'ac' here in the future... */
-  address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                           PLUGIN_NAME,
-                                           arg,
-                                           args,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-  plugin->env->notify_address (plugin->env->cls, add_remove, address);
-  GNUNET_HELLO_address_free (address);
-}
-
-
-/**
- * Function called for a quick conversion of the binary address to
- * a numeric address.  Note that the caller must not free the
- * address and that the next call to this function is allowed
- * to override the address again.
- *
- * @param cls closure (`struct Plugin*`)
- * @param addr binary address
- * @param addrlen length of @a addr
- * @return string representing the same address
- */
-static const char *
-tcp_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
-{
-  static char rbuf[INET6_ADDRSTRLEN + 12];
-  char buf[INET6_ADDRSTRLEN];
-  const void *sb;
-  struct in_addr a4;
-  struct in6_addr a6;
-  const struct IPv4TcpAddress *t4;
-  const struct IPv6TcpAddress *t6;
-  int af;
-  uint16_t port;
-  uint32_t options;
-
-  switch (addrlen)
-  {
-  case sizeof(struct IPv6TcpAddress):
-    t6 = addr;
-    af = AF_INET6;
-    port = ntohs (t6->t6_port);
-    options = ntohl (t6->options);
-    GNUNET_memcpy (&a6, &t6->ipv6_addr, sizeof(a6));
-    sb = &a6;
-    break;
-
-  case sizeof(struct IPv4TcpAddress):
-    t4 = addr;
-    af = AF_INET;
-    port = ntohs (t4->t4_port);
-    options = ntohl (t4->options);
-    GNUNET_memcpy (&a4, &t4->ipv4_addr, sizeof(a4));
-    sb = &a4;
-    break;
-
-  default:
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         _ ("Unexpected address length: %u bytes\n"),
-         (unsigned int) addrlen);
-    return NULL;
-  }
-  if (NULL == inet_ntop (af, sb, buf, INET6_ADDRSTRLEN))
-  {
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "inet_ntop");
-    return NULL;
-  }
-  GNUNET_snprintf (rbuf,
-                   sizeof(rbuf),
-                   (af == AF_INET6) ? "%s.%u.[%s]:%u" : "%s.%u.%s:%u",
-                   PLUGIN_NAME,
-                   options,
-                   buf,
-                   port);
-  return rbuf;
-}
-
-
-/**
- * Function called to convert a string address to
- * a binary address.
- *
- * @param cls closure (`struct Plugin*`)
- * @param addr string address
- * @param addrlen length of the address
- * @param buf location to store the buffer
- * @param added location to store the number of bytes in the buffer.
- *        If the function returns #GNUNET_SYSERR, its contents are undefined.
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-static int
-tcp_plugin_string_to_address (void *cls,
-                              const char *addr,
-                              uint16_t addrlen,
-                              void **buf,
-                              size_t *added)
-{
-  struct sockaddr_storage socket_address;
-  char *address;
-  char *plugin;
-  char *optionstr;
-  uint32_t options;
-
-  /* Format tcp.options.address:port */
-  address = NULL;
-  plugin = NULL;
-  optionstr = NULL;
-  if ((NULL == addr) || (0 == addrlen))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if ('\0' != addr[addrlen - 1])
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if (strlen (addr) != addrlen - 1)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  plugin = GNUNET_strdup (addr);
-  optionstr = strchr (plugin, '.');
-  if (NULL == optionstr)
-  {
-    GNUNET_break (0);
-    GNUNET_free (plugin);
-    return GNUNET_SYSERR;
-  }
-  optionstr[0] = '\0';
-  optionstr++;
-  options = atol (optionstr);
-  address = strchr (optionstr, '.');
-  if (NULL == address)
-  {
-    GNUNET_break (0);
-    GNUNET_free (plugin);
-    return GNUNET_SYSERR;
-  }
-  address[0] = '\0';
-  address++;
-
-  if (GNUNET_OK !=
-      GNUNET_STRINGS_to_address_ip (address, strlen (address), 
&socket_address))
-  {
-    GNUNET_break (0);
-    GNUNET_free (plugin);
-    return GNUNET_SYSERR;
-  }
-
-  GNUNET_free (plugin);
-  switch (socket_address.ss_family)
-  {
-  case AF_INET: {
-      struct IPv4TcpAddress *t4;
-      struct sockaddr_in *in4 = (struct sockaddr_in *) &socket_address;
-      t4 = GNUNET_new (struct IPv4TcpAddress);
-      t4->options = htonl (options);
-      t4->ipv4_addr = in4->sin_addr.s_addr;
-      t4->t4_port = in4->sin_port;
-      *buf = t4;
-      *added = sizeof(struct IPv4TcpAddress);
-      return GNUNET_OK;
-    }
-
-  case AF_INET6: {
-      struct IPv6TcpAddress *t6;
-      struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) &socket_address;
-      t6 = GNUNET_new (struct IPv6TcpAddress);
-      t6->options = htonl (options);
-      t6->ipv6_addr = in6->sin6_addr;
-      t6->t6_port = in6->sin6_port;
-      *buf = t6;
-      *added = sizeof(struct IPv6TcpAddress);
-      return GNUNET_OK;
-    }
-
-  default:
-    return GNUNET_SYSERR;
-  }
-}
-
-
-/**
- * Find the session handle for the given client.
- * Currently uses both the hashmap and the client
- * context, as the client context is new and the
- * logic still needs to be tested.
- *
- * @param plugin the plugin
- * @param client which client to find the session handle for
- * @return NULL if no matching session exists
- */
-static struct GNUNET_ATS_Session *
-lookup_session_by_client (struct Plugin *plugin,
-                          struct GNUNET_SERVER_Client *client)
-{
-  return GNUNET_SERVER_client_get_user_context (client,
-                                                struct GNUNET_ATS_Session);
-}
-
-
-/**
- * Functions with this signature are called whenever we need
- * to close a session due to a disconnect or failure to
- * establish a connection.
- *
- * @param cls the `struct Plugin`
- * @param session session to close down
- * @return #GNUNET_OK on success
- */
-static int
-tcp_plugin_disconnect_session (void *cls, struct GNUNET_ATS_Session *session)
-{
-  struct Plugin *plugin = cls;
-  struct PendingMessage *pm;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Disconnecting session of peer `%s' address `%s'\n",
-       GNUNET_i2s (&session->target),
-       tcp_plugin_address_to_string (session->plugin,
-                                     session->address->address,
-                                     session->address->address_length));
-
-  if (NULL != session->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (session->timeout_task);
-    session->timeout_task = NULL;
-    session->timeout = GNUNET_TIME_UNIT_ZERO_ABS;
-  }
-
-  if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (plugin->sessionmap,
-                                                          &session->target,
-                                                          session))
-  {
-    GNUNET_STATISTICS_update (session->plugin->env->stats,
-                              gettext_noop ("# TCP sessions active"),
-                              -1,
-                              GNUNET_NO);
-  }
-  else
-  {
-    GNUNET_assert (GNUNET_YES ==
-                   GNUNET_CONTAINER_multipeermap_remove 
(plugin->nat_wait_conns,
-                                                         &session->target,
-                                                         session));
-  }
-  if (NULL != session->client)
-    GNUNET_SERVER_client_set_user_context (session->client, NULL);
-
-  /* clean up state */
-  if (NULL != session->transmit_handle)
-  {
-    GNUNET_SERVER_notify_transmit_ready_cancel (session->transmit_handle);
-    session->transmit_handle = NULL;
-  }
-  session->plugin->env->session_end (session->plugin->env->cls,
-                                     session->address,
-                                     session);
-
-  if (NULL != session->nat_connection_timeout)
-  {
-    GNUNET_SCHEDULER_cancel (session->nat_connection_timeout);
-    session->nat_connection_timeout = NULL;
-  }
-
-  while (NULL != (pm = session->pending_messages_head))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         (NULL != pm->transmit_cont)
-         ? "Could not deliver message to `%s' at %s.\n"
-         : "Could not deliver message to `%s' at %s, notifying.\n",
-         GNUNET_i2s (&session->target),
-         tcp_plugin_address_to_string (session->plugin,
-                                       session->address->address,
-                                       session->address->address_length));
-    GNUNET_STATISTICS_update (session->plugin->env->stats,
-                              gettext_noop ("# bytes currently in TCP 
buffers"),
-                              -(int64_t) pm->message_size,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (session->plugin->env->stats,
-                              gettext_noop (
-                                "# bytes discarded by TCP (disconnect)"),
-                              pm->message_size,
-                              GNUNET_NO);
-    GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
-                                 session->pending_messages_tail,
-                                 pm);
-    GNUNET_assert (0 < session->msgs_in_queue);
-    session->msgs_in_queue--;
-    GNUNET_assert (pm->message_size <= session->bytes_in_queue);
-    session->bytes_in_queue -= pm->message_size;
-    if (NULL != pm->transmit_cont)
-      pm->transmit_cont (pm->transmit_cont_cls,
-                         &session->target,
-                         GNUNET_SYSERR,
-                         pm->message_size,
-                         0);
-    GNUNET_free (pm);
-  }
-  GNUNET_assert (0 == session->msgs_in_queue);
-  GNUNET_assert (0 == session->bytes_in_queue);
-  notify_session_monitor (session->plugin, session, GNUNET_TRANSPORT_SS_DONE);
-
-  if (NULL != session->receive_delay_task)
-  {
-    GNUNET_SCHEDULER_cancel (session->receive_delay_task);
-    session->receive_delay_task = NULL;
-  }
-  if (NULL != session->client)
-  {
-    GNUNET_SERVER_client_disconnect (session->client);
-    session->client = NULL;
-  }
-  GNUNET_HELLO_address_free (session->address);
-  GNUNET_assert (NULL == session->transmit_handle);
-  GNUNET_free (session);
-  return GNUNET_OK;
-}
-
-
-/**
- * Function that is called to get the keepalive factor.
- * #GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
- * calculate the interval between keepalive packets.
- *
- * @param cls closure with the `struct Plugin`
- * @return keepalive factor
- */
-static unsigned int
-tcp_plugin_query_keepalive_factor (void *cls)
-{
-  return 3;
-}
-
-
-/**
- * Session was idle for too long, so disconnect it
- *
- * @param cls the `struct GNUNET_ATS_Session` of the idle session
- */
-static void
-session_timeout (void *cls)
-{
-  struct GNUNET_ATS_Session *s = cls;
-  struct GNUNET_TIME_Relative left;
-
-  s->timeout_task = NULL;
-  left = GNUNET_TIME_absolute_get_remaining (s->timeout);
-  if (0 != left.rel_value_us)
-  {
-    /* not actually our turn yet, but let's at least update
-       the monitor, it may think we're about to die ... */
-    notify_session_monitor (s->plugin, s, GNUNET_TRANSPORT_SS_UPDATE);
-    s->timeout_task = GNUNET_SCHEDULER_add_delayed (left, &session_timeout, s);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p was idle for %s, disconnecting\n",
-       s,
-       GNUNET_STRINGS_relative_time_to_string (
-         GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
-         GNUNET_YES));
-  /* call session destroy function */
-  tcp_plugin_disconnect_session (s->plugin, s);
-}
-
-
-/**
- * Increment session timeout due to activity.
- *
- * @param s session to increment timeout for
- */
-static void
-reschedule_session_timeout (struct GNUNET_ATS_Session *s)
-{
-  GNUNET_assert (NULL != s->timeout_task);
-  s->timeout =
-    GNUNET_TIME_relative_to_absolute 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-}
-
-
-/**
- * Create a new session.  Also queues a welcome message.
- *
- * @param plugin the plugin
- * @param address the address to create the session for
- * @param scope network scope the address is from
- * @param client client to use, reference counter must have already been 
increased
- * @param is_nat this a NAT session, we should wait for a client to
- *               connect to us from an address, then assign that to
- *               the session
- * @return new session object
- */
-static struct GNUNET_ATS_Session *
-create_session (struct Plugin *plugin,
-                const struct GNUNET_HELLO_Address *address,
-                enum GNUNET_NetworkType scope,
-                struct GNUNET_SERVER_Client *client,
-                int is_nat)
-{
-  struct GNUNET_ATS_Session *session;
-  struct PendingMessage *pm;
-
-  if (GNUNET_YES != is_nat)
-    GNUNET_assert (NULL != client);
-  else
-    GNUNET_assert (NULL == client);
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Creating new session for peer `%s' at address %s\n",
-       GNUNET_i2s (&address->peer),
-       tcp_plugin_address_to_string (plugin,
-                                     address->address,
-                                     address->address_length));
-  session = GNUNET_new (struct GNUNET_ATS_Session);
-  session->last_activity = GNUNET_TIME_absolute_get ();
-  session->plugin = plugin;
-  session->is_nat = is_nat;
-  if (NULL != client)
-  {
-    session->client = client;
-    GNUNET_SERVER_client_set_user_context (client, session);
-  }
-  session->address = GNUNET_HELLO_address_copy (address);
-  session->target = address->peer;
-  session->expecting_welcome = GNUNET_YES;
-  session->scope = scope;
-  pm = GNUNET_malloc (sizeof(struct PendingMessage)
-                      + sizeof(struct WelcomeMessage));
-  pm->msg = (const char *) &pm[1];
-  pm->message_size = sizeof(struct WelcomeMessage);
-  GNUNET_memcpy (&pm[1], &plugin->my_welcome, sizeof(struct WelcomeMessage));
-  pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS;
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            gettext_noop ("# bytes currently in TCP buffers"),
-                            pm->message_size,
-                            GNUNET_NO);
-  GNUNET_CONTAINER_DLL_insert (session->pending_messages_head,
-                               session->pending_messages_tail,
-                               pm);
-  session->msgs_in_queue++;
-  session->bytes_in_queue += pm->message_size;
-  session->timeout =
-    GNUNET_TIME_relative_to_absolute 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-  session->timeout_task =
-    GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
-                                  &session_timeout,
-                                  session);
-  notify_session_monitor (session->plugin, session, GNUNET_TRANSPORT_SS_INIT);
-  if (GNUNET_YES != is_nat)
-  {
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              gettext_noop ("# TCP sessions active"),
-                              1,
-                              GNUNET_NO);
-    notify_session_monitor (session->plugin, session, GNUNET_TRANSPORT_SS_UP);
-  }
-  else
-  {
-    notify_session_monitor (session->plugin,
-                            session,
-                            GNUNET_TRANSPORT_SS_HANDSHAKE);
-  }
-  return session;
-}
-
-
-/**
- * If we have pending messages, ask the server to
- * transmit them (schedule the respective tasks, etc.)
- *
- * @param session for which session should we do this
- */
-static void
-process_pending_messages (struct GNUNET_ATS_Session *session);
-
-
-/**
- * Function called to notify a client about the socket
- * being ready to queue more data.  "buf" will be
- * NULL and "size" zero if the socket was closed for
- * writing in the meantime.
- *
- * @param cls closure
- * @param size number of bytes available in @a buf
- * @param buf where the callee should write the message
- * @return number of bytes written to @a buf
- */
-static size_t
-do_transmit (void *cls, size_t size, void *buf)
-{
-  struct GNUNET_ATS_Session *session = cls;
-  struct GNUNET_PeerIdentity pid;
-  struct Plugin *plugin;
-  struct PendingMessage *pos;
-  struct PendingMessage *hd;
-  struct PendingMessage *tl;
-  struct GNUNET_TIME_Absolute now;
-  char *cbuf;
-  size_t ret;
-
-  session->transmit_handle = NULL;
-  plugin = session->plugin;
-  if (NULL == buf)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Timeout trying to transmit to peer `%s', discarding message 
queue.\n",
-         GNUNET_i2s (&session->target));
-    /* timeout; cancel all messages that have already expired */
-    hd = NULL;
-    tl = NULL;
-    ret = 0;
-    now = GNUNET_TIME_absolute_get ();
-    while ((NULL != (pos = session->pending_messages_head)) &&
-           (pos->timeout.abs_value_us <= now.abs_value_us))
-    {
-      GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
-                                   session->pending_messages_tail,
-                                   pos);
-      GNUNET_assert (0 < session->msgs_in_queue);
-      session->msgs_in_queue--;
-      GNUNET_assert (pos->message_size <= session->bytes_in_queue);
-      session->bytes_in_queue -= pos->message_size;
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Failed to transmit %lu byte message to `%s'.\n",
-           (unsigned long) pos->message_size,
-           GNUNET_i2s (&session->target));
-      ret += pos->message_size;
-      GNUNET_CONTAINER_DLL_insert_after (hd, tl, tl, pos);
-    }
-    /* do this call before callbacks (so that if callbacks destroy
-     * session, they have a chance to cancel actions done by this
-     * call) */
-    process_pending_messages (session);
-    pid = session->target;
-    /* no do callbacks and do not use session again since
-     * the callbacks may abort the session */
-    while (NULL != (pos = hd))
-    {
-      GNUNET_CONTAINER_DLL_remove (hd, tl, pos);
-      if (NULL != pos->transmit_cont)
-        pos->transmit_cont (pos->transmit_cont_cls,
-                            &pid,
-                            GNUNET_SYSERR,
-                            pos->message_size,
-                            0);
-      GNUNET_free (pos);
-    }
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              gettext_noop ("# bytes currently in TCP 
buffers"),
-                              -(int64_t) ret,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              gettext_noop (
-                                "# bytes discarded by TCP (timeout)"),
-                              ret,
-                              GNUNET_NO);
-    if (0 < ret)
-      notify_session_monitor (session->plugin,
-                              session,
-                              GNUNET_TRANSPORT_SS_UPDATE);
-    return 0;
-  }
-  /* copy all pending messages that would fit */
-  ret = 0;
-  cbuf = buf;
-  hd = NULL;
-  tl = NULL;
-  while (NULL != (pos = session->pending_messages_head))
-  {
-    if (ret + pos->message_size > size)
-      break;
-    GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
-                                 session->pending_messages_tail,
-                                 pos);
-    GNUNET_assert (0 < session->msgs_in_queue);
-    session->msgs_in_queue--;
-    GNUNET_assert (pos->message_size <= session->bytes_in_queue);
-    session->bytes_in_queue -= pos->message_size;
-    GNUNET_assert (size >= pos->message_size);
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Transmitting message of type %u size %lu to peer %s at %s\n",
-         ntohs (((struct GNUNET_MessageHeader *) pos->msg)->type),
-         (unsigned long) pos->message_size,
-         GNUNET_i2s (&session->target),
-         tcp_plugin_address_to_string (session->plugin,
-                                       session->address->address,
-                                       session->address->address_length));
-    /* FIXME: this GNUNET_memcpy can be up to 7% of our total runtime */
-    GNUNET_memcpy (cbuf, pos->msg, pos->message_size);
-    cbuf += pos->message_size;
-    ret += pos->message_size;
-    size -= pos->message_size;
-    GNUNET_CONTAINER_DLL_insert_tail (hd, tl, pos);
-  }
-  notify_session_monitor (session->plugin, session, 
GNUNET_TRANSPORT_SS_UPDATE);
-  /* schedule 'continuation' before callbacks so that callbacks that
-   * cancel everything don't cause us to use a session that no longer
-   * exists... */
-  process_pending_messages (session);
-  session->last_activity = GNUNET_TIME_absolute_get ();
-  pid = session->target;
-  /* we'll now call callbacks that may cancel the session; hence
-   * we should not use 'session' after this point */
-  while (NULL != (pos = hd))
-  {
-    GNUNET_CONTAINER_DLL_remove (hd, tl, pos);
-    if (NULL != pos->transmit_cont)
-      pos->transmit_cont (pos->transmit_cont_cls,
-                          &pid,
-                          GNUNET_OK,
-                          pos->message_size,
-                          pos->message_size);  /* FIXME: include TCP overhead 
*/
-    GNUNET_free (pos);
-  }
-  GNUNET_assert (NULL == hd);
-  GNUNET_assert (NULL == tl);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            gettext_noop ("# bytes currently in TCP buffers"),
-                            -(int64_t) ret,
-                            GNUNET_NO);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            gettext_noop ("# bytes transmitted via TCP"),
-                            ret,
-                            GNUNET_NO);
-  return ret;
-}
-
-
-/**
- * If we have pending messages, ask the server to
- * transmit them (schedule the respective tasks, etc.)
- *
- * @param session for which session should we do this
- */
-static void
-process_pending_messages (struct GNUNET_ATS_Session *session)
-{
-  struct PendingMessage *pm;
-
-  GNUNET_assert (NULL != session->client);
-  if (NULL != session->transmit_handle)
-    return;
-  if (NULL == (pm = session->pending_messages_head))
-    return;
-
-  session->transmit_handle =
-    GNUNET_SERVER_notify_transmit_ready (session->client,
-                                         pm->message_size,
-                                         GNUNET_TIME_absolute_get_remaining (
-                                           pm->timeout),
-                                         &do_transmit,
-                                         session);
-}
-
-
-/**
- * Function that can be used by the transport service to transmit
- * a message using the plugin.   Note that in the case of a
- * peer disconnecting, the continuation MUST be called
- * prior to the disconnect notification itself.  This function
- * will be called with this peer's HELLO message to initiate
- * a fresh connection to another peer.
- *
- * @param cls closure
- * @param session which session must be used
- * @param msgbuf the message to transmit
- * @param msgbuf_size number of bytes in @a msgbuf
- * @param priority how important is the message (most plugins will
- *                 ignore message priority and just FIFO)
- * @param to how long to wait at most for the transmission (does not
- *                require plugins to discard the message after the timeout,
- *                just advisory for the desired delay; most plugins will ignore
- *                this as well)
- * @param cont continuation to call once the message has
- *        been transmitted (or if the transport is ready
- *        for the next transmission call; or if the
- *        peer disconnected...); can be NULL
- * @param cont_cls closure for @a cont
- * @return number of bytes used (on the physical network, with overheads);
- *         -1 on hard errors (i.e. address invalid); 0 is a legal value
- *         and does NOT mean that the message was not transmitted (DV)
- */
-static ssize_t
-tcp_plugin_send (void *cls,
-                 struct GNUNET_ATS_Session *session,
-                 const char *msgbuf,
-                 size_t msgbuf_size,
-                 unsigned int priority,
-                 struct GNUNET_TIME_Relative to,
-                 GNUNET_TRANSPORT_TransmitContinuation cont,
-                 void *cont_cls)
-{
-  struct Plugin *plugin = cls;
-  struct PendingMessage *pm;
-
-  /* create new message entry */
-  pm = GNUNET_malloc (sizeof(struct PendingMessage) + msgbuf_size);
-  pm->msg = (const char *) &pm[1];
-  GNUNET_memcpy (&pm[1], msgbuf, msgbuf_size);
-  pm->message_size = msgbuf_size;
-  pm->timeout = GNUNET_TIME_relative_to_absolute (to);
-  pm->transmit_cont = cont;
-  pm->transmit_cont_cls = cont_cls;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Asked to transmit %lu bytes to `%s', added message to list.\n",
-       (unsigned long) msgbuf_size,
-       GNUNET_i2s (&session->target));
-
-  if (GNUNET_YES ==
-      GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap,
-                                                    &session->target,
-                                                    session))
-  {
-    GNUNET_assert (NULL != session->client);
-    GNUNET_SERVER_client_set_timeout (session->client,
-                                      
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              gettext_noop ("# bytes currently in TCP 
buffers"),
-                              msgbuf_size,
-                              GNUNET_NO);
-
-    /* append pm to pending_messages list */
-    GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head,
-                                      session->pending_messages_tail,
-                                      pm);
-    notify_session_monitor (session->plugin,
-                            session,
-                            GNUNET_TRANSPORT_SS_UPDATE);
-    session->msgs_in_queue++;
-    session->bytes_in_queue += pm->message_size;
-    process_pending_messages (session);
-    return msgbuf_size;
-  }
-  if (GNUNET_YES ==
-      GNUNET_CONTAINER_multipeermap_contains_value (plugin->nat_wait_conns,
-                                                    &session->target,
-                                                    session))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "This NAT WAIT session for peer `%s' is not yet ready!\n",
-         GNUNET_i2s (&session->target));
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              gettext_noop ("# bytes currently in TCP 
buffers"),
-                              msgbuf_size,
-                              GNUNET_NO);
-    /* append pm to pending_messages list */
-    GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head,
-                                      session->pending_messages_tail,
-                                      pm);
-    session->msgs_in_queue++;
-    session->bytes_in_queue += pm->message_size;
-    notify_session_monitor (session->plugin,
-                            session,
-                            GNUNET_TRANSPORT_SS_HANDSHAKE);
-    return msgbuf_size;
-  }
-  LOG (GNUNET_ERROR_TYPE_ERROR, "Invalid session %p\n", session);
-  if (NULL != cont)
-    cont (cont_cls, &session->target, GNUNET_SYSERR, pm->message_size, 0);
-  GNUNET_break (0);
-  GNUNET_free (pm);
-  return GNUNET_SYSERR; /* session does not exist here */
-}
-
-
-/**
- * Closure for #session_lookup_it().
- */
-struct GNUNET_ATS_SessionItCtx
-{
-  /**
-   * Address we are looking for.
-   */
-  const struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Where to store the session (if we found it).
-   */
-  struct GNUNET_ATS_Session *result;
-};
-
-
-/**
- * Look for a session by address.
- *
- * @param cls the `struct GNUNET_ATS_SessionItCtx`
- * @param key unused
- * @param value a `struct GNUNET_ATS_Session`
- * @return #GNUNET_YES to continue looking, #GNUNET_NO if we found the session
- */
-static int
-session_lookup_it (void *cls,
-                   const struct GNUNET_PeerIdentity *key,
-                   void *value)
-{
-  struct GNUNET_ATS_SessionItCtx *si_ctx = cls;
-  struct GNUNET_ATS_Session *session = value;
-
-  if (0 != GNUNET_HELLO_address_cmp (si_ctx->address, session->address))
-    return GNUNET_YES;
-  si_ctx->result = session;
-  return GNUNET_NO;
-}
-
-
-/**
- * Task cleaning up a NAT connection attempt after timeout
- *
- * @param cls the `struct GNUNET_ATS_Session`
- */
-static void
-nat_connect_timeout (void *cls)
-{
-  struct GNUNET_ATS_Session *session = cls;
-
-  session->nat_connection_timeout = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "NAT WAIT connection to `%4s' at `%s' could not be established, 
removing session\n",
-       GNUNET_i2s (&session->target),
-       tcp_plugin_address_to_string (session->plugin,
-                                     session->address->address,
-                                     session->address->address_length));
-  tcp_plugin_disconnect_session (session->plugin, session);
-}
-
-
-/**
- * Function that will be called whenever the transport service wants to
- * notify the plugin that a session is still active and in use and
- * therefore the session timeout for this session has to be updated
- *
- * @param cls closure
- * @param peer which peer was the session for
- * @param session which session is being updated
- */
-static void
-tcp_plugin_update_session_timeout (void *cls,
-                                   const struct GNUNET_PeerIdentity *peer,
-                                   struct GNUNET_ATS_Session *session)
-{
-  reschedule_session_timeout (session);
-}
-
-
-/**
- * Task to signal the server that we can continue
- * receiving from the TCP client now.
- *
- * @param cls the `struct GNUNET_ATS_Session *`
- */
-static void
-delayed_done (void *cls)
-{
-  struct GNUNET_ATS_Session *session = cls;
-
-  session->receive_delay_task = NULL;
-  reschedule_session_timeout (session);
-  GNUNET_SERVER_receive_done (session->client, GNUNET_OK);
-}
-
-
-/**
- * Function that will be called whenever the transport service wants to
- * notify the plugin that the inbound quota changed and that the plugin
- * should update it's delay for the next receive value
- *
- * @param cls closure
- * @param peer which peer was the session for
- * @param session which session is being updated
- * @param delay new delay to use for receiving
- */
-static void
-tcp_plugin_update_inbound_delay (void *cls,
-                                 const struct GNUNET_PeerIdentity *peer,
-                                 struct GNUNET_ATS_Session *session,
-                                 struct GNUNET_TIME_Relative delay)
-{
-  if (NULL == session->receive_delay_task)
-    return;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "New inbound delay %s\n",
-       GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_NO));
-  session->receive_delay = GNUNET_TIME_relative_to_absolute (delay);
-  GNUNET_SCHEDULER_cancel (session->receive_delay_task);
-  session->receive_delay_task =
-    GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session);
-}
-
-
-/**
- * Create a new session to transmit data to the target
- * This session will used to send data to this peer and the plugin will
- * notify us by calling the env->session_end function
- *
- * @param cls closure
- * @param address the address to use
- * @return the session if the address is valid, NULL otherwise
- */
-static struct GNUNET_ATS_Session *
-tcp_plugin_get_session (void *cls, const struct GNUNET_HELLO_Address *address)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session = NULL;
-  int af;
-  const void *sb;
-  size_t sbs;
-  struct GNUNET_CONNECTION_Handle *sa;
-  struct sockaddr_in a4;
-  struct sockaddr_in6 a6;
-  const struct IPv4TcpAddress *t4;
-  const struct IPv6TcpAddress *t6;
-  unsigned int options;
-  enum GNUNET_NetworkType net_type;
-  unsigned int is_natd = GNUNET_NO;
-  size_t addrlen;
-
-#ifdef TCP_STEALTH
-  struct GNUNET_NETWORK_Handle *s;
-#endif
-
-  addrlen = address->address_length;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Trying to get session for `%s' address of peer `%s'\n",
-       tcp_plugin_address_to_string (plugin,
-                                     address->address,
-                                     address->address_length),
-       GNUNET_i2s (&address->peer));
-
-  if (GNUNET_HELLO_address_check_option (address,
-                                         GNUNET_HELLO_ADDRESS_INFO_INBOUND))
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-
-  /* look for existing session */
-  if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (plugin->sessionmap,
-                                                            &address->peer))
-  {
-    struct GNUNET_ATS_SessionItCtx si_ctx;
-
-    si_ctx.address = address;
-    si_ctx.result = NULL;
-    GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap,
-                                                &address->peer,
-                                                &session_lookup_it,
-                                                &si_ctx);
-    if (NULL != si_ctx.result)
-    {
-      session = si_ctx.result;
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Found existing session for `%s' address `%s'\n",
-           GNUNET_i2s (&address->peer),
-           tcp_plugin_address_to_string (plugin,
-                                         address->address,
-                                         address->address_length));
-      return session;
-    }
-    /* This is a bit of a hack, limiting TCP to never allow more than
-       one TCP connection to any given peer at the same time.
-       Without this, peers sometimes disagree about which of the TCP
-       connections they should use, causing one side to believe that
-       they transmit successfully, while the other receives nothing. */return 
NULL; /* Refuse to have more than one TCP connection per
-                      peer pair at the same time. */
-  }
-
-  if (addrlen == sizeof(struct IPv6TcpAddress))
-  {
-    GNUNET_assert (NULL != address->address);  /* make static analysis happy */
-    t6 = address->address;
-    options = t6->options;
-    af = AF_INET6;
-    memset (&a6, 0, sizeof(a6));
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    a6.sin6_len = sizeof(a6);
-#endif
-    a6.sin6_family = AF_INET6;
-    a6.sin6_port = t6->t6_port;
-    if (t6->t6_port == 0)
-      is_natd = GNUNET_YES;
-    GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
-    sb = &a6;
-    sbs = sizeof(a6);
-  }
-  else if (addrlen == sizeof(struct IPv4TcpAddress))
-  {
-    GNUNET_assert (NULL != address->address);  /* make static analysis happy */
-    t4 = address->address;
-    options = t4->options;
-    af = AF_INET;
-    memset (&a4, 0, sizeof(a4));
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    a4.sin_len = sizeof(a4);
-#endif
-    a4.sin_family = AF_INET;
-    a4.sin_port = t4->t4_port;
-    if (t4->t4_port == 0)
-      is_natd = GNUNET_YES;
-    a4.sin_addr.s_addr = t4->ipv4_addr;
-    sb = &a4;
-    sbs = sizeof(a4);
-  }
-  else
-  {
-    GNUNET_STATISTICS_update (
-      plugin->env->stats,
-      gettext_noop ("# requests to create session with invalid address"),
-      1,
-      GNUNET_NO);
-    return NULL;
-  }
-
-  net_type = plugin->env->get_address_type (plugin->env->cls, sb, sbs);
-  GNUNET_break (net_type != GNUNET_NT_UNSPECIFIED);
-
-  if ((is_natd == GNUNET_YES) && (addrlen == sizeof(struct IPv6TcpAddress)))
-  {
-    /* NAT client only works with IPv4 addresses */
-    return NULL;
-  }
-
-  if (plugin->cur_connections >= plugin->max_connections)
-  {
-    /* saturated */
-    return NULL;
-  }
-
-  if ((is_natd == GNUNET_YES) &&
-      (GNUNET_YES ==
-       GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns,
-                                               &address->peer)))
-  {
-    /* Only do one NAT punch attempt per peer identity */
-    return NULL;
-  }
-
-  if ((is_natd == GNUNET_YES) && (NULL != plugin->nat) &&
-      (GNUNET_NO ==
-       GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns,
-                                               &address->peer)))
-  {
-    struct sockaddr_in local_sa;
-
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Found valid IPv4 NAT address (creating session)!\n");
-    session = create_session (plugin, address, net_type, NULL, GNUNET_YES);
-    session->nat_connection_timeout =
-      GNUNET_SCHEDULER_add_delayed (NAT_TIMEOUT, &nat_connect_timeout, 
session);
-    GNUNET_assert (GNUNET_OK ==
-                   GNUNET_CONTAINER_multipeermap_put (
-                     plugin->nat_wait_conns,
-                     &session->target,
-                     session,
-                     GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Created NAT WAIT connection to `%s' at `%s'\n",
-         GNUNET_i2s (&session->target),
-         GNUNET_a2s (sb, sbs));
-    memset (&local_sa, 0, sizeof(local_sa));
-    local_sa.sin_family = AF_INET;
-    local_sa.sin_port = htons (plugin->open_port);
-    /* We leave sin_address at 0, let the kernel figure it out,
-       even if our bind() is more specific.  (May want to reconsider
-       later.) */
-    if (GNUNET_OK == GNUNET_NAT_request_reversal (plugin->nat, &local_sa, &a4))
-      return session;
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Running NAT client for `%s' at `%s' failed\n",
-         GNUNET_i2s (&session->target),
-         GNUNET_a2s (sb, sbs));
-    tcp_plugin_disconnect_session (plugin, session);
-    return NULL;
-  }
-
-  /* create new outbound session */
-  if (0 != (options & TCP_OPTIONS_TCP_STEALTH))
-  {
-#ifdef TCP_STEALTH
-    s = GNUNET_NETWORK_socket_create (af, SOCK_STREAM, 0);
-    if (NULL == s)
-    {
-      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
-                           "socket");
-      sa = NULL;
-    }
-    else
-    {
-      if ((GNUNET_OK !=
-           GNUNET_NETWORK_socket_setsockopt (s,
-                                             IPPROTO_TCP,
-                                             TCP_STEALTH,
-                                             &session->target,
-                                             sizeof(
-                                               struct GNUNET_PeerIdentity))) ||
-          (GNUNET_OK !=
-           GNUNET_NETWORK_socket_setsockopt (s,
-                                             IPPROTO_TCP,
-                                             TCP_STEALTH_INTEGRITY,
-                                             &plugin->my_welcome,
-                                             sizeof(struct WelcomeMessage))))
-      {
-        /* TCP STEALTH not supported by kernel */
-        GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (s));
-        sa = NULL;
-      }
-      else
-      {
-        sa = GNUNET_CONNECTION_connect_socket (s, sb, sbs);
-      }
-    }
-#else
-    sa = NULL;
-#endif
-  }
-  else
-  {
-    sa = GNUNET_CONNECTION_create_from_sockaddr (af, sb, sbs);
-  }
-  if (NULL == sa)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Failed to create connection to `%s' at `%s'\n",
-         GNUNET_i2s (&address->peer),
-         GNUNET_a2s (sb, sbs));
-    return NULL;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Asked to transmit to `%s', creating fresh session using address 
`%s'.\n",
-       GNUNET_i2s (&address->peer),
-       GNUNET_a2s (sb, sbs));
-
-  session = create_session (plugin,
-                            address,
-                            net_type,
-                            GNUNET_SERVER_connect_socket (plugin->server, sa),
-                            GNUNET_NO);
-  (void) GNUNET_CONTAINER_multipeermap_put (
-    plugin->sessionmap,
-    &session->target,
-    session,
-    GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  /* Send TCP Welcome */
-  process_pending_messages (session);
-
-  return session;
-}
-
-
-/**
- * We have been asked to destroy all connections to a particular peer.
- * This function is called on each applicable session and must tear it
- * down.
- *
- * @param cls the `struct Plugin *`
- * @param key the peer which the session belongs to (unused)
- * @param value the `struct GNUNET_ATS_Session`
- * @return #GNUNET_YES (continue to iterate)
- */
-static int
-session_disconnect_it (void *cls,
-                       const struct GNUNET_PeerIdentity *key,
-                       void *value)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session = value;
-
-  GNUNET_STATISTICS_update (session->plugin->env->stats,
-                            gettext_noop (
-                              "# transport-service disconnect requests for 
TCP"),
-                            1,
-                            GNUNET_NO);
-  tcp_plugin_disconnect_session (plugin, session);
-  return GNUNET_YES;
-}
-
-
-/**
- * Function that can be called to force a disconnect from the
- * specified neighbour.  This should also cancel all previously
- * scheduled transmissions.  Obviously the transmission may have been
- * partially completed already, which is OK.  The plugin is supposed
- * to close the connection (if applicable) and no longer call the
- * transmit continuation(s).
- *
- * Finally, plugin MUST NOT call the services's receive function to
- * notify the service that the connection to the specified target was
- * closed after a getting this call.
- *
- * @param cls closure
- * @param target peer for which the last transmission is
- *        to be cancelled
- */
-static void
-tcp_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
-{
-  struct Plugin *plugin = cls;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Disconnecting peer `%s'\n",
-       GNUNET_i2s (target));
-  GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap,
-                                              target,
-                                              &session_disconnect_it,
-                                              plugin);
-  GNUNET_CONTAINER_multipeermap_get_multiple (plugin->nat_wait_conns,
-                                              target,
-                                              &session_disconnect_it,
-                                              plugin);
-}
-
-
-/**
- * We are processing an address pretty printing request and finished
- * the IP resolution (if applicable).  Append our port and forward the
- * result.  If called with @a hostname NULL, we are done and should
- * clean up the pretty printer (otherwise, there might be multiple
- * hostnames for the IP address and we might receive more).
- *
- * @param cls the `struct PrettyPrinterContext *`
- * @param hostname hostname part of the address
- */
-static void
-append_port (void *cls, const char *hostname)
-{
-  struct PrettyPrinterContext *ppc = cls;
-  struct Plugin *plugin = ppc->plugin;
-  char *ret;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "append_port called with hostname `%s'\n",
-              hostname);
-  if (NULL == hostname)
-  {
-    /* Final call, done */
-    ppc->resolver_handle = NULL;
-    GNUNET_CONTAINER_DLL_remove (plugin->ppc_dll_head,
-                                 plugin->ppc_dll_tail,
-                                 ppc);
-    ppc->asc (ppc->asc_cls, NULL, GNUNET_OK);
-    GNUNET_free (ppc);
-    return;
-  }
-  if (GNUNET_YES == ppc->ipv6)
-    GNUNET_asprintf (&ret,
-                     "%s.%u.[%s]:%d",
-                     PLUGIN_NAME,
-                     ppc->options,
-                     hostname,
-                     ppc->port);
-  else
-    GNUNET_asprintf (&ret,
-                     "%s.%u.%s:%d",
-                     PLUGIN_NAME,
-                     ppc->options,
-                     hostname,
-                     ppc->port);
-  ppc->asc (ppc->asc_cls, ret, GNUNET_OK);
-  GNUNET_free (ret);
-}
-
-
-/**
- * Convert the transports address to a nice, human-readable format.
- *
- * @param cls closure with the `struct Plugin`
- * @param type name of the transport that generated the address
- * @param addr one of the addresses of the host, NULL for the last address
- *        the specific address format depends on the transport
- * @param addrlen length of the @a addr
- * @param numeric should (IP) addresses be displayed in numeric form?
- * @param timeout after how long should we give up?
- * @param asc function to call on each string
- * @param asc_cls closure for @a asc
- */
-static void
-tcp_plugin_address_pretty_printer (void *cls,
-                                   const char *type,
-                                   const void *addr,
-                                   size_t addrlen,
-                                   int numeric,
-                                   struct GNUNET_TIME_Relative timeout,
-                                   GNUNET_TRANSPORT_AddressStringCallback asc,
-                                   void *asc_cls)
-{
-  struct Plugin *plugin = cls;
-  struct PrettyPrinterContext *ppc;
-  const void *sb;
-  size_t sbs;
-  struct sockaddr_in a4;
-  struct sockaddr_in6 a6;
-  const struct IPv4TcpAddress *t4;
-  const struct IPv6TcpAddress *t6;
-  uint16_t port;
-  uint32_t options;
-
-  if (sizeof(struct IPv6TcpAddress) == addrlen)
-  {
-    t6 = addr;
-    memset (&a6, 0, sizeof(a6));
-    a6.sin6_family = AF_INET6;
-    a6.sin6_port = t6->t6_port;
-    GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
-    port = ntohs (t6->t6_port);
-    options = ntohl (t6->options);
-    sb = &a6;
-    sbs = sizeof(a6);
-  }
-  else if (sizeof(struct IPv4TcpAddress) == addrlen)
-  {
-    t4 = addr;
-    memset (&a4, 0, sizeof(a4));
-    a4.sin_family = AF_INET;
-    a4.sin_port = t4->t4_port;
-    a4.sin_addr.s_addr = t4->ipv4_addr;
-    port = ntohs (t4->t4_port);
-    options = ntohl (t4->options);
-    sb = &a4;
-    sbs = sizeof(a4);
-  }
-  else
-  {
-    /* invalid address */
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         _ ("Unexpected address length: %u bytes\n"),
-         (unsigned int) addrlen);
-    asc (asc_cls, NULL, GNUNET_SYSERR);
-    asc (asc_cls, NULL, GNUNET_OK);
-    return;
-  }
-  ppc = GNUNET_new (struct PrettyPrinterContext);
-  ppc->plugin = plugin;
-  if (addrlen == sizeof(struct IPv6TcpAddress))
-    ppc->ipv6 = GNUNET_YES;
-  else
-    ppc->ipv6 = GNUNET_NO;
-  ppc->asc = asc;
-  ppc->asc_cls = asc_cls;
-  ppc->port = port;
-  ppc->options = options;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting DNS reverse lookup\n");
-  ppc->resolver_handle = GNUNET_RESOLVER_hostname_get (sb,
-                                                       sbs,
-                                                       ! numeric,
-                                                       timeout,
-                                                       &append_port,
-                                                       ppc);
-  if (NULL == ppc->resolver_handle)
-  {
-    GNUNET_break (0);
-    GNUNET_free (ppc);
-    return;
-  }
-  GNUNET_CONTAINER_DLL_insert (plugin->ppc_dll_head, plugin->ppc_dll_tail, 
ppc);
-}
-
-
-/**
- * Function that will be called to check if a binary address for this
- * plugin is well-formed and corresponds to an address for THIS peer
- * (as per our configuration).  Naturally, if absolutely necessary,
- * plugins can be a bit conservative in their answer, but in general
- * plugins should make sure that the address does not redirect
- * traffic to a 3rd party that might try to man-in-the-middle our
- * traffic.
- *
- * @param cls closure, our `struct Plugin *`
- * @param addr pointer to the address
- * @param addrlen length of @a addr
- * @return #GNUNET_OK if this is a plausible address for this peer
- *         and transport, #GNUNET_SYSERR if not
- */
-static int
-tcp_plugin_check_address (void *cls, const void *addr, size_t addrlen)
-{
-  struct Plugin *plugin = cls;
-  const struct IPv4TcpAddress *v4;
-  const struct IPv6TcpAddress *v6;
-
-  if ((addrlen != sizeof(struct IPv4TcpAddress)) &&
-      (addrlen != sizeof(struct IPv6TcpAddress)))
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-
-  if (addrlen == sizeof(struct IPv4TcpAddress))
-  {
-    struct sockaddr_in s4;
-
-    v4 = (const struct IPv4TcpAddress *) addr;
-    if (0 != memcmp (&v4->options, &plugin->myoptions, sizeof(uint32_t)))
-    {
-      GNUNET_break (0);
-      return GNUNET_SYSERR;
-    }
-    memset (&s4, 0, sizeof(s4));
-    s4.sin_family = AF_INET;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    s4.sin_len = sizeof(s4);
-#endif
-    s4.sin_port = v4->t4_port;
-    s4.sin_addr.s_addr = v4->ipv4_addr;
-
-    if (GNUNET_OK !=
-        GNUNET_NAT_test_address (plugin->nat, &s4, sizeof(struct sockaddr_in)))
-      return GNUNET_SYSERR;
-  }
-  else
-  {
-    struct sockaddr_in6 s6;
-
-    v6 = (const struct IPv6TcpAddress *) addr;
-    if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr))
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-    if (0 != memcmp (&v6->options, &plugin->myoptions, sizeof(uint32_t)))
-    {
-      GNUNET_break (0);
-      return GNUNET_SYSERR;
-    }
-    memset (&s6, 0, sizeof(s6));
-    s6.sin6_family = AF_INET6;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    s6.sin6_len = sizeof(s6);
-#endif
-    s6.sin6_port = v6->t6_port;
-    s6.sin6_addr = v6->ipv6_addr;
-
-    if (GNUNET_OK != GNUNET_NAT_test_address (plugin->nat,
-                                              &s6,
-                                              sizeof(struct sockaddr_in6)))
-      return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * We've received a nat probe from this peer via TCP.  Finish
- * creating the client session and resume sending of queued
- * messages.
- *
- * @param cls closure
- * @param client identification of the client
- * @param message the actual message
- */
-static void
-handle_tcp_nat_probe (void *cls,
-                      struct GNUNET_SERVER_Client *client,
-                      const struct GNUNET_MessageHeader *message)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session;
-  const struct TCP_NAT_ProbeMessage *tcp_nat_probe;
-  size_t alen;
-  void *vaddr;
-  struct IPv4TcpAddress *t4;
-  struct IPv6TcpAddress *t6;
-  const struct sockaddr_in *s4;
-  const struct sockaddr_in6 *s6;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Received NAT probe\n");
-  /* We have received a TCP NAT probe, meaning we (hopefully) initiated
-   * a connection to this peer by running gnunet-nat-client.  This peer
-   * received the punch message and now wants us to use the new connection
-   * as the default for that peer.  Do so and then send a WELCOME message
-   * so we can really be connected!
-   */if (ntohs (message->size) != sizeof(struct TCP_NAT_ProbeMessage))
-  {
-    GNUNET_break_op (0);
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    return;
-  }
-
-  tcp_nat_probe = (const struct TCP_NAT_ProbeMessage *) message;
-  if (0 == memcmp (&tcp_nat_probe->clientIdentity,
-                   plugin->env->my_identity,
-                   sizeof(struct GNUNET_PeerIdentity)))
-  {
-    /* refuse connections from ourselves */
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    return;
-  }
-
-  session = GNUNET_CONTAINER_multipeermap_get (plugin->nat_wait_conns,
-                                               &tcp_nat_probe->clientIdentity);
-  if (NULL == session)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Did NOT find session for NAT probe!\n");
-    GNUNET_SERVER_receive_done (client, GNUNET_OK);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Found session for NAT probe!\n");
-
-  if (NULL != session->nat_connection_timeout)
-  {
-    GNUNET_SCHEDULER_cancel (session->nat_connection_timeout);
-    session->nat_connection_timeout = NULL;
-  }
-
-  if (GNUNET_OK != GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
-  {
-    GNUNET_break (0);
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    tcp_plugin_disconnect_session (plugin, session);
-    return;
-  }
-  GNUNET_assert (
-    GNUNET_YES ==
-    GNUNET_CONTAINER_multipeermap_remove (plugin->nat_wait_conns,
-                                          &tcp_nat_probe->clientIdentity,
-                                          session));
-  GNUNET_SERVER_client_set_user_context (client, session);
-  (void) GNUNET_CONTAINER_multipeermap_put (
-    plugin->sessionmap,
-    &session->target,
-    session,
-    GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  session->last_activity = GNUNET_TIME_absolute_get ();
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Found address `%s' for incoming connection\n",
-       GNUNET_a2s (vaddr, alen));
-  switch (((const struct sockaddr *) vaddr)->sa_family)
-  {
-  case AF_INET:
-    s4 = vaddr;
-    t4 = GNUNET_new (struct IPv4TcpAddress);
-    t4->options = htonl (TCP_OPTIONS_NONE);
-    t4->t4_port = s4->sin_port;
-    t4->ipv4_addr = s4->sin_addr.s_addr;
-    session->address =
-      GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity,
-                                     PLUGIN_NAME,
-                                     &t4,
-                                     sizeof(struct IPv4TcpAddress),
-                                     GNUNET_HELLO_ADDRESS_INFO_NONE);
-    break;
-
-  case AF_INET6:
-    s6 = vaddr;
-    t6 = GNUNET_new (struct IPv6TcpAddress);
-    t6->options = htonl (TCP_OPTIONS_NONE);
-    t6->t6_port = s6->sin6_port;
-    GNUNET_memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr));
-    session->address =
-      GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity,
-                                     PLUGIN_NAME,
-                                     &t6,
-                                     sizeof(struct IPv6TcpAddress),
-                                     GNUNET_HELLO_ADDRESS_INFO_NONE);
-    break;
-
-  default:
-    GNUNET_break_op (0);
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Bad address for incoming connection!\n");
-    GNUNET_free (vaddr);
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    tcp_plugin_disconnect_session (plugin, session);
-    return;
-  }
-  GNUNET_free (vaddr);
-  GNUNET_break (NULL == session->client);
-  session->client = client;
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            gettext_noop ("# TCP sessions active"),
-                            1,
-                            GNUNET_NO);
-  process_pending_messages (session);
-  GNUNET_SERVER_receive_done (client, GNUNET_OK);
-}
-
-
-/**
- * We've received a welcome from this peer via TCP.  Possibly create a
- * fresh client record and send back our welcome.
- *
- * @param cls closure
- * @param client identification of the client
- * @param message the actual message
- */
-static void
-handle_tcp_welcome (void *cls,
-                    struct GNUNET_SERVER_Client *client,
-                    const struct GNUNET_MessageHeader *message)
-{
-  struct Plugin *plugin = cls;
-  const struct WelcomeMessage *wm = (const struct WelcomeMessage *) message;
-  struct GNUNET_HELLO_Address *address;
-  struct GNUNET_ATS_Session *session;
-  size_t alen;
-  void *vaddr;
-  struct IPv4TcpAddress t4;
-  struct IPv6TcpAddress t6;
-  const struct sockaddr_in *s4;
-  const struct sockaddr_in6 *s6;
-
-  if (0 == memcmp (&wm->clientIdentity,
-                   plugin->env->my_identity,
-                   sizeof(struct GNUNET_PeerIdentity)))
-  {
-    /* refuse connections from ourselves */
-    if (GNUNET_OK == GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
-    {
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           "Received WELCOME message from my own identity `%s' on address 
`%s'\n",
-           GNUNET_i2s (&wm->clientIdentity),
-           GNUNET_a2s (vaddr, alen));
-      GNUNET_free (vaddr);
-    }
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    return;
-  }
-
-  if (GNUNET_OK == GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Received WELCOME message from `%s' on address `%s'\n",
-         GNUNET_i2s (&wm->clientIdentity),
-         GNUNET_a2s (vaddr, alen));
-    GNUNET_free (vaddr);
-  }
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            gettext_noop ("# TCP WELCOME messages received"),
-                            1,
-                            GNUNET_NO);
-  session = lookup_session_by_client (plugin, client);
-  if (NULL != session)
-  {
-    if (GNUNET_OK == GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Found existing session %p for peer `%s'\n",
-           session,
-           GNUNET_a2s (vaddr, alen));
-      GNUNET_free (vaddr);
-    }
-  }
-  else
-  {
-    if (GNUNET_OK == GNUNET_SERVER_client_get_address (client, &vaddr, &alen))
-    {
-      if (alen == sizeof(struct sockaddr_in))
-      {
-        s4 = vaddr;
-        memset (&t4, '\0', sizeof(t4));
-        t4.options = htonl (TCP_OPTIONS_NONE);
-        t4.t4_port = s4->sin_port;
-        t4.ipv4_addr = s4->sin_addr.s_addr;
-        address =
-          GNUNET_HELLO_address_allocate (&wm->clientIdentity,
-                                         PLUGIN_NAME,
-                                         &t4,
-                                         sizeof(t4),
-                                         GNUNET_HELLO_ADDRESS_INFO_INBOUND);
-      }
-      else if (alen == sizeof(struct sockaddr_in6))
-      {
-        s6 = vaddr;
-        memset (&t6, '\0', sizeof(t6));
-        t6.options = htonl (TCP_OPTIONS_NONE);
-        t6.t6_port = s6->sin6_port;
-        GNUNET_memcpy (&t6.ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr));
-        address =
-          GNUNET_HELLO_address_allocate (&wm->clientIdentity,
-                                         PLUGIN_NAME,
-                                         &t6,
-                                         sizeof(t6),
-                                         GNUNET_HELLO_ADDRESS_INFO_INBOUND);
-      }
-      else
-      {
-        GNUNET_break (0);
-        GNUNET_free (vaddr);
-        GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-        return;
-      }
-      session = create_session (plugin,
-                                address,
-                                plugin->env->get_address_type 
(plugin->env->cls,
-                                                               vaddr,
-                                                               alen),
-                                client,
-                                GNUNET_NO);
-      GNUNET_break (GNUNET_NT_UNSPECIFIED != session->scope);
-      GNUNET_HELLO_address_free (address);
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Creating new%s session %p for peer `%s' client %p\n",
-           GNUNET_HELLO_address_check_option (session->address,
-                                              
GNUNET_HELLO_ADDRESS_INFO_INBOUND)
-           ? " inbound"
-           : "",
-           session,
-           tcp_plugin_address_to_string (plugin,
-                                         session->address->address,
-                                         session->address->address_length),
-           client);
-      GNUNET_free (vaddr);
-      (void) GNUNET_CONTAINER_multipeermap_put (
-        plugin->sessionmap,
-        &session->target,
-        session,
-        GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-      /* Notify transport and ATS about new session */
-      plugin->env->session_start (plugin->env->cls,
-                                  session->address,
-                                  session,
-                                  session->scope);
-    }
-    else
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Did not obtain TCP socket address for incoming connection\n");
-      GNUNET_break (0);
-      GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-      return;
-    }
-  }
-
-  if (GNUNET_YES != session->expecting_welcome)
-  {
-    GNUNET_break_op (0);
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    return;
-  }
-  session->last_activity = GNUNET_TIME_absolute_get ();
-  session->expecting_welcome = GNUNET_NO;
-
-  process_pending_messages (session);
-  GNUNET_SERVER_client_set_timeout (client,
-                                    GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-  GNUNET_SERVER_receive_done (client, GNUNET_OK);
-}
-
-
-/**
- * We've received data for this peer via TCP.  Unbox,
- * compute latency and forward.
- *
- * @param cls closure
- * @param client identification of the client
- * @param message the actual message
- */
-static void
-handle_tcp_data (void *cls,
-                 struct GNUNET_SERVER_Client *client,
-                 const struct GNUNET_MessageHeader *message)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session;
-  struct GNUNET_TIME_Relative delay;
-  uint16_t type;
-
-  type = ntohs (message->type);
-  if ((GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME == type) ||
-      (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE == type))
-  {
-    /* We don't want to propagate WELCOME and NAT Probe messages up! */
-    GNUNET_SERVER_receive_done (client, GNUNET_OK);
-    return;
-  }
-  session = lookup_session_by_client (plugin, client);
-  if (NULL == session)
-  {
-    /* No inbound session found */
-    void *vaddr = NULL;
-    size_t alen;
-
-    GNUNET_assert (GNUNET_OK ==
-                   GNUNET_SERVER_client_get_address (client, &vaddr, &alen));
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Received unexpected %u bytes of type %u from `%s'\n",
-         (unsigned int) ntohs (message->size),
-         (unsigned int) ntohs (message->type),
-         GNUNET_a2s (vaddr, alen));
-    GNUNET_break_op (0);
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    GNUNET_free (vaddr);
-    return;
-  }
-  if (GNUNET_YES == session->expecting_welcome)
-  {
-    /* Session is expecting WELCOME message */
-    void *vaddr = NULL;
-    size_t alen;
-
-    GNUNET_SERVER_client_get_address (client, &vaddr, &alen);
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Received unexpected %u bytes of type %u from `%s'\n",
-         (unsigned int) ntohs (message->size),
-         (unsigned int) ntohs (message->type),
-         GNUNET_a2s (vaddr, alen));
-    GNUNET_break_op (0);
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    GNUNET_free (vaddr);
-    return;
-  }
-
-  session->last_activity = GNUNET_TIME_absolute_get ();
-  {
-    void *vaddr = NULL;
-    size_t alen;
-
-    GNUNET_SERVER_client_get_address (client, &vaddr, &alen);
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Passing %u bytes of type %u from `%s' at %s to transport service.\n",
-         (unsigned int) ntohs (message->size),
-         (unsigned int) ntohs (message->type),
-         GNUNET_i2s (&session->target),
-         GNUNET_a2s (vaddr, alen));
-    GNUNET_free (vaddr);
-  }
-
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            gettext_noop ("# bytes received via TCP"),
-                            ntohs (message->size),
-                            GNUNET_NO);
-
-  GNUNET_assert (
-    GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap,
-                                                  &session->target,
-                                                  session));
-  delay =
-    plugin->env->receive (plugin->env->cls, session->address, session, 
message);
-  reschedule_session_timeout (session);
-  if (0 == delay.rel_value_us)
-  {
-    GNUNET_SERVER_receive_done (client, GNUNET_OK);
-  }
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Throttling receiving from `%s' for %s\n",
-         GNUNET_i2s (&session->target),
-         GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
-    GNUNET_SERVER_disable_receive_done_warning (client);
-    GNUNET_assert (NULL == session->receive_delay_task);
-    session->receive_delay_task =
-      GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session);
-  }
-}
-
-
-/**
- * Function called whenever a peer is connected on the "SERVER" level.
- * Increments number of active connections and suspends server if we
- * have reached the limit.
- *
- * @param cls closure
- * @param client identification of the client
- */
-static void
-connect_notify (void *cls, struct GNUNET_SERVER_Client *client)
-{
-  struct Plugin *plugin = cls;
-
-  if (NULL == client)
-    return;
-  plugin->cur_connections++;
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         gettext_noop ("# TCP server connections active"),
-                         plugin->cur_connections,
-                         GNUNET_NO);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            gettext_noop ("# TCP server connect events"),
-                            1,
-                            GNUNET_NO);
-  if (plugin->cur_connections != plugin->max_connections)
-    return;
-  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-              _ ("TCP connection limit reached, suspending server\n"));
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            gettext_noop ("# TCP service suspended"),
-                            1,
-                            GNUNET_NO);
-  GNUNET_SERVER_suspend (
-    plugin->server); /* Maximum number of connections rechead */
-}
-
-
-/**
- * Function called whenever a peer is disconnected on the "SERVER"
- * level.  Cleans up the connection, decrements number of active
- * connections and if applicable resumes listening.
- *
- * @param cls closure
- * @param client identification of the client
- */
-static void
-disconnect_notify (void *cls, struct GNUNET_SERVER_Client *client)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session;
-
-  if (NULL == client)
-    return;
-  GNUNET_assert (plugin->cur_connections >= 1);
-  plugin->cur_connections--;
-  session = lookup_session_by_client (plugin, client);
-  if (NULL == session)
-    return; /* unknown, nothing to do */
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Destroying session of `%s' with %s due to network-level disconnect.\n",
-       GNUNET_i2s (&session->target),
-       tcp_plugin_address_to_string (session->plugin,
-                                     session->address->address,
-                                     session->address->address_length));
-
-  if (plugin->cur_connections == plugin->max_connections)
-  {
-    GNUNET_STATISTICS_update (session->plugin->env->stats,
-                              gettext_noop ("# TCP service resumed"),
-                              1,
-                              GNUNET_NO);
-    GNUNET_SERVER_resume (plugin->server);  /* Resume server  */
-  }
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         gettext_noop ("# TCP server connections active"),
-                         plugin->cur_connections,
-                         GNUNET_NO);
-  GNUNET_STATISTICS_update (session->plugin->env->stats,
-                            gettext_noop (
-                              "# network-level TCP disconnect events"),
-                            1,
-                            GNUNET_NO);
-  tcp_plugin_disconnect_session (plugin, session);
-}
-
-
-/**
- * We can now send a probe message, copy into buffer to really send.
- *
- * @param cls closure, a `struct TCPProbeContext`
- * @param size max size to copy
- * @param buf buffer to copy message to
- * @return number of bytes copied into @a buf
- */
-static size_t
-notify_send_probe (void *cls, size_t size, void *buf)
-{
-  struct TCPProbeContext *tcp_probe_ctx = cls;
-  struct Plugin *plugin = tcp_probe_ctx->plugin;
-  size_t ret;
-
-  tcp_probe_ctx->transmit_handle = NULL;
-  GNUNET_CONTAINER_DLL_remove (plugin->probe_head,
-                               plugin->probe_tail,
-                               tcp_probe_ctx);
-  if (NULL == buf)
-  {
-    GNUNET_CONNECTION_destroy (tcp_probe_ctx->sock);
-    GNUNET_free (tcp_probe_ctx);
-    return 0;
-  }
-  GNUNET_assert (size >= sizeof(tcp_probe_ctx->message));
-  GNUNET_memcpy (buf, &tcp_probe_ctx->message, sizeof(tcp_probe_ctx->message));
-  GNUNET_SERVER_connect_socket (tcp_probe_ctx->plugin->server,
-                                tcp_probe_ctx->sock);
-  ret = sizeof(tcp_probe_ctx->message);
-  GNUNET_free (tcp_probe_ctx);
-  return ret;
-}
-
-
-/**
- * Function called by the NAT subsystem suggesting another peer wants
- * to connect to us via connection reversal.  Try to connect back to the
- * given IP.
- *
- * @param cls closure
- * @param addr address to try
- * @param addrlen number of bytes in @a addr
- */
-static void
-try_connection_reversal (void *cls,
-                         const struct sockaddr *addr,
-                         socklen_t addrlen)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_CONNECTION_Handle *sock;
-  struct TCPProbeContext *tcp_probe_ctx;
-
-  /**
-   * We have received an ICMP response, ostensibly from a peer
-   * that wants to connect to us! Send a message to establish a connection.
-   */
-  sock = GNUNET_CONNECTION_create_from_sockaddr (AF_INET, addr, addrlen);
-  if (NULL == sock)
-  {
-    /* failed for some odd reason (out of sockets?); ignore attempt */
-    return;
-  }
-
-  tcp_probe_ctx = GNUNET_new (struct TCPProbeContext);
-  tcp_probe_ctx->message.header.size =
-    htons (sizeof(struct TCP_NAT_ProbeMessage));
-  tcp_probe_ctx->message.header.type =
-    htons (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE);
-  tcp_probe_ctx->message.clientIdentity = *plugin->env->my_identity;
-  tcp_probe_ctx->plugin = plugin;
-  tcp_probe_ctx->sock = sock;
-  GNUNET_CONTAINER_DLL_insert (plugin->probe_head,
-                               plugin->probe_tail,
-                               tcp_probe_ctx);
-  tcp_probe_ctx->transmit_handle =
-    GNUNET_CONNECTION_notify_transmit_ready (sock,
-                                             ntohs (tcp_probe_ctx->message
-                                                    .header.size),
-                                             GNUNET_TIME_UNIT_FOREVER_REL,
-                                             &notify_send_probe,
-                                             tcp_probe_ctx);
-}
-
-
-/**
- * Function obtain the network type for a session
- *
- * @param cls closure (`struct Plugin *`)
- * @param session the session
- * @return the network type in HBO or #GNUNET_SYSERR
- */
-static enum GNUNET_NetworkType
-tcp_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session)
-{
-  return session->scope;
-}
-
-
-/**
- * Function obtain the network type for an address.
- *
- * @param cls closure (`struct Plugin *`)
- * @param address the address
- * @return the network type
- */
-static enum GNUNET_NetworkType
-tcp_plugin_get_network_for_address (void *cls,
-                                    const struct GNUNET_HELLO_Address *address)
-{
-  struct Plugin *plugin = cls;
-  size_t addrlen;
-  struct sockaddr_in a4;
-  struct sockaddr_in6 a6;
-  const struct IPv4TcpAddress *t4;
-  const struct IPv6TcpAddress *t6;
-  const void *sb;
-  size_t sbs;
-
-  addrlen = address->address_length;
-  if (addrlen == sizeof(struct IPv6TcpAddress))
-  {
-    GNUNET_assert (NULL != address->address);  /* make static analysis happy */
-    t6 = address->address;
-    memset (&a6, 0, sizeof(a6));
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    a6.sin6_len = sizeof(a6);
-#endif
-    a6.sin6_family = AF_INET6;
-    a6.sin6_port = t6->t6_port;
-    GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr));
-    sb = &a6;
-    sbs = sizeof(a6);
-  }
-  else if (addrlen == sizeof(struct IPv4TcpAddress))
-  {
-    GNUNET_assert (NULL != address->address);  /* make static analysis happy */
-    t4 = address->address;
-    memset (&a4, 0, sizeof(a4));
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    a4.sin_len = sizeof(a4);
-#endif
-    a4.sin_family = AF_INET;
-    a4.sin_port = t4->t4_port;
-    a4.sin_addr.s_addr = t4->ipv4_addr;
-    sb = &a4;
-    sbs = sizeof(a4);
-  }
-  else
-  {
-    GNUNET_break (0);
-    return GNUNET_NT_UNSPECIFIED;
-  }
-  return plugin->env->get_address_type (plugin->env->cls, sb, sbs);
-}
-
-
-/**
- * Return information about the given session to the
- * monitor callback.
- *
- * @param cls the `struct Plugin` with the monitor callback (`sic`)
- * @param peer peer we send information about
- * @param value our `struct GNUNET_ATS_Session` to send information about
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-send_session_info_iter (void *cls,
-                        const struct GNUNET_PeerIdentity *peer,
-                        void *value)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session = value;
-
-  notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_INIT);
-  /* FIXME: cannot tell if this is up or not from current
-     session state... */
-  notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_UP);
-  return GNUNET_OK;
-}
-
-
-/**
- * Begin monitoring sessions of a plugin.  There can only
- * be one active monitor per plugin (i.e. if there are
- * multiple monitors, the transport service needs to
- * multiplex the generated events over all of them).
- *
- * @param cls closure of the plugin
- * @param sic callback to invoke, NULL to disable monitor;
- *            plugin will being by iterating over all active
- *            sessions immediately and then enter monitor mode
- * @param sic_cls closure for @a sic
- */
-static void
-tcp_plugin_setup_monitor (void *cls,
-                          GNUNET_TRANSPORT_SessionInfoCallback sic,
-                          void *sic_cls)
-{
-  struct Plugin *plugin = cls;
-
-  plugin->sic = sic;
-  plugin->sic_cls = sic_cls;
-  if (NULL != sic)
-  {
-    GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap,
-                                           &send_session_info_iter,
-                                           plugin);
-    /* signal end of first iteration */
-    sic (sic_cls, NULL, NULL);
-  }
-}
-
-
-/**
- * Entry point for the plugin.
- *
- * @param cls closure, the `struct GNUNET_TRANSPORT_PluginEnvironment *`
- * @return the `struct GNUNET_TRANSPORT_PluginFunctions *` or NULL on error
- */
-void *
-libgnunet_plugin_transport_tcp_init (void *cls)
-{
-  static const struct GNUNET_SERVER_MessageHandler my_handlers[] =
-  { { &handle_tcp_welcome,
-      NULL,
-      GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME,
-      sizeof(struct WelcomeMessage) },
-    { &handle_tcp_nat_probe,
-      NULL,
-      GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE,
-      sizeof(struct TCP_NAT_ProbeMessage) },
-    { &handle_tcp_data, NULL, GNUNET_MESSAGE_TYPE_ALL, 0 },
-    { NULL, NULL, 0, 0 } };
-  struct GNUNET_TRANSPORT_PluginEnvironment *env = cls;
-  struct GNUNET_TRANSPORT_PluginFunctions *api;
-  struct Plugin *plugin;
-  struct LEGACY_SERVICE_Context *service;
-  unsigned long long aport;
-  unsigned long long bport;
-  unsigned long long max_connections;
-  unsigned int i;
-  struct GNUNET_TIME_Relative idle_timeout;
-
-#ifdef TCP_STEALTH
-  struct GNUNET_NETWORK_Handle *const *lsocks;
-#endif
-  int ret;
-  int ret_s;
-  struct sockaddr **addrs;
-  socklen_t *addrlens;
-
-  if (NULL == env->receive)
-  {
-    /* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully
-       initialize the plugin or the API */
-    api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-    api->cls = NULL;
-    api->address_pretty_printer = &tcp_plugin_address_pretty_printer;
-    api->address_to_string = &tcp_plugin_address_to_string;
-    api->string_to_address = &tcp_plugin_string_to_address;
-    return api;
-  }
-
-  GNUNET_assert (NULL != env->cfg);
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (env->cfg,
-                                                          "transport-tcp",
-                                                          "MAX_CONNECTIONS",
-                                                          &max_connections))
-    max_connections = 128;
-
-  aport = 0;
-  if ((GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (env->cfg,
-                                                           "transport-tcp",
-                                                           "PORT",
-                                                           &bport)) ||
-      (bport > 65535) ||
-      ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (env->cfg,
-                                                            "transport-tcp",
-                                                            "ADVERTISED-PORT",
-                                                            &aport)) &&
-       (aport > 65535)))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ ("Require valid port number for service `%s' in configuration!\n"),
-         "transport-tcp");
-    return NULL;
-  }
-  if (0 == aport)
-    aport = bport;
-  if (0 == bport)
-    aport = 0;
-  if (0 != bport)
-  {
-    service = LEGACY_SERVICE_start ("transport-tcp",
-                                    env->cfg,
-                                    LEGACY_SERVICE_OPTION_NONE);
-    if (NULL == service)
-    {
-      LOG (GNUNET_ERROR_TYPE_WARNING, _ ("Failed to start service.\n"));
-      return NULL;
-    }
-  }
-  else
-    service = NULL;
-
-  api = NULL;
-  plugin = GNUNET_new (struct Plugin);
-  plugin->sessionmap =
-    GNUNET_CONTAINER_multipeermap_create (max_connections, GNUNET_YES);
-  plugin->max_connections = max_connections;
-  plugin->open_port = bport;
-  plugin->adv_port = aport;
-  plugin->env = env;
-  plugin->my_welcome.header.size = htons (sizeof(struct WelcomeMessage));
-  plugin->my_welcome.header.type =
-    htons (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME);
-  plugin->my_welcome.clientIdentity = *plugin->env->my_identity;
-
-  if ((NULL != service) &&
-      (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                           "transport-tcp",
-                                                           "TCP_STEALTH")))
-  {
-#ifdef TCP_STEALTH
-    plugin->myoptions |= TCP_OPTIONS_TCP_STEALTH;
-    lsocks = LEGACY_SERVICE_get_listen_sockets (service);
-    if (NULL != lsocks)
-    {
-      uint32_t len = sizeof(struct WelcomeMessage);
-
-      for (i = 0; NULL != lsocks[i]; i++)
-      {
-        if (
-          (GNUNET_OK !=
-           GNUNET_NETWORK_socket_setsockopt (lsocks[i],
-                                             IPPROTO_TCP,
-                                             TCP_STEALTH,
-                                             env->my_identity,
-                                             sizeof(
-                                               struct GNUNET_PeerIdentity))) ||
-          (GNUNET_OK !=
-           GNUNET_NETWORK_socket_setsockopt (lsocks[i],
-                                             IPPROTO_TCP,
-                                             TCP_STEALTH_INTEGRITY_LEN,
-                                             &len,
-                                             sizeof(len))))
-        {
-          /* TCP STEALTH not supported by kernel */
-          GNUNET_assert (0 == i);
-          GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                      _ ("TCP_STEALTH not supported on this platform.\n"));
-          goto die;
-        }
-      }
-    }
-#else
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _ ("TCP_STEALTH not supported on this platform.\n"));
-    goto die;
-#endif
-  }
-
-  if ((NULL != service) &&
-      (GNUNET_SYSERR !=
-       (ret_s =
-          get_server_addresses ("transport-tcp", env->cfg, &addrs, 
&addrlens))))
-  {
-    for (ret = ret_s - 1; ret >= 0; ret--)
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           "Binding to address `%s'\n",
-           GNUNET_a2s (addrs[ret], addrlens[ret]));
-    plugin->nat = GNUNET_NAT_register (env->cfg,
-                                       "transport-tcp",
-                                       IPPROTO_TCP,
-                                       (unsigned int) ret_s,
-                                       (const struct sockaddr **) addrs,
-                                       addrlens,
-                                       &tcp_nat_port_map_callback,
-                                       &try_connection_reversal,
-                                       plugin);
-    for (ret = ret_s - 1; ret >= 0; ret--)
-      GNUNET_free (addrs[ret]);
-    GNUNET_free (addrs);
-    GNUNET_free (addrlens);
-  }
-  else
-  {
-    plugin->nat = GNUNET_NAT_register (plugin->env->cfg,
-                                       "transport-tcp",
-                                       IPPROTO_TCP,
-                                       0,
-                                       NULL,
-                                       NULL,
-                                       NULL,
-                                       &try_connection_reversal,
-                                       plugin);
-  }
-  api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-  api->cls = plugin;
-  api->send = &tcp_plugin_send;
-  api->get_session = &tcp_plugin_get_session;
-  api->disconnect_session = &tcp_plugin_disconnect_session;
-  api->query_keepalive_factor = &tcp_plugin_query_keepalive_factor;
-  api->disconnect_peer = &tcp_plugin_disconnect;
-  api->address_pretty_printer = &tcp_plugin_address_pretty_printer;
-  api->check_address = &tcp_plugin_check_address;
-  api->address_to_string = &tcp_plugin_address_to_string;
-  api->string_to_address = &tcp_plugin_string_to_address;
-  api->get_network = &tcp_plugin_get_network;
-  api->get_network_for_address = &tcp_plugin_get_network_for_address;
-  api->update_session_timeout = &tcp_plugin_update_session_timeout;
-  api->update_inbound_delay = &tcp_plugin_update_inbound_delay;
-  api->setup_monitor = &tcp_plugin_setup_monitor;
-  plugin->service = service;
-  if (NULL != service)
-  {
-    plugin->server = LEGACY_SERVICE_get_server (service);
-  }
-  else
-  {
-    if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (env->cfg,
-                                                          "transport-tcp",
-                                                          "TIMEOUT",
-                                                          &idle_timeout))
-    {
-      GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                                 "transport-tcp",
-                                 "TIMEOUT");
-      goto die;
-    }
-    plugin->server = GNUNET_SERVER_create_with_sockets (NULL,
-                                                        plugin,
-                                                        NULL,
-                                                        idle_timeout,
-                                                        GNUNET_YES);
-  }
-  plugin->handlers = GNUNET_malloc (sizeof(my_handlers));
-  GNUNET_memcpy (plugin->handlers, my_handlers, sizeof(my_handlers));
-  for (i = 0;
-       i < sizeof(my_handlers) / sizeof(struct GNUNET_SERVER_MessageHandler);
-       i++)
-    plugin->handlers[i].callback_cls = plugin;
-
-  GNUNET_SERVER_add_handlers (plugin->server, plugin->handlers);
-  GNUNET_SERVER_connect_notify (plugin->server, &connect_notify, plugin);
-  GNUNET_SERVER_disconnect_notify (plugin->server, &disconnect_notify, plugin);
-  plugin->nat_wait_conns =
-    GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
-  if (0 != bport)
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         _ ("TCP transport listening on port %llu\n"),
-         bport);
-  else
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         _ ("TCP transport not listening on any port (client only)\n"));
-  if ((aport != bport) && (0 != bport))
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         _ ("TCP transport advertises itself as being on port %llu\n"),
-         aport);
-  /* Initially set connections to 0 */
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         gettext_noop ("# TCP sessions active"),
-                         0,
-                         GNUNET_NO);
-  return api;
-
-die:
-  if (NULL != plugin->nat)
-    GNUNET_NAT_unregister (plugin->nat);
-  GNUNET_CONTAINER_multipeermap_destroy (plugin->sessionmap);
-  if (NULL != service)
-    LEGACY_SERVICE_stop (service);
-  GNUNET_free (plugin);
-  GNUNET_free (api);
-  return NULL;
-}
-
-
-/**
- * Exit point from the plugin.
- *
- * @param cls the `struct GNUNET_TRANSPORT_PluginFunctions`
- * @return NULL
- */
-void *
-libgnunet_plugin_transport_tcp_done (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
-  struct Plugin *plugin = api->cls;
-  struct TCPProbeContext *tcp_probe;
-  struct PrettyPrinterContext *cur;
-  struct PrettyPrinterContext *next;
-
-  if (NULL == plugin)
-  {
-    GNUNET_free (api);
-    return NULL;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down TCP plugin\n");
-
-  /* Removing leftover sessions */
-  GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap,
-                                         &session_disconnect_it,
-                                         plugin);
-  /* Removing leftover NAT sessions */
-  GNUNET_CONTAINER_multipeermap_iterate (plugin->nat_wait_conns,
-                                         &session_disconnect_it,
-                                         plugin);
-
-  for (cur = plugin->ppc_dll_head; NULL != cur; cur = next)
-  {
-    next = cur->next;
-    GNUNET_CONTAINER_DLL_remove (plugin->ppc_dll_head,
-                                 plugin->ppc_dll_tail,
-                                 cur);
-    GNUNET_RESOLVER_request_cancel (cur->resolver_handle);
-    cur->asc (cur->asc_cls, NULL, GNUNET_OK);
-    GNUNET_free (cur);
-  }
-
-  if (NULL != plugin->service)
-    LEGACY_SERVICE_stop (plugin->service);
-  else
-    GNUNET_SERVER_destroy (plugin->server);
-  GNUNET_free (plugin->handlers);
-  if (NULL != plugin->nat)
-    GNUNET_NAT_unregister (plugin->nat);
-  while (NULL != (tcp_probe = plugin->probe_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (plugin->probe_head,
-                                 plugin->probe_tail,
-                                 tcp_probe);
-    GNUNET_CONNECTION_destroy (tcp_probe->sock);
-    GNUNET_free (tcp_probe);
-  }
-  GNUNET_CONTAINER_multipeermap_destroy (plugin->nat_wait_conns);
-  GNUNET_CONTAINER_multipeermap_destroy (plugin->sessionmap);
-  GNUNET_break (0 == plugin->cur_connections);
-  GNUNET_free (plugin);
-  GNUNET_free (api);
-  return NULL;
-}
-
-
-/* end of plugin_transport_tcp.c */
diff --git a/src/transport/plugin_transport_template.c 
b/src/transport/plugin_transport_template.c
deleted file mode 100644
index c39c72178..000000000
--- a/src/transport/plugin_transport_template.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2002-2014 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_template.c
- * @brief template for a new transport service
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_transport_plugin.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-template", 
__VA_ARGS__)
-
-/**
- * After how long do we expire an address that we
- * learned from another peer if it is not reconfirmed
- * by anyone?
- */
-#define LEARNED_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_HOURS, 6)
-
-#define PLUGIN_NAME "template"
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct Plugin;
-
-
-/**
- * Session handle for connections.
- */
-struct GNUNET_ATS_Session
-{
-  /**
-   * To whom are we talking to (set to our identity
-   * if we are still waiting for the welcome message)
-   */
-  struct GNUNET_PeerIdentity sender;
-
-  /**
-   * Stored in a linked list (or a peer map, or ...)
-   */
-  struct GNUNET_ATS_Session *next;
-
-  /**
-   * Pointer to the global plugin struct.
-   */
-  struct Plugin *plugin;
-
-  /**
-   * The client (used to identify this connection)
-   */
-  /* void *client; */
-
-  /**
-   * Continuation function to call once the transmission buffer
-   * has again space available.  NULL if there is no
-   * continuation to call.
-   */
-  GNUNET_TRANSPORT_TransmitContinuation transmit_cont;
-
-  /**
-   * Closure for @e transmit_cont.
-   */
-  void *transmit_cont_cls;
-
-  /**
-   * At what time did we reset @e last_received last?
-   */
-  struct GNUNET_TIME_Absolute last_quota_update;
-
-  /**
-   * How many bytes have we received since the @e last_quota_update
-   * timestamp?
-   */
-  uint64_t last_received;
-
-  /**
-   * Number of bytes per ms that this peer is allowed
-   * to send to us.
-   */
-  uint32_t quota;
-};
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-struct TemplateAddress
-{
-  /**
-   * Address options in NBO
-   */
-  uint32_t options GNUNET_PACKED;
-
-  /* Add address here */
-};
-
-GNUNET_NETWORK_STRUCT_END
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct Plugin
-{
-  /**
-   * Our environment.
-   */
-  struct GNUNET_TRANSPORT_PluginEnvironment *env;
-
-  /**
-   * List of open sessions (or peer map, or...)
-   */
-  struct GNUNET_ATS_Session *sessions;
-
-  /**
-   * Function to call about session status changes.
-   */
-  GNUNET_TRANSPORT_SessionInfoCallback sic;
-
-  /**
-   * Closure for @e sic.
-   */
-  void *sic_cls;
-
-  /**
-   * Options in HBO to be used with addresses
-   */
-};
-
-
-#if 0
-/**
- * If a session monitor is attached, notify it about the new
- * session state.
- *
- * @param plugin our plugin
- * @param session session that changed state
- * @param state new state of the session
- */
-static void
-notify_session_monitor (struct Plugin *plugin,
-                        struct GNUNET_ATS_Session *session,
-                        enum GNUNET_TRANSPORT_SessionState state)
-{
-  struct GNUNET_TRANSPORT_SessionInfo info;
-
-  if (NULL == plugin->sic)
-    return;
-  memset (&info, 0, sizeof(info));
-  info.state = state;
-  info.is_inbound = GNUNET_SYSERR; /* FIXME */
-  // info.num_msg_pending =
-  // info.num_bytes_pending =
-  // info.receive_delay =
-  // info.session_timeout = session->timeout;
-  // info.address = session->address;
-  plugin->sic (plugin->sic_cls,
-               session,
-               &info);
-}
-
-
-#endif
-
-
-/**
- * Function that can be used by the transport service to transmit
- * a message using the plugin.   Note that in the case of a
- * peer disconnecting, the continuation MUST be called
- * prior to the disconnect notification itself.  This function
- * will be called with this peer's HELLO message to initiate
- * a fresh connection to another peer.
- *
- * @param cls closure
- * @param session which session must be used
- * @param msgbuf the message to transmit
- * @param msgbuf_size number of bytes in @a msgbuf
- * @param priority how important is the message (most plugins will
- *                 ignore message priority and just FIFO)
- * @param to how long to wait at most for the transmission (does not
- *                require plugins to discard the message after the timeout,
- *                just advisory for the desired delay; most plugins will ignore
- *                this as well)
- * @param cont continuation to call once the message has
- *        been transmitted (or if the transport is ready
- *        for the next transmission call; or if the
- *        peer disconnected...); can be NULL
- * @param cont_cls closure for @a cont
- * @return number of bytes used (on the physical network, with overheads);
- *         -1 on hard errors (i.e. address invalid); 0 is a legal value
- *         and does NOT mean that the message was not transmitted (DV)
- */
-static ssize_t
-template_plugin_send (void *cls,
-                      struct GNUNET_ATS_Session *session,
-                      const char *msgbuf,
-                      size_t msgbuf_size,
-                      unsigned int priority,
-                      struct GNUNET_TIME_Relative to,
-                      GNUNET_TRANSPORT_TransmitContinuation cont,
-                      void *cont_cls)
-{
-  /*  struct Plugin *plugin = cls; */
-  ssize_t bytes_sent = 0;
-
-  return bytes_sent;
-}
-
-
-/**
- * Function that can be used to force the plugin to disconnect
- * from the given peer and cancel all previous transmissions
- * (and their continuationc).
- *
- * @param cls closure
- * @param target peer from which to disconnect
- */
-static void
-template_plugin_disconnect_peer (void *cls,
-                                 const struct GNUNET_PeerIdentity *target)
-{
-  // struct Plugin *plugin = cls;
-  // FIXME
-}
-
-
-/**
- * Function that can be used to force the plugin to disconnect
- * from the given peer and cancel all previous transmissions
- * (and their continuationc).
- *
- * @param cls closure
- * @param session session from which to disconnect
- * @return #GNUNET_OK on success
- */
-static int
-template_plugin_disconnect_session (void *cls,
-                                    struct GNUNET_ATS_Session *session)
-{
-  // struct Plugin *plugin = cls;
-  // FIXME
-  return GNUNET_SYSERR;
-}
-
-
-/**
- * Function that is called to get the keepalive factor.
- * GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
- * calculate the interval between keepalive packets.
- *
- * @param cls closure with the `struct Plugin`
- * @return keepalive factor
- */
-static unsigned int
-template_plugin_query_keepalive_factor (void *cls)
-{
-  return 3;
-}
-
-
-/**
- * Function obtain the network type for a session
- *
- * @param cls closure ('struct Plugin*')
- * @param session the session
- * @return the network type in HBO or #GNUNET_SYSERR
- */
-static enum GNUNET_NetworkType
-template_plugin_get_network (void *cls,
-                             struct GNUNET_ATS_Session *session)
-{
-  GNUNET_assert (NULL != session);
-  return GNUNET_NT_UNSPECIFIED; /* Change to correct network type */
-}
-
-
-/**
- * Function obtain the network type for an address.
- *
- * @param cls closure (`struct Plugin *`)
- * @param address the address
- * @return the network type
- */
-static enum GNUNET_NetworkType
-template_plugin_get_network_for_address (void *cls,
-                                         const struct
-                                         GNUNET_HELLO_Address *address)
-{
-  return GNUNET_NT_WAN; /* FOR NOW */
-}
-
-
-/**
- * Convert the transports address to a nice, human-readable
- * format.
- *
- * @param cls closure
- * @param type name of the transport that generated the address
- * @param addr one of the addresses of the host, NULL for the last address
- *        the specific address format depends on the transport
- * @param addrlen length of the address
- * @param numeric should (IP) addresses be displayed in numeric form?
- * @param timeout after how long should we give up?
- * @param asc function to call on each string
- * @param asc_cls closure for @a asc
- */
-static void
-template_plugin_address_pretty_printer (void *cls, const char *type,
-                                        const void *addr, size_t addrlen,
-                                        int numeric,
-                                        struct GNUNET_TIME_Relative timeout,
-                                        GNUNET_TRANSPORT_AddressStringCallback
-                                        asc, void *asc_cls)
-{
-  asc (asc_cls, "converted address", GNUNET_OK);  /* return address */
-  asc (asc_cls, NULL, GNUNET_OK);  /* done */
-}
-
-
-/**
- * Another peer has suggested an address for this
- * peer and transport plugin.  Check that this could be a valid
- * address.  If so, consider adding it to the list
- * of addresses.
- *
- * @param cls closure
- * @param addr pointer to the address
- * @param addrlen length of addr
- * @return #GNUNET_OK if this is a plausible address for this peer
- *         and transport
- */
-static int
-template_plugin_address_suggested (void *cls, const void *addr, size_t addrlen)
-{
-  /* struct Plugin *plugin = cls; */
-
-  /* check if the address is belonging to the plugin*/
-  return GNUNET_OK;
-}
-
-
-/**
- * Function called for a quick conversion of the binary address to
- * a numeric address.  Note that the caller must not free the
- * address and that the next call to this function is allowed
- * to override the address again.
- *
- * @param cls closure
- * @param addr binary address
- * @param addrlen length of the address
- * @return string representing the same address
- */
-static const char *
-template_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
-{
-  /*
-   * Print address in format template.options.address
-   */
-
-  if (0 == addrlen)
-  {
-    return TRANSPORT_SESSION_INBOUND_STRING;
-  }
-
-  GNUNET_break (0);
-  return NULL;
-}
-
-
-/**
- * Function called to convert a string address to
- * a binary address.
- *
- * @param cls closure ('struct Plugin*')
- * @param addr string address
- * @param addrlen length of the @a addr
- * @param buf location to store the buffer
- * @param added location to store the number of bytes in the buffer.
- *        If the function returns #GNUNET_SYSERR, its contents are undefined.
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-static int
-template_plugin_string_to_address (void *cls,
-                                   const char *addr,
-                                   uint16_t addrlen,
-                                   void **buf, size_t *added)
-{
-  /*
-   * Parse string in format template.options.address
-   */
-  GNUNET_break (0);
-  return GNUNET_SYSERR;
-}
-
-
-/**
- * Create a new session to transmit data to the target
- * This session will used to send data to this peer and the plugin will
- * notify us by calling the env->session_end function
- *
- * @param cls closure
- * @param address pointer to the GNUNET_HELLO_Address
- * @return the session if the address is valid, NULL otherwise
- */
-static struct GNUNET_ATS_Session *
-template_plugin_get_session (void *cls,
-                             const struct GNUNET_HELLO_Address *address)
-{
-  GNUNET_break (0);
-  return NULL;
-}
-
-
-static void
-template_plugin_update_session_timeout (void *cls,
-                                        const struct GNUNET_PeerIdentity *peer,
-                                        struct GNUNET_ATS_Session *session)
-{
-}
-
-
-#if 0
-/**
- * Return information about the given session to the
- * monitor callback.
- *
- * @param cls the `struct Plugin` with the monitor callback (`sic`)
- * @param peer peer we send information about
- * @param value our `struct GNUNET_ATS_Session` to send information about
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-send_session_info_iter (void *cls,
-                        const struct GNUNET_PeerIdentity *peer,
-                        void *value)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session = value;
-
-  notify_session_monitor (plugin,
-                          session,
-                          GNUNET_TRANSPORT_SS_UP);
-  return GNUNET_OK;
-}
-
-
-#endif
-
-
-/**
- * Begin monitoring sessions of a plugin.  There can only
- * be one active monitor per plugin (i.e. if there are
- * multiple monitors, the transport service needs to
- * multiplex the generated events over all of them).
- *
- * @param cls closure of the plugin
- * @param sic callback to invoke, NULL to disable monitor;
- *            plugin will being by iterating over all active
- *            sessions immediately and then enter monitor mode
- * @param sic_cls closure for @a sic
- */
-static void
-template_plugin_setup_monitor (void *cls,
-                               GNUNET_TRANSPORT_SessionInfoCallback sic,
-                               void *sic_cls)
-{
-  struct Plugin *plugin = cls;
-
-  plugin->sic = sic;
-  plugin->sic_cls = sic_cls;
-  if (NULL != sic)
-  {
-#if 0
-    GNUNET_CONTAINER_multipeermap_iterate (NULL /* FIXME */,
-                                           &send_session_info_iter,
-                                           plugin);
-#endif
-    /* signal end of first iteration */
-    sic (sic_cls, NULL, NULL);
-  }
-}
-
-
-/**
- * Entry point for the plugin.
- */
-void *
-libgnunet_plugin_transport_template_init (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginEnvironment *env = cls;
-  struct GNUNET_TRANSPORT_PluginFunctions *api;
-  struct Plugin *plugin;
-
-  if (NULL == env->receive)
-  {
-    /* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully
-       initialize the plugin or the API */
-    api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-    api->cls = NULL;
-    api->address_to_string = &template_plugin_address_to_string;
-    api->string_to_address = &template_plugin_string_to_address;
-    api->address_pretty_printer = &template_plugin_address_pretty_printer;
-    return api;
-  }
-
-  plugin = GNUNET_new (struct Plugin);
-  plugin->env = env;
-  api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-  api->cls = plugin;
-  api->send = &template_plugin_send;
-  api->disconnect_peer = &template_plugin_disconnect_peer;
-  api->disconnect_session = &template_plugin_disconnect_session;
-  api->query_keepalive_factor = &template_plugin_query_keepalive_factor;
-  api->address_pretty_printer = &template_plugin_address_pretty_printer;
-  api->check_address = &template_plugin_address_suggested;
-  api->address_to_string = &template_plugin_address_to_string;
-  api->string_to_address = &template_plugin_string_to_address;
-  api->get_session = &template_plugin_get_session;
-  api->get_network = &template_plugin_get_network;
-  api->get_network_for_address = &template_plugin_get_network_for_address;
-  api->update_session_timeout = &template_plugin_update_session_timeout;
-  api->setup_monitor = &template_plugin_setup_monitor;
-  LOG (GNUNET_ERROR_TYPE_INFO, "Template plugin successfully loaded\n");
-  return api;
-}
-
-
-/**
- * Exit point from the plugin.
- */
-void *
-libgnunet_plugin_transport_template_done (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
-  struct Plugin *plugin = api->cls;
-
-  GNUNET_free (plugin);
-  GNUNET_free (api);
-  return NULL;
-}
-
-
-/* end of plugin_transport_template.c */
diff --git a/src/transport/plugin_transport_udp.c 
b/src/transport/plugin_transport_udp.c
deleted file mode 100644
index 0d3ca449d..000000000
--- a/src/transport/plugin_transport_udp.c
+++ /dev/null
@@ -1,3897 +0,0 @@
-/*
-   This file is part of GNUnet
-   Copyright (C) 2010-2017 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_udp.c
- * @brief Implementation of the UDP transport protocol
- * @author Christian Grothoff
- * @author Nathan Evans
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "plugin_transport_udp.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_fragmentation_lib.h"
-#include "gnunet_nat_service.h"
-#include "gnunet_protocols.h"
-#include "gnunet_resolver_service.h"
-#include "gnunet_signatures.h"
-#include "gnunet_constants.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_transport_plugin.h"
-#include "transport.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-udp", __VA_ARGS__)
-
-/**
- * After how much inactivity should a UDP session time out?
- */
-#define UDP_SESSION_TIME_OUT \
-  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
-
-/**
- * Number of messages we can defragment in parallel.  We only really
- * defragment 1 message at a time, but if messages get re-ordered, we
- * may want to keep knowledge about the previous message to avoid
- * discarding the current message in favor of a single fragment of a
- * previous message.  3 should be good since we don't expect massive
- * message reorderings with UDP.
- */
-#define UDP_MAX_MESSAGES_IN_DEFRAG 3
-
-/**
- * We keep a defragmentation queue per sender address.  How many
- * sender addresses do we support at the same time? Memory consumption
- * is roughly a factor of 32k * #UDP_MAX_MESSAGES_IN_DEFRAG times this
- * value. (So 128 corresponds to 12 MB and should suffice for
- * connecting to roughly 128 peers via UDP).
- */
-#define UDP_MAX_SENDER_ADDRESSES_WITH_DEFRAG 128
-
-
-/**
- * UDP Message-Packet header (after defragmentation).
- */
-struct UDPMessage
-{
-  /**
-   * Message header.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Always zero for now.
-   */
-  uint32_t reserved;
-
-  /**
-   * What is the identity of the sender
-   */
-  struct GNUNET_PeerIdentity sender;
-};
-
-
-/**
- * Closure for #append_port().
- */
-struct PrettyPrinterContext
-{
-  /**
-   * DLL
-   */
-  struct PrettyPrinterContext *next;
-
-  /**
-   * DLL
-   */
-  struct PrettyPrinterContext *prev;
-
-  /**
-   * Our plugin.
-   */
-  struct Plugin *plugin;
-
-  /**
-   * Resolver handle
-   */
-  struct GNUNET_RESOLVER_RequestHandle *resolver_handle;
-
-  /**
-   * Function to call with the result.
-   */
-  GNUNET_TRANSPORT_AddressStringCallback asc;
-
-  /**
-   * Clsoure for @e asc.
-   */
-  void *asc_cls;
-
-  /**
-   * Timeout task
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * Is this an IPv6 address?
-   */
-  int ipv6;
-
-  /**
-   * Options
-   */
-  uint32_t options;
-
-  /**
-   * Port to add after the IP address.
-   */
-  uint16_t port;
-};
-
-
-/**
- * Session with another peer.
- */
-struct GNUNET_ATS_Session
-{
-  /**
-   * Which peer is this session for?
-   */
-  struct GNUNET_PeerIdentity target;
-
-  /**
-   * Tokenizer for inbound messages.
-   */
-  struct GNUNET_MessageStreamTokenizer *mst;
-
-  /**
-   * Plugin this session belongs to.
-   */
-  struct Plugin *plugin;
-
-  /**
-   * Context for dealing with fragments.
-   */
-  struct UDP_FragmentationContext *frag_ctx;
-
-  /**
-   * Desired delay for next sending we send to other peer
-   */
-  struct GNUNET_TIME_Relative flow_delay_for_other_peer;
-
-  /**
-   * Desired delay for transmissions we received from other peer.
-   * This is for full messages, the value needs to be adjusted for
-   * fragmented messages.
-   */
-  struct GNUNET_TIME_Relative flow_delay_from_other_peer;
-
-  /**
-   * Session timeout task
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * When does this session time out?
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * What time did we last transmit?
-   */
-  struct GNUNET_TIME_Absolute last_transmit_time;
-
-  /**
-   * expected delay for ACKs
-   */
-  struct GNUNET_TIME_Relative last_expected_ack_delay;
-
-  /**
-   * desired delay between UDP messages
-   */
-  struct GNUNET_TIME_Relative last_expected_msg_delay;
-
-  /**
-   * Our own address.
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Number of bytes waiting for transmission to this peer.
-   */
-  unsigned long long bytes_in_queue;
-
-  /**
-   * Number of messages waiting for transmission to this peer.
-   */
-  unsigned int msgs_in_queue;
-
-  /**
-   * Reference counter to indicate that this session is
-   * currently being used and must not be destroyed;
-   * setting @e in_destroy will destroy it as soon as
-   * possible.
-   */
-  unsigned int rc;
-
-  /**
-   * Network type of the address.
-   */
-  enum GNUNET_NetworkType scope;
-
-  /**
-   * Is this session about to be destroyed (sometimes we cannot
-   * destroy a session immediately as below us on the stack
-   * there might be code that still uses it; in this case,
-   * @e rc is non-zero).
-   */
-  int in_destroy;
-};
-
-
-/**
- * Data structure to track defragmentation contexts based
- * on the source of the UDP traffic.
- */
-struct DefragContext
-{
-  /**
-   * Defragmentation context.
-   */
-  struct GNUNET_DEFRAGMENT_Context *defrag;
-
-  /**
-   * Reference to master plugin struct.
-   */
-  struct Plugin *plugin;
-
-  /**
-   * Node in the defrag heap.
-   */
-  struct GNUNET_CONTAINER_HeapNode *hnode;
-
-  /**
-   * Source address this receive context is for (allocated at the
-   * end of the struct).
-   */
-  const union UdpAddress *udp_addr;
-
-  /**
-   * Who's message(s) are we defragmenting here?
-   * Only initialized once we succeeded and
-   * @e have_sender is set.
-   */
-  struct GNUNET_PeerIdentity sender;
-
-  /**
-   * Length of @e udp_addr.
-   */
-  size_t udp_addr_len;
-
-  /**
-   * Network type the address belongs to.
-   */
-  enum GNUNET_NetworkType network_type;
-
-  /**
-   * Has the @e sender field been initialized yet?
-   */
-  int have_sender;
-};
-
-
-/**
- * Context to send fragmented messages
- */
-struct UDP_FragmentationContext
-{
-  /**
-   * Next in linked list
-   */
-  struct UDP_FragmentationContext *next;
-
-  /**
-   * Previous in linked list
-   */
-  struct UDP_FragmentationContext *prev;
-
-  /**
-   * The plugin
-   */
-  struct Plugin *plugin;
-
-  /**
-   * Handle for fragmentation.
-   */
-  struct GNUNET_FRAGMENT_Context *frag;
-
-  /**
-   * The session this fragmentation context belongs to
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * Function to call upon completion of the transmission.
-   */
-  GNUNET_TRANSPORT_TransmitContinuation cont;
-
-  /**
-   * Closure for @e cont.
-   */
-  void *cont_cls;
-
-  /**
-   * Start time.
-   */
-  struct GNUNET_TIME_Absolute start_time;
-
-  /**
-   * Transmission time for the next fragment.  Incremented by
-   * the @e flow_delay_from_other_peer for each fragment when
-   * we setup the fragments.
-   */
-  struct GNUNET_TIME_Absolute next_frag_time;
-
-  /**
-   * Desired delay for transmissions we received from other peer.
-   * Adjusted to be per fragment (UDP_MTU), even though on the
-   * wire it was for "full messages".
-   */
-  struct GNUNET_TIME_Relative flow_delay_from_other_peer;
-
-  /**
-   * Message timeout
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * Payload size of original unfragmented message
-   */
-  size_t payload_size;
-
-  /**
-   * Bytes used to send all fragments on wire including UDP overhead
-   */
-  size_t on_wire_size;
-};
-
-
-/**
- * Function called when a message is removed from the
- * transmission queue.
- *
- * @param cls closure
- * @param udpw message wrapper finished
- * @param result #GNUNET_OK on success (message was sent)
- *               #GNUNET_SYSERR if the target disconnected
- *               or we had a timeout or other trouble sending
- */
-typedef void (*QueueContinuation) (void *cls,
-                                   struct UDP_MessageWrapper *udpw,
-                                   int result);
-
-
-/**
- * Information we track for each message in the queue.
- */
-struct UDP_MessageWrapper
-{
-  /**
-   * Session this message belongs to
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * DLL of messages, previous element
-   */
-  struct UDP_MessageWrapper *prev;
-
-  /**
-   * DLL of messages, next element
-   */
-  struct UDP_MessageWrapper *next;
-
-  /**
-   * Message with @e msg_size bytes including UDP-specific overhead.
-   */
-  char *msg_buf;
-
-  /**
-   * Function to call once the message wrapper is being removed
-   * from the queue (with success or failure).
-   */
-  QueueContinuation qc;
-
-  /**
-   * Closure for @e qc.
-   */
-  void *qc_cls;
-
-  /**
-   * External continuation to call upon completion of the
-   * transmission, NULL if this queue entry is not for a
-   * message from the application.
-   */
-  GNUNET_TRANSPORT_TransmitContinuation cont;
-
-  /**
-   * Closure for @e cont.
-   */
-  void *cont_cls;
-
-  /**
-   * Fragmentation context.
-   * frag_ctx == NULL if transport <= MTU
-   * frag_ctx != NULL if transport > MTU
-   */
-  struct UDP_FragmentationContext *frag_ctx;
-
-  /**
-   * Message enqueue time.
-   */
-  struct GNUNET_TIME_Absolute start_time;
-
-  /**
-   * Desired transmission time for this message, based on the
-   * flow limiting information we got from the other peer.
-   */
-  struct GNUNET_TIME_Absolute transmission_time;
-
-  /**
-   * Message timeout.
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * Size of UDP message to send, including UDP-specific overhead.
-   */
-  size_t msg_size;
-
-  /**
-   * Payload size of original message.
-   */
-  size_t payload_size;
-};
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * UDP ACK Message-Packet header.
- */
-struct UDP_ACK_Message
-{
-  /**
-   * Message header.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Desired delay for flow control, in us (in NBO).
-   * A value of UINT32_MAX indicates that the other
-   * peer wants us to disconnect.
-   */
-  uint32_t delay GNUNET_PACKED;
-
-  /**
-   * What is the identity of the sender
-   */
-  struct GNUNET_PeerIdentity sender;
-};
-
-GNUNET_NETWORK_STRUCT_END
-
-
-/* ************************* Monitoring *********** */
-
-
-/**
- * If a session monitor is attached, notify it about the new
- * session state.
- *
- * @param plugin our plugin
- * @param session session that changed state
- * @param state new state of the session
- */
-static void
-notify_session_monitor (struct Plugin *plugin,
-                        struct GNUNET_ATS_Session *session,
-                        enum GNUNET_TRANSPORT_SessionState state)
-{
-  struct GNUNET_TRANSPORT_SessionInfo info;
-
-  if (NULL == plugin->sic)
-    return;
-  if (GNUNET_YES == session->in_destroy)
-    return; /* already destroyed, just RC>0 left-over actions */
-  memset (&info, 0, sizeof(info));
-  info.state = state;
-  info.is_inbound = GNUNET_SYSERR; /* hard to say */
-  info.num_msg_pending = session->msgs_in_queue;
-  info.num_bytes_pending = session->bytes_in_queue;
-  /* info.receive_delay remains zero as this is not supported by UDP
-     (cannot selectively not receive from 'some' peer while continuing
-     to receive from others) */
-  info.session_timeout = session->timeout;
-  info.address = session->address;
-  plugin->sic (plugin->sic_cls, session, &info);
-}
-
-
-/**
- * Return information about the given session to the monitor callback.
- *
- * @param cls the `struct Plugin` with the monitor callback (`sic`)
- * @param peer peer we send information about
- * @param value our `struct GNUNET_ATS_Session` to send information about
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-send_session_info_iter (void *cls,
-                        const struct GNUNET_PeerIdentity *peer,
-                        void *value)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session = value;
-
-  notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_INIT);
-  notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_UP);
-  return GNUNET_OK;
-}
-
-
-/**
- * Begin monitoring sessions of a plugin.  There can only
- * be one active monitor per plugin (i.e. if there are
- * multiple monitors, the transport service needs to
- * multiplex the generated events over all of them).
- *
- * @param cls closure of the plugin
- * @param sic callback to invoke, NULL to disable monitor;
- *            plugin will being by iterating over all active
- *            sessions immediately and then enter monitor mode
- * @param sic_cls closure for @a sic
- */
-static void
-udp_plugin_setup_monitor (void *cls,
-                          GNUNET_TRANSPORT_SessionInfoCallback sic,
-                          void *sic_cls)
-{
-  struct Plugin *plugin = cls;
-
-  plugin->sic = sic;
-  plugin->sic_cls = sic_cls;
-  if (NULL != sic)
-  {
-    GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions,
-                                           &send_session_info_iter,
-                                           plugin);
-    /* signal end of first iteration */
-    sic (sic_cls, NULL, NULL);
-  }
-}
-
-
-/* ****************** Little Helpers ****************** */
-
-
-/**
- * Function to free last resources associated with a session.
- *
- * @param s session to free
- */
-static void
-free_session (struct GNUNET_ATS_Session *s)
-{
-  if (NULL != s->address)
-  {
-    GNUNET_HELLO_address_free (s->address);
-    s->address = NULL;
-  }
-  if (NULL != s->frag_ctx)
-  {
-    GNUNET_FRAGMENT_context_destroy (s->frag_ctx->frag, NULL, NULL);
-    GNUNET_free (s->frag_ctx);
-    s->frag_ctx = NULL;
-  }
-  if (NULL != s->mst)
-  {
-    GNUNET_MST_destroy (s->mst);
-    s->mst = NULL;
-  }
-  GNUNET_free (s);
-}
-
-
-/**
- * Function that is called to get the keepalive factor.
- * #GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
- * calculate the interval between keepalive packets.
- *
- * @param cls closure with the `struct Plugin`
- * @return keepalive factor
- */
-static unsigned int
-udp_query_keepalive_factor (void *cls)
-{
-  return 15;
-}
-
-
-/**
- * Function obtain the network type for a session
- *
- * @param cls closure (`struct Plugin *`)
- * @param session the session
- * @return the network type
- */
-static enum GNUNET_NetworkType
-udp_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session)
-{
-  return session->scope;
-}
-
-
-/**
- * Function obtain the network type for an address.
- *
- * @param cls closure (`struct Plugin *`)
- * @param address the address
- * @return the network type
- */
-static enum GNUNET_NetworkType
-udp_plugin_get_network_for_address (void *cls,
-                                    const struct GNUNET_HELLO_Address *address)
-{
-  struct Plugin *plugin = cls;
-  size_t addrlen;
-  struct sockaddr_in a4;
-  struct sockaddr_in6 a6;
-  const struct IPv4UdpAddress *u4;
-  const struct IPv6UdpAddress *u6;
-  const void *sb;
-  size_t sbs;
-
-  addrlen = address->address_length;
-  if (addrlen == sizeof(struct IPv6UdpAddress))
-  {
-    GNUNET_assert (NULL != address->address);  /* make static analysis happy */
-    u6 = address->address;
-    memset (&a6, 0, sizeof(a6));
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    a6.sin6_len = sizeof(a6);
-#endif
-    a6.sin6_family = AF_INET6;
-    a6.sin6_port = u6->u6_port;
-    GNUNET_memcpy (&a6.sin6_addr, &u6->ipv6_addr, sizeof(struct in6_addr));
-    sb = &a6;
-    sbs = sizeof(a6);
-  }
-  else if (addrlen == sizeof(struct IPv4UdpAddress))
-  {
-    GNUNET_assert (NULL != address->address);  /* make static analysis happy */
-    u4 = address->address;
-    memset (&a4, 0, sizeof(a4));
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    a4.sin_len = sizeof(a4);
-#endif
-    a4.sin_family = AF_INET;
-    a4.sin_port = u4->u4_port;
-    a4.sin_addr.s_addr = u4->ipv4_addr;
-    sb = &a4;
-    sbs = sizeof(a4);
-  }
-  else
-  {
-    GNUNET_break (0);
-    return GNUNET_NT_UNSPECIFIED;
-  }
-  return plugin->env->get_address_type (plugin->env->cls, sb, sbs);
-}
-
-
-/* ******************* Event loop ******************** */
-
-/**
- * We have been notified that our readset has something to read.  We don't
- * know which socket needs to be read, so we have to check each one
- * Then reschedule this function to be called again once more is available.
- *
- * @param cls the plugin handle
- */
-static void
-udp_plugin_select_v4 (void *cls);
-
-
-/**
- * We have been notified that our readset has something to read.  We don't
- * know which socket needs to be read, so we have to check each one
- * Then reschedule this function to be called again once more is available.
- *
- * @param cls the plugin handle
- */
-static void
-udp_plugin_select_v6 (void *cls);
-
-
-/**
- * (re)schedule IPv4-select tasks for this plugin.
- *
- * @param plugin plugin to reschedule
- */
-static void
-schedule_select_v4 (struct Plugin *plugin)
-{
-  struct GNUNET_TIME_Relative min_delay;
-  struct GNUNET_TIME_Relative delay;
-  struct UDP_MessageWrapper *udpw;
-  struct UDP_MessageWrapper *min_udpw;
-
-  if ((GNUNET_YES == plugin->enable_ipv4) && (NULL != plugin->sockv4))
-  {
-    /* Find a message ready to send:
-     * Flow delay from other peer is expired or not set (0) */
-    min_delay = GNUNET_TIME_UNIT_FOREVER_REL;
-    min_udpw = NULL;
-    for (udpw = plugin->ipv4_queue_head; NULL != udpw; udpw = udpw->next)
-    {
-      delay = GNUNET_TIME_absolute_get_remaining (udpw->transmission_time);
-      if (delay.rel_value_us < min_delay.rel_value_us)
-      {
-        min_delay = delay;
-        min_udpw = udpw;
-      }
-    }
-    if (NULL != plugin->select_task_v4)
-      GNUNET_SCHEDULER_cancel (plugin->select_task_v4);
-    if (NULL != min_udpw)
-    {
-      if (min_delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                    "Calculated flow delay for UDPv4 at %s for %s\n",
-                    GNUNET_STRINGS_relative_time_to_string (min_delay,
-                                                            GNUNET_YES),
-                    GNUNET_i2s (&min_udpw->session->target));
-      }
-      else
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Calculated flow delay for UDPv4 at %s for %s\n",
-                    GNUNET_STRINGS_relative_time_to_string (min_delay,
-                                                            GNUNET_YES),
-                    GNUNET_i2s (&min_udpw->session->target));
-      }
-    }
-    plugin->select_task_v4 =
-      GNUNET_SCHEDULER_add_read_net (min_delay,
-                                     plugin->sockv4,
-                                     &udp_plugin_select_v4,
-                                     plugin);
-  }
-}
-
-
-/**
- * (re)schedule IPv6-select tasks for this plugin.
- *
- * @param plugin plugin to reschedule
- */
-static void
-schedule_select_v6 (struct Plugin *plugin)
-{
-  struct GNUNET_TIME_Relative min_delay;
-  struct GNUNET_TIME_Relative delay;
-  struct UDP_MessageWrapper *udpw;
-  struct UDP_MessageWrapper *min_udpw;
-
-  if ((GNUNET_YES == plugin->enable_ipv6) && (NULL != plugin->sockv6))
-  {
-    min_delay = GNUNET_TIME_UNIT_FOREVER_REL;
-    min_udpw = NULL;
-    for (udpw = plugin->ipv6_queue_head; NULL != udpw; udpw = udpw->next)
-    {
-      delay = GNUNET_TIME_absolute_get_remaining (udpw->transmission_time);
-      if (delay.rel_value_us < min_delay.rel_value_us)
-      {
-        min_delay = delay;
-        min_udpw = udpw;
-      }
-    }
-    if (NULL != plugin->select_task_v6)
-      GNUNET_SCHEDULER_cancel (plugin->select_task_v6);
-    if (NULL != min_udpw)
-    {
-      if (min_delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                    "Calculated flow delay for UDPv6 at %s for %s\n",
-                    GNUNET_STRINGS_relative_time_to_string (min_delay,
-                                                            GNUNET_YES),
-                    GNUNET_i2s (&min_udpw->session->target));
-      }
-      else
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Calculated flow delay for UDPv6 at %s for %s\n",
-                    GNUNET_STRINGS_relative_time_to_string (min_delay,
-                                                            GNUNET_YES),
-                    GNUNET_i2s (&min_udpw->session->target));
-      }
-    }
-    plugin->select_task_v6 =
-      GNUNET_SCHEDULER_add_read_net (min_delay,
-                                     plugin->sockv6,
-                                     &udp_plugin_select_v6,
-                                     plugin);
-  }
-}
-
-
-/* ******************* Address to string and back ***************** */
-
-
-/**
- * Function called for a quick conversion of the binary address to
- * a numeric address.  Note that the caller must not free the
- * address and that the next call to this function is allowed
- * to override the address again.
- *
- * @param cls closure
- * @param addr binary address (a `union UdpAddress`)
- * @param addrlen length of the @a addr
- * @return string representing the same address
- */
-const char *
-udp_address_to_string (void *cls, const void *addr, size_t addrlen)
-{
-  static char rbuf[INET6_ADDRSTRLEN + 10];
-  char buf[INET6_ADDRSTRLEN];
-  const void *sb;
-  struct in_addr a4;
-  struct in6_addr a6;
-  const struct IPv4UdpAddress *t4;
-  const struct IPv6UdpAddress *t6;
-  int af;
-  uint16_t port;
-  uint32_t options;
-
-  if (NULL == addr)
-  {
-    GNUNET_break_op (0);
-    return NULL;
-  }
-
-  if (addrlen == sizeof(struct IPv6UdpAddress))
-  {
-    t6 = addr;
-    af = AF_INET6;
-    options = ntohl (t6->options);
-    port = ntohs (t6->u6_port);
-    a6 = t6->ipv6_addr;
-    sb = &a6;
-  }
-  else if (addrlen == sizeof(struct IPv4UdpAddress))
-  {
-    t4 = addr;
-    af = AF_INET;
-    options = ntohl (t4->options);
-    port = ntohs (t4->u4_port);
-    a4.s_addr = t4->ipv4_addr;
-    sb = &a4;
-  }
-  else
-  {
-    GNUNET_break_op (0);
-    return NULL;
-  }
-  inet_ntop (af, sb, buf, INET6_ADDRSTRLEN);
-  GNUNET_snprintf (rbuf,
-                   sizeof(rbuf),
-                   (af == AF_INET6) ? "%s.%u.[%s]:%u" : "%s.%u.%s:%u",
-                   PLUGIN_NAME,
-                   options,
-                   buf,
-                   port);
-  return rbuf;
-}
-
-
-/**
- * Function called to convert a string address to a binary address.
- *
- * @param cls closure (`struct Plugin *`)
- * @param addr string address
- * @param addrlen length of the address
- * @param buf location to store the buffer
- * @param added location to store the number of bytes in the buffer.
- *        If the function returns #GNUNET_SYSERR, its contents are undefined.
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-static int
-udp_string_to_address (void *cls,
-                       const char *addr,
-                       uint16_t addrlen,
-                       void **buf,
-                       size_t *added)
-{
-  struct sockaddr_storage socket_address;
-  char *address;
-  char *plugin;
-  char *optionstr;
-  uint32_t options;
-
-  /* Format tcp.options.address:port */
-  address = NULL;
-  plugin = NULL;
-  optionstr = NULL;
-
-  if ((NULL == addr) || (0 == addrlen))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if ('\0' != addr[addrlen - 1])
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if (strlen (addr) != addrlen - 1)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  plugin = GNUNET_strdup (addr);
-  optionstr = strchr (plugin, '.');
-  if (NULL == optionstr)
-  {
-    GNUNET_break (0);
-    GNUNET_free (plugin);
-    return GNUNET_SYSERR;
-  }
-  optionstr[0] = '\0';
-  optionstr++;
-  options = atol (optionstr);
-  address = strchr (optionstr, '.');
-  if (NULL == address)
-  {
-    GNUNET_break (0);
-    GNUNET_free (plugin);
-    return GNUNET_SYSERR;
-  }
-  address[0] = '\0';
-  address++;
-
-  if (GNUNET_OK !=
-      GNUNET_STRINGS_to_address_ip (address, strlen (address), 
&socket_address))
-  {
-    GNUNET_break (0);
-    GNUNET_free (plugin);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (plugin);
-
-  switch (socket_address.ss_family)
-  {
-  case AF_INET: {
-      struct IPv4UdpAddress *u4;
-      const struct sockaddr_in *in4 =
-        (const struct sockaddr_in *) &socket_address;
-
-      u4 = GNUNET_new (struct IPv4UdpAddress);
-      u4->options = htonl (options);
-      u4->ipv4_addr = in4->sin_addr.s_addr;
-      u4->u4_port = in4->sin_port;
-      *buf = u4;
-      *added = sizeof(struct IPv4UdpAddress);
-      return GNUNET_OK;
-    }
-
-  case AF_INET6: {
-      struct IPv6UdpAddress *u6;
-      const struct sockaddr_in6 *in6 =
-        (const struct sockaddr_in6 *) &socket_address;
-
-      u6 = GNUNET_new (struct IPv6UdpAddress);
-      u6->options = htonl (options);
-      u6->ipv6_addr = in6->sin6_addr;
-      u6->u6_port = in6->sin6_port;
-      *buf = u6;
-      *added = sizeof(struct IPv6UdpAddress);
-      return GNUNET_OK;
-    }
-
-  default:
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-}
-
-
-/**
- * Append our port and forward the result.
- *
- * @param cls a `struct PrettyPrinterContext *`
- * @param hostname result from DNS resolver
- */
-static void
-append_port (void *cls, const char *hostname)
-{
-  struct PrettyPrinterContext *ppc = cls;
-  struct Plugin *plugin = ppc->plugin;
-  char *ret;
-
-  if (NULL == hostname)
-  {
-    /* Final call, done */
-    GNUNET_CONTAINER_DLL_remove (plugin->ppc_dll_head,
-                                 plugin->ppc_dll_tail,
-                                 ppc);
-    ppc->resolver_handle = NULL;
-    ppc->asc (ppc->asc_cls, NULL, GNUNET_OK);
-    GNUNET_free (ppc);
-    return;
-  }
-  if (GNUNET_YES == ppc->ipv6)
-    GNUNET_asprintf (&ret,
-                     "%s.%u.[%s]:%d",
-                     PLUGIN_NAME,
-                     ppc->options,
-                     hostname,
-                     ppc->port);
-  else
-    GNUNET_asprintf (&ret,
-                     "%s.%u.%s:%d",
-                     PLUGIN_NAME,
-                     ppc->options,
-                     hostname,
-                     ppc->port);
-  ppc->asc (ppc->asc_cls, ret, GNUNET_OK);
-  GNUNET_free (ret);
-}
-
-
-/**
- * Convert the transports address to a nice, human-readable format.
- *
- * @param cls closure with the `struct Plugin *`
- * @param type name of the transport that generated the address
- * @param addr one of the addresses of the host, NULL for the last address
- *        the specific address format depends on the transport;
- *        a `union UdpAddress`
- * @param addrlen length of the address
- * @param numeric should (IP) addresses be displayed in numeric form?
- * @param timeout after how long should we give up?
- * @param asc function to call on each string
- * @param asc_cls closure for @a asc
- */
-static void
-udp_plugin_address_pretty_printer (void *cls,
-                                   const char *type,
-                                   const void *addr,
-                                   size_t addrlen,
-                                   int numeric,
-                                   struct GNUNET_TIME_Relative timeout,
-                                   GNUNET_TRANSPORT_AddressStringCallback asc,
-                                   void *asc_cls)
-{
-  struct Plugin *plugin = cls;
-  struct PrettyPrinterContext *ppc;
-  const struct sockaddr *sb;
-  size_t sbs;
-  struct sockaddr_in a4;
-  struct sockaddr_in6 a6;
-  const struct IPv4UdpAddress *u4;
-  const struct IPv6UdpAddress *u6;
-  uint16_t port;
-  uint32_t options;
-
-  if (addrlen == sizeof(struct IPv6UdpAddress))
-  {
-    u6 = addr;
-    memset (&a6, 0, sizeof(a6));
-    a6.sin6_family = AF_INET6;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    a6.sin6_len = sizeof(a6);
-#endif
-    a6.sin6_port = u6->u6_port;
-    a6.sin6_addr = u6->ipv6_addr;
-    port = ntohs (u6->u6_port);
-    options = ntohl (u6->options);
-    sb = (const struct sockaddr *) &a6;
-    sbs = sizeof(a6);
-  }
-  else if (addrlen == sizeof(struct IPv4UdpAddress))
-  {
-    u4 = addr;
-    memset (&a4, 0, sizeof(a4));
-    a4.sin_family = AF_INET;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    a4.sin_len = sizeof(a4);
-#endif
-    a4.sin_port = u4->u4_port;
-    a4.sin_addr.s_addr = u4->ipv4_addr;
-    port = ntohs (u4->u4_port);
-    options = ntohl (u4->options);
-    sb = (const struct sockaddr *) &a4;
-    sbs = sizeof(a4);
-  }
-  else
-  {
-    /* invalid address */
-    GNUNET_break_op (0);
-    asc (asc_cls, NULL, GNUNET_SYSERR);
-    asc (asc_cls, NULL, GNUNET_OK);
-    return;
-  }
-  ppc = GNUNET_new (struct PrettyPrinterContext);
-  ppc->plugin = plugin;
-  ppc->asc = asc;
-  ppc->asc_cls = asc_cls;
-  ppc->port = port;
-  ppc->options = options;
-  if (addrlen == sizeof(struct IPv6UdpAddress))
-    ppc->ipv6 = GNUNET_YES;
-  else
-    ppc->ipv6 = GNUNET_NO;
-  GNUNET_CONTAINER_DLL_insert (plugin->ppc_dll_head, plugin->ppc_dll_tail, 
ppc);
-  ppc->resolver_handle = GNUNET_RESOLVER_hostname_get (sb,
-                                                       sbs,
-                                                       ! numeric,
-                                                       timeout,
-                                                       &append_port,
-                                                       ppc);
-}
-
-
-/**
- * Check if the given port is plausible (must be either our listen
- * port or our advertised port).  If it is neither, we return
- * #GNUNET_SYSERR.
- *
- * @param plugin global variables
- * @param in_port port number to check
- * @return #GNUNET_OK if port is either our open or advertised port
- */
-static int
-check_port (const struct Plugin *plugin, uint16_t in_port)
-{
-  if ((plugin->port == in_port) || (plugin->aport == in_port))
-    return GNUNET_OK;
-  return GNUNET_SYSERR;
-}
-
-
-/**
- * Function that will be called to check if a binary address for this
- * plugin is well-formed and corresponds to an address for THIS peer
- * (as per our configuration).  Naturally, if absolutely necessary,
- * plugins can be a bit conservative in their answer, but in general
- * plugins should make sure that the address does not redirect
- * traffic to a 3rd party that might try to man-in-the-middle our
- * traffic.
- *
- * @param cls closure, should be our handle to the Plugin
- * @param addr pointer to a `union UdpAddress`
- * @param addrlen length of @a addr
- * @return #GNUNET_OK if this is a plausible address for this peer
- *         and transport, #GNUNET_SYSERR if not
- */
-static int
-udp_plugin_check_address (void *cls, const void *addr, size_t addrlen)
-{
-  struct Plugin *plugin = cls;
-  const struct IPv4UdpAddress *v4;
-  const struct IPv6UdpAddress *v6;
-
-  if (sizeof(struct IPv4UdpAddress) == addrlen)
-  {
-    struct sockaddr_in s4;
-
-    v4 = (const struct IPv4UdpAddress *) addr;
-    if (GNUNET_OK != check_port (plugin, ntohs (v4->u4_port)))
-      return GNUNET_SYSERR;
-    memset (&s4, 0, sizeof(s4));
-    s4.sin_family = AF_INET;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    s4.sin_len = sizeof(s4);
-#endif
-    s4.sin_port = v4->u4_port;
-    s4.sin_addr.s_addr = v4->ipv4_addr;
-
-    if (GNUNET_OK !=
-        GNUNET_NAT_test_address (plugin->nat, &s4, sizeof(struct sockaddr_in)))
-      return GNUNET_SYSERR;
-  }
-  else if (sizeof(struct IPv6UdpAddress) == addrlen)
-  {
-    struct sockaddr_in6 s6;
-
-    v6 = (const struct IPv6UdpAddress *) addr;
-    if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr))
-      return GNUNET_OK;   /* plausible, if unlikely... */
-    memset (&s6, 0, sizeof(s6));
-    s6.sin6_family = AF_INET6;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    s6.sin6_len = sizeof(s6);
-#endif
-    s6.sin6_port = v6->u6_port;
-    s6.sin6_addr = v6->ipv6_addr;
-
-    if (GNUNET_OK != GNUNET_NAT_test_address (plugin->nat,
-                                              &s6,
-                                              sizeof(struct sockaddr_in6)))
-      return GNUNET_SYSERR;
-  }
-  else
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Our external IP address/port mapping has changed.
- *
- * @param cls closure, the `struct Plugin`
- * @param[in,out] app_ctx location where the app can store stuff
- *                  on add and retrieve it on remove
- * @param add_remove #GNUNET_YES to mean the new public IP address,
- *                   #GNUNET_NO to mean the previous (now invalid) one
- * @param ac address class the address belongs to
- * @param addr either the previous or the new public IP address
- * @param addrlen actual length of the @a addr
- */
-static void
-udp_nat_port_map_callback (void *cls,
-                           void **app_ctx,
-                           int add_remove,
-                           enum GNUNET_NAT_AddressClass ac,
-                           const struct sockaddr *addr,
-                           socklen_t addrlen)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_HELLO_Address *address;
-  struct IPv4UdpAddress u4;
-  struct IPv6UdpAddress u6;
-  void *arg;
-  size_t args;
-
-  (void) app_ctx;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       (GNUNET_YES == add_remove) ? "NAT notification to add address `%s'\n"
-       : "NAT notification to remove address `%s'\n",
-       GNUNET_a2s (addr, addrlen));
-  /* convert 'address' to our internal format */
-  switch (addr->sa_family)
-  {
-  case AF_INET: {
-      const struct sockaddr_in *i4;
-
-      GNUNET_assert (sizeof(struct sockaddr_in) == addrlen);
-      i4 = (const struct sockaddr_in *) addr;
-      if (0 == ntohs (i4->sin_port))
-        return; /* Port = 0 means unmapped, ignore these for UDP. */
-      memset (&u4, 0, sizeof(u4));
-      u4.options = htonl (plugin->myoptions);
-      u4.ipv4_addr = i4->sin_addr.s_addr;
-      u4.u4_port = i4->sin_port;
-      arg = &u4;
-      args = sizeof(struct IPv4UdpAddress);
-      break;
-    }
-
-  case AF_INET6: {
-      const struct sockaddr_in6 *i6;
-
-      GNUNET_assert (sizeof(struct sockaddr_in6) == addrlen);
-      i6 = (const struct sockaddr_in6 *) addr;
-      if (0 == ntohs (i6->sin6_port))
-        return; /* Port = 0 means unmapped, ignore these for UDP. */
-      memset (&u6, 0, sizeof(u6));
-      u6.options = htonl (plugin->myoptions);
-      u6.ipv6_addr = i6->sin6_addr;
-      u6.u6_port = i6->sin6_port;
-      arg = &u6;
-      args = sizeof(struct IPv6UdpAddress);
-      break;
-    }
-
-  default:
-    GNUNET_break (0);
-    return;
-  }
-  /* modify our published address list */
-  /* TODO: use 'ac' here in the future... */
-  address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                           PLUGIN_NAME,
-                                           arg,
-                                           args,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-  plugin->env->notify_address (plugin->env->cls, add_remove, address);
-  GNUNET_HELLO_address_free (address);
-}
-
-
-/* ********************* Finding sessions ******************* */
-
-
-/**
- * Closure for #session_cmp_it().
- */
-struct GNUNET_ATS_SessionCompareContext
-{
-  /**
-   * Set to session matching the address.
-   */
-  struct GNUNET_ATS_Session *res;
-
-  /**
-   * Address we are looking for.
-   */
-  const struct GNUNET_HELLO_Address *address;
-};
-
-
-/**
- * Find a session with a matching address.
- *
- * @param cls the `struct GNUNET_ATS_SessionCompareContext *`
- * @param key peer identity (unused)
- * @param value the `struct GNUNET_ATS_Session *`
- * @return #GNUNET_NO if we found the session, #GNUNET_OK if not
- */
-static int
-session_cmp_it (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
-{
-  struct GNUNET_ATS_SessionCompareContext *cctx = cls;
-  struct GNUNET_ATS_Session *s = value;
-
-  if (0 == GNUNET_HELLO_address_cmp (s->address, cctx->address))
-  {
-    GNUNET_assert (GNUNET_NO == s->in_destroy);
-    cctx->res = s;
-    return GNUNET_NO;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Locate an existing session the transport service is using to
- * send data to another peer.  Performs some basic sanity checks
- * on the address and then tries to locate a matching session.
- *
- * @param cls the plugin
- * @param address the address we should locate the session by
- * @return the session if it exists, or NULL if it is not found
- */
-static struct GNUNET_ATS_Session *
-udp_plugin_lookup_session (void *cls,
-                           const struct GNUNET_HELLO_Address *address)
-{
-  struct Plugin *plugin = cls;
-  const struct IPv6UdpAddress *udp_a6;
-  const struct IPv4UdpAddress *udp_a4;
-  struct GNUNET_ATS_SessionCompareContext cctx;
-
-  if (NULL == address->address)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  if (sizeof(struct IPv4UdpAddress) == address->address_length)
-  {
-    if (NULL == plugin->sockv4)
-      return NULL;
-    udp_a4 = (const struct IPv4UdpAddress *) address->address;
-    if (0 == udp_a4->u4_port)
-    {
-      GNUNET_break (0);
-      return NULL;
-    }
-  }
-  else if (sizeof(struct IPv6UdpAddress) == address->address_length)
-  {
-    if (NULL == plugin->sockv6)
-      return NULL;
-    udp_a6 = (const struct IPv6UdpAddress *) address->address;
-    if (0 == udp_a6->u6_port)
-    {
-      GNUNET_break (0);
-      return NULL;
-    }
-  }
-  else
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-
-  /* check if session already exists */
-  cctx.address = address;
-  cctx.res = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Looking for existing session for peer `%s' with address `%s'\n",
-       GNUNET_i2s (&address->peer),
-       udp_address_to_string (plugin,
-                              address->address,
-                              address->address_length));
-  GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions,
-                                              &address->peer,
-                                              &session_cmp_it,
-                                              &cctx);
-  if (NULL == cctx.res)
-    return NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Found existing session %p\n", cctx.res);
-  return cctx.res;
-}
-
-
-/* ********************** Timeout ****************** */
-
-
-/**
- * Increment session timeout due to activity.
- *
- * @param s session to reschedule timeout activity for
- */
-static void
-reschedule_session_timeout (struct GNUNET_ATS_Session *s)
-{
-  if (GNUNET_YES == s->in_destroy)
-    return;
-  GNUNET_assert (NULL != s->timeout_task);
-  s->timeout = GNUNET_TIME_relative_to_absolute (UDP_SESSION_TIME_OUT);
-}
-
-
-/**
- * Function that will be called whenever the transport service wants to
- * notify the plugin that a session is still active and in use and
- * therefore the session timeout for this session has to be updated
- *
- * @param cls closure with the `struct Plugin`
- * @param peer which peer was the session for
- * @param session which session is being updated
- */
-static void
-udp_plugin_update_session_timeout (void *cls,
-                                   const struct GNUNET_PeerIdentity *peer,
-                                   struct GNUNET_ATS_Session *session)
-{
-  struct Plugin *plugin = cls;
-
-  if (GNUNET_YES !=
-      GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessions,
-                                                    peer,
-                                                    session))
-  {
-    GNUNET_break (0);
-    return;
-  }
-  /* Reschedule session timeout */
-  reschedule_session_timeout (session);
-}
-
-
-/* ************************* Sending ************************ */
-
-
-/**
- * Remove the given message from the transmission queue and
- * update all applicable statistics.
- *
- * @param plugin the UDP plugin
- * @param udpw message wrapper to dequeue
- */
-static void
-dequeue (struct Plugin *plugin, struct UDP_MessageWrapper *udpw)
-{
-  struct GNUNET_ATS_Session *session = udpw->session;
-
-  if (plugin->bytes_in_buffer < udpw->msg_size)
-  {
-    GNUNET_break (0);
-  }
-  else
-  {
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, total bytes in send buffers",
-                              -(long long) udpw->msg_size,
-                              GNUNET_NO);
-    plugin->bytes_in_buffer -= udpw->msg_size;
-  }
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            "# UDP, total messages in send buffers",
-                            -1,
-                            GNUNET_NO);
-  if (sizeof(struct IPv4UdpAddress) == udpw->session->address->address_length)
-  {
-    GNUNET_CONTAINER_DLL_remove (plugin->ipv4_queue_head,
-                                 plugin->ipv4_queue_tail,
-                                 udpw);
-  }
-  else if (sizeof(struct IPv6UdpAddress) ==
-           udpw->session->address->address_length)
-  {
-    GNUNET_CONTAINER_DLL_remove (plugin->ipv6_queue_head,
-                                 plugin->ipv6_queue_tail,
-                                 udpw);
-  }
-  else
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GNUNET_assert (session->msgs_in_queue > 0);
-  session->msgs_in_queue--;
-  GNUNET_assert (session->bytes_in_queue >= udpw->msg_size);
-  session->bytes_in_queue -= udpw->msg_size;
-}
-
-
-/**
- * Enqueue a message for transmission and update statistics.
- *
- * @param plugin the UDP plugin
- * @param udpw message wrapper to queue
- */
-static void
-enqueue (struct Plugin *plugin, struct UDP_MessageWrapper *udpw)
-{
-  struct GNUNET_ATS_Session *session = udpw->session;
-
-  if (GNUNET_YES == session->in_destroy)
-  {
-    GNUNET_break (0);
-    GNUNET_free (udpw);
-    return;
-  }
-  if (plugin->bytes_in_buffer > INT64_MAX - udpw->msg_size)
-  {
-    GNUNET_break (0);
-  }
-  else
-  {
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, total bytes in send buffers",
-                              udpw->msg_size,
-                              GNUNET_NO);
-    plugin->bytes_in_buffer += udpw->msg_size;
-  }
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            "# UDP, total messages in send buffers",
-                            1,
-                            GNUNET_NO);
-  if (sizeof(struct IPv4UdpAddress) == udpw->session->address->address_length)
-  {
-    GNUNET_CONTAINER_DLL_insert (plugin->ipv4_queue_head,
-                                 plugin->ipv4_queue_tail,
-                                 udpw);
-  }
-  else if (sizeof(struct IPv6UdpAddress) ==
-           udpw->session->address->address_length)
-  {
-    GNUNET_CONTAINER_DLL_insert (plugin->ipv6_queue_head,
-                                 plugin->ipv6_queue_tail,
-                                 udpw);
-  }
-  else
-  {
-    GNUNET_break (0);
-    udpw->cont (udpw->cont_cls,
-                &session->target,
-                GNUNET_SYSERR,
-                udpw->msg_size,
-                0);
-    GNUNET_free (udpw);
-    return;
-  }
-  session->msgs_in_queue++;
-  session->bytes_in_queue += udpw->msg_size;
-}
-
-
-/**
- * We have completed our (attempt) to transmit a message that had to
- * be fragmented -- either because we got an ACK saying that all
- * fragments were received, or because of timeout / disconnect.  Clean
- * up our state.
- *
- * @param frag_ctx fragmentation context to clean up
- * @param result #GNUNET_OK if we succeeded (got ACK),
- *               #GNUNET_SYSERR if the transmission failed
- */
-static void
-fragmented_message_done (struct UDP_FragmentationContext *frag_ctx, int result)
-{
-  struct Plugin *plugin = frag_ctx->plugin;
-  struct GNUNET_ATS_Session *s = frag_ctx->session;
-  struct UDP_MessageWrapper *udpw;
-  struct UDP_MessageWrapper *tmp;
-  size_t overhead;
-  struct GNUNET_TIME_Relative delay;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "%p: Fragmented message removed with result %s\n",
-       frag_ctx,
-       (result == GNUNET_SYSERR) ? "FAIL" : "SUCCESS");
-  /* Call continuation for fragmented message */
-  if (frag_ctx->on_wire_size >= frag_ctx->payload_size)
-    overhead = frag_ctx->on_wire_size - frag_ctx->payload_size;
-  else
-    overhead = frag_ctx->on_wire_size;
-  delay = GNUNET_TIME_absolute_get_duration (frag_ctx->start_time);
-  if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         "Fragmented message acknowledged after %s (expected at %s)\n",
-         GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES),
-         GNUNET_STRINGS_absolute_time_to_string (frag_ctx->next_frag_time));
-  }
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Fragmented message acknowledged after %s (expected at %s)\n",
-         GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES),
-         GNUNET_STRINGS_absolute_time_to_string (frag_ctx->next_frag_time));
-  }
-
-  if (NULL != frag_ctx->cont)
-    frag_ctx->cont (frag_ctx->cont_cls,
-                    &s->target,
-                    result,
-                    s->frag_ctx->payload_size,
-                    frag_ctx->on_wire_size);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            "# UDP, fragmented messages active",
-                            -1,
-                            GNUNET_NO);
-
-  if (GNUNET_OK == result)
-  {
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragmented msgs, messages, sent, 
success",
-                              1,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragmented msgs, bytes payload, sent, 
success",
-                              s->frag_ctx->payload_size,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (
-      plugin->env->stats,
-      "# UDP, fragmented msgs, bytes overhead, sent, success",
-      overhead,
-      GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, total, bytes overhead, sent",
-                              overhead,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, total, bytes payload, sent",
-                              s->frag_ctx->payload_size,
-                              GNUNET_NO);
-  }
-  else
-  {
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragmented msgs, messages, sent, 
failure",
-                              1,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragmented msgs, bytes payload, sent, 
failure",
-                              s->frag_ctx->payload_size,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragmented msgs, bytes payload, sent, 
failure",
-                              overhead,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragmented msgs, bytes payload, sent, 
failure",
-                              overhead,
-                              GNUNET_NO);
-  }
-
-  /* Remove remaining fragments from queue, no need to transmit those
-     any longer. */
-  if (s->address->address_length == sizeof(struct IPv6UdpAddress))
-  {
-    udpw = plugin->ipv6_queue_head;
-    while (NULL != udpw)
-    {
-      tmp = udpw->next;
-      if ((udpw->frag_ctx != NULL) && (udpw->frag_ctx == frag_ctx))
-      {
-        dequeue (plugin, udpw);
-        GNUNET_free (udpw);
-      }
-      udpw = tmp;
-    }
-  }
-  if (s->address->address_length == sizeof(struct IPv4UdpAddress))
-  {
-    udpw = plugin->ipv4_queue_head;
-    while (NULL != udpw)
-    {
-      tmp = udpw->next;
-      if ((NULL != udpw->frag_ctx) && (udpw->frag_ctx == frag_ctx))
-      {
-        dequeue (plugin, udpw);
-        GNUNET_free (udpw);
-      }
-      udpw = tmp;
-    }
-  }
-  notify_session_monitor (s->plugin, s, GNUNET_TRANSPORT_SS_UPDATE);
-  GNUNET_FRAGMENT_context_destroy (frag_ctx->frag,
-                                   &s->last_expected_msg_delay,
-                                   &s->last_expected_ack_delay);
-  s->frag_ctx = NULL;
-  GNUNET_free (frag_ctx);
-}
-
-
-/**
- * We are finished with a fragment in the message queue.
- * Notify the continuation and update statistics.
- *
- * @param cls the `struct Plugin *`
- * @param udpw the queue entry
- * @param result #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-static void
-qc_fragment_sent (void *cls, struct UDP_MessageWrapper *udpw, int result)
-{
-  struct Plugin *plugin = cls;
-
-  GNUNET_assert (NULL != udpw->frag_ctx);
-  if (GNUNET_OK == result)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Fragment of message with %u bytes transmitted to %s\n",
-                (unsigned int) udpw->payload_size,
-                GNUNET_i2s (&udpw->session->target));
-    GNUNET_FRAGMENT_context_transmission_done (udpw->frag_ctx->frag);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragmented msgs, fragments, sent, 
success",
-                              1,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (
-      plugin->env->stats,
-      "# UDP, fragmented msgs, fragments bytes, sent, success",
-      udpw->msg_size,
-      GNUNET_NO);
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Failed to transmit fragment of message with %u bytes to %s\n",
-                (unsigned int) udpw->payload_size,
-                GNUNET_i2s (&udpw->session->target));
-    fragmented_message_done (udpw->frag_ctx, GNUNET_SYSERR);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragmented msgs, fragments, sent, 
failure",
-                              1,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (
-      plugin->env->stats,
-      "# UDP, fragmented msgs, fragments bytes, sent, failure",
-      udpw->msg_size,
-      GNUNET_NO);
-  }
-}
-
-
-/**
- * Function that is called with messages created by the fragmentation
- * module.  In the case of the `proc` callback of the
- * #GNUNET_FRAGMENT_context_create() function, this function must
- * eventually call #GNUNET_FRAGMENT_context_transmission_done().
- *
- * @param cls closure, the `struct UDP_FragmentationContext`
- * @param msg the message that was created
- */
-static void
-enqueue_fragment (void *cls, const struct GNUNET_MessageHeader *msg)
-{
-  struct UDP_FragmentationContext *frag_ctx = cls;
-  struct Plugin *plugin = frag_ctx->plugin;
-  struct UDP_MessageWrapper *udpw;
-  struct GNUNET_ATS_Session *session = frag_ctx->session;
-  size_t msg_len = ntohs (msg->size);
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Enqueuing fragment with %lu bytes\n",
-       (unsigned long) msg_len);
-  udpw = GNUNET_malloc (sizeof(struct UDP_MessageWrapper) + msg_len);
-  udpw->session = session;
-  udpw->msg_buf = (char *) &udpw[1];
-  udpw->msg_size = msg_len;
-  udpw->payload_size = msg_len; /* FIXME: minus fragment overhead */
-  udpw->timeout = frag_ctx->timeout;
-  udpw->start_time = frag_ctx->start_time;
-  udpw->transmission_time = frag_ctx->next_frag_time;
-  frag_ctx->next_frag_time =
-    GNUNET_TIME_absolute_add (frag_ctx->next_frag_time,
-                              frag_ctx->flow_delay_from_other_peer);
-  udpw->frag_ctx = frag_ctx;
-  udpw->qc = &qc_fragment_sent;
-  udpw->qc_cls = plugin;
-  GNUNET_memcpy (udpw->msg_buf, msg, msg_len);
-  enqueue (plugin, udpw);
-  if (session->address->address_length == sizeof(struct IPv4UdpAddress))
-    schedule_select_v4 (plugin);
-  else
-    schedule_select_v6 (plugin);
-}
-
-
-/**
- * We are finished with a message from the message queue.
- * Notify the continuation and update statistics.
- *
- * @param cls the `struct Plugin *`
- * @param udpw the queue entry
- * @param result #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-static void
-qc_message_sent (void *cls, struct UDP_MessageWrapper *udpw, int result)
-{
-  struct Plugin *plugin = cls;
-  size_t overhead;
-  struct GNUNET_TIME_Relative delay;
-
-  if (udpw->msg_size >= udpw->payload_size)
-    overhead = udpw->msg_size - udpw->payload_size;
-  else
-    overhead = udpw->msg_size;
-
-  if (NULL != udpw->cont)
-  {
-    delay = GNUNET_TIME_absolute_get_duration (udpw->start_time);
-    if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
-    {
-      LOG (GNUNET_ERROR_TYPE_WARNING,
-           "Message sent via UDP with delay of %s\n",
-           GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
-    }
-    else
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Message sent via UDP with delay of %s\n",
-           GNUNET_STRINGS_relative_time_to_string (delay, GNUNET_YES));
-    }
-    udpw->cont (udpw->cont_cls,
-                &udpw->session->target,
-                result,
-                udpw->payload_size,
-                overhead);
-  }
-  if (GNUNET_OK == result)
-  {
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, unfragmented msgs, messages, sent, 
success",
-                              1,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (
-      plugin->env->stats,
-      "# UDP, unfragmented msgs, bytes payload, sent, success",
-      udpw->payload_size,
-      GNUNET_NO);
-    GNUNET_STATISTICS_update (
-      plugin->env->stats,
-      "# UDP, unfragmented msgs, bytes overhead, sent, success",
-      overhead,
-      GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, total, bytes overhead, sent",
-                              overhead,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, total, bytes payload, sent",
-                              udpw->payload_size,
-                              GNUNET_NO);
-  }
-  else
-  {
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, unfragmented msgs, messages, sent, 
failure",
-                              1,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (
-      plugin->env->stats,
-      "# UDP, unfragmented msgs, bytes payload, sent, failure",
-      udpw->payload_size,
-      GNUNET_NO);
-    GNUNET_STATISTICS_update (
-      plugin->env->stats,
-      "# UDP, unfragmented msgs, bytes overhead, sent, failure",
-      overhead,
-      GNUNET_NO);
-  }
-}
-
-
-/**
- * Function that can be used by the transport service to transmit a
- * message using the plugin.  Note that in the case of a peer
- * disconnecting, the continuation MUST be called prior to the
- * disconnect notification itself.  This function will be called with
- * this peer's HELLO message to initiate a fresh connection to another
- * peer.
- *
- * @param cls closure
- * @param s which session must be used
- * @param msgbuf the message to transmit
- * @param msgbuf_size number of bytes in @a msgbuf
- * @param priority how important is the message (most plugins will
- *                 ignore message priority and just FIFO)
- * @param to how long to wait at most for the transmission (does not
- *                require plugins to discard the message after the timeout,
- *                just advisory for the desired delay; most plugins will ignore
- *                this as well)
- * @param cont continuation to call once the message has
- *        been transmitted (or if the transport is ready
- *        for the next transmission call; or if the
- *        peer disconnected...); can be NULL
- * @param cont_cls closure for @a cont
- * @return number of bytes used (on the physical network, with overheads);
- *         -1 on hard errors (i.e. address invalid); 0 is a legal value
- *         and does NOT mean that the message was not transmitted (DV)
- */
-static ssize_t
-udp_plugin_send (void *cls,
-                 struct GNUNET_ATS_Session *s,
-                 const char *msgbuf,
-                 size_t msgbuf_size,
-                 unsigned int priority,
-                 struct GNUNET_TIME_Relative to,
-                 GNUNET_TRANSPORT_TransmitContinuation cont,
-                 void *cont_cls)
-{
-  struct Plugin *plugin = cls;
-  size_t udpmlen = msgbuf_size + sizeof(struct UDPMessage);
-  struct UDP_FragmentationContext *frag_ctx;
-  struct UDP_MessageWrapper *udpw;
-  struct UDPMessage *udp;
-  char mbuf[udpmlen] GNUNET_ALIGN;
-  struct GNUNET_TIME_Relative latency;
-
-  if ((sizeof(struct IPv6UdpAddress) == s->address->address_length) &&
-      (NULL == plugin->sockv6))
-    return GNUNET_SYSERR;
-  if ((sizeof(struct IPv4UdpAddress) == s->address->address_length) &&
-      (NULL == plugin->sockv4))
-    return GNUNET_SYSERR;
-  if (udpmlen >= GNUNET_MAX_MESSAGE_SIZE)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if (GNUNET_YES !=
-      GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessions,
-                                                    &s->target,
-                                                    s))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "UDP transmits %lu-byte message to `%s' using address `%s'\n",
-       (unsigned long) udpmlen,
-       GNUNET_i2s (&s->target),
-       udp_address_to_string (plugin,
-                              s->address->address,
-                              s->address->address_length));
-
-  udp = (struct UDPMessage *) mbuf;
-  udp->header.size = htons (udpmlen);
-  udp->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_MESSAGE);
-  udp->reserved = htonl (0);
-  udp->sender = *plugin->env->my_identity;
-
-  /* We do not update the session time out here!  Otherwise this
-   * session will not timeout since we send keep alive before session
-   * can timeout.
-   *
-   * For UDP we update session timeout only on receive, this will
-   * cover keep alives, since remote peer will reply with keep alive
-   * responses!
-   */if (udpmlen <= UDP_MTU)
-  {
-    /* unfragmented message */
-    udpw = GNUNET_malloc (sizeof(struct UDP_MessageWrapper) + udpmlen);
-    udpw->session = s;
-    udpw->msg_buf = (char *) &udpw[1];
-    udpw->msg_size = udpmlen;   /* message size with UDP overhead */
-    udpw->payload_size = msgbuf_size;   /* message size without UDP overhead */
-    udpw->start_time = GNUNET_TIME_absolute_get ();
-    udpw->timeout = GNUNET_TIME_relative_to_absolute (to);
-    udpw->transmission_time = s->last_transmit_time;
-    s->last_transmit_time =
-      GNUNET_TIME_absolute_add (s->last_transmit_time,
-                                s->flow_delay_from_other_peer);
-    udpw->cont = cont;
-    udpw->cont_cls = cont_cls;
-    udpw->frag_ctx = NULL;
-    udpw->qc = &qc_message_sent;
-    udpw->qc_cls = plugin;
-    GNUNET_memcpy (udpw->msg_buf, udp, sizeof(struct UDPMessage));
-    GNUNET_memcpy (&udpw->msg_buf[sizeof(struct UDPMessage)],
-                   msgbuf,
-                   msgbuf_size);
-    enqueue (plugin, udpw);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, unfragmented messages queued total",
-                              1,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, unfragmented bytes payload queued total",
-                              msgbuf_size,
-                              GNUNET_NO);
-    if (s->address->address_length == sizeof(struct IPv4UdpAddress))
-      schedule_select_v4 (plugin);
-    else
-      schedule_select_v6 (plugin);
-  }
-  else
-  {
-    /* fragmented message */
-    if (NULL != s->frag_ctx)
-      return GNUNET_SYSERR;
-    GNUNET_memcpy (&udp[1], msgbuf, msgbuf_size);
-    frag_ctx = GNUNET_new (struct UDP_FragmentationContext);
-    frag_ctx->plugin = plugin;
-    frag_ctx->session = s;
-    frag_ctx->cont = cont;
-    frag_ctx->cont_cls = cont_cls;
-    frag_ctx->start_time = GNUNET_TIME_absolute_get ();
-    frag_ctx->next_frag_time = s->last_transmit_time;
-    frag_ctx->flow_delay_from_other_peer =
-      GNUNET_TIME_relative_divide (s->flow_delay_from_other_peer,
-                                   1 + (msgbuf_size / UDP_MTU));
-    frag_ctx->timeout = GNUNET_TIME_relative_to_absolute (to);
-    frag_ctx->payload_size =
-      msgbuf_size;   /* unfragmented message size without UDP overhead */
-    frag_ctx->on_wire_size = 0;   /* bytes with UDP and fragmentation overhead 
*/
-    frag_ctx->frag = GNUNET_FRAGMENT_context_create (plugin->env->stats,
-                                                     UDP_MTU,
-                                                     &plugin->tracker,
-                                                     
s->last_expected_msg_delay,
-                                                     
s->last_expected_ack_delay,
-                                                     &udp->header,
-                                                     &enqueue_fragment,
-                                                     frag_ctx);
-    s->frag_ctx = frag_ctx;
-    s->last_transmit_time = frag_ctx->next_frag_time;
-    latency = GNUNET_TIME_absolute_get_remaining (s->last_transmit_time);
-    if (latency.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
-      LOG (GNUNET_ERROR_TYPE_WARNING,
-           "Enqueued fragments will take %s for transmission to %s (queue 
size: %u)\n",
-           GNUNET_STRINGS_relative_time_to_string (latency, GNUNET_YES),
-           GNUNET_i2s (&s->target),
-           (unsigned int) s->msgs_in_queue);
-    else
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Enqueued fragments will take %s for transmission to %s (queue 
size: %u)\n",
-           GNUNET_STRINGS_relative_time_to_string (latency, GNUNET_YES),
-           GNUNET_i2s (&s->target),
-           (unsigned int) s->msgs_in_queue);
-
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragmented messages active",
-                              1,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragmented messages, total",
-                              1,
-                              GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragmented bytes (payload)",
-                              frag_ctx->payload_size,
-                              GNUNET_NO);
-  }
-  notify_session_monitor (s->plugin, s, GNUNET_TRANSPORT_SS_UPDATE);
-  return udpmlen;
-}
-
-
-/* ********************** Receiving ********************** */
-
-
-/**
- * Closure for #find_receive_context().
- */
-struct FindReceiveContext
-{
-  /**
-   * Where to store the result.
-   */
-  struct DefragContext *rc;
-
-  /**
-   * Session associated with this context.
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * Address to find.
-   */
-  const union UdpAddress *udp_addr;
-
-  /**
-   * Number of bytes in @e udp_addr.
-   */
-  size_t udp_addr_len;
-};
-
-
-/**
- * Scan the heap for a receive context with the given address.
- *
- * @param cls the `struct FindReceiveContext`
- * @param node internal node of the heap
- * @param element value stored at the node (a `struct ReceiveContext`)
- * @param cost cost associated with the node
- * @return #GNUNET_YES if we should continue to iterate,
- *         #GNUNET_NO if not.
- */
-static int
-find_receive_context (void *cls,
-                      struct GNUNET_CONTAINER_HeapNode *node,
-                      void *element,
-                      GNUNET_CONTAINER_HeapCostType cost)
-{
-  struct FindReceiveContext *frc = cls;
-  struct DefragContext *e = element;
-
-  if ((frc->udp_addr_len == e->udp_addr_len) &&
-      (0 == memcmp (frc->udp_addr, e->udp_addr, frc->udp_addr_len)))
-  {
-    frc->rc = e;
-    return GNUNET_NO;
-  }
-  return GNUNET_YES;
-}
-
-
-/**
- * Functions with this signature are called whenever we need to close
- * a session due to a disconnect or failure to establish a connection.
- *
- * @param cls closure with the `struct Plugin`
- * @param s session to close down
- * @return #GNUNET_OK on success
- */
-static int
-udp_disconnect_session (void *cls, struct GNUNET_ATS_Session *s)
-{
-  struct Plugin *plugin = cls;
-  struct UDP_MessageWrapper *udpw;
-  struct UDP_MessageWrapper *next;
-  struct FindReceiveContext frc;
-
-  GNUNET_assert (GNUNET_YES != s->in_destroy);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p to peer `%s' at address %s ended\n",
-       s,
-       GNUNET_i2s (&s->target),
-       udp_address_to_string (plugin,
-                              s->address->address,
-                              s->address->address_length));
-  if (NULL != s->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (s->timeout_task);
-    s->timeout_task = NULL;
-  }
-  if (NULL != s->frag_ctx)
-  {
-    /* Remove fragmented message due to disconnect */
-    fragmented_message_done (s->frag_ctx, GNUNET_SYSERR);
-  }
-  GNUNET_assert (
-    GNUNET_YES ==
-    GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, &s->target, s));
-  frc.rc = NULL;
-  frc.udp_addr = s->address->address;
-  frc.udp_addr_len = s->address->address_length;
-  /* Lookup existing receive context for this address */
-  if (NULL != plugin->defrag_ctxs)
-  {
-    GNUNET_CONTAINER_heap_iterate (plugin->defrag_ctxs,
-                                   &find_receive_context,
-                                   &frc);
-    if (NULL != frc.rc)
-    {
-      struct DefragContext *d_ctx = frc.rc;
-
-      GNUNET_CONTAINER_heap_remove_node (d_ctx->hnode);
-      GNUNET_DEFRAGMENT_context_destroy (d_ctx->defrag);
-      GNUNET_free (d_ctx);
-    }
-  }
-  s->in_destroy = GNUNET_YES;
-  next = plugin->ipv4_queue_head;
-  while (NULL != (udpw = next))
-  {
-    next = udpw->next;
-    if (udpw->session == s)
-    {
-      dequeue (plugin, udpw);
-      udpw->qc (udpw->qc_cls, udpw, GNUNET_SYSERR);
-      GNUNET_free (udpw);
-    }
-  }
-  next = plugin->ipv6_queue_head;
-  while (NULL != (udpw = next))
-  {
-    next = udpw->next;
-    if (udpw->session == s)
-    {
-      dequeue (plugin, udpw);
-      udpw->qc (udpw->qc_cls, udpw, GNUNET_SYSERR);
-      GNUNET_free (udpw);
-    }
-  }
-  if ((NULL != s->frag_ctx) && (NULL != s->frag_ctx->cont))
-  {
-    /* The 'frag_ctx' itself will be freed in #free_session() a bit
-       later, as it might be in use right now */
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Calling continuation for fragemented message to `%s' with result 
SYSERR\n",
-         GNUNET_i2s (&s->target));
-    s->frag_ctx->cont (s->frag_ctx->cont_cls,
-                       &s->target,
-                       GNUNET_SYSERR,
-                       s->frag_ctx->payload_size,
-                       s->frag_ctx->on_wire_size);
-  }
-  notify_session_monitor (s->plugin, s, GNUNET_TRANSPORT_SS_DONE);
-  plugin->env->session_end (plugin->env->cls, s->address, s);
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         "# UDP sessions active",
-                         GNUNET_CONTAINER_multipeermap_size (plugin->sessions),
-                         GNUNET_NO);
-  if (0 == s->rc)
-    free_session (s);
-  return GNUNET_OK;
-}
-
-
-/**
- * Handle a #GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK message.
- *
- * @param plugin the UDP plugin
- * @param msg the (presumed) UDP ACK message
- * @param udp_addr sender address
- * @param udp_addr_len number of bytes in @a udp_addr
- */
-static void
-read_process_ack (struct Plugin *plugin,
-                  const struct GNUNET_MessageHeader *msg,
-                  const union UdpAddress *udp_addr,
-                  socklen_t udp_addr_len)
-{
-  const struct GNUNET_MessageHeader *ack;
-  const struct UDP_ACK_Message *udp_ack;
-  struct GNUNET_HELLO_Address *address;
-  struct GNUNET_ATS_Session *s;
-  struct GNUNET_TIME_Relative flow_delay;
-
-  /* check message format */
-  if (ntohs (msg->size) <
-      sizeof(struct UDP_ACK_Message) + sizeof(struct GNUNET_MessageHeader))
-  {
-    GNUNET_break_op (0);
-    return;
-  }
-  udp_ack = (const struct UDP_ACK_Message *) msg;
-  ack = (const struct GNUNET_MessageHeader *) &udp_ack[1];
-  if (ntohs (ack->size) != ntohs (msg->size) - sizeof(struct UDP_ACK_Message))
-  {
-    GNUNET_break_op (0);
-    return;
-  }
-
-  /* Locate session */
-  address = GNUNET_HELLO_address_allocate (&udp_ack->sender,
-                                           PLUGIN_NAME,
-                                           udp_addr,
-                                           udp_addr_len,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-  s = udp_plugin_lookup_session (plugin, address);
-  if (NULL == s)
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         "UDP session of address %s for ACK not found\n",
-         udp_address_to_string (plugin,
-                                address->address,
-                                address->address_length));
-    GNUNET_HELLO_address_free (address);
-    return;
-  }
-  if (NULL == s->frag_ctx)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
-         "Fragmentation context of address %s for ACK (%s) not found\n",
-         udp_address_to_string (plugin,
-                                address->address,
-                                address->address_length),
-         GNUNET_FRAGMENT_print_ack (ack));
-    GNUNET_HELLO_address_free (address);
-    return;
-  }
-  GNUNET_HELLO_address_free (address);
-
-  /* evaluate flow delay: how long should we wait between messages? */
-  if (UINT32_MAX == ntohl (udp_ack->delay))
-  {
-    /* Other peer asked for us to terminate the session */
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         "Asked to disconnect UDP session of %s\n",
-         GNUNET_i2s (&udp_ack->sender));
-    udp_disconnect_session (plugin, s);
-    return;
-  }
-  flow_delay.rel_value_us = (uint64_t) ntohl (udp_ack->delay);
-  if (flow_delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         "We received a sending delay of %s for %s\n",
-         GNUNET_STRINGS_relative_time_to_string (flow_delay, GNUNET_YES),
-         GNUNET_i2s (&udp_ack->sender));
-  else
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "We received a sending delay of %s for %s\n",
-         GNUNET_STRINGS_relative_time_to_string (flow_delay, GNUNET_YES),
-         GNUNET_i2s (&udp_ack->sender));
-  /* Flow delay is for the reassembled packet, however, our delay
-     is per packet, so we need to adjust: */
-  s->flow_delay_from_other_peer = flow_delay;
-
-  /* Handle ACK */
-  if (GNUNET_OK != GNUNET_FRAGMENT_process_ack (s->frag_ctx->frag, ack))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "UDP processes %u-byte acknowledgement from `%s' at `%s'\n",
-         (unsigned int) ntohs (msg->size),
-         GNUNET_i2s (&udp_ack->sender),
-         udp_address_to_string (plugin, udp_addr, udp_addr_len));
-    /* Expect more ACKs to arrive */
-    return;
-  }
-
-  /* Remove fragmented message after successful sending */
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Message from %s at %s full ACK'ed\n",
-       GNUNET_i2s (&udp_ack->sender),
-       udp_address_to_string (plugin, udp_addr, udp_addr_len));
-  fragmented_message_done (s->frag_ctx, GNUNET_OK);
-}
-
-
-/**
- * Message tokenizer has broken up an incoming message. Pass it on
- * to the service.
- *
- * @param cls the `struct GNUNET_ATS_Session *`
- * @param hdr the actual message
- * @return #GNUNET_OK (always)
- */
-static int
-process_inbound_tokenized_messages (void *cls,
-                                    const struct GNUNET_MessageHeader *hdr)
-{
-  struct GNUNET_ATS_Session *session = cls;
-  struct Plugin *plugin = session->plugin;
-
-  if (GNUNET_YES == session->in_destroy)
-    return GNUNET_OK;
-  reschedule_session_timeout (session);
-  session->flow_delay_for_other_peer =
-    plugin->env->receive (plugin->env->cls, session->address, session, hdr);
-  return GNUNET_OK;
-}
-
-
-/**
- * Destroy a session, plugin is being unloaded.
- *
- * @param cls the `struct Plugin`
- * @param key hash of public key of target peer
- * @param value a `struct PeerSession *` to clean up
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-disconnect_and_free_it (void *cls,
-                        const struct GNUNET_PeerIdentity *key,
-                        void *value)
-{
-  struct Plugin *plugin = cls;
-
-  udp_disconnect_session (plugin, value);
-  return GNUNET_OK;
-}
-
-
-/**
- * Disconnect from a remote node.  Clean up session if we have one for
- * this peer.
- *
- * @param cls closure for this call (should be handle to Plugin)
- * @param target the peeridentity of the peer to disconnect
- * @return #GNUNET_OK on success, #GNUNET_SYSERR if the operation failed
- */
-static void
-udp_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
-{
-  struct Plugin *plugin = cls;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Disconnecting from peer `%s'\n",
-       GNUNET_i2s (target));
-  GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions,
-                                              target,
-                                              &disconnect_and_free_it,
-                                              plugin);
-}
-
-
-/**
- * Session was idle, so disconnect it.
- *
- * @param cls the `struct GNUNET_ATS_Session` to time out
- */
-static void
-session_timeout (void *cls)
-{
-  struct GNUNET_ATS_Session *s = cls;
-  struct Plugin *plugin = s->plugin;
-  struct GNUNET_TIME_Relative left;
-
-  s->timeout_task = NULL;
-  left = GNUNET_TIME_absolute_get_remaining (s->timeout);
-  if (left.rel_value_us > 0)
-  {
-    /* not actually our turn yet, but let's at least update
-       the monitor, it may think we're about to die ... */
-    notify_session_monitor (s->plugin, s, GNUNET_TRANSPORT_SS_UPDATE);
-    s->timeout_task = GNUNET_SCHEDULER_add_delayed (left, &session_timeout, s);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p was idle for %s, disconnecting\n",
-       s,
-       GNUNET_STRINGS_relative_time_to_string (UDP_SESSION_TIME_OUT,
-                                               GNUNET_YES));
-  /* call session destroy function */
-  udp_disconnect_session (plugin, s);
-}
-
-
-/**
- * Allocate a new session for the given endpoint address.
- * Note that this function does not inform the service
- * of the new session, this is the responsibility of the
- * caller (if needed).
- *
- * @param cls the `struct Plugin`
- * @param address address of the other peer to use
- * @param network_type network type the address belongs to
- * @return NULL on error, otherwise session handle
- */
-static struct GNUNET_ATS_Session *
-udp_plugin_create_session (void *cls,
-                           const struct GNUNET_HELLO_Address *address,
-                           enum GNUNET_NetworkType network_type)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *s;
-
-  s = GNUNET_new (struct GNUNET_ATS_Session);
-  s->mst = GNUNET_MST_create (&process_inbound_tokenized_messages, s);
-  s->plugin = plugin;
-  s->address = GNUNET_HELLO_address_copy (address);
-  s->target = address->peer;
-  s->last_transmit_time = GNUNET_TIME_absolute_get ();
-  s->last_expected_ack_delay =
-    GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250);
-  s->last_expected_msg_delay = GNUNET_TIME_UNIT_MILLISECONDS;
-  s->flow_delay_from_other_peer = GNUNET_TIME_UNIT_ZERO;
-  s->flow_delay_for_other_peer = GNUNET_TIME_UNIT_ZERO;
-  s->timeout = GNUNET_TIME_relative_to_absolute (UDP_SESSION_TIME_OUT);
-  s->timeout_task =
-    GNUNET_SCHEDULER_add_delayed (UDP_SESSION_TIME_OUT, &session_timeout, s);
-  s->scope = network_type;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Creating new session %p for peer `%s' address `%s'\n",
-       s,
-       GNUNET_i2s (&address->peer),
-       udp_address_to_string (plugin,
-                              address->address,
-                              address->address_length));
-  GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multipeermap_put (
-                   plugin->sessions,
-                   &s->target,
-                   s,
-                   GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         "# UDP sessions active",
-                         GNUNET_CONTAINER_multipeermap_size (plugin->sessions),
-                         GNUNET_NO);
-  notify_session_monitor (plugin, s, GNUNET_TRANSPORT_SS_INIT);
-  return s;
-}
-
-
-/**
- * Creates a new outbound session the transport service will use to
- * send data to the peer.
- *
- * @param cls the `struct Plugin *`
- * @param address the address
- * @return the session or NULL of max connections exceeded
- */
-static struct GNUNET_ATS_Session *
-udp_plugin_get_session (void *cls, const struct GNUNET_HELLO_Address *address)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *s;
-  enum GNUNET_NetworkType network_type = GNUNET_NT_UNSPECIFIED;
-  const struct IPv4UdpAddress *udp_v4;
-  const struct IPv6UdpAddress *udp_v6;
-
-  if (NULL == address)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  if ((address->address_length != sizeof(struct IPv4UdpAddress)) &&
-      (address->address_length != sizeof(struct IPv6UdpAddress)))
-  {
-    GNUNET_break_op (0);
-    return NULL;
-  }
-  if (NULL != (s = udp_plugin_lookup_session (cls, address)))
-    return s;
-
-  /* need to create new session */
-  if (sizeof(struct IPv4UdpAddress) == address->address_length)
-  {
-    struct sockaddr_in v4;
-
-    udp_v4 = (const struct IPv4UdpAddress *) address->address;
-    memset (&v4, '\0', sizeof(v4));
-    v4.sin_family = AF_INET;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    v4.sin_len = sizeof(struct sockaddr_in);
-#endif
-    v4.sin_port = udp_v4->u4_port;
-    v4.sin_addr.s_addr = udp_v4->ipv4_addr;
-    network_type = plugin->env->get_address_type (plugin->env->cls,
-                                                  (const struct sockaddr *) 
&v4,
-                                                  sizeof(v4));
-  }
-  if (sizeof(struct IPv6UdpAddress) == address->address_length)
-  {
-    struct sockaddr_in6 v6;
-
-    udp_v6 = (const struct IPv6UdpAddress *) address->address;
-    memset (&v6, '\0', sizeof(v6));
-    v6.sin6_family = AF_INET6;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    v6.sin6_len = sizeof(struct sockaddr_in6);
-#endif
-    v6.sin6_port = udp_v6->u6_port;
-    v6.sin6_addr = udp_v6->ipv6_addr;
-    network_type = plugin->env->get_address_type (plugin->env->cls,
-                                                  (const struct sockaddr *) 
&v6,
-                                                  sizeof(v6));
-  }
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != network_type);
-  return udp_plugin_create_session (cls, address, network_type);
-}
-
-
-/**
- * We've received a UDP Message.  Process it (pass contents to main service).
- *
- * @param plugin plugin context
- * @param msg the message
- * @param udp_addr sender address
- * @param udp_addr_len number of bytes in @a udp_addr
- * @param network_type network type the address belongs to
- */
-static void
-process_udp_message (struct Plugin *plugin,
-                     const struct UDPMessage *msg,
-                     const union UdpAddress *udp_addr,
-                     size_t udp_addr_len,
-                     enum GNUNET_NetworkType network_type)
-{
-  struct GNUNET_ATS_Session *s;
-  struct GNUNET_HELLO_Address *address;
-
-  GNUNET_break (GNUNET_NT_UNSPECIFIED != network_type);
-  if (0 != ntohl (msg->reserved))
-  {
-    GNUNET_break_op (0);
-    return;
-  }
-  if (ntohs (msg->header.size) <
-      sizeof(struct GNUNET_MessageHeader) + sizeof(struct UDPMessage))
-  {
-    GNUNET_break_op (0);
-    return;
-  }
-
-  address = GNUNET_HELLO_address_allocate (&msg->sender,
-                                           PLUGIN_NAME,
-                                           udp_addr,
-                                           udp_addr_len,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-  if (NULL == (s = udp_plugin_lookup_session (plugin, address)))
-  {
-    s = udp_plugin_create_session (plugin, address, network_type);
-    plugin->env->session_start (plugin->env->cls, address, s, s->scope);
-    notify_session_monitor (plugin, s, GNUNET_TRANSPORT_SS_UP);
-  }
-  GNUNET_free (address);
-
-  s->rc++;
-  GNUNET_MST_from_buffer (s->mst,
-                          (const char *) &msg[1],
-                          ntohs (msg->header.size) - sizeof(struct UDPMessage),
-                          GNUNET_YES,
-                          GNUNET_NO);
-  s->rc--;
-  if ((0 == s->rc) && (GNUNET_YES == s->in_destroy))
-    free_session (s);
-}
-
-
-/**
- * Process a defragmented message.
- *
- * @param cls the `struct DefragContext *`
- * @param msg the message
- */
-static void
-fragment_msg_proc (void *cls, const struct GNUNET_MessageHeader *msg)
-{
-  struct DefragContext *dc = cls;
-  const struct UDPMessage *um;
-
-  if (ntohs (msg->type) != GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_MESSAGE)
-  {
-    GNUNET_break_op (0);
-    return;
-  }
-  if (ntohs (msg->size) < sizeof(struct UDPMessage))
-  {
-    GNUNET_break_op (0);
-    return;
-  }
-  um = (const struct UDPMessage *) msg;
-  dc->sender = um->sender;
-  dc->have_sender = GNUNET_YES;
-  process_udp_message (dc->plugin,
-                       um,
-                       dc->udp_addr,
-                       dc->udp_addr_len,
-                       dc->network_type);
-}
-
-
-/**
- * We finished sending an acknowledgement.  Update
- * statistics.
- *
- * @param cls the `struct Plugin`
- * @param udpw message queue entry of the ACK
- * @param result #GNUNET_OK if the transmission worked,
- *               #GNUNET_SYSERR if we failed to send the ACK
- */
-static void
-ack_message_sent (void *cls, struct UDP_MessageWrapper *udpw, int result)
-{
-  struct Plugin *plugin = cls;
-
-  if (GNUNET_OK == result)
-  {
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, ACK messages sent",
-                              1,
-                              GNUNET_NO);
-  }
-  else
-  {
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, ACK transmissions failed",
-                              1,
-                              GNUNET_NO);
-  }
-}
-
-
-/**
- * Transmit an acknowledgement.
- *
- * @param cls the `struct DefragContext *`
- * @param id message ID (unused)
- * @param msg ack to transmit
- */
-static void
-ack_proc (void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg)
-{
-  struct DefragContext *rc = cls;
-  struct Plugin *plugin = rc->plugin;
-  size_t msize = sizeof(struct UDP_ACK_Message) + ntohs (msg->size);
-  struct UDP_ACK_Message *udp_ack;
-  uint32_t delay;
-  struct UDP_MessageWrapper *udpw;
-  struct GNUNET_ATS_Session *s;
-  struct GNUNET_HELLO_Address *address;
-
-  if (GNUNET_NO == rc->have_sender)
-  {
-    /* tried to defragment but never succeeded, hence will not ACK */
-    /* This can happen if we just lost msgs */
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, fragments discarded without ACK",
-                              1,
-                              GNUNET_NO);
-    return;
-  }
-  address = GNUNET_HELLO_address_allocate (&rc->sender,
-                                           PLUGIN_NAME,
-                                           rc->udp_addr,
-                                           rc->udp_addr_len,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-  s = udp_plugin_lookup_session (plugin, address);
-  GNUNET_HELLO_address_free (address);
-  if (NULL == s)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Trying to transmit ACK to peer `%s' but no session found!\n",
-         udp_address_to_string (plugin, rc->udp_addr, rc->udp_addr_len));
-    GNUNET_CONTAINER_heap_remove_node (rc->hnode);
-    GNUNET_DEFRAGMENT_context_destroy (rc->defrag);
-    GNUNET_free (rc);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, ACK transmissions failed",
-                              1,
-                              GNUNET_NO);
-    return;
-  }
-  if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us ==
-      s->flow_delay_for_other_peer.rel_value_us)
-    delay = UINT32_MAX;
-  else if (s->flow_delay_for_other_peer.rel_value_us < UINT32_MAX)
-    delay = s->flow_delay_for_other_peer.rel_value_us;
-  else
-    delay = UINT32_MAX - 1; /* largest value we can communicate */
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Sending ACK to `%s' including delay of %s\n",
-       udp_address_to_string (plugin, rc->udp_addr, rc->udp_addr_len),
-       GNUNET_STRINGS_relative_time_to_string (s->flow_delay_for_other_peer,
-                                               GNUNET_YES));
-  udpw = GNUNET_malloc (sizeof(struct UDP_MessageWrapper) + msize);
-  udpw->msg_size = msize;
-  udpw->payload_size = 0;
-  udpw->session = s;
-  udpw->start_time = GNUNET_TIME_absolute_get ();
-  udpw->timeout = GNUNET_TIME_UNIT_FOREVER_ABS;
-  udpw->msg_buf = (char *) &udpw[1];
-  udpw->qc = &ack_message_sent;
-  udpw->qc_cls = plugin;
-  udp_ack = (struct UDP_ACK_Message *) udpw->msg_buf;
-  udp_ack->header.size = htons ((uint16_t) msize);
-  udp_ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK);
-  udp_ack->delay = htonl (delay);
-  udp_ack->sender = *plugin->env->my_identity;
-  GNUNET_memcpy (&udp_ack[1], msg, ntohs (msg->size));
-  enqueue (plugin, udpw);
-  notify_session_monitor (plugin, s, GNUNET_TRANSPORT_SS_UPDATE);
-  if (s->address->address_length == sizeof(struct IPv4UdpAddress))
-    schedule_select_v4 (plugin);
-  else
-    schedule_select_v6 (plugin);
-}
-
-
-/**
- * We received a fragment, process it.
- *
- * @param plugin our plugin
- * @param msg a message of type #GNUNET_MESSAGE_TYPE_FRAGMENT
- * @param udp_addr sender address
- * @param udp_addr_len number of bytes in @a udp_addr
- * @param network_type network type the address belongs to
- */
-static void
-read_process_fragment (struct Plugin *plugin,
-                       const struct GNUNET_MessageHeader *msg,
-                       const union UdpAddress *udp_addr,
-                       size_t udp_addr_len,
-                       enum GNUNET_NetworkType network_type)
-{
-  struct DefragContext *d_ctx;
-  struct GNUNET_TIME_Absolute now;
-  struct FindReceiveContext frc;
-
-  frc.rc = NULL;
-  frc.udp_addr = udp_addr;
-  frc.udp_addr_len = udp_addr_len;
-
-  /* Lookup existing receive context for this address */
-  GNUNET_CONTAINER_heap_iterate (plugin->defrag_ctxs,
-                                 &find_receive_context,
-                                 &frc);
-  now = GNUNET_TIME_absolute_get ();
-  d_ctx = frc.rc;
-
-  if (NULL == d_ctx)
-  {
-    /* Create a new defragmentation context */
-    d_ctx = GNUNET_malloc (sizeof(struct DefragContext) + udp_addr_len);
-    GNUNET_memcpy (&d_ctx[1], udp_addr, udp_addr_len);
-    d_ctx->udp_addr = (const union UdpAddress *) &d_ctx[1];
-    d_ctx->udp_addr_len = udp_addr_len;
-    d_ctx->network_type = network_type;
-    d_ctx->plugin = plugin;
-    d_ctx->defrag =
-      GNUNET_DEFRAGMENT_context_create (plugin->env->stats,
-                                        UDP_MTU,
-                                        UDP_MAX_MESSAGES_IN_DEFRAG,
-                                        d_ctx,
-                                        &fragment_msg_proc,
-                                        &ack_proc);
-    d_ctx->hnode = GNUNET_CONTAINER_heap_insert (plugin->defrag_ctxs,
-                                                 d_ctx,
-                                                 
(GNUNET_CONTAINER_HeapCostType)
-                                                 now.abs_value_us);
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Created new defragmentation context for %u-byte fragment from 
`%s'\n",
-         (unsigned int) ntohs (msg->size),
-         udp_address_to_string (plugin, udp_addr, udp_addr_len));
-  }
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Found existing defragmentation context for %u-byte fragment from 
`%s'\n",
-         (unsigned int) ntohs (msg->size),
-         udp_address_to_string (plugin, udp_addr, udp_addr_len));
-  }
-
-  if (GNUNET_OK == GNUNET_DEFRAGMENT_process_fragment (d_ctx->defrag, msg))
-  {
-    /* keep this 'rc' from expiring */
-    GNUNET_CONTAINER_heap_update_cost (d_ctx->hnode,
-                                       (GNUNET_CONTAINER_HeapCostType)
-                                       now.abs_value_us);
-  }
-  if (GNUNET_CONTAINER_heap_get_size (plugin->defrag_ctxs) >
-      UDP_MAX_SENDER_ADDRESSES_WITH_DEFRAG)
-  {
-    /* remove 'rc' that was inactive the longest */
-    d_ctx = GNUNET_CONTAINER_heap_remove_root (plugin->defrag_ctxs);
-    GNUNET_assert (NULL != d_ctx);
-    GNUNET_DEFRAGMENT_context_destroy (d_ctx->defrag);
-    GNUNET_free (d_ctx);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UDP, Defragmentations aborted",
-                              1,
-                              GNUNET_NO);
-  }
-}
-
-
-/**
- * Read and process a message from the given socket.
- *
- * @param plugin the overall plugin
- * @param rsock socket to read from
- */
-static void
-udp_select_read (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *rsock)
-{
-  socklen_t fromlen;
-  struct sockaddr_storage addr;
-  char buf[65536] GNUNET_ALIGN;
-  ssize_t size;
-  const struct GNUNET_MessageHeader *msg;
-  struct IPv4UdpAddress v4;
-  struct IPv6UdpAddress v6;
-  const struct sockaddr *sa;
-  const struct sockaddr_in *sa4;
-  const struct sockaddr_in6 *sa6;
-  const union UdpAddress *int_addr;
-  size_t int_addr_len;
-  enum GNUNET_NetworkType network_type;
-
-  fromlen = sizeof(addr);
-  memset (&addr, 0, sizeof(addr));
-  size = GNUNET_NETWORK_socket_recvfrom (rsock,
-                                         buf,
-                                         sizeof(buf),
-                                         (struct sockaddr *) &addr,
-                                         &fromlen);
-  sa = (const struct sockaddr *) &addr;
-
-  if (-1 == size)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "UDP failed to receive data: %s\n",
-         strerror (errno));
-    /* Connection failure or something. Not a protocol violation. */
-    return;
-  }
-
-  /* Check if this is a STUN packet */
-  if (GNUNET_NO !=
-      GNUNET_NAT_stun_handle_packet (plugin->nat,
-                                     (const struct sockaddr *) &addr,
-                                     fromlen,
-                                     buf,
-                                     size))
-    return; /* was STUN, do not process further */
-
-  if (size < sizeof(struct GNUNET_MessageHeader))
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         "UDP got %u bytes from %s, which is not enough for a GNUnet message 
header\n",
-         (unsigned int) size,
-         GNUNET_a2s (sa, fromlen));
-    /* _MAY_ be a connection failure (got partial message) */
-    /* But it _MAY_ also be that the other side uses non-GNUnet protocol. */
-    GNUNET_break_op (0);
-    return;
-  }
-
-  msg = (const struct GNUNET_MessageHeader *) buf;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "UDP received %u-byte message from `%s' type %u\n",
-       (unsigned int) size,
-       GNUNET_a2s (sa, fromlen),
-       ntohs (msg->type));
-  if (size != ntohs (msg->size))
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         "UDP malformed message (size %u) header from %s\n",
-         (unsigned int) size,
-         GNUNET_a2s (sa, fromlen));
-    GNUNET_break_op (0);
-    return;
-  }
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            "# UDP, total bytes received",
-                            size,
-                            GNUNET_NO);
-  network_type = plugin->env->get_address_type (plugin->env->cls, sa, fromlen);
-  switch (sa->sa_family)
-  {
-  case AF_INET:
-    sa4 = (const struct sockaddr_in *) &addr;
-    v4.options = 0;
-    v4.ipv4_addr = sa4->sin_addr.s_addr;
-    v4.u4_port = sa4->sin_port;
-    int_addr = (union UdpAddress *) &v4;
-    int_addr_len = sizeof(v4);
-    break;
-
-  case AF_INET6:
-    sa6 = (const struct sockaddr_in6 *) &addr;
-    v6.options = 0;
-    v6.ipv6_addr = sa6->sin6_addr;
-    v6.u6_port = sa6->sin6_port;
-    int_addr = (union UdpAddress *) &v6;
-    int_addr_len = sizeof(v6);
-    break;
-
-  default:
-    GNUNET_break (0);
-    return;
-  }
-
-  switch (ntohs (msg->type))
-  {
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON:
-    if (GNUNET_YES == plugin->enable_broadcasting_receiving)
-      udp_broadcast_receive (plugin,
-                             buf,
-                             size,
-                             int_addr,
-                             int_addr_len,
-                             network_type);
-    return;
-
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_MESSAGE:
-    if (ntohs (msg->size) < sizeof(struct UDPMessage))
-    {
-      GNUNET_break_op (0);
-      return;
-    }
-    process_udp_message (plugin,
-                         (const struct UDPMessage *) msg,
-                         int_addr,
-                         int_addr_len,
-                         network_type);
-    return;
-
-  case GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_ACK:
-    read_process_ack (plugin, msg, int_addr, int_addr_len);
-    return;
-
-  case GNUNET_MESSAGE_TYPE_FRAGMENT:
-    read_process_fragment (plugin, msg, int_addr, int_addr_len, network_type);
-    return;
-
-  default:
-    GNUNET_break_op (0);
-    return;
-  }
-}
-
-
-/**
- * Removes messages from the transmission queue that have
- * timed out, and then selects a message that should be
- * transmitted next.
- *
- * @param plugin the UDP plugin
- * @param sock which socket should we process the queue for (v4 or v6)
- * @return message selected for transmission, or NULL for none
- */
-static struct UDP_MessageWrapper *
-remove_timeout_messages_and_select (struct Plugin *plugin,
-                                    struct GNUNET_NETWORK_Handle *sock)
-{
-  struct UDP_MessageWrapper *udpw;
-  struct GNUNET_TIME_Relative remaining;
-  struct GNUNET_ATS_Session *session;
-  int removed;
-
-  removed = GNUNET_NO;
-  udpw = (sock == plugin->sockv4) ? plugin->ipv4_queue_head
-         : plugin->ipv6_queue_head;
-  while (NULL != udpw)
-  {
-    session = udpw->session;
-    /* Find messages with timeout */
-    remaining = GNUNET_TIME_absolute_get_remaining (udpw->timeout);
-    if (GNUNET_TIME_UNIT_ZERO.rel_value_us == remaining.rel_value_us)
-    {
-      /* Message timed out */
-      removed = GNUNET_YES;
-      dequeue (plugin, udpw);
-      udpw->qc (udpw->qc_cls, udpw, GNUNET_SYSERR);
-      GNUNET_free (udpw);
-
-      if (sock == plugin->sockv4)
-      {
-        udpw = plugin->ipv4_queue_head;
-      }
-      else if (sock == plugin->sockv6)
-      {
-        udpw = plugin->ipv6_queue_head;
-      }
-      else
-      {
-        GNUNET_break (0);      /* should never happen */
-        udpw = NULL;
-      }
-      GNUNET_STATISTICS_update (plugin->env->stats,
-                                "# messages discarded due to timeout",
-                                1,
-                                GNUNET_NO);
-    }
-    else
-    {
-      /* Message did not time out, check transmission time */
-      remaining = GNUNET_TIME_absolute_get_remaining (udpw->transmission_time);
-      if (0 == remaining.rel_value_us)
-      {
-        /* this message is not delayed */
-        LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "Message for peer `%s' (%lu bytes) is not delayed \n",
-             GNUNET_i2s (&udpw->session->target),
-             (unsigned long) udpw->payload_size);
-        break;       /* Found message to send, break */
-      }
-      else
-      {
-        /* Message is delayed, try next */
-        LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "Message for peer `%s' (%lu bytes) is delayed for %s\n",
-             GNUNET_i2s (&udpw->session->target),
-             (unsigned long) udpw->payload_size,
-             GNUNET_STRINGS_relative_time_to_string (remaining, GNUNET_YES));
-        udpw = udpw->next;
-      }
-    }
-  }
-  if (GNUNET_YES == removed)
-    notify_session_monitor (session->plugin,
-                            session,
-                            GNUNET_TRANSPORT_SS_UPDATE);
-  return udpw;
-}
-
-
-/**
- * We failed to transmit a message via UDP. Generate
- * a descriptive error message.
- *
- * @param plugin our plugin
- * @param sa target address we were trying to reach
- * @param slen number of bytes in @a sa
- * @param error the errno value returned from the sendto() call
- */
-static void
-analyze_send_error (struct Plugin *plugin,
-                    const struct sockaddr *sa,
-                    socklen_t slen,
-                    int error)
-{
-  enum GNUNET_NetworkType type;
-
-  type = plugin->env->get_address_type (plugin->env->cls, sa, slen);
-  if (((GNUNET_NT_LAN == type) || (GNUNET_NT_WAN == type)) &&
-      ((ENETUNREACH == errno) || (ENETDOWN == errno)))
-  {
-    if (slen == sizeof(struct sockaddr_in))
-    {
-      /* IPv4: "Network unreachable" or "Network down"
-       *
-       * This indicates we do not have connectivity
-       */
-      LOG (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
-           _ ("UDP could not transmit message to `%s': "
-              "Network seems down, please check your network configuration\n"),
-           GNUNET_a2s (sa, slen));
-    }
-    if (slen == sizeof(struct sockaddr_in6))
-    {
-      /* IPv6: "Network unreachable" or "Network down"
-       *
-       * This indicates that this system is IPv6 enabled, but does not
-       * have a valid global IPv6 address assigned or we do not have
-       * connectivity
-       */LOG (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
-           _ (
-             "UDP could not transmit IPv6 message! "
-             "Please check your network configuration and disable IPv6 if your 
"
-             "connection does not have a global IPv6 address\n"));
-    }
-  }
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         "UDP could not transmit message to `%s': `%s'\n",
-         GNUNET_a2s (sa, slen),
-         strerror (error));
-  }
-}
-
-
-/**
- * It is time to try to transmit a UDP message.  Select one
- * and send.
- *
- * @param plugin the plugin
- * @param sock which socket (v4/v6) to send on
- */
-static void
-udp_select_send (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *sock)
-{
-  ssize_t sent;
-  socklen_t slen;
-  const struct sockaddr *a;
-  const struct IPv4UdpAddress *u4;
-  struct sockaddr_in a4;
-  const struct IPv6UdpAddress *u6;
-  struct sockaddr_in6 a6;
-  struct UDP_MessageWrapper *udpw;
-
-  /* Find message(s) to send */
-  while (NULL != (udpw = remove_timeout_messages_and_select (plugin, sock)))
-  {
-    if (sizeof(struct IPv4UdpAddress) ==
-        udpw->session->address->address_length)
-    {
-      u4 = udpw->session->address->address;
-      memset (&a4, 0, sizeof(a4));
-      a4.sin_family = AF_INET;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      a4.sin_len = sizeof(a4);
-#endif
-      a4.sin_port = u4->u4_port;
-      a4.sin_addr.s_addr = u4->ipv4_addr;
-      a = (const struct sockaddr *) &a4;
-      slen = sizeof(a4);
-    }
-    else if (sizeof(struct IPv6UdpAddress) ==
-             udpw->session->address->address_length)
-    {
-      u6 = udpw->session->address->address;
-      memset (&a6, 0, sizeof(a6));
-      a6.sin6_family = AF_INET6;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      a6.sin6_len = sizeof(a6);
-#endif
-      a6.sin6_port = u6->u6_port;
-      a6.sin6_addr = u6->ipv6_addr;
-      a = (const struct sockaddr *) &a6;
-      slen = sizeof(a6);
-    }
-    else
-    {
-      GNUNET_break (0);
-      dequeue (plugin, udpw);
-      udpw->qc (udpw->qc_cls, udpw, GNUNET_SYSERR);
-      notify_session_monitor (plugin,
-                              udpw->session,
-                              GNUNET_TRANSPORT_SS_UPDATE);
-      GNUNET_free (udpw);
-      continue;
-    }
-    sent = GNUNET_NETWORK_socket_sendto (sock,
-                                         udpw->msg_buf,
-                                         udpw->msg_size,
-                                         a,
-                                         slen);
-    udpw->session->last_transmit_time =
-      GNUNET_TIME_absolute_max (GNUNET_TIME_absolute_get (),
-                                udpw->session->last_transmit_time);
-    dequeue (plugin, udpw);
-    if (GNUNET_SYSERR == sent)
-    {
-      /* Failure */
-      analyze_send_error (plugin, a, slen, errno);
-      udpw->qc (udpw->qc_cls, udpw, GNUNET_SYSERR);
-      GNUNET_STATISTICS_update (plugin->env->stats,
-                                "# UDP, total, bytes, sent, failure",
-                                sent,
-                                GNUNET_NO);
-      GNUNET_STATISTICS_update (plugin->env->stats,
-                                "# UDP, total, messages, sent, failure",
-                                1,
-                                GNUNET_NO);
-    }
-    else
-    {
-      /* Success */
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "UDP transmitted %u-byte message to  `%s' `%s' (%d: %s)\n",
-           (unsigned int) (udpw->msg_size),
-           GNUNET_i2s (&udpw->session->target),
-           GNUNET_a2s (a, slen),
-           (int) sent,
-           (sent < 0) ? strerror (errno) : "ok");
-      GNUNET_STATISTICS_update (plugin->env->stats,
-                                "# UDP, total, bytes, sent, success",
-                                sent,
-                                GNUNET_NO);
-      GNUNET_STATISTICS_update (plugin->env->stats,
-                                "# UDP, total, messages, sent, success",
-                                1,
-                                GNUNET_NO);
-      if (NULL != udpw->frag_ctx)
-        udpw->frag_ctx->on_wire_size += udpw->msg_size;
-      udpw->qc (udpw->qc_cls, udpw, GNUNET_OK);
-    }
-    notify_session_monitor (plugin, udpw->session, GNUNET_TRANSPORT_SS_UPDATE);
-    GNUNET_free (udpw);
-  }
-}
-
-
-/* ***************** Event loop (part 2) *************** */
-
-
-/**
- * We have been notified that our readset has something to read.  We don't
- * know which socket needs to be read, so we have to check each one
- * Then reschedule this function to be called again once more is available.
- *
- * @param cls the plugin handle
- */
-static void
-udp_plugin_select_v4 (void *cls)
-{
-  struct Plugin *plugin = cls;
-  const struct GNUNET_SCHEDULER_TaskContext *tc;
-
-  plugin->select_task_v4 = NULL;
-  if (NULL == plugin->sockv4)
-    return;
-  tc = GNUNET_SCHEDULER_get_task_context ();
-  if ((0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) &&
-      (GNUNET_NETWORK_fdset_isset (tc->read_ready, plugin->sockv4)))
-    udp_select_read (plugin, plugin->sockv4);
-  udp_select_send (plugin, plugin->sockv4);
-  schedule_select_v4 (plugin);
-}
-
-
-/**
- * We have been notified that our readset has something to read.  We don't
- * know which socket needs to be read, so we have to check each one
- * Then reschedule this function to be called again once more is available.
- *
- * @param cls the plugin handle
- */
-static void
-udp_plugin_select_v6 (void *cls)
-{
-  struct Plugin *plugin = cls;
-  const struct GNUNET_SCHEDULER_TaskContext *tc;
-
-  plugin->select_task_v6 = NULL;
-  if (NULL == plugin->sockv6)
-    return;
-  tc = GNUNET_SCHEDULER_get_task_context ();
-  if ((0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) &&
-      (GNUNET_NETWORK_fdset_isset (tc->read_ready, plugin->sockv6)))
-    udp_select_read (plugin, plugin->sockv6);
-
-  udp_select_send (plugin, plugin->sockv6);
-  schedule_select_v6 (plugin);
-}
-
-
-/* ******************* Initialization *************** */
-
-
-/**
- * Setup the UDP sockets (for IPv4 and IPv6) for the plugin.
- *
- * @param plugin the plugin to initialize
- * @param bind_v6 IPv6 address to bind to (can be NULL, for 'any')
- * @param bind_v4 IPv4 address to bind to (can be NULL, for 'any')
- * @return number of sockets that were successfully bound
- */
-static unsigned int
-setup_sockets (struct Plugin *plugin,
-               const struct sockaddr_in6 *bind_v6,
-               const struct sockaddr_in *bind_v4)
-{
-  int tries;
-  unsigned int sockets_created = 0;
-  struct sockaddr_in6 server_addrv6;
-  struct sockaddr_in server_addrv4;
-  const struct sockaddr *server_addr;
-  const struct sockaddr *addrs[2];
-  socklen_t addrlens[2];
-  socklen_t addrlen;
-  int eno;
-
-  /* Create IPv6 socket */
-  eno = EINVAL;
-  if (GNUNET_YES == plugin->enable_ipv6)
-  {
-    plugin->sockv6 = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_DGRAM, 0);
-    if (NULL == plugin->sockv6)
-    {
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           _ ("Disabling IPv6 since it is not supported on this system!\n"));
-      plugin->enable_ipv6 = GNUNET_NO;
-    }
-    else
-    {
-      memset (&server_addrv6, 0, sizeof(struct sockaddr_in6));
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      server_addrv6.sin6_len = sizeof(struct sockaddr_in6);
-#endif
-      server_addrv6.sin6_family = AF_INET6;
-      if (NULL != bind_v6)
-        server_addrv6.sin6_addr = bind_v6->sin6_addr;
-      else
-        server_addrv6.sin6_addr = in6addr_any;
-
-      if (0 == plugin->port)     /* autodetect */
-        server_addrv6.sin6_port = htons (
-          GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 33537)
-          + 32000);
-      else
-        server_addrv6.sin6_port = htons (plugin->port);
-      addrlen = sizeof(struct sockaddr_in6);
-      server_addr = (const struct sockaddr *) &server_addrv6;
-
-      tries = 0;
-      while (tries < 10)
-      {
-        LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "Binding to IPv6 `%s'\n",
-             GNUNET_a2s (server_addr, addrlen));
-        /* binding */
-        if (GNUNET_OK ==
-            GNUNET_NETWORK_socket_bind (plugin->sockv6, server_addr, addrlen))
-          break;
-        eno = errno;
-        if (0 != plugin->port)
-        {
-          tries = 10;         /* fail immediately */
-          break;         /* bind failed on specific port */
-        }
-        /* autodetect */
-        server_addrv6.sin6_port = htons (
-          GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 33537)
-          + 32000);
-        tries++;
-      }
-      if (tries >= 10)
-      {
-        GNUNET_NETWORK_socket_close (plugin->sockv6);
-        plugin->enable_ipv6 = GNUNET_NO;
-        plugin->sockv6 = NULL;
-      }
-      else
-      {
-        plugin->port = ntohs (server_addrv6.sin6_port);
-      }
-      if (NULL != plugin->sockv6)
-      {
-        LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "IPv6 UDP socket created listinging at %s\n",
-             GNUNET_a2s (server_addr, addrlen));
-        addrs[sockets_created] = server_addr;
-        addrlens[sockets_created] = addrlen;
-        sockets_created++;
-      }
-      else
-      {
-        LOG (GNUNET_ERROR_TYPE_WARNING,
-             _ ("Failed to bind UDP socket to %s: %s\n"),
-             GNUNET_a2s (server_addr, addrlen),
-             strerror (eno));
-      }
-    }
-  }
-
-  /* Create IPv4 socket */
-  eno = EINVAL;
-  plugin->sockv4 = GNUNET_NETWORK_socket_create (PF_INET, SOCK_DGRAM, 0);
-  if (NULL == plugin->sockv4)
-  {
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "socket");
-    LOG (GNUNET_ERROR_TYPE_INFO,
-         _ ("Disabling IPv4 since it is not supported on this system!\n"));
-    plugin->enable_ipv4 = GNUNET_NO;
-  }
-  else
-  {
-    memset (&server_addrv4, 0, sizeof(struct sockaddr_in));
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    server_addrv4.sin_len = sizeof(struct sockaddr_in);
-#endif
-    server_addrv4.sin_family = AF_INET;
-    if (NULL != bind_v4)
-      server_addrv4.sin_addr = bind_v4->sin_addr;
-    else
-      server_addrv4.sin_addr.s_addr = INADDR_ANY;
-
-    if (0 == plugin->port)
-      /* autodetect */
-      server_addrv4.sin_port = htons (
-        GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 33537) + 
32000);
-    else
-      server_addrv4.sin_port = htons (plugin->port);
-
-    addrlen = sizeof(struct sockaddr_in);
-    server_addr = (const struct sockaddr *) &server_addrv4;
-
-    tries = 0;
-    while (tries < 10)
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Binding to IPv4 `%s'\n",
-           GNUNET_a2s (server_addr, addrlen));
-
-      /* binding */
-      if (GNUNET_OK ==
-          GNUNET_NETWORK_socket_bind (plugin->sockv4, server_addr, addrlen))
-        break;
-      eno = errno;
-      if (0 != plugin->port)
-      {
-        tries = 10;       /* fail */
-        break;       /* bind failed on specific port */
-      }
-
-      /* autodetect */
-      server_addrv4.sin_port = htons (
-        GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, 33537) + 
32000);
-      tries++;
-    }
-    if (tries >= 10)
-    {
-      GNUNET_NETWORK_socket_close (plugin->sockv4);
-      plugin->enable_ipv4 = GNUNET_NO;
-      plugin->sockv4 = NULL;
-    }
-    else
-    {
-      plugin->port = ntohs (server_addrv4.sin_port);
-    }
-
-    if (NULL != plugin->sockv4)
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "IPv4 socket created on port %s\n",
-           GNUNET_a2s (server_addr, addrlen));
-      addrs[sockets_created] = server_addr;
-      addrlens[sockets_created] = addrlen;
-      sockets_created++;
-    }
-    else
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Failed to bind UDP socket to %s: %s\n"),
-           GNUNET_a2s (server_addr, addrlen),
-           strerror (eno));
-    }
-  }
-
-  if (0 == sockets_created)
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING, _ ("Failed to open UDP sockets\n"));
-    return 0;   /* No sockets created, return */
-  }
-  schedule_select_v4 (plugin);
-  schedule_select_v6 (plugin);
-  plugin->nat = GNUNET_NAT_register (plugin->env->cfg,
-                                     "transport-udp",
-                                     IPPROTO_UDP,
-                                     sockets_created,
-                                     addrs,
-                                     addrlens,
-                                     &udp_nat_port_map_callback,
-                                     NULL,
-                                     plugin);
-  return sockets_created;
-}
-
-
-/**
- * The exported method. Makes the core api available via a global and
- * returns the udp transport API.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PluginEnvironment`
- * @return our `struct GNUNET_TRANSPORT_PluginFunctions`
- */
-void *
-libgnunet_plugin_transport_udp_init (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginEnvironment *env = cls;
-  struct GNUNET_TRANSPORT_PluginFunctions *api;
-  struct Plugin *p;
-  unsigned long long port;
-  unsigned long long aport;
-  unsigned long long udp_max_bps;
-  int enable_v6;
-  int enable_broadcasting;
-  int enable_broadcasting_recv;
-  char *bind4_address;
-  char *bind6_address;
-  struct GNUNET_TIME_Relative interval;
-  struct sockaddr_in server_addrv4;
-  struct sockaddr_in6 server_addrv6;
-  unsigned int res;
-  int have_bind4;
-  int have_bind6;
-
-  if (NULL == env->receive)
-  {
-    /* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully
-       initialize the plugin or the API */
-    api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-    api->cls = NULL;
-    api->address_pretty_printer = &udp_plugin_address_pretty_printer;
-    api->address_to_string = &udp_address_to_string;
-    api->string_to_address = &udp_string_to_address;
-    return api;
-  }
-
-  /* Get port number: port == 0 : autodetect a port,
-  * > 0 : use this port, not given : 2086 default */
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (env->cfg,
-                                                          "transport-udp",
-                                                          "PORT",
-                                                          &port))
-    port = 2086;
-  if (port > 65535)
-  {
-    GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
-                               "transport-udp",
-                               "PORT",
-                               _ ("must be in [0,65535]"));
-    return NULL;
-  }
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (env->cfg,
-                                                          "transport-udp",
-                                                          "ADVERTISED_PORT",
-                                                          &aport))
-    aport = port;
-  if (aport > 65535)
-  {
-    GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
-                               "transport-udp",
-                               "ADVERTISED_PORT",
-                               _ ("must be in [0,65535]"));
-    return NULL;
-  }
-
-  if (GNUNET_YES ==
-      GNUNET_CONFIGURATION_get_value_yesno (env->cfg, "nat", "DISABLEV6"))
-    enable_v6 = GNUNET_NO;
-  else
-    enable_v6 = GNUNET_YES;
-
-  have_bind4 = GNUNET_NO;
-  memset (&server_addrv4, 0, sizeof(server_addrv4));
-  if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (env->cfg,
-                                                           "transport-udp",
-                                                           "BINDTO",
-                                                           &bind4_address))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Binding UDP plugin to specific address: `%s'\n",
-         bind4_address);
-    if (1 != inet_pton (AF_INET, bind4_address, &server_addrv4.sin_addr))
-    {
-      GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
-                                 "transport-udp",
-                                 "BINDTO",
-                                 _ ("must be valid IPv4 address"));
-      GNUNET_free (bind4_address);
-      return NULL;
-    }
-    have_bind4 = GNUNET_YES;
-  }
-  GNUNET_free (bind4_address);
-  have_bind6 = GNUNET_NO;
-  memset (&server_addrv6, 0, sizeof(server_addrv6));
-  if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (env->cfg,
-                                                           "transport-udp",
-                                                           "BINDTO6",
-                                                           &bind6_address))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Binding udp plugin to specific address: `%s'\n",
-         bind6_address);
-    if (1 != inet_pton (AF_INET6, bind6_address, &server_addrv6.sin6_addr))
-    {
-      GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
-                                 "transport-udp",
-                                 "BINDTO6",
-                                 _ ("must be valid IPv6 address"));
-      GNUNET_free (bind6_address);
-      return NULL;
-    }
-    have_bind6 = GNUNET_YES;
-  }
-  GNUNET_free (bind6_address);
-
-  enable_broadcasting = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                              "transport-udp",
-                                                              "BROADCAST");
-  if (enable_broadcasting == GNUNET_SYSERR)
-    enable_broadcasting = GNUNET_NO;
-
-  enable_broadcasting_recv =
-    GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                          "transport-udp",
-                                          "BROADCAST_RECEIVE");
-  if (enable_broadcasting_recv == GNUNET_SYSERR)
-    enable_broadcasting_recv = GNUNET_YES;
-
-  if (GNUNET_SYSERR ==
-      GNUNET_CONFIGURATION_get_value_time (env->cfg,
-                                           "transport-udp",
-                                           "BROADCAST_INTERVAL",
-                                           &interval))
-  {
-    interval = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10);
-  }
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (env->cfg,
-                                                          "transport-udp",
-                                                          "MAX_BPS",
-                                                          &udp_max_bps))
-  {
-    /* 50 MB/s == infinity for practical purposes */
-    udp_max_bps = 1024 * 1024 * 50;
-  }
-
-  p = GNUNET_new (struct Plugin);
-  p->port = port;
-  p->aport = aport;
-  p->broadcast_interval = interval;
-  p->enable_ipv6 = enable_v6;
-  p->enable_ipv4 = GNUNET_YES; /* default */
-  p->enable_broadcasting = enable_broadcasting;
-  p->enable_broadcasting_receiving = enable_broadcasting_recv;
-  p->env = env;
-  p->sessions = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_NO);
-  p->defrag_ctxs =
-    GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
-  GNUNET_BANDWIDTH_tracker_init (&p->tracker,
-                                 NULL,
-                                 NULL,
-                                 GNUNET_BANDWIDTH_value_init (
-                                   (uint32_t) udp_max_bps),
-                                 30);
-  res = setup_sockets (p,
-                       (GNUNET_YES == have_bind6) ? &server_addrv6 : NULL,
-                       (GNUNET_YES == have_bind4) ? &server_addrv4 : NULL);
-  if ((0 == res) || ((NULL == p->sockv4) && (NULL == p->sockv6)))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Failed to create UDP network 
sockets\n"));
-    GNUNET_CONTAINER_multipeermap_destroy (p->sessions);
-    GNUNET_CONTAINER_heap_destroy (p->defrag_ctxs);
-    if (NULL != p->nat)
-      GNUNET_NAT_unregister (p->nat);
-    GNUNET_free (p);
-    return NULL;
-  }
-
-  /* Setup broadcasting and receiving beacons */
-  setup_broadcast (p, &server_addrv6, &server_addrv4);
-
-  api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-  api->cls = p;
-  api->disconnect_session = &udp_disconnect_session;
-  api->query_keepalive_factor = &udp_query_keepalive_factor;
-  api->disconnect_peer = &udp_disconnect;
-  api->address_pretty_printer = &udp_plugin_address_pretty_printer;
-  api->address_to_string = &udp_address_to_string;
-  api->string_to_address = &udp_string_to_address;
-  api->check_address = &udp_plugin_check_address;
-  api->get_session = &udp_plugin_get_session;
-  api->send = &udp_plugin_send;
-  api->get_network = &udp_plugin_get_network;
-  api->get_network_for_address = &udp_plugin_get_network_for_address;
-  api->update_session_timeout = &udp_plugin_update_session_timeout;
-  api->setup_monitor = &udp_plugin_setup_monitor;
-  return api;
-}
-
-
-/**
- * Function called on each entry in the defragmentation heap to
- * clean it up.
- *
- * @param cls NULL
- * @param node node in the heap (to be removed)
- * @param element a `struct DefragContext` to be cleaned up
- * @param cost unused
- * @return #GNUNET_YES
- */
-static int
-heap_cleanup_iterator (void *cls,
-                       struct GNUNET_CONTAINER_HeapNode *node,
-                       void *element,
-                       GNUNET_CONTAINER_HeapCostType cost)
-{
-  struct DefragContext *d_ctx = element;
-
-  GNUNET_CONTAINER_heap_remove_node (node);
-  GNUNET_DEFRAGMENT_context_destroy (d_ctx->defrag);
-  GNUNET_free (d_ctx);
-  return GNUNET_YES;
-}
-
-
-/**
- * The exported method. Makes the core api available via a global and
- * returns the udp transport API.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PluginEnvironment`
- * @return NULL
- */
-void *
-libgnunet_plugin_transport_udp_done (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
-  struct Plugin *plugin = api->cls;
-  struct PrettyPrinterContext *cur;
-  struct UDP_MessageWrapper *udpw;
-
-  if (NULL == plugin)
-  {
-    GNUNET_free (api);
-    return NULL;
-  }
-  stop_broadcast (plugin);
-  if (NULL != plugin->select_task_v4)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->select_task_v4);
-    plugin->select_task_v4 = NULL;
-  }
-  if (NULL != plugin->select_task_v6)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->select_task_v6);
-    plugin->select_task_v6 = NULL;
-  }
-  if (NULL != plugin->sockv4)
-  {
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (plugin->sockv4));
-    plugin->sockv4 = NULL;
-  }
-  if (NULL != plugin->sockv6)
-  {
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (plugin->sockv6));
-    plugin->sockv6 = NULL;
-  }
-  if (NULL != plugin->nat)
-  {
-    GNUNET_NAT_unregister (plugin->nat);
-    plugin->nat = NULL;
-  }
-  if (NULL != plugin->defrag_ctxs)
-  {
-    GNUNET_CONTAINER_heap_iterate (plugin->defrag_ctxs,
-                                   &heap_cleanup_iterator,
-                                   NULL);
-    GNUNET_CONTAINER_heap_destroy (plugin->defrag_ctxs);
-    plugin->defrag_ctxs = NULL;
-  }
-  while (NULL != (udpw = plugin->ipv4_queue_head))
-  {
-    dequeue (plugin, udpw);
-    udpw->qc (udpw->qc_cls, udpw, GNUNET_SYSERR);
-    GNUNET_free (udpw);
-  }
-  while (NULL != (udpw = plugin->ipv6_queue_head))
-  {
-    dequeue (plugin, udpw);
-    udpw->qc (udpw->qc_cls, udpw, GNUNET_SYSERR);
-    GNUNET_free (udpw);
-  }
-  GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions,
-                                         &disconnect_and_free_it,
-                                         plugin);
-  GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions);
-
-  while (NULL != (cur = plugin->ppc_dll_head))
-  {
-    GNUNET_break (0);
-    GNUNET_CONTAINER_DLL_remove (plugin->ppc_dll_head,
-                                 plugin->ppc_dll_tail,
-                                 cur);
-    GNUNET_RESOLVER_request_cancel (cur->resolver_handle);
-    if (NULL != cur->timeout_task)
-    {
-      GNUNET_SCHEDULER_cancel (cur->timeout_task);
-      cur->timeout_task = NULL;
-    }
-    GNUNET_free (cur);
-  }
-  GNUNET_free (plugin);
-  GNUNET_free (api);
-  return NULL;
-}
-
-
-/* end of plugin_transport_udp.c */
diff --git a/src/transport/plugin_transport_udp.h 
b/src/transport/plugin_transport_udp.h
deleted file mode 100644
index 7192da885..000000000
--- a/src/transport/plugin_transport_udp.h
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2010-2014 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_udp.h
- * @brief Implementation of the UDP transport protocol
- * @author Christian Grothoff
- * @author Nathan Evans
- * @author Matthias Wachs
- */
-#ifndef PLUGIN_TRANSPORT_UDP_H
-#define PLUGIN_TRANSPORT_UDP_H
-
-#include "platform.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_fragmentation_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_resolver_service.h"
-#include "gnunet_signatures.h"
-#include "gnunet_constants.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_transport_plugin.h"
-#include "transport.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-udp", __VA_ARGS__)
-
-#define PLUGIN_NAME "udp"
-
-#define DEBUG_UDP GNUNET_NO
-
-#define DEBUG_UDP_BROADCASTING GNUNET_NO
-
-/**
- * MTU for fragmentation subsystem.  Should be conservative since
- * all communicating peers MUST work with this MTU.
- */
-#define UDP_MTU 1400
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-/**
- * Network format for IPv4 addresses.
- */
-struct IPv4UdpAddress
-{
-  /**
-   * Optional options and flags for this address
-   */
-  uint32_t options GNUNET_PACKED;
-
-  /**
-   * IPv4 address, in network byte order.
-   */
-  uint32_t ipv4_addr GNUNET_PACKED;
-
-  /**
-   * Port number, in network byte order.
-   */
-  uint16_t u4_port GNUNET_PACKED;
-};
-
-
-/**
- * Network format for IPv6 addresses.
- */
-struct IPv6UdpAddress
-{
-  /**
-   * Optional options and flags for this address
-   */
-  uint32_t options GNUNET_PACKED;
-
-  /**
-   * IPv6 address.
-   */
-  struct in6_addr ipv6_addr GNUNET_PACKED;
-
-  /**
-   * Port number, in network byte order.
-   */
-  uint16_t u6_port GNUNET_PACKED;
-};
-GNUNET_NETWORK_STRUCT_END
-
-/**
- * Either an IPv4 or IPv6 UDP address.  Note that without a "length",
- * one cannot tell which one of the two types this address represents.
- */
-union UdpAddress
-{
-  /**
-   * IPv4 case.
-   */
-  struct IPv4UdpAddress v4;
-
-  /**
-   * IPv6 case.
-   */
-  struct IPv6UdpAddress v6;
-};
-
-
-/**
- * Information we track for each message in the queue.
- */
-struct UDP_MessageWrapper;
-
-
-/**
- * Closure for #append_port().
- */
-struct PrettyPrinterContext;
-
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct Plugin
-{
-  /**
-   * Our environment.
-   */
-  struct GNUNET_TRANSPORT_PluginEnvironment *env;
-
-  /**
-   * Session of peers with whom we are currently connected,
-   * map of peer identity to `struct GNUNET_ATS_Session *`.
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *sessions;
-
-  /**
-   * Heap with all of our defragmentation activities.
-   */
-  struct GNUNET_CONTAINER_Heap *defrag_ctxs;
-
-  /**
-   * ID of select task for IPv4
-   */
-  struct GNUNET_SCHEDULER_Task *select_task_v4;
-
-  /**
-   * ID of select task for IPv6
-   */
-  struct GNUNET_SCHEDULER_Task *select_task_v6;
-
-  /**
-   * Bandwidth tracker to limit global UDP traffic.
-   */
-  struct GNUNET_BANDWIDTH_Tracker tracker;
-
-  /**
-   * Address we were told to bind to exclusively (IPv4).
-   */
-  char *bind4_address;
-
-  /**
-   * Address we were told to bind to exclusively (IPv6).
-   */
-  char *bind6_address;
-
-  /**
-   * Handle to NAT traversal support.
-   */
-  struct GNUNET_NAT_Handle *nat;
-
-  /**
-   * Handle to NAT traversal support.
-   */
-  struct GNUNET_NAT_STUN_Handle *stun;
-
-  /**
-   * The read socket for IPv4
-   */
-  struct GNUNET_NETWORK_Handle *sockv4;
-
-  /**
-   * The read socket for IPv6
-   */
-  struct GNUNET_NETWORK_Handle *sockv6;
-
-  /**
-   * Head of DLL of broadcast addresses
-   */
-  struct BroadcastAddress *broadcast_tail;
-
-  /**
-   * Tail of DLL of broadcast addresses
-   */
-  struct BroadcastAddress *broadcast_head;
-
-  /**
-   * Head of messages in IPv4 queue.
-   */
-  struct UDP_MessageWrapper *ipv4_queue_head;
-
-  /**
-   * Tail of messages in IPv4 queue.
-   */
-  struct UDP_MessageWrapper *ipv4_queue_tail;
-
-  /**
-   * Head of messages in IPv6 queue.
-   */
-  struct UDP_MessageWrapper *ipv6_queue_head;
-
-  /**
-   * Tail of messages in IPv6 queue.
-   */
-  struct UDP_MessageWrapper *ipv6_queue_tail;
-
-  /**
-   * Running pretty printers: head
-   */
-  struct PrettyPrinterContext *ppc_dll_head;
-
-  /**
-   * Running pretty printers: tail
-   */
-  struct PrettyPrinterContext *ppc_dll_tail;
-
-  /**
-   * Function to call about session status changes.
-   */
-  GNUNET_TRANSPORT_SessionInfoCallback sic;
-
-  /**
-   * Closure for @e sic.
-   */
-  void *sic_cls;
-
-  /**
-   * IPv6 multicast address
-   */
-  struct sockaddr_in6 ipv6_multicast_address;
-
-  /**
-   * Broadcast interval
-   */
-  struct GNUNET_TIME_Relative broadcast_interval;
-
-  /**
-   * Bytes currently in buffer
-   */
-  int64_t bytes_in_buffer;
-
-  /**
-   * Address options
-   */
-  uint32_t myoptions;
-
-  /**
-   * Is IPv6 enabled: #GNUNET_YES or #GNUNET_NO
-   */
-  int enable_ipv6;
-
-  /**
-   * Is IPv4 enabled: #GNUNET_YES or #GNUNET_NO
-   */
-  int enable_ipv4;
-
-  /**
-   * Is broadcasting enabled: #GNUNET_YES or #GNUNET_NO
-   */
-  int enable_broadcasting;
-
-  /**
-   * Is receiving broadcasts enabled: #GNUNET_YES or #GNUNET_NO
-   */
-  int enable_broadcasting_receiving;
-
-  /**
-   * Port we broadcasting on.
-   */
-  uint16_t broadcast_port;
-
-  /**
-   * Port we listen on.
-   */
-  uint16_t port;
-
-  /**
-   * Port we advertise on.
-   */
-  uint16_t aport;
-};
-
-
-/**
- * Function called for a quick conversion of the binary address to
- * a numeric address.  Note that the caller must not free the
- * address and that the next call to this function is allowed
- * to override the address again.
- *
- * @param cls closure
- * @param addr binary address (a `union UdpAddress`)
- * @param addrlen length of the @a addr
- * @return string representing the same address
- */
-const char *
-udp_address_to_string (void *cls,
-                       const void *addr,
-                       size_t addrlen);
-
-
-/**
- * We received a broadcast message.  Process it and all subsequent
- * messages in the same packet.
- *
- * @param plugin the UDP plugin
- * @param buf the buffer with the message(s)
- * @param size number of bytes in @a buf
- * @param udp_addr address of the sender
- * @param udp_addr_len number of bytes in @a udp_addr
- * @param network_type network type of the sender's address
- */
-void
-udp_broadcast_receive (struct Plugin *plugin,
-                       const char *buf,
-                       ssize_t size,
-                       const union UdpAddress *udp_addr,
-                       size_t udp_addr_len,
-                       enum GNUNET_NetworkType network_type);
-
-
-void
-setup_broadcast (struct Plugin *plugin,
-                 struct sockaddr_in6 *server_addrv6,
-                 struct sockaddr_in *server_addrv4);
-
-
-void
-stop_broadcast (struct Plugin *plugin);
-
-/*#ifndef PLUGIN_TRANSPORT_UDP_H*/
-#endif
-/* end of plugin_transport_udp.h */
diff --git a/src/transport/plugin_transport_udp_broadcasting.c 
b/src/transport/plugin_transport_udp_broadcasting.c
deleted file mode 100644
index a65f5bd2f..000000000
--- a/src/transport/plugin_transport_udp_broadcasting.c
+++ /dev/null
@@ -1,647 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2010, 2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_udp_broadcasting.c
- * @brief Neighbour discovery with UDP
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "plugin_transport_udp.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_fragmentation_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_resolver_service.h"
-#include "gnunet_signatures.h"
-#include "gnunet_constants.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_transport_plugin.h"
-#include "transport.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-udp", __VA_ARGS__)
-
-/* *********** Cryogenic ********** */
-#ifdef __linux__
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <sys/ioctl.h>
-#include <sys/select.h>
-#include <sys/time.h>
-
-#define PM_MAGIC 'k'
-#define PM_SET_DELAY_AND_TIMEOUT _IOW (PM_MAGIC, 1, struct pm_times)
-
-struct pm_times
-{
-  unsigned long delay_msecs;
-  unsigned long timeout_msecs;
-};
-#endif
-/************************************/
-
-
-struct UDP_Beacon_Message
-{
-  /**
-   * Message header.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * What is the identity of the sender
-   */
-  struct GNUNET_PeerIdentity sender;
-};
-
-
-struct BroadcastAddress
-{
-  struct BroadcastAddress *next;
-
-  struct BroadcastAddress *prev;
-
-  /**
-   * ID of select broadcast task
-   */
-  struct GNUNET_SCHEDULER_Task *broadcast_task;
-
-  struct Plugin *plugin;
-
-  struct sockaddr *addr;
-
-  socklen_t addrlen;
-
-#ifdef __linux__
-  /**
-   * Cryogenic handle.
-   */
-  struct GNUNET_DISK_FileHandle *cryogenic_fd;
-
-  /**
-   * Time out for cryogenic.
-   */
-  struct pm_times cryogenic_times;
-#endif
-};
-
-
-/**
- * Client-specific context for #broadcast_mst_cb().
- */
-struct MstContext
-{
-  struct Plugin *plugin;
-
-  const union UdpAddress *udp_addr;
-
-  size_t udp_addr_len;
-
-  /**
-   * ATS network type.
-   */
-  enum GNUNET_NetworkType ats_address_network_type;
-};
-
-
-/**
- * Parse broadcast message received.
- *
- * @param cls the `struct Plugin`
- * @param client the `struct MstContext` with sender address
- * @param message the message we received
- * @return #GNUNET_OK (always)
- */
-static int
-broadcast_mst_cb (void *cls,
-                  const struct GNUNET_MessageHeader *message)
-{
-  struct MstContext *mc = cls;
-  struct Plugin *plugin = mc->plugin;
-  struct GNUNET_HELLO_Address *address;
-  const struct GNUNET_MessageHeader *hello;
-  const struct UDP_Beacon_Message *msg;
-
-  msg = (const struct UDP_Beacon_Message *) message;
-
-  if (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON !=
-      ntohs (msg->header.type))
-    return GNUNET_OK;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Received beacon with %u bytes from peer `%s' via address `%s'\n",
-       ntohs (msg->header.size),
-       GNUNET_i2s (&msg->sender),
-       udp_address_to_string (NULL,
-                              mc->udp_addr,
-                              mc->udp_addr_len));
-  hello = (struct GNUNET_MessageHeader *) &msg[1];
-  address = GNUNET_HELLO_address_allocate (&msg->sender,
-                                           PLUGIN_NAME,
-                                           mc->udp_addr,
-                                           mc->udp_addr_len,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-  plugin->env->receive (plugin->env->cls,
-                        address,
-                        NULL,
-                        hello);
-  GNUNET_HELLO_address_free (address);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            _ ("# Multicast HELLO beacons received via UDP"),
-                            1, GNUNET_NO);
-  return GNUNET_OK;
-}
-
-
-/**
- * We received a broadcast message.  Process it and all subsequent
- * messages in the same packet.
- *
- * @param plugin the UDP plugin
- * @param buf the buffer with the message(s)
- * @param size number of bytes in @a buf
- * @param udp_addr address of the sender
- * @param udp_addr_len number of bytes in @a udp_addr
- * @param network_type network type of the sender's address
- */
-void
-udp_broadcast_receive (struct Plugin *plugin,
-                       const char *buf,
-                       ssize_t size,
-                       const union UdpAddress *udp_addr,
-                       size_t udp_addr_len,
-                       enum GNUNET_NetworkType network_type)
-{
-  struct GNUNET_MessageStreamTokenizer *broadcast_mst;
-  struct MstContext mc;
-
-  broadcast_mst = GNUNET_MST_create (&broadcast_mst_cb,
-                                     &mc);
-  mc.plugin = plugin;
-  mc.udp_addr = udp_addr;
-  mc.udp_addr_len = udp_addr_len;
-  mc.ats_address_network_type = network_type;
-  GNUNET_MST_from_buffer (broadcast_mst,
-                          buf, size,
-                          GNUNET_NO,
-                          GNUNET_NO);
-  GNUNET_MST_destroy (broadcast_mst);
-}
-
-
-static unsigned int
-prepare_beacon (struct Plugin *plugin,
-                struct UDP_Beacon_Message *msg)
-{
-  uint16_t hello_size;
-  uint16_t msg_size;
-
-  const struct GNUNET_MessageHeader *hello;
-
-  hello = plugin->env->get_our_hello ();
-  if (NULL == hello)
-    return 0;
-  hello_size = GNUNET_HELLO_size ((struct GNUNET_HELLO_Message *) hello);
-  msg_size = hello_size + sizeof(struct UDP_Beacon_Message);
-
-  if ((hello_size < (sizeof(struct GNUNET_MessageHeader))) ||
-      (msg_size > (UDP_MTU)))
-    return 0;
-
-  msg->sender = *(plugin->env->my_identity);
-  msg->header.size = htons (msg_size);
-  msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON);
-  GNUNET_memcpy (&msg[1], hello, hello_size);
-  return msg_size;
-}
-
-
-static void
-udp_ipv4_broadcast_send (void *cls)
-{
-  struct BroadcastAddress *baddr = cls;
-  struct Plugin *plugin = baddr->plugin;
-  int sent;
-  uint16_t msg_size;
-  char buf[65536] GNUNET_ALIGN;
-
-  baddr->broadcast_task = NULL;
-
-  msg_size = prepare_beacon (plugin, (struct UDP_Beacon_Message *) &buf);
-  if (0 != msg_size)
-  {
-    struct sockaddr_in *addr = (struct sockaddr_in *) baddr->addr;
-
-    addr->sin_port = htons (plugin->port);
-    sent = GNUNET_NETWORK_socket_sendto (plugin->sockv4, &buf, msg_size,
-                                         (const struct sockaddr *) addr,
-                                         baddr->addrlen);
-    if (sent == GNUNET_SYSERR)
-    {
-      if ((ENETUNREACH == errno) || (ENETDOWN == errno))
-      {
-        /* "Network unreachable" or "Network down"
-         *
-         * This indicates that we just do not have network connectivity
-         */
-        GNUNET_log (GNUNET_ERROR_TYPE_BULK | GNUNET_ERROR_TYPE_WARNING,
-                    "Network connectivity is down, cannot send beacon!\n");
-      }
-      else
-        GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sendto");
-    }
-    else
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Sent HELLO beacon broadcast with %i bytes to address %s\n", sent,
-           GNUNET_a2s (baddr->addr, baddr->addrlen));
-    }
-  }
-
-#ifdef __linux__
-  /*
-   * Cryogenic
-   */
-  if (NULL != baddr->cryogenic_fd)
-  {
-    baddr->cryogenic_times.delay_msecs =
-      (plugin->broadcast_interval.rel_value_us / 1000.0) * 0.5;
-    baddr->cryogenic_times.timeout_msecs =
-      (plugin->broadcast_interval.rel_value_us / 1000.0) * 1.5;
-
-    if (ioctl (baddr->cryogenic_fd->fd,
-               PM_SET_DELAY_AND_TIMEOUT,
-               &baddr->cryogenic_times) < 0)
-    {
-      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "ioctl");
-      baddr->broadcast_task =
-        GNUNET_SCHEDULER_add_delayed (plugin->broadcast_interval,
-                                      &udp_ipv4_broadcast_send, baddr);
-    }
-    else
-      GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL,
-                                       baddr->cryogenic_fd,
-                                       &udp_ipv4_broadcast_send,
-                                       baddr);
-  }
-  else
-#endif
-  baddr->broadcast_task =
-    GNUNET_SCHEDULER_add_delayed (plugin->broadcast_interval,
-                                  &udp_ipv4_broadcast_send, baddr);
-}
-
-
-static void
-udp_ipv6_broadcast_send (void *cls)
-{
-  struct BroadcastAddress *baddr = cls;
-  struct Plugin *plugin = baddr->plugin;
-  ssize_t sent;
-  uint16_t msg_size;
-  char buf[65536] GNUNET_ALIGN;
-  const struct sockaddr_in6 *s6 = (const struct sockaddr_in6 *) baddr->addr;
-
-  baddr->broadcast_task = NULL;
-
-  msg_size = prepare_beacon (plugin, (struct UDP_Beacon_Message *) &buf);
-  /* Note: unclear if this actually works to limit the multicast to
-     the specified interface as we're not (necessarily) using a
-     link-local multicast group and the kernel suggests that the
-     scope ID is only respected for link-local addresses; however,
-     if the scope ID is ignored, the kernel should just multicast
-     on ALL interfaces, which is merely slightly less efficient;
-     in that case, we might want to revert to only doing this
-     once, and not per interface (hard to test...) 
*/plugin->ipv6_multicast_address.sin6_scope_id = s6->sin6_scope_id;
-  sent = GNUNET_NETWORK_socket_sendto (plugin->sockv6, &buf, msg_size,
-                                       (const struct sockaddr *)
-                                       &plugin->ipv6_multicast_address,
-                                       sizeof(struct sockaddr_in6));
-  plugin->ipv6_multicast_address.sin6_scope_id = 0;
-  if (sent == GNUNET_SYSERR)
-  {
-    if ((ENETUNREACH == errno) || (ENETDOWN == errno))
-    {
-      /* "Network unreachable" or "Network down"
-       *
-       * This indicates that this system is IPv6 enabled, but does not
-       * have a valid global IPv6 address assigned
-       */GNUNET_log (GNUNET_ERROR_TYPE_BULK | GNUNET_ERROR_TYPE_WARNING,
-                  "Network connectivity is down, cannot send beacon!\n");
-    }
-    else
-      GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sendto");
-  }
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Sending IPv6 HELLO beacon broadcast with %d bytes to address %s\n",
-         (int) sent,
-         GNUNET_a2s ((const struct sockaddr *) &plugin->ipv6_multicast_address,
-                     sizeof(struct sockaddr_in6)));
-  }
-#ifdef __linux__
-  /*
-   * Cryogenic
-   */
-  if (NULL != baddr->cryogenic_fd)
-  {
-    baddr->cryogenic_times.delay_msecs =
-      (plugin->broadcast_interval.rel_value_us / 1000.0) * 0.5;
-    baddr->cryogenic_times.timeout_msecs =
-      (plugin->broadcast_interval.rel_value_us / 1000.0) * 1.5;
-
-    if (ioctl (baddr->cryogenic_fd->fd,
-               PM_SET_DELAY_AND_TIMEOUT,
-               &baddr->cryogenic_times) < 0)
-    {
-      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "ioctl");
-      baddr->broadcast_task =
-        GNUNET_SCHEDULER_add_delayed (plugin->broadcast_interval,
-                                      &udp_ipv6_broadcast_send, baddr);
-    }
-    else
-      GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL,
-                                       baddr->cryogenic_fd,
-                                       &udp_ipv6_broadcast_send,
-                                       baddr);
-  }
-  else
-#endif
-  baddr->broadcast_task =
-    GNUNET_SCHEDULER_add_delayed (plugin->broadcast_interval,
-                                  &udp_ipv6_broadcast_send, baddr);
-}
-
-
-/**
- * Callback function invoked for each interface found.
- *
- * @param cls closure with the `struct Plugin`
- * @param name name of the interface (can be NULL for unknown)
- * @param isDefault is this presumably the default interface
- * @param addr address of this interface (can be NULL for unknown or 
unassigned)
- * @param broadcast_addr the broadcast address (can be NULL for unknown or 
unassigned)
- * @param netmask the network mask (can be NULL for unknown or unassigned)
- * @param addrlen length of the address
- * @return #GNUNET_OK to continue iteration, #GNUNET_SYSERR to abort
- */
-static int
-iface_proc (void *cls,
-            const char *name,
-            int isDefault,
-            const struct sockaddr *addr,
-            const struct sockaddr *broadcast_addr,
-            const struct sockaddr *netmask, socklen_t addrlen)
-{
-  struct Plugin *plugin = cls;
-  struct BroadcastAddress *ba;
-  enum GNUNET_NetworkType network;
-
-  if (NULL == addr)
-    return GNUNET_OK;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "address %s for interface %s %p\n ",
-              GNUNET_a2s (addr, addrlen), name, addr);
-  if (NULL == broadcast_addr)
-    return GNUNET_OK;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "broadcast address %s for interface %s %p\n ",
-              GNUNET_a2s (broadcast_addr, addrlen), name, broadcast_addr);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "netmask %s for interface %s %p\n ",
-              GNUNET_a2s (netmask, addrlen), name, netmask);
-
-  network = plugin->env->get_address_type (plugin->env->cls, broadcast_addr,
-                                           addrlen);
-  if (GNUNET_NT_LOOPBACK == network)
-  {
-    /* Broadcasting on loopback does not make sense */
-    return GNUNET_YES;
-  }
-
-  ba = GNUNET_new (struct BroadcastAddress);
-  ba->plugin = plugin;
-  ba->addr = GNUNET_malloc (addrlen);
-  GNUNET_memcpy (ba->addr, broadcast_addr, addrlen);
-  ba->addrlen = addrlen;
-
-  if ((GNUNET_YES == plugin->enable_ipv4) &&
-      (NULL != plugin->sockv4) &&
-      (addrlen == sizeof(struct sockaddr_in)))
-  {
-#ifdef __linux__
-    /*
-     * setup Cryogenic FD for ipv4 broadcasting
-     */
-    char *filename;
-
-    GNUNET_asprintf (&filename,
-                     "/dev/cryogenic/%s",
-                     name);
-    if (0 == access (name, R_OK))
-    {
-      ba->cryogenic_fd =
-        GNUNET_DISK_file_open (filename,
-                               GNUNET_DISK_OPEN_WRITE,
-                               GNUNET_DISK_PERM_NONE);
-    }
-    GNUNET_free (filename);
-#endif
-    ba->broadcast_task =
-      GNUNET_SCHEDULER_add_now (&udp_ipv4_broadcast_send, ba);
-  }
-  if ((GNUNET_YES == plugin->enable_ipv6) &&
-      (NULL != plugin->sockv6) &&
-      (addrlen == sizeof(struct sockaddr_in6)))
-  {
-    /* Create IPv6 multicast request */
-    struct ipv6_mreq multicastRequest;
-    const struct sockaddr_in6 *s6 = (const struct
-                                     sockaddr_in6 *) broadcast_addr;
-
-    multicastRequest.ipv6mr_multiaddr =
-      plugin->ipv6_multicast_address.sin6_addr;
-    /* http://tools.ietf.org/html/rfc2553#section-5.2:
-     *
-     * IPV6_JOIN_GROUP
-     *
-     * Join a multicast group on a specified local interface.  If the
-     * interface index is specified as 0, the kernel chooses the local
-     * interface.  For example, some kernels look up the multicast
-     * group in the normal IPv6 routing table and using the resulting
-     * interface; we do this for each interface, so no need to use
-     * zero (anymore...).
-     */multicastRequest.ipv6mr_interface = s6->sin6_scope_id;
-
-    /* Join the multicast group */
-    if (GNUNET_OK !=
-        GNUNET_NETWORK_socket_setsockopt
-          (plugin->sockv6, IPPROTO_IPV6, IPV6_JOIN_GROUP,
-          &multicastRequest, sizeof(multicastRequest)))
-    {
-      LOG (GNUNET_ERROR_TYPE_WARNING,
-           "Failed to join IPv6 multicast group: IPv6 broadcasting not 
running\n");
-    }
-    else
-    {
-#ifdef __linux__
-      /*
-       * setup Cryogenic FD for ipv6 broadcasting
-       */
-      char *filename;
-
-      GNUNET_asprintf (&filename,
-                       "/dev/cryogenic/%s",
-                       name);
-      if (0 == access (name, R_OK))
-      {
-        ba->cryogenic_fd =
-          GNUNET_DISK_file_open (filename,
-                                 GNUNET_DISK_OPEN_WRITE,
-                                 GNUNET_DISK_PERM_NONE);
-      }
-      GNUNET_free (filename);
-#endif
-      ba->broadcast_task =
-        GNUNET_SCHEDULER_add_now (&udp_ipv6_broadcast_send, ba);
-    }
-  }
-  GNUNET_CONTAINER_DLL_insert (plugin->broadcast_head,
-                               plugin->broadcast_tail, ba);
-  return GNUNET_OK;
-}
-
-
-/**
- * Setup broadcasting subsystem.
- *
- * @param plugin
- * @param server_addrv6
- * @param server_addrv4
- */
-void
-setup_broadcast (struct Plugin *plugin,
-                 struct sockaddr_in6 *server_addrv6,
-                 struct sockaddr_in *server_addrv4)
-{
-  if (GNUNET_YES ==
-      GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg,
-                                            "topology",
-                                            "FRIENDS-ONLY"))
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         _ (
-           "Disabling HELLO broadcasting due to friend-to-friend only 
configuration!\n"));
-    return;
-  }
-
-  if (GNUNET_YES != plugin->enable_broadcasting)
-    return; /* We do not send, just receive */
-
-  /* create IPv4 broadcast socket */
-  if ((GNUNET_YES == plugin->enable_ipv4) && (NULL != plugin->sockv4))
-  {
-    static int yes = 1;
-
-    if (GNUNET_NETWORK_socket_setsockopt
-          (plugin->sockv4, SOL_SOCKET, SO_BROADCAST, &yes,
-          sizeof(int)) != GNUNET_OK)
-    {
-      LOG (GNUNET_ERROR_TYPE_WARNING,
-           _ (
-             "Failed to set IPv4 broadcast option for broadcast socket on port 
%d\n"),
-           ntohs (server_addrv4->sin_port));
-    }
-  }
-  /* create IPv6 multicast socket */
-  if ((GNUNET_YES == plugin->enable_ipv6) && (plugin->sockv6 != NULL))
-  {
-    memset (&plugin->ipv6_multicast_address, 0, sizeof(struct sockaddr_in6));
-    GNUNET_assert (1 ==
-                   inet_pton (AF_INET6, "FF05::13B",
-                              &plugin->ipv6_multicast_address.sin6_addr));
-    plugin->ipv6_multicast_address.sin6_family = AF_INET6;
-    plugin->ipv6_multicast_address.sin6_port = htons (plugin->port);
-  }
-  GNUNET_OS_network_interfaces_list (&iface_proc, plugin);
-}
-
-
-/**
- * Stop broadcasting subsystem.
- *
- * @param plugin
- */
-void
-stop_broadcast (struct Plugin *plugin)
-{
-  if (GNUNET_YES == plugin->enable_broadcasting)
-  {
-    /* Disable broadcasting */
-    while (plugin->broadcast_head != NULL)
-    {
-      struct BroadcastAddress *p = plugin->broadcast_head;
-
-      if (p->broadcast_task != NULL)
-      {
-        GNUNET_SCHEDULER_cancel (p->broadcast_task);
-        p->broadcast_task = NULL;
-      }
-      if ((GNUNET_YES == plugin->enable_ipv6) &&
-          (NULL != plugin->sockv6) &&
-          (p->addrlen == sizeof(struct sockaddr_in6)))
-      {
-        /* Create IPv6 multicast request */
-        struct ipv6_mreq multicastRequest;
-        const struct sockaddr_in6 *s6 = (const struct sockaddr_in6 *) p->addr;
-
-        multicastRequest.ipv6mr_multiaddr =
-          plugin->ipv6_multicast_address.sin6_addr;
-        multicastRequest.ipv6mr_interface = s6->sin6_scope_id;
-
-        /* Leave the multicast group */
-        if (GNUNET_OK ==
-            GNUNET_NETWORK_socket_setsockopt
-              (plugin->sockv6, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
-              &multicastRequest, sizeof(multicastRequest)))
-        {
-          GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "setsockopt");
-        }
-        else
-        {
-          LOG (GNUNET_ERROR_TYPE_DEBUG, "IPv6 multicasting stopped\n");
-        }
-      }
-
-#ifdef __linux__
-      GNUNET_DISK_file_close (p->cryogenic_fd);
-#endif
-      GNUNET_CONTAINER_DLL_remove (plugin->broadcast_head,
-                                   plugin->broadcast_tail, p);
-      GNUNET_free (p->addr);
-      GNUNET_free (p);
-    }
-  }
-}
-
-
-/* end of plugin_transport_udp_broadcasting.c */
diff --git a/src/transport/plugin_transport_unix.c 
b/src/transport/plugin_transport_unix.c
deleted file mode 100644
index 269949a99..000000000
--- a/src/transport/plugin_transport_unix.c
+++ /dev/null
@@ -1,1890 +0,0 @@
-/*
-     This file is part of GNUnet
-     Copyright (C) 2010-2014 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_unix.c
- * @brief Transport plugin using unix domain sockets (!)
- *        Clearly, can only be used locally on Unix/Linux hosts...
- *        ONLY INTENDED FOR TESTING!!!
- * @author Christian Grothoff
- * @author Nathan Evans
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_transport_plugin.h"
-#include "transport.h"
-
-
-/**
- * Return code we give on 'send' if we failed to send right now
- * but it makes sense to retry later. (Note: we might want to
- * move this to the plugin API!?).
- */
-#define RETRY 0
-
-/**
- * Name of the plugin.
- */
-#define PLUGIN_NAME "unix"
-
-/**
- * Options for UNIX Domain addresses.
- */
-enum UNIX_ADDRESS_OPTIONS
-{
-  /**
-   * No special options.
-   */
-  UNIX_OPTIONS_NONE = 0,
-
-  /**
-   * Linux abstract domain sockets should be used.
-   */
-  UNIX_OPTIONS_USE_ABSTRACT_SOCKETS = 1
-};
-
-
-/**
- * How long until we give up on transmitting the welcome message?
- */
-#define HOSTNAME_RESOLVE_TIMEOUT \
-  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-unix", __VA_ARGS__)
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * Binary format for an UNIX Domain Socket address in GNUnet.
- */
-struct UnixAddress
-{
-  /**
-   * Options to use for the address, in NBO
-   */
-  uint32_t options GNUNET_PACKED;
-
-  /**
-   * Length of the address (path length), in NBO
-   */
-  uint32_t addrlen GNUNET_PACKED;
-
-  /* followed by actual path */
-};
-
-
-/**
- * UNIX Message-Packet header.
- */
-struct UNIXMessage
-{
-  /**
-   * Message header.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * What is the identity of the sender (GNUNET_hash of public key)
-   */
-  struct GNUNET_PeerIdentity sender;
-};
-
-GNUNET_NETWORK_STRUCT_END
-
-
-/**
- * Information we track for a message awaiting transmission.
- */
-struct UNIXMessageWrapper
-{
-  /**
-   * We keep messages in a doubly linked list.
-   */
-  struct UNIXMessageWrapper *next;
-
-  /**
-   * We keep messages in a doubly linked list.
-   */
-  struct UNIXMessageWrapper *prev;
-
-  /**
-   * The actual payload (allocated separately right now).
-   */
-  struct UNIXMessage *msg;
-
-  /**
-   * Session this message belongs to.
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * Function to call upon transmission.
-   */
-  GNUNET_TRANSPORT_TransmitContinuation cont;
-
-  /**
-   * Closure for @e cont.
-   */
-  void *cont_cls;
-
-  /**
-   * Timeout for this message.
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * Number of bytes in @e msg.
-   */
-  size_t msgsize;
-
-  /**
-   * Number of bytes of payload encapsulated in @e msg.
-   */
-  size_t payload;
-
-  /**
-   * Priority of the message (ignored, just dragged along in UNIX).
-   */
-  unsigned int priority;
-};
-
-
-/**
- * Handle for a session.
- */
-struct GNUNET_ATS_Session
-{
-  /**
-   * Sessions with pending messages (!) are kept in a DLL.
-   */
-  struct GNUNET_ATS_Session *next;
-
-  /**
-   * Sessions with pending messages (!) are kept in a DLL.
-   */
-  struct GNUNET_ATS_Session *prev;
-
-  /**
-   * To whom are we talking to (set to our identity
-   * if we are still waiting for the welcome message).
-   *
-   * FIXME: information duplicated with 'peer' in address!
-   */
-  struct GNUNET_PeerIdentity target;
-
-  /**
-   * Pointer to the global plugin struct.
-   */
-  struct Plugin *plugin;
-
-  /**
-   * Address of the other peer.
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * Number of bytes we currently have in our write queue.
-   */
-  unsigned long long bytes_in_queue;
-
-  /**
-   * Timeout for this session.
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * Session timeout task.
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * Number of messages we currently have in our write queue.
-   */
-  unsigned int msgs_in_queue;
-};
-
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct Plugin;
-
-
-/**
- * Information we keep for each of our listen sockets.
- */
-struct UNIX_Sock_Info
-{
-  /**
-   * The network handle
-   */
-  struct GNUNET_NETWORK_Handle *desc;
-};
-
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct Plugin
-{
-  /**
-   * ID of task used to update our addresses when one expires.
-   */
-  struct GNUNET_SCHEDULER_Task *address_update_task;
-
-  /**
-   * ID of read task
-   */
-  struct GNUNET_SCHEDULER_Task *read_task;
-
-  /**
-   * ID of write task
-   */
-  struct GNUNET_SCHEDULER_Task *write_task;
-
-  /**
-   * Number of bytes we currently have in our write queues.
-   */
-  unsigned long long bytes_in_queue;
-
-  /**
-   * Our environment.
-   */
-  struct GNUNET_TRANSPORT_PluginEnvironment *env;
-
-  /**
-   * Sessions (map from peer identity to `struct GNUNET_ATS_Session`)
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *session_map;
-
-  /**
-   * Head of queue of messages to transmit.
-   */
-  struct UNIXMessageWrapper *msg_head;
-
-  /**
-   * Tail of queue of messages to transmit.
-   */
-  struct UNIXMessageWrapper *msg_tail;
-
-  /**
-   * Path of our unix domain socket (/tmp/unix-plugin)
-   */
-  char *unix_socket_path;
-
-  /**
-   * Function to call about session status changes.
-   */
-  GNUNET_TRANSPORT_SessionInfoCallback sic;
-
-  /**
-   * Closure for @e sic.
-   */
-  void *sic_cls;
-
-  /**
-   * socket that we transmit all data with
-   */
-  struct UNIX_Sock_Info unix_sock;
-
-  /**
-   * Address options in HBO
-   */
-  uint32_t myoptions;
-
-  /**
-   * Are we using an abstract UNIX domain socket?
-   */
-  int is_abstract;
-};
-
-
-/**
- * If a session monitor is attached, notify it about the new
- * session state.
- *
- * @param plugin our plugin
- * @param session session that changed state
- * @param state new state of the session
- */
-static void
-notify_session_monitor (struct Plugin *plugin,
-                        struct GNUNET_ATS_Session *session,
-                        enum GNUNET_TRANSPORT_SessionState state)
-{
-  struct GNUNET_TRANSPORT_SessionInfo info;
-
-  if (NULL == plugin->sic)
-    return;
-  memset (&info, 0, sizeof(info));
-  info.state = state;
-  info.is_inbound = GNUNET_SYSERR; /* hard to say */
-  info.num_msg_pending = session->msgs_in_queue;
-  info.num_bytes_pending = session->bytes_in_queue;
-  /* info.receive_delay remains zero as this is not supported by UNIX
-     (cannot selectively not receive from 'some' peer while continuing
-     to receive from others) */
-  info.session_timeout = session->timeout;
-  info.address = session->address;
-  plugin->sic (plugin->sic_cls, session, &info);
-}
-
-
-/**
- * Function called for a quick conversion of the binary address to
- * a numeric address.  Note that the caller must not free the
- * address and that the next call to this function is allowed
- * to override the address again.
- *
- * @param cls closure
- * @param addr binary address
- * @param addrlen length of the @a addr
- * @return string representing the same address
- */
-static const char *
-unix_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
-{
-  static char rbuf[1024];
-  struct UnixAddress *ua = (struct UnixAddress *) addr;
-  char *addrstr;
-  size_t addr_str_len;
-  unsigned int off;
-
-  if ((NULL == addr) || (sizeof(struct UnixAddress) > addrlen))
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  addrstr = (char *) &ua[1];
-  addr_str_len = ntohl (ua->addrlen);
-
-  if (addr_str_len != addrlen - sizeof(struct UnixAddress))
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  if ('\0' != addrstr[addr_str_len - 1])
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  if (strlen (addrstr) + 1 != addr_str_len)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-
-  off = 0;
-  if ('\0' == addrstr[0])
-    off++;
-  memset (rbuf, 0, sizeof(rbuf));
-  GNUNET_snprintf (rbuf,
-                   sizeof(rbuf) - 1,
-                   "%s.%u.%s%.*s",
-                   PLUGIN_NAME,
-                   ntohl (ua->options),
-                   (off == 1) ? "@" : "",
-                   (int) (addr_str_len - off),
-                   &addrstr[off]);
-  return rbuf;
-}
-
-
-/**
- * Functions with this signature are called whenever we need
- * to close a session due to a disconnect or failure to
- * establish a connection.
- *
- * @param cls closure with the `struct Plugin *`
- * @param session session to close down
- * @return #GNUNET_OK on success
- */
-static int
-unix_plugin_session_disconnect (void *cls, struct GNUNET_ATS_Session *session)
-{
-  struct Plugin *plugin = cls;
-  struct UNIXMessageWrapper *msgw;
-  struct UNIXMessageWrapper *next;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Disconnecting session for peer `%s' `%s'\n",
-       GNUNET_i2s (&session->target),
-       unix_plugin_address_to_string (NULL,
-                                      session->address->address,
-                                      session->address->address_length));
-  plugin->env->session_end (plugin->env->cls, session->address, session);
-  next = plugin->msg_head;
-  while (NULL != next)
-  {
-    msgw = next;
-    next = msgw->next;
-    if (msgw->session != session)
-      continue;
-    GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw);
-    session->msgs_in_queue--;
-    GNUNET_assert (session->bytes_in_queue >= msgw->msgsize);
-    session->bytes_in_queue -= msgw->msgsize;
-    GNUNET_assert (plugin->bytes_in_queue >= msgw->msgsize);
-    plugin->bytes_in_queue -= msgw->msgsize;
-    if (NULL != msgw->cont)
-      msgw->cont (msgw->cont_cls,
-                  &msgw->session->target,
-                  GNUNET_SYSERR,
-                  msgw->payload,
-                  0);
-    GNUNET_free (msgw->msg);
-    GNUNET_free (msgw);
-  }
-  GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CONTAINER_multipeermap_remove (plugin->session_map,
-                                                       &session->target,
-                                                       session));
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         "# UNIX sessions active",
-                         GNUNET_CONTAINER_multipeermap_size (
-                           plugin->session_map),
-                         GNUNET_NO);
-  if (NULL != session->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (session->timeout_task);
-    session->timeout_task = NULL;
-    session->timeout = GNUNET_TIME_UNIT_ZERO_ABS;
-  }
-  notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_DONE);
-  GNUNET_HELLO_address_free (session->address);
-  GNUNET_break (0 == session->bytes_in_queue);
-  GNUNET_break (0 == session->msgs_in_queue);
-  GNUNET_free (session);
-  return GNUNET_OK;
-}
-
-
-/**
- * Session was idle for too long, so disconnect it
- *
- * @param cls the `struct GNUNET_ATS_Session *` to disconnect
- */
-static void
-session_timeout (void *cls)
-{
-  struct GNUNET_ATS_Session *session = cls;
-  struct GNUNET_TIME_Relative left;
-
-  session->timeout_task = NULL;
-  left = GNUNET_TIME_absolute_get_remaining (session->timeout);
-  if (0 != left.rel_value_us)
-  {
-    /* not actually our turn yet, but let's at least update
-       the monitor, it may think we're about to die ... */
-    notify_session_monitor (session->plugin,
-                            session,
-                            GNUNET_TRANSPORT_SS_UPDATE);
-    session->timeout_task =
-      GNUNET_SCHEDULER_add_delayed (left, &session_timeout, session);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Session %p was idle for %s, disconnecting\n",
-       session,
-       GNUNET_STRINGS_relative_time_to_string (
-         GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
-         GNUNET_YES));
-  unix_plugin_session_disconnect (session->plugin, session);
-}
-
-
-/**
- * Increment session timeout due to activity.  We do not immediately
- * notify the monitor here as that might generate excessive
- * signalling.
- *
- * @param session session for which the timeout should be rescheduled
- */
-static void
-reschedule_session_timeout (struct GNUNET_ATS_Session *session)
-{
-  GNUNET_assert (NULL != session->timeout_task);
-  session->timeout =
-    GNUNET_TIME_relative_to_absolute 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-}
-
-
-/**
- * Convert unix path to a `struct sockaddr_un *`
- *
- * @param unixpath path to convert
- * @param[out] sock_len set to the length of the address
- * @return converted unix path
- */
-static struct sockaddr_un *
-unix_address_to_sockaddr (const char *unixpath, socklen_t *sock_len)
-{
-  struct sockaddr_un *un;
-  size_t slen;
-
-  GNUNET_assert (0 < strlen (unixpath));   /* sanity check */
-  un = GNUNET_new (struct sockaddr_un);
-  un->sun_family = AF_UNIX;
-  slen = strlen (unixpath);
-  if (slen >= sizeof(un->sun_path))
-    slen = sizeof(un->sun_path) - 1;
-  GNUNET_memcpy (un->sun_path, unixpath, slen);
-  un->sun_path[slen] = '\0';
-  slen = sizeof(struct sockaddr_un);
-#if HAVE_SOCKADDR_UN_SUN_LEN
-  un->sun_len = (u_char) slen;
-#endif
-  (*sock_len) = slen;
-  return un;
-}
-
-
-/**
- * Closure to #lookup_session_it().
- */
-struct LookupCtx
-{
-  /**
-   * Location to store the session, if found.
-   */
-  struct GNUNET_ATS_Session *res;
-
-  /**
-   * Address we are looking for.
-   */
-  const struct GNUNET_HELLO_Address *address;
-};
-
-
-/**
- * Function called to find a session by address.
- *
- * @param cls the `struct LookupCtx *`
- * @param key peer we are looking for (unused)
- * @param value a session
- * @return #GNUNET_YES if not found (continue looking), #GNUNET_NO on success
- */
-static int
-lookup_session_it (void *cls,
-                   const struct GNUNET_PeerIdentity *key,
-                   void *value)
-{
-  struct LookupCtx *lctx = cls;
-  struct GNUNET_ATS_Session *session = value;
-
-  if (0 == GNUNET_HELLO_address_cmp (lctx->address, session->address))
-  {
-    lctx->res = session;
-    return GNUNET_NO;
-  }
-  return GNUNET_YES;
-}
-
-
-/**
- * Find an existing session by address.
- *
- * @param plugin the plugin
- * @param address the address to find
- * @return NULL if session was not found
- */
-static struct GNUNET_ATS_Session *
-lookup_session (struct Plugin *plugin,
-                const struct GNUNET_HELLO_Address *address)
-{
-  struct LookupCtx lctx;
-
-  lctx.address = address;
-  lctx.res = NULL;
-  GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map,
-                                              &address->peer,
-                                              &lookup_session_it,
-                                              &lctx);
-  return lctx.res;
-}
-
-
-/**
- * Function that is called to get the keepalive factor.
- * #GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
- * calculate the interval between keepalive packets.
- *
- * @param cls closure with the `struct Plugin`
- * @return keepalive factor
- */
-static unsigned int
-unix_plugin_query_keepalive_factor (void *cls)
-{
-  return 3;
-}
-
-
-/**
- * Actually send out the message, assume we've got the address and
- * send_handle squared away!
- *
- * @param cls closure
- * @param send_handle which handle to send message on
- * @param target who should receive this message (ignored by UNIX)
- * @param msgbuf one or more GNUNET_MessageHeader(s) strung together
- * @param msgbuf_size the size of the @a msgbuf to send
- * @param priority how important is the message (ignored by UNIX)
- * @param timeout when should we time out (give up) if we can not transmit?
- * @param addr the addr to send the message to, needs to be a sockaddr for us
- * @param addrlen the len of @a addr
- * @param payload bytes payload to send
- * @param cont continuation to call once the message has
- *        been transmitted (or if the transport is ready
- *        for the next transmission call; or if the
- *        peer disconnected...)
- * @param cont_cls closure for @a cont
- * @return on success the number of bytes written, RETRY for retry, -1 on 
errors
- */
-static ssize_t
-unix_real_send (void *cls,
-                struct GNUNET_NETWORK_Handle *send_handle,
-                const struct GNUNET_PeerIdentity *target,
-                const char *msgbuf,
-                size_t msgbuf_size,
-                unsigned int priority,
-                struct GNUNET_TIME_Absolute timeout,
-                const struct UnixAddress *addr,
-                size_t addrlen,
-                size_t payload,
-                GNUNET_TRANSPORT_TransmitContinuation cont,
-                void *cont_cls)
-{
-  struct Plugin *plugin = cls;
-  ssize_t sent;
-  struct sockaddr_un *un;
-  socklen_t un_len;
-  const char *unixpath;
-
-  if (NULL == send_handle)
-  {
-    GNUNET_break (0);  /* We do not have a send handle */
-    return GNUNET_SYSERR;
-  }
-  if ((NULL == addr) || (0 == addrlen))
-  {
-    GNUNET_break (0);  /* Can never send if we don't have an address */
-    return GNUNET_SYSERR;
-  }
-
-  /* Prepare address */
-  unixpath = (const char *) &addr[1];
-  if (NULL == (un = unix_address_to_sockaddr (unixpath, &un_len)))
-  {
-    GNUNET_break (0);
-    return -1;
-  }
-
-  if ((GNUNET_YES == plugin->is_abstract) &&
-      (0 != (UNIX_OPTIONS_USE_ABSTRACT_SOCKETS & ntohl (addr->options))))
-  {
-    un->sun_path[0] = '\0';
-  }
-resend:
-  /* Send the data */
-  sent = GNUNET_NETWORK_socket_sendto (send_handle,
-                                       msgbuf,
-                                       msgbuf_size,
-                                       (const struct sockaddr *) un,
-                                       un_len);
-  if (GNUNET_SYSERR == sent)
-  {
-    if ((EAGAIN == errno) || (ENOBUFS == errno))
-    {
-      GNUNET_free (un);
-      return RETRY;     /* We have to retry later  */
-    }
-    if (EMSGSIZE == errno)
-    {
-      socklen_t size = 0;
-      socklen_t len = sizeof(size);
-
-      GNUNET_NETWORK_socket_getsockopt ((struct GNUNET_NETWORK_Handle *)
-                                        send_handle,
-                                        SOL_SOCKET,
-                                        SO_SNDBUF,
-                                        &size,
-                                        &len);
-      if (size < msgbuf_size)
-      {
-        LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "Trying to increase socket buffer size from %u to %u for message 
size %u\n",
-             (unsigned int) size,
-             (unsigned int) ((msgbuf_size / 1000) + 2) * 1000,
-             (unsigned int) msgbuf_size);
-        size = ((msgbuf_size / 1000) + 2) * 1000;
-        if (GNUNET_OK ==
-            GNUNET_NETWORK_socket_setsockopt ((struct GNUNET_NETWORK_Handle *)
-                                              send_handle,
-                                              SOL_SOCKET,
-                                              SO_SNDBUF,
-                                              &size,
-                                              sizeof(size)))
-          goto resend;       /* Increased buffer size, retry sending */
-        else
-        {
-          /* Could not increase buffer size: error, no retry */
-          GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "setsockopt");
-          GNUNET_free (un);
-          return GNUNET_SYSERR;
-        }
-      }
-      else
-      {
-        /* Buffer is bigger than message:  error, no retry
-         * This should never happen!*/
-        GNUNET_break (0);
-        GNUNET_free (un);
-        return GNUNET_SYSERR;
-      }
-    }
-  }
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "UNIX transmitted %u-byte message to %s (%d: %s)\n",
-       (unsigned int) msgbuf_size,
-       GNUNET_a2s ((const struct sockaddr *) un, un_len),
-       (int) sent,
-       (sent < 0) ? strerror (errno) : "ok");
-  GNUNET_free (un);
-  return sent;
-}
-
-
-/**
- * Function obtain the network type for a session
- *
- * @param cls closure ('struct Plugin*')
- * @param session the session
- * @return the network type in HBO or #GNUNET_SYSERR
- */
-static enum GNUNET_NetworkType
-unix_plugin_get_network (void *cls, struct GNUNET_ATS_Session *session)
-{
-  GNUNET_assert (NULL != session);
-  return GNUNET_NT_LOOPBACK;
-}
-
-
-/**
- * Function obtain the network type for a session
- *
- * @param cls closure (`struct Plugin *`)
- * @param address the address
- * @return the network type
- */
-static enum GNUNET_NetworkType
-unix_plugin_get_network_for_address (void *cls,
-                                     const struct GNUNET_HELLO_Address 
*address)
-{
-  return GNUNET_NT_LOOPBACK;
-}
-
-
-/**
- * Creates a new outbound session the transport service will use to send data 
to the
- * peer
- *
- * @param cls the plugin
- * @param address the address
- * @return the session or NULL of max connections exceeded
- */
-static struct GNUNET_ATS_Session *
-unix_plugin_get_session (void *cls, const struct GNUNET_HELLO_Address *address)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session;
-  struct UnixAddress *ua;
-  char *addrstr;
-  uint32_t addr_str_len;
-  uint32_t addr_option;
-
-  ua = (struct UnixAddress *) address->address;
-  if ((NULL == address->address) || (0 == address->address_length) ||
-      (sizeof(struct UnixAddress) > address->address_length))
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  addrstr = (char *) &ua[1];
-  addr_str_len = ntohl (ua->addrlen);
-  addr_option = ntohl (ua->options);
-
-  if ((0 != (UNIX_OPTIONS_USE_ABSTRACT_SOCKETS & addr_option)) &&
-      (GNUNET_NO == plugin->is_abstract))
-  {
-    return NULL;
-  }
-
-  if (addr_str_len != address->address_length - sizeof(struct UnixAddress))
-  {
-    return NULL;   /* This can be a legacy address */
-  }
-
-  if ('\0' != addrstr[addr_str_len - 1])
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  if (strlen (addrstr) + 1 != addr_str_len)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-
-  /* Check if a session for this address already exists */
-  if (NULL != (session = lookup_session (plugin, address)))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Found existing session %p for address `%s'\n",
-         session,
-         unix_plugin_address_to_string (NULL,
-                                        address->address,
-                                        address->address_length));
-    return session;
-  }
-
-  /* create a new session */
-  session = GNUNET_new (struct GNUNET_ATS_Session);
-  session->target = address->peer;
-  session->address = GNUNET_HELLO_address_copy (address);
-  session->plugin = plugin;
-  session->timeout =
-    GNUNET_TIME_relative_to_absolute 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-  session->timeout_task =
-    GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
-                                  &session_timeout,
-                                  session);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Creating a new session %p for address `%s'\n",
-       session,
-       unix_plugin_address_to_string (NULL,
-                                      address->address,
-                                      address->address_length));
-  (void) GNUNET_CONTAINER_multipeermap_put (
-    plugin->session_map,
-    &address->peer,
-    session,
-    GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         "# UNIX sessions active",
-                         GNUNET_CONTAINER_multipeermap_size (
-                           plugin->session_map),
-                         GNUNET_NO);
-  notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_INIT);
-  notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_UP);
-  return session;
-}
-
-
-/**
- * Function that will be called whenever the transport service wants
- * to notify the plugin that a session is still active and in use and
- * therefore the session timeout for this session has to be updated
- *
- * @param cls closure with the `struct Plugin *`
- * @param peer which peer was the session for
- * @param session which session is being updated
- */
-static void
-unix_plugin_update_session_timeout (void *cls,
-                                    const struct GNUNET_PeerIdentity *peer,
-                                    struct GNUNET_ATS_Session *session)
-{
-  struct Plugin *plugin = cls;
-
-  if (GNUNET_OK !=
-      GNUNET_CONTAINER_multipeermap_contains_value (plugin->session_map,
-                                                    &session->target,
-                                                    session))
-  {
-    GNUNET_break (0);
-    return;
-  }
-  reschedule_session_timeout (session);
-}
-
-
-/**
- * Demultiplexer for UNIX messages
- *
- * @param plugin the main plugin for this transport
- * @param sender from which peer the message was received
- * @param currhdr pointer to the header of the message
- * @param ua address to look for
- * @param ua_len length of the address @a ua
- */
-static void
-unix_demultiplexer (struct Plugin *plugin,
-                    struct GNUNET_PeerIdentity *sender,
-                    const struct GNUNET_MessageHeader *currhdr,
-                    const struct UnixAddress *ua,
-                    size_t ua_len)
-{
-  struct GNUNET_ATS_Session *session;
-  struct GNUNET_HELLO_Address *address;
-
-  GNUNET_assert (ua_len >= sizeof(struct UnixAddress));
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Received message from %s\n",
-       unix_plugin_address_to_string (NULL, ua, ua_len));
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            "# bytes received via UNIX",
-                            ntohs (currhdr->size),
-                            GNUNET_NO);
-
-  /* Look for existing session */
-  address = GNUNET_HELLO_address_allocate (
-    sender,
-    PLUGIN_NAME,
-    ua,
-    ua_len,
-    GNUNET_HELLO_ADDRESS_INFO_NONE); /* UNIX does not have "inbound" sessions 
*/
-  session = lookup_session (plugin, address);
-  if (NULL == session)
-  {
-    session = unix_plugin_get_session (plugin, address);
-    /* Notify transport and ATS about new inbound session */
-    plugin->env->session_start (NULL,
-                                session->address,
-                                session,
-                                GNUNET_NT_LOOPBACK);
-  }
-  else
-  {
-    reschedule_session_timeout (session);
-  }
-  GNUNET_HELLO_address_free (address);
-  plugin->env->receive (plugin->env->cls, session->address, session, currhdr);
-}
-
-
-/**
- * Read from UNIX domain socket (it is ready).
- *
- * @param plugin the plugin
- */
-static void
-unix_plugin_do_read (struct Plugin *plugin)
-{
-  char buf[65536] GNUNET_ALIGN;
-  struct UnixAddress *ua;
-  struct UNIXMessage *msg;
-  struct GNUNET_PeerIdentity sender;
-  struct sockaddr_un un;
-  socklen_t addrlen;
-  ssize_t ret;
-  int offset;
-  int tsize;
-  int is_abstract;
-  char *msgbuf;
-  const struct GNUNET_MessageHeader *currhdr;
-  uint16_t csize;
-  size_t ua_len;
-
-  addrlen = sizeof(un);
-  memset (&un, 0, sizeof(un));
-  ret = GNUNET_NETWORK_socket_recvfrom (plugin->unix_sock.desc,
-                                        buf,
-                                        sizeof(buf),
-                                        (struct sockaddr *) &un,
-                                        &addrlen);
-  if ((GNUNET_SYSERR == ret) && ((errno == EAGAIN) || (errno == ENOBUFS)))
-    return;
-  if (GNUNET_SYSERR == ret)
-  {
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "recvfrom");
-    return;
-  }
-  else
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Read %d bytes from socket %s\n",
-         (int) ret,
-         un.sun_path);
-  }
-
-  GNUNET_assert (AF_UNIX == (un.sun_family));
-  is_abstract = GNUNET_NO;
-  if ('\0' == un.sun_path[0])
-  {
-    un.sun_path[0] = '@';
-    is_abstract = GNUNET_YES;
-  }
-
-  ua_len = sizeof(struct UnixAddress) + strlen (un.sun_path) + 1;
-  ua = GNUNET_malloc (ua_len);
-  ua->addrlen = htonl (strlen (&un.sun_path[0]) + 1);
-  GNUNET_memcpy (&ua[1], &un.sun_path[0], strlen (un.sun_path) + 1);
-  if (is_abstract)
-    ua->options = htonl (UNIX_OPTIONS_USE_ABSTRACT_SOCKETS);
-  else
-    ua->options = htonl (UNIX_OPTIONS_NONE);
-
-  msg = (struct UNIXMessage *) buf;
-  csize = ntohs (msg->header.size);
-  if ((csize < sizeof(struct UNIXMessage)) || (csize > ret))
-  {
-    GNUNET_break_op (0);
-    GNUNET_free (ua);
-    return;
-  }
-  msgbuf = (char *) &msg[1];
-  GNUNET_memcpy (&sender, &msg->sender, sizeof(struct GNUNET_PeerIdentity));
-  offset = 0;
-  tsize = csize - sizeof(struct UNIXMessage);
-  while (offset + sizeof(struct GNUNET_MessageHeader) <= tsize)
-  {
-    currhdr = (struct GNUNET_MessageHeader *) &msgbuf[offset];
-    csize = ntohs (currhdr->size);
-    if ((csize < sizeof(struct GNUNET_MessageHeader)) ||
-        (csize > tsize - offset))
-    {
-      GNUNET_break_op (0);
-      break;
-    }
-    unix_demultiplexer (plugin, &sender, currhdr, ua, ua_len);
-    offset += csize;
-  }
-  GNUNET_free (ua);
-}
-
-
-/**
- * Write to UNIX domain socket (it is ready).
- *
- * @param plugin handle to the plugin
- */
-static void
-unix_plugin_do_write (struct Plugin *plugin)
-{
-  ssize_t sent = 0;
-  struct UNIXMessageWrapper *msgw;
-  struct GNUNET_ATS_Session *session;
-  int did_delete;
-
-  session = NULL;
-  did_delete = GNUNET_NO;
-  while (NULL != (msgw = plugin->msg_head))
-  {
-    if (GNUNET_TIME_absolute_get_remaining (msgw->timeout).rel_value_us > 0)
-      break;   /* Message is ready for sending */
-    /* Message has a timeout */
-    did_delete = GNUNET_YES;
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Timeout for message with %u bytes \n",
-         (unsigned int) msgw->msgsize);
-    GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw);
-    session = msgw->session;
-    session->msgs_in_queue--;
-    GNUNET_assert (session->bytes_in_queue >= msgw->msgsize);
-    session->bytes_in_queue -= msgw->msgsize;
-    GNUNET_assert (plugin->bytes_in_queue >= msgw->msgsize);
-    plugin->bytes_in_queue -= msgw->msgsize;
-    GNUNET_STATISTICS_set (plugin->env->stats,
-                           "# bytes currently in UNIX buffers",
-                           plugin->bytes_in_queue,
-                           GNUNET_NO);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UNIX bytes discarded",
-                              msgw->msgsize,
-                              GNUNET_NO);
-    if (NULL != msgw->cont)
-      msgw->cont (msgw->cont_cls,
-                  &msgw->session->target,
-                  GNUNET_SYSERR,
-                  msgw->payload,
-                  0);
-    GNUNET_free (msgw->msg);
-    GNUNET_free (msgw);
-  }
-  if (NULL == msgw)
-  {
-    if (GNUNET_YES == did_delete)
-      notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_UPDATE);
-    return;   /* Nothing to send at the moment */
-  }
-  session = msgw->session;
-  sent = unix_real_send (plugin,
-                         plugin->unix_sock.desc,
-                         &session->target,
-                         (const char *) msgw->msg,
-                         msgw->msgsize,
-                         msgw->priority,
-                         msgw->timeout,
-                         msgw->session->address->address,
-                         msgw->session->address->address_length,
-                         msgw->payload,
-                         msgw->cont,
-                         msgw->cont_cls);
-  if (RETRY == sent)
-  {
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UNIX retry attempts",
-                              1,
-                              GNUNET_NO);
-    notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_UPDATE);
-    return;
-  }
-  GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw);
-  session->msgs_in_queue--;
-  GNUNET_assert (session->bytes_in_queue >= msgw->msgsize);
-  session->bytes_in_queue -= msgw->msgsize;
-  GNUNET_assert (plugin->bytes_in_queue >= msgw->msgsize);
-  plugin->bytes_in_queue -= msgw->msgsize;
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         "# bytes currently in UNIX buffers",
-                         plugin->bytes_in_queue,
-                         GNUNET_NO);
-  notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_UPDATE);
-  if (GNUNET_SYSERR == sent)
-  {
-    /* failed and no retry */
-    if (NULL != msgw->cont)
-      msgw->cont (msgw->cont_cls,
-                  &msgw->session->target,
-                  GNUNET_SYSERR,
-                  msgw->payload,
-                  0);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              "# UNIX bytes discarded",
-                              msgw->msgsize,
-                              GNUNET_NO);
-    GNUNET_free (msgw->msg);
-    GNUNET_free (msgw);
-    return;
-  }
-  /* successfully sent bytes */
-  GNUNET_break (sent > 0);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            "# bytes transmitted via UNIX",
-                            msgw->msgsize,
-                            GNUNET_NO);
-  if (NULL != msgw->cont)
-    msgw->cont (msgw->cont_cls,
-                &msgw->session->target,
-                GNUNET_OK,
-                msgw->payload,
-                msgw->msgsize);
-  GNUNET_free (msgw->msg);
-  GNUNET_free (msgw);
-}
-
-
-/**
- * We have been notified that our socket has something to read.
- * Then reschedule this function to be called again once more is available.
- *
- * @param cls the plugin handle
- */
-static void
-unix_plugin_select_read (void *cls)
-{
-  struct Plugin *plugin = cls;
-  const struct GNUNET_SCHEDULER_TaskContext *tc;
-
-  plugin->read_task = NULL;
-  tc = GNUNET_SCHEDULER_get_task_context ();
-  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
-    unix_plugin_do_read (plugin);
-  plugin->read_task =
-    GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
-                                   plugin->unix_sock.desc,
-                                   &unix_plugin_select_read,
-                                   plugin);
-}
-
-
-/**
- * We have been notified that our socket is ready to write.
- * Then reschedule this function to be called again once more is available.
- *
- * @param cls the plugin handle
- */
-static void
-unix_plugin_select_write (void *cls)
-{
-  struct Plugin *plugin = cls;
-  const struct GNUNET_SCHEDULER_TaskContext *tc;
-
-  plugin->write_task = NULL;
-  tc = GNUNET_SCHEDULER_get_task_context ();
-  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY))
-    unix_plugin_do_write (plugin);
-  if (NULL == plugin->msg_head)
-    return; /* write queue empty */
-  plugin->write_task =
-    GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
-                                    plugin->unix_sock.desc,
-                                    &unix_plugin_select_write,
-                                    plugin);
-}
-
-
-/**
- * Function that can be used by the transport service to transmit
- * a message using the plugin.   Note that in the case of a
- * peer disconnecting, the continuation MUST be called
- * prior to the disconnect notification itself.  This function
- * will be called with this peer's HELLO message to initiate
- * a fresh connection to another peer.
- *
- * @param cls closure
- * @param session which session must be used
- * @param msgbuf the message to transmit
- * @param msgbuf_size number of bytes in @a msgbuf
- * @param priority how important is the message (most plugins will
- *                 ignore message priority and just FIFO)
- * @param to how long to wait at most for the transmission (does not
- *                require plugins to discard the message after the timeout,
- *                just advisory for the desired delay; most plugins will ignore
- *                this as well)
- * @param cont continuation to call once the message has
- *        been transmitted (or if the transport is ready
- *        for the next transmission call; or if the
- *        peer disconnected...); can be NULL
- * @param cont_cls closure for @a cont
- * @return number of bytes used (on the physical network, with overheads);
- *         -1 on hard errors (i.e. address invalid); 0 is a legal value
- *         and does NOT mean that the message was not transmitted (DV)
- */
-static ssize_t
-unix_plugin_send (void *cls,
-                  struct GNUNET_ATS_Session *session,
-                  const char *msgbuf,
-                  size_t msgbuf_size,
-                  unsigned int priority,
-                  struct GNUNET_TIME_Relative to,
-                  GNUNET_TRANSPORT_TransmitContinuation cont,
-                  void *cont_cls)
-{
-  struct Plugin *plugin = cls;
-  struct UNIXMessageWrapper *wrapper;
-  struct UNIXMessage *message;
-  int ssize;
-
-  if (GNUNET_OK !=
-      GNUNET_CONTAINER_multipeermap_contains_value (plugin->session_map,
-                                                    &session->target,
-                                                    session))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Invalid session for peer `%s' `%s'\n",
-         GNUNET_i2s (&session->target),
-         unix_plugin_address_to_string (NULL,
-                                        session->address->address,
-                                        session->address->address_length));
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Sending %lu bytes with session for peer `%s' `%s'\n",
-       (unsigned long) msgbuf_size,
-       GNUNET_i2s (&session->target),
-       unix_plugin_address_to_string (NULL,
-                                      session->address->address,
-                                      session->address->address_length));
-  ssize = sizeof(struct UNIXMessage) + msgbuf_size;
-  message = GNUNET_malloc (sizeof(struct UNIXMessage) + msgbuf_size);
-  message->header.size = htons (ssize);
-  message->header.type = htons (0);
-  GNUNET_memcpy (&message->sender,
-                 plugin->env->my_identity,
-                 sizeof(struct GNUNET_PeerIdentity));
-  GNUNET_memcpy (&message[1], msgbuf, msgbuf_size);
-  wrapper = GNUNET_new (struct UNIXMessageWrapper);
-  wrapper->msg = message;
-  wrapper->msgsize = ssize;
-  wrapper->payload = msgbuf_size;
-  wrapper->priority = priority;
-  wrapper->timeout = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), 
to);
-  wrapper->cont = cont;
-  wrapper->cont_cls = cont_cls;
-  wrapper->session = session;
-  GNUNET_CONTAINER_DLL_insert_tail (plugin->msg_head,
-                                    plugin->msg_tail,
-                                    wrapper);
-  plugin->bytes_in_queue += ssize;
-  session->bytes_in_queue += ssize;
-  session->msgs_in_queue++;
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         "# bytes currently in UNIX buffers",
-                         plugin->bytes_in_queue,
-                         GNUNET_NO);
-  notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_UPDATE);
-  if (NULL == plugin->write_task)
-    plugin->write_task =
-      GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
-                                      plugin->unix_sock.desc,
-                                      &unix_plugin_select_write,
-                                      plugin);
-  return ssize;
-}
-
-
-/**
- * Create a slew of UNIX sockets.  If possible, use IPv6 and IPv4.
- *
- * @param cls closure for server start, should be a `struct Plugin *`
- * @return number of sockets created or #GNUNET_SYSERR on error
- */
-static int
-unix_transport_server_start (void *cls)
-{
-  struct Plugin *plugin = cls;
-  struct sockaddr_un *un;
-  socklen_t un_len;
-
-  un = unix_address_to_sockaddr (plugin->unix_socket_path, &un_len);
-  if (GNUNET_YES == plugin->is_abstract)
-  {
-    plugin->unix_socket_path[0] = '@';
-    un->sun_path[0] = '\0';
-  }
-  plugin->unix_sock.desc =
-    GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_DGRAM, 0);
-  if (NULL == plugin->unix_sock.desc)
-  {
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
-    GNUNET_free (un);
-    return GNUNET_SYSERR;
-  }
-  if ('\0' != un->sun_path[0])
-  {
-    if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (un->sun_path))
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Cannot create path to `%s'\n"),
-           un->sun_path);
-      GNUNET_NETWORK_socket_close (plugin->unix_sock.desc);
-      plugin->unix_sock.desc = NULL;
-      GNUNET_free (un);
-      return GNUNET_SYSERR;
-    }
-  }
-  if (GNUNET_OK != GNUNET_NETWORK_socket_bind (plugin->unix_sock.desc,
-                                               (const struct sockaddr *) un,
-                                               un_len))
-  {
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind");
-    LOG (GNUNET_ERROR_TYPE_ERROR, _ ("Cannot bind to `%s'\n"), un->sun_path);
-    GNUNET_NETWORK_socket_close (plugin->unix_sock.desc);
-    plugin->unix_sock.desc = NULL;
-    GNUNET_free (un);
-    return GNUNET_SYSERR;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Bound to `%s'\n", plugin->unix_socket_path);
-  plugin->read_task =
-    GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
-                                   plugin->unix_sock.desc,
-                                   &unix_plugin_select_read,
-                                   plugin);
-  GNUNET_free (un);
-  return 1;
-}
-
-
-/**
- * Function that will be called to check if a binary address for this
- * plugin is well-formed and corresponds to an address for THIS peer
- * (as per our configuration).  Naturally, if absolutely necessary,
- * plugins can be a bit conservative in their answer, but in general
- * plugins should make sure that the address does not redirect
- * traffic to a 3rd party that might try to man-in-the-middle our
- * traffic.
- *
- * @param cls closure, should be our handle to the Plugin
- * @param addr pointer to the address
- * @param addrlen length of @a addr
- * @return #GNUNET_OK if this is a plausible address for this peer
- *         and transport, #GNUNET_SYSERR if not
- *
- */
-static int
-unix_plugin_check_address (void *cls, const void *addr, size_t addrlen)
-{
-  struct Plugin *plugin = cls;
-  const struct UnixAddress *ua = addr;
-  char *addrstr;
-  size_t addr_str_len;
-
-  if ((NULL == addr) || (0 == addrlen) ||
-      (sizeof(struct UnixAddress) > addrlen))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  addrstr = (char *) &ua[1];
-  addr_str_len = ntohl (ua->addrlen);
-  if ('\0' != addrstr[addr_str_len - 1])
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if (strlen (addrstr) + 1 != addr_str_len)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-
-  if (0 == strcmp (plugin->unix_socket_path, addrstr))
-    return GNUNET_OK;
-  return GNUNET_SYSERR;
-}
-
-
-/**
- * Convert the transports address to a nice, human-readable
- * format.
- *
- * @param cls closure
- * @param type name of the transport that generated the address
- * @param addr one of the addresses of the host, NULL for the last address
- *        the specific address format depends on the transport
- * @param addrlen length of the @a addr
- * @param numeric should (IP) addresses be displayed in numeric form?
- * @param timeout after how long should we give up?
- * @param asc function to call on each string
- * @param asc_cls closure for @a asc
- */
-static void
-unix_plugin_address_pretty_printer (void *cls,
-                                    const char *type,
-                                    const void *addr,
-                                    size_t addrlen,
-                                    int numeric,
-                                    struct GNUNET_TIME_Relative timeout,
-                                    GNUNET_TRANSPORT_AddressStringCallback asc,
-                                    void *asc_cls)
-{
-  const char *ret;
-
-  if ((NULL != addr) && (addrlen > 0))
-    ret = unix_plugin_address_to_string (NULL, addr, addrlen);
-  else
-    ret = NULL;
-  asc (asc_cls, ret, (NULL == ret) ? GNUNET_SYSERR : GNUNET_OK);
-  asc (asc_cls, NULL, GNUNET_OK);
-}
-
-
-/**
- * Function called to convert a string address to
- * a binary address.
- *
- * @param cls closure (`struct Plugin *`)
- * @param addr string address
- * @param addrlen length of the @a addr (strlen(addr) + '\0')
- * @param buf location to store the buffer
- *        If the function returns #GNUNET_SYSERR, its contents are undefined.
- * @param added length of created address
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-static int
-unix_plugin_string_to_address (void *cls,
-                               const char *addr,
-                               uint16_t addrlen,
-                               void **buf,
-                               size_t *added)
-{
-  struct UnixAddress *ua;
-  char *address;
-  char *plugin;
-  char *optionstr;
-  uint32_t options;
-  size_t ua_size;
-
-  /* Format unix.options.address */
-  address = NULL;
-  plugin = NULL;
-  optionstr = NULL;
-
-  if ((NULL == addr) || (addrlen == 0))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if ('\0' != addr[addrlen - 1])
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if (strlen (addr) != addrlen - 1)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  plugin = GNUNET_strdup (addr);
-  optionstr = strchr (plugin, '.');
-  if (NULL == optionstr)
-  {
-    GNUNET_break (0);
-    GNUNET_free (plugin);
-    return GNUNET_SYSERR;
-  }
-  optionstr[0] = '\0';
-  optionstr++;
-  options = atol (optionstr);
-  address = strchr (optionstr, '.');
-  if (NULL == address)
-  {
-    GNUNET_break (0);
-    GNUNET_free (plugin);
-    return GNUNET_SYSERR;
-  }
-  address[0] = '\0';
-  address++;
-  if (0 != strcmp (plugin, PLUGIN_NAME))
-  {
-    GNUNET_break (0);
-    GNUNET_free (plugin);
-    return GNUNET_SYSERR;
-  }
-
-  ua_size = sizeof(struct UnixAddress) + strlen (address) + 1;
-  ua = GNUNET_malloc (ua_size);
-  ua->options = htonl (options);
-  ua->addrlen = htonl (strlen (address) + 1);
-  GNUNET_memcpy (&ua[1], address, strlen (address) + 1);
-  GNUNET_free (plugin);
-
-  (*buf) = ua;
-  (*added) = ua_size;
-  return GNUNET_OK;
-}
-
-
-/**
- * Notify transport service about address
- *
- * @param cls the plugin
- */
-static void
-address_notification (void *cls)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_HELLO_Address *address;
-  size_t len;
-  struct UnixAddress *ua;
-  char *unix_path;
-
-  len = sizeof(struct UnixAddress) + strlen (plugin->unix_socket_path) + 1;
-  ua = GNUNET_malloc (len);
-  ua->options = htonl (plugin->myoptions);
-  ua->addrlen = htonl (strlen (plugin->unix_socket_path) + 1);
-  unix_path = (char *) &ua[1];
-  GNUNET_memcpy (unix_path,
-                 plugin->unix_socket_path,
-                 strlen (plugin->unix_socket_path) + 1);
-
-  plugin->address_update_task = NULL;
-  address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                           PLUGIN_NAME,
-                                           ua,
-                                           len,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-  plugin->env->notify_address (plugin->env->cls, GNUNET_YES, address);
-  GNUNET_free (ua);
-  GNUNET_free (address);
-}
-
-
-/**
- * Function called on sessions to disconnect
- *
- * @param cls the plugin
- * @param key peer identity (unused)
- * @param value the `struct GNUNET_ATS_Session *` to disconnect
- * @return #GNUNET_YES (always, continue to iterate)
- */
-static int
-get_session_delete_it (void *cls,
-                       const struct GNUNET_PeerIdentity *key,
-                       void *value)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session = value;
-
-  unix_plugin_session_disconnect (plugin, session);
-  return GNUNET_YES;
-}
-
-
-/**
- * Disconnect from a remote node.  Clean up session if we have one for this 
peer
- *
- * @param cls closure for this call (should be handle to Plugin)
- * @param target the peeridentity of the peer to disconnect
- * @return #GNUNET_OK on success, #GNUNET_SYSERR if the operation failed
- */
-static void
-unix_plugin_peer_disconnect (void *cls,
-                             const struct GNUNET_PeerIdentity *target)
-{
-  struct Plugin *plugin = cls;
-
-  GNUNET_CONTAINER_multipeermap_get_multiple (plugin->session_map,
-                                              target,
-                                              &get_session_delete_it,
-                                              plugin);
-}
-
-
-/**
- * Return information about the given session to the
- * monitor callback.
- *
- * @param cls the `struct Plugin` with the monitor callback (`sic`)
- * @param peer peer we send information about
- * @param value our `struct GNUNET_ATS_Session` to send information about
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-send_session_info_iter (void *cls,
-                        const struct GNUNET_PeerIdentity *peer,
-                        void *value)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session = value;
-
-  notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_INIT);
-  notify_session_monitor (plugin, session, GNUNET_TRANSPORT_SS_UP);
-  return GNUNET_OK;
-}
-
-
-/**
- * Begin monitoring sessions of a plugin.  There can only
- * be one active monitor per plugin (i.e. if there are
- * multiple monitors, the transport service needs to
- * multiplex the generated events over all of them).
- *
- * @param cls closure of the plugin
- * @param sic callback to invoke, NULL to disable monitor;
- *            plugin will being by iterating over all active
- *            sessions immediately and then enter monitor mode
- * @param sic_cls closure for @a sic
- */
-static void
-unix_plugin_setup_monitor (void *cls,
-                           GNUNET_TRANSPORT_SessionInfoCallback sic,
-                           void *sic_cls)
-{
-  struct Plugin *plugin = cls;
-
-  plugin->sic = sic;
-  plugin->sic_cls = sic_cls;
-  if (NULL != sic)
-  {
-    GNUNET_CONTAINER_multipeermap_iterate (plugin->session_map,
-                                           &send_session_info_iter,
-                                           plugin);
-    /* signal end of first iteration */
-    sic (sic_cls, NULL, NULL);
-  }
-}
-
-
-/**
- * The exported method.  Initializes the plugin and returns a
- * struct with the callbacks.
- *
- * @param cls the plugin's execution environment
- * @return NULL on error, plugin functions otherwise
- */
-void *
-libgnunet_plugin_transport_unix_init (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginEnvironment *env = cls;
-  struct GNUNET_TRANSPORT_PluginFunctions *api;
-  struct Plugin *plugin;
-  int sockets_created;
-
-  if (NULL == env->receive)
-  {
-    /* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully
-       initialize the plugin or the API */
-    api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-    api->cls = NULL;
-    api->address_pretty_printer = &unix_plugin_address_pretty_printer;
-    api->address_to_string = &unix_plugin_address_to_string;
-    api->string_to_address = &unix_plugin_string_to_address;
-    return api;
-  }
-
-  plugin = GNUNET_new (struct Plugin);
-  if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_filename (env->cfg,
-                                               "transport-unix",
-                                               "UNIXPATH",
-                                               &plugin->unix_socket_path))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               "transport-unix",
-                               "UNIXPATH");
-    GNUNET_free (plugin);
-    return NULL;
-  }
-
-  plugin->env = env;
-
-  /* Initialize my flags */
-#ifdef __linux__
-  plugin->is_abstract =
-    GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg,
-                                          "testing",
-                                          "USE_ABSTRACT_SOCKETS");
-#endif
-  plugin->myoptions = UNIX_OPTIONS_NONE;
-  if (GNUNET_YES == plugin->is_abstract)
-    plugin->myoptions = UNIX_OPTIONS_USE_ABSTRACT_SOCKETS;
-
-  api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-  api->cls = plugin;
-  api->get_session = &unix_plugin_get_session;
-  api->send = &unix_plugin_send;
-  api->disconnect_peer = &unix_plugin_peer_disconnect;
-  api->disconnect_session = &unix_plugin_session_disconnect;
-  api->query_keepalive_factor = &unix_plugin_query_keepalive_factor;
-  api->address_pretty_printer = &unix_plugin_address_pretty_printer;
-  api->address_to_string = &unix_plugin_address_to_string;
-  api->check_address = &unix_plugin_check_address;
-  api->string_to_address = &unix_plugin_string_to_address;
-  api->get_network = &unix_plugin_get_network;
-  api->get_network_for_address = &unix_plugin_get_network_for_address;
-  api->update_session_timeout = &unix_plugin_update_session_timeout;
-  api->setup_monitor = &unix_plugin_setup_monitor;
-  sockets_created = unix_transport_server_start (plugin);
-  if ((0 == sockets_created) || (GNUNET_SYSERR == sockets_created))
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING, _ ("Failed to open UNIX listen socket\n"));
-    GNUNET_free (api);
-    GNUNET_free (plugin->unix_socket_path);
-    GNUNET_free (plugin);
-    return NULL;
-  }
-  plugin->session_map = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
-  plugin->address_update_task =
-    GNUNET_SCHEDULER_add_now (&address_notification, plugin);
-  return api;
-}
-
-
-/**
- * Shutdown the plugin.
- *
- * @param cls the plugin API returned from the initialization function
- * @return NULL (always)
- */
-void *
-libgnunet_plugin_transport_unix_done (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
-  struct Plugin *plugin = api->cls;
-  struct GNUNET_HELLO_Address *address;
-  struct UNIXMessageWrapper *msgw;
-  struct UnixAddress *ua;
-  size_t len;
-  struct GNUNET_ATS_Session *session;
-
-  if (NULL == plugin)
-  {
-    GNUNET_free (api);
-    return NULL;
-  }
-  len = sizeof(struct UnixAddress) + strlen (plugin->unix_socket_path) + 1;
-  ua = GNUNET_malloc (len);
-  ua->options = htonl (plugin->myoptions);
-  ua->addrlen = htonl (strlen (plugin->unix_socket_path) + 1);
-  GNUNET_memcpy (&ua[1],
-                 plugin->unix_socket_path,
-                 strlen (plugin->unix_socket_path) + 1);
-  address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                           PLUGIN_NAME,
-                                           ua,
-                                           len,
-                                           GNUNET_HELLO_ADDRESS_INFO_NONE);
-  plugin->env->notify_address (plugin->env->cls, GNUNET_NO, address);
-
-  GNUNET_free (address);
-  GNUNET_free (ua);
-
-  while (NULL != (msgw = plugin->msg_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (plugin->msg_head, plugin->msg_tail, msgw);
-    session = msgw->session;
-    session->msgs_in_queue--;
-    GNUNET_assert (session->bytes_in_queue >= msgw->msgsize);
-    session->bytes_in_queue -= msgw->msgsize;
-    GNUNET_assert (plugin->bytes_in_queue >= msgw->msgsize);
-    plugin->bytes_in_queue -= msgw->msgsize;
-    if (NULL != msgw->cont)
-      msgw->cont (msgw->cont_cls,
-                  &msgw->session->target,
-                  GNUNET_SYSERR,
-                  msgw->payload,
-                  0);
-    GNUNET_free (msgw->msg);
-    GNUNET_free (msgw);
-  }
-
-  if (NULL != plugin->read_task)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->read_task);
-    plugin->read_task = NULL;
-  }
-  if (NULL != plugin->write_task)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->write_task);
-    plugin->write_task = NULL;
-  }
-  if (NULL != plugin->address_update_task)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->address_update_task);
-    plugin->address_update_task = NULL;
-  }
-  if (NULL != plugin->unix_sock.desc)
-  {
-    GNUNET_break (GNUNET_OK ==
-                  GNUNET_NETWORK_socket_close (plugin->unix_sock.desc));
-    plugin->unix_sock.desc = NULL;
-  }
-  GNUNET_CONTAINER_multipeermap_iterate (plugin->session_map,
-                                         &get_session_delete_it,
-                                         plugin);
-  GNUNET_CONTAINER_multipeermap_destroy (plugin->session_map);
-  GNUNET_break (0 == plugin->bytes_in_queue);
-  GNUNET_free (plugin->unix_socket_path);
-  GNUNET_free (plugin);
-  GNUNET_free (api);
-  return NULL;
-}
-
-
-/* end of plugin_transport_unix.c */
diff --git a/src/transport/plugin_transport_wlan.c 
b/src/transport/plugin_transport_wlan.c
deleted file mode 100644
index 3ac106859..000000000
--- a/src/transport/plugin_transport_wlan.c
+++ /dev/null
@@ -1,2405 +0,0 @@
-/*
-   This file is part of GNUnet
-   Copyright (C) 2010-2014 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_wlan.c
- * @brief transport plugin for wlan and/or bluetooth
- * @author David Brodski
- * @author Christian Grothoff
- *
- * BUILD_WLAN or BUILD_BLUETOOTH must be defined such that the respective
- * variant of this code is compiled.
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_transport_plugin.h"
-#include "plugin_transport_wlan.h"
-#include "gnunet_fragmentation_lib.h"
-#include "gnunet_constants.h"
-
-
-#if BUILD_WLAN
-/* begin case wlan */
-#define PLUGIN_NAME "wlan"
-#define CONFIG_NAME "transport-wlan"
-#define HELPER_NAME "gnunet-helper-transport-wlan"
-#define DUMMY_HELPER_NAME "gnunet-helper-transport-wlan-dummy"
-#define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_wlan_init
-#define LIBGNUNET_PLUGIN_TRANSPORT_DONE libgnunet_plugin_transport_wlan_done
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-wlan", __VA_ARGS__)
-
-
-/**
- * time out of a mac endpoint
- */
-#define MACENDPOINT_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 2)
-
-/**
- * We reduce the frequence of HELLO beacons in relation to
- * the number of MAC addresses currently visible to us.
- * This is the multiplication factor.
- */
-#define HELLO_BEACON_SCALING_FACTOR GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 2)
-
-
-/* end case wlan */
-#elif BUILD_BLUETOOTH
-/* begin case bluetooth */
-
-#define PLUGIN_NAME "bluetooth"
-#define CONFIG_NAME "transport-bluetooth"
-#define HELPER_NAME "gnunet-helper-transport-bluetooth"
-/* yes, this is correct, we use the same dummy driver as 'wlan' */
-#define DUMMY_HELPER_NAME "gnunet-helper-transport-wlan-dummy"
-#define LIBGNUNET_PLUGIN_TRANSPORT_INIT \
-  libgnunet_plugin_transport_bluetooth_init
-#define LIBGNUNET_PLUGIN_TRANSPORT_DONE \
-  libgnunet_plugin_transport_bluetooth_done
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-bluetooth", \
-                                        __VA_ARGS__)
-
-/**
- * time out of a mac endpoint
- */
-#define MACENDPOINT_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 60)
-
-
-/**
- * We reduce the frequence of HELLO beacons in relation to
- * the number of MAC addresses currently visible to us.
- * This is the multiplication factor.
- */
-#define HELLO_BEACON_SCALING_FACTOR GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 60)
-
-/* end case bluetooth */
-#else
-#error need to build wlan or bluetooth
-#endif
-
-
-/**
- * Functions with this signature are called whenever a
- * complete message is received by the tokenizer.
- *
- * Do not call #GNUNET_SERVER_mst_destroy from within
- * the scope of this callback.
- *
- * @param cls closure
- * @param client identification of the client
- * @param message the actual message
- * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
- */
-typedef int
-(*GNUNET_SERVER_MessageTokenizerCallback) (void *cls,
-                                           void *client,
-                                           const struct
-                                           GNUNET_MessageHeader *message);
-
-
-/* Include legacy message stream tokenizer that was removed from util (for 
now) */
-#include "tcp_server_mst_legacy.c"
-
-
-/**
- * Max size of packet (that we give to the WLAN driver for transmission)
- */
-#define WLAN_MTU 1430
-
-
-/**
- * Which network scope do we belong to?
- */
-#if BUILD_WLAN
-static const enum GNUNET_NetworkType scope = GNUNET_NT_WLAN;
-#else
-static const enum GNUNET_NetworkType scope = GNUNET_NT_BT;
-#endif
-
-
-/**
- * Maximum number of messages in defragmentation queue per MAC
- */
-#define MESSAGES_IN_DEFRAG_QUEUE_PER_MAC 2
-
-/**
- * Link layer control fields for better compatibility
- * (i.e. GNUnet over WLAN is not IP-over-WLAN).
- */
-#define WLAN_LLC_DSAP_FIELD 0x1f
-#define WLAN_LLC_SSAP_FIELD 0x1f
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-/**
- * Header for messages which need fragmentation.  This is the format of
- * a message we obtain AFTER defragmentation.  We then need to check
- * the CRC and then tokenize the payload and pass it to the
- * 'receive' callback.
- */
-struct WlanHeader
-{
-  /**
-   * Message type is #GNUNET_MESSAGE_TYPE_WLAN_DATA.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * CRC32 checksum (only over the payload), in NBO.
-   */
-  uint32_t crc GNUNET_PACKED;
-
-  /**
-   * Sender of the message.
-   */
-  struct GNUNET_PeerIdentity sender;
-
-  /**
-   * Target of the message.
-   */
-  struct GNUNET_PeerIdentity target;
-
-  /* followed by payload, possibly including
-     multiple messages! */
-};
-
-
-/**
- * Address format for WLAN.
- */
-struct WlanAddress
-{
-  /**
-   * Options set for the WLAN, in NBO.
-   */
-  uint32_t options GNUNET_PACKED;
-
-  /**
-   * WLAN addresses using MACs.
-   */
-  struct GNUNET_TRANSPORT_WLAN_MacAddress mac;
-};
-
-
-GNUNET_NETWORK_STRUCT_END
-
-
-/**
- * Information kept for each message that is yet to be fragmented and
- * transmitted.
- */
-struct PendingMessage
-{
-  /**
-   * next entry in the DLL
-   */
-  struct PendingMessage *next;
-
-  /**
-   * previous entry in the DLL
-   */
-  struct PendingMessage *prev;
-
-  /**
-   * The pending message
-   */
-  struct WlanHeader *msg;
-
-  /**
-   * Continuation function to call once the message
-   * has been sent.  Can be NULL if there is no
-   * continuation to call.
-   */
-  GNUNET_TRANSPORT_TransmitContinuation transmit_cont;
-
-  /**
-   * Cls for @e transmit_cont
-   */
-  void *transmit_cont_cls;
-
-  /**
-   * Timeout task (for this message).
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-};
-
-
-/**
- * Session handle for connections with other peers.
- */
-struct GNUNET_ATS_Session
-{
-  /**
-   * To whom are we talking to (set to our identity
-   * if we are still waiting for the welcome message)
-   */
-  struct GNUNET_PeerIdentity target;
-
-  /**
-   * We keep all sessions in a DLL at their respective
-   * `struct MACEndpoint *`.
-   */
-  struct GNUNET_ATS_Session *next;
-
-  /**
-   * We keep all sessions in a DLL at their respective
-   * `struct MACEndpoint *`.
-   */
-  struct GNUNET_ATS_Session *prev;
-
-  /**
-   * MAC endpoint with the address of this peer.
-   */
-  struct MacEndpoint *mac;
-
-  /**
-   * Address associated with this session and MAC endpoint
-   */
-  struct GNUNET_HELLO_Address *address;
-
-  /**
-   * When should this session time out?
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * Timeout task (for the session).
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-};
-
-
-/**
- * Struct for messages that are being fragmented in a MAC's transmission queue.
- */
-struct FragmentMessage
-{
-  /**
-   * This is a doubly-linked list.
-   */
-  struct FragmentMessage *next;
-
-  /**
-   * This is a doubly-linked list.
-   */
-  struct FragmentMessage *prev;
-
-  /**
-   * MAC endpoint this message belongs to
-   */
-  struct MacEndpoint *macendpoint;
-
-  /**
-   * Fragmentation context
-   */
-  struct GNUNET_FRAGMENT_Context *fragcontext;
-
-  /**
-   * Transmission handle to helper (to cancel if the frag context
-   * is destroyed early for some reason).
-   */
-  struct GNUNET_HELPER_SendHandle *sh;
-
-  /**
-   * Intended recipient.
-   */
-  struct GNUNET_PeerIdentity target;
-
-  /**
-   * Timeout value for the message.
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * Timeout task.
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * Continuation to call when we're done with this message.
-   */
-  GNUNET_TRANSPORT_TransmitContinuation cont;
-
-  /**
-   * Message we need to fragment and transmit, NULL after the
-   * @e fragmentcontext has been created.
-   */
-  struct GNUNET_MessageHeader *msg;
-
-  /**
-   * Closure for @e cont
-   */
-  void *cont_cls;
-
-  /**
-   * Size of original message
-   */
-  size_t size_payload;
-
-  /**
-   * Number of bytes used to transmit message
-   */
-  size_t size_on_wire;
-};
-
-
-/**
- * Struct to represent one network card connection
- */
-struct MacEndpoint
-{
-  /**
-   * We keep all MACs in a DLL in the plugin.
-   */
-  struct MacEndpoint *next;
-
-  /**
-   * We keep all MACs in a DLL in the plugin.
-   */
-  struct MacEndpoint *prev;
-
-  /**
-   * Pointer to the global plugin struct.
-   */
-  struct Plugin *plugin;
-
-  /**
-   * Head of sessions that use this MAC.
-   */
-  struct GNUNET_ATS_Session *sessions_head;
-
-  /**
-   * Tail of sessions that use this MAC.
-   */
-  struct GNUNET_ATS_Session *sessions_tail;
-
-  /**
-   * Head of messages we are currently sending to this MAC.
-   */
-  struct FragmentMessage *sending_messages_head;
-
-  /**
-   * Tail of messages we are currently sending to this MAC.
-   */
-  struct FragmentMessage *sending_messages_tail;
-
-  /**
-   * Defrag context for this MAC
-   */
-  struct GNUNET_DEFRAGMENT_Context *defrag;
-
-  /**
-   * When should this endpoint time out?
-   */
-  struct GNUNET_TIME_Absolute timeout;
-
-  /**
-   * Timeout task.
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * count of messages in the fragment out queue for this mac endpoint
-   */
-  unsigned int fragment_messages_out_count;
-
-  /**
-   * peer MAC address
-   */
-  struct WlanAddress wlan_addr;
-
-  /**
-   * Message delay for fragmentation context
-   */
-  struct GNUNET_TIME_Relative msg_delay;
-
-  /**
-   * ACK delay for fragmentation context
-   */
-  struct GNUNET_TIME_Relative ack_delay;
-
-  /**
-   * Desired transmission power for this MAC
-   */
-  uint16_t tx_power;
-
-  /**
-   * Desired transmission rate for this MAC
-   */
-  uint8_t rate;
-
-  /**
-   * Antenna we should use for this MAC
-   */
-  uint8_t antenna;
-};
-
-
-/**
- * Encapsulation of all of the state of the plugin.
- */
-struct Plugin
-{
-  /**
-   * Our environment.
-   */
-  struct GNUNET_TRANSPORT_PluginEnvironment *env;
-
-  /**
-   * Handle to helper process for privileged operations.
-   */
-  struct GNUNET_HELPER_Handle *suid_helper;
-
-  /**
-   * Function to call about session status changes.
-   */
-  GNUNET_TRANSPORT_SessionInfoCallback sic;
-
-  /**
-   * Closure for @e sic.
-   */
-  void *sic_cls;
-
-  /**
-   * ARGV-vector for the helper (all helpers take only the binary
-   * name, one actual argument, plus the NULL terminator for 'argv').
-   */
-  char *helper_argv[3];
-
-  /**
-   * The interface of the wlan card given to us by the user.
-   */
-  char *wlan_interface;
-
-  /**
-   * Tokenizer for demultiplexing of data packets resulting from
-   * defragmentation.
-   */
-  struct GNUNET_SERVER_MessageStreamTokenizer *fragment_data_tokenizer;
-
-  /**
-   * Tokenizer for demultiplexing of data packets received from the suid helper
-   */
-  struct GNUNET_SERVER_MessageStreamTokenizer *helper_payload_tokenizer;
-
-  /**
-   * Tokenizer for demultiplexing of data packets that follow the WLAN Header
-   */
-  struct GNUNET_SERVER_MessageStreamTokenizer *wlan_header_payload_tokenizer;
-
-  /**
-   * Head of list of open connections.
-   */
-  struct MacEndpoint *mac_head;
-
-  /**
-   * Tail of list of open connections.
-   */
-  struct MacEndpoint *mac_tail;
-
-  /**
-   * Task that periodically sends a HELLO beacon via the helper.
-   */
-  struct GNUNET_SCHEDULER_Task *beacon_task;
-
-  /**
-   * Tracker for bandwidth limit
-   */
-  struct GNUNET_BANDWIDTH_Tracker tracker;
-
-  /**
-   * The mac_address of the wlan card given to us by the helper.
-   */
-  struct GNUNET_TRANSPORT_WLAN_MacAddress mac_address;
-
-  /**
-   * Have we received a control message with our MAC address yet?
-   */
-  int have_mac;
-
-  /**
-   * Number of connections
-   */
-  unsigned int mac_count;
-
-  /**
-   * Options for addresses
-   */
-  uint32_t options;
-};
-
-
-/**
- * Information associated with a message.  Can contain
- * the session or the MAC endpoint associated with the
- * message (or both).
- */
-struct MacAndSession
-{
-  /**
-   * NULL if the identity of the other peer is not known.
-   */
-  struct GNUNET_ATS_Session *session;
-
-  /**
-   * MAC address of the other peer, NULL if not known.
-   */
-  struct MacEndpoint *endpoint;
-};
-
-
-/**
- * Print MAC addresses nicely.
- *
- * @param mac the mac address
- * @return string to a static buffer with
- * the human-readable mac, will be overwritten during the next call to
- * this function
- */
-static const char *
-mac_to_string (const struct GNUNET_TRANSPORT_WLAN_MacAddress *mac)
-{
-  static char macstr[20];
-
-  GNUNET_snprintf (macstr,
-                   sizeof(macstr),
-                   "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
-                   mac->mac[0], mac->mac[1],
-                   mac->mac[2], mac->mac[3],
-                   mac->mac[4], mac->mac[5]);
-  return macstr;
-}
-
-
-/**
- * Function called for a quick conversion of the binary address to
- * a numeric address.  Note that the caller must not free the
- * address and that the next call to this function is allowed
- * to override the address again.
- *
- * @param cls closure
- * @param addr binary address
- * @param addrlen length of the address
- * @return string representing the same address
- */
-static const char *
-wlan_plugin_address_to_string (void *cls,
-                               const void *addr,
-                               size_t addrlen)
-{
-  const struct GNUNET_TRANSPORT_WLAN_MacAddress *mac;
-  static char macstr[36];
-
-  if (sizeof(struct WlanAddress) != addrlen)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  mac = &((struct WlanAddress *) addr)->mac;
-  GNUNET_snprintf (macstr,
-                   sizeof(macstr),
-                   "%s.%u.%s",
-                   PLUGIN_NAME,
-                   ntohl (((struct WlanAddress *) addr)->options),
-                   mac_to_string (mac));
-  return macstr;
-}
-
-
-/**
- * If a session monitor is attached, notify it about the new
- * session state.
- *
- * @param plugin our plugin
- * @param session session that changed state
- * @param state new state of the session
- */
-static void
-notify_session_monitor (struct Plugin *plugin,
-                        struct GNUNET_ATS_Session *session,
-                        enum GNUNET_TRANSPORT_SessionState state)
-{
-  struct GNUNET_TRANSPORT_SessionInfo info;
-
-  if (NULL == plugin->sic)
-    return;
-  memset (&info, 0, sizeof(info));
-  info.state = state;
-  info.is_inbound = GNUNET_SYSERR; /* hard to say */
-  info.num_msg_pending = 0; /* we queue per MAC, not per peer */
-  info.num_bytes_pending = 0; /* we queue per MAC, not per peer */
-  info.receive_delay = GNUNET_TIME_UNIT_ZERO_ABS; /* not supported by WLAN */
-  info.session_timeout = session->timeout;
-  info.address = session->address;
-  plugin->sic (plugin->sic_cls,
-               session,
-               &info);
-}
-
-
-/**
- * Fill the radiotap header
- *
- * @param endpoint pointer to the endpoint, can be NULL
- * @param header pointer to the radiotap header
- * @param size total message size
- */
-static void
-get_radiotap_header (struct MacEndpoint *endpoint,
-                     struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *header,
-                     uint16_t size)
-{
-  header->header.type = ntohs (GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER);
-  header->header.size = ntohs (size);
-  if (NULL != endpoint)
-  {
-    header->rate = endpoint->rate;
-    header->tx_power = endpoint->tx_power;
-    header->antenna = endpoint->antenna;
-  }
-  else
-  {
-    header->rate = 255;
-    header->tx_power = 0;
-    header->antenna = 0;
-  }
-}
-
-
-/**
- * Generate the WLAN hardware header for one packet
- *
- * @param plugin the plugin handle
- * @param header address to write the header to
- * @param to_mac_addr address of the recipient
- * @param size size of the whole packet, needed to calculate the time to send 
the packet
- */
-static void
-get_wlan_header (struct Plugin *plugin,
-                 struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *header,
-                 const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr,
-                 unsigned int size)
-{
-  const int rate = 11000000;
-
-  header->frame_control = htons (IEEE80211_FC0_TYPE_DATA);
-  header->addr1 = *to_mac_addr;
-  header->addr2 = plugin->mac_address;
-  header->addr3 = mac_bssid_gnunet;
-  header->duration = GNUNET_htole16 ((size * 1000000) / rate + 290);
-  header->sequence_control = 0; // FIXME?
-  header->llc[0] = WLAN_LLC_DSAP_FIELD;
-  header->llc[1] = WLAN_LLC_SSAP_FIELD;
-  header->llc[2] = 0;  // FIXME?
-  header->llc[3] = 0;  // FIXME?
-}
-
-
-/**
- * Send an ACK for a fragment we received.
- *
- * @param cls the `struct MacEndpoint *` the ACK must be sent to
- * @param msg_id id of the message
- * @param hdr pointer to the hdr where the ack is stored
- */
-static void
-send_ack (void *cls,
-          uint32_t msg_id,
-          const struct GNUNET_MessageHeader *hdr)
-{
-  struct MacEndpoint *endpoint = cls;
-  struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*radio_header;
-  uint16_t msize = ntohs (hdr->size);
-  size_t size = sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)
-                + msize;
-  char buf[size];
-
-  if (NULL == endpoint)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  if (size >= GNUNET_MAX_MESSAGE_SIZE)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Sending ACK to %s\n",
-       mac_to_string (&endpoint->wlan_addr.mac));
-  radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf;
-  get_radiotap_header (endpoint, radio_header, size);
-  get_wlan_header (endpoint->plugin,
-                   &radio_header->frame,
-                   &endpoint->wlan_addr.mac,
-                   sizeof(endpoint->wlan_addr.mac));
-  GNUNET_memcpy (&radio_header[1], hdr, msize);
-  if (NULL !=
-      GNUNET_HELPER_send (endpoint->plugin->suid_helper,
-                          &radio_header->header,
-                          GNUNET_NO /* dropping ACKs is bad */,
-                          NULL, NULL))
-    GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                              _ ("# ACKs sent"),
-                              1, GNUNET_NO);
-}
-
-
-/**
- * Handles the data after all fragments are put together
- *
- * @param cls macendpoint this messages belongs to
- * @param hdr pointer to the data
- */
-static void
-wlan_data_message_handler (void *cls,
-                           const struct GNUNET_MessageHeader *hdr)
-{
-  struct MacEndpoint *endpoint = cls;
-  struct Plugin *plugin = endpoint->plugin;
-  struct MacAndSession mas;
-
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            _ ("# Messages defragmented"),
-                            1,
-                            GNUNET_NO);
-  mas.session = NULL;
-  mas.endpoint = endpoint;
-  (void) GNUNET_SERVER_mst_receive (plugin->fragment_data_tokenizer,
-                                    &mas,
-                                    (const char *) hdr,
-                                    ntohs (hdr->size),
-                                    GNUNET_YES, GNUNET_NO);
-}
-
-
-/**
- * Free a session
- *
- * @param cls our `struct Plugin`.
- * @param session the session free
- */
-static int
-wlan_plugin_disconnect_session (void *cls,
-                                struct GNUNET_ATS_Session *session)
-{
-  struct MacEndpoint *endpoint = session->mac;
-  struct Plugin *plugin = endpoint->plugin;
-
-  plugin->env->session_end (plugin->env->cls,
-                            session->address,
-                            session);
-  notify_session_monitor (plugin,
-                          session,
-                          GNUNET_TRANSPORT_SS_DONE);
-  GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head,
-                               endpoint->sessions_tail,
-                               session);
-  if (session->timeout_task != NULL)
-  {
-    GNUNET_SCHEDULER_cancel (session->timeout_task);
-    session->timeout_task = NULL;
-  }
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            _ ("# Sessions allocated"),
-                            -1,
-                            GNUNET_NO);
-  GNUNET_HELLO_address_free (session->address);
-  GNUNET_free (session);
-  return GNUNET_OK;
-}
-
-
-/**
- * Function that is called to get the keepalive factor.
- * #GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to
- * calculate the interval between keepalive packets.
- *
- * @param cls closure with the `struct Plugin`
- * @return keepalive factor
- */
-static unsigned int
-wlan_plugin_query_keepalive_factor (void *cls)
-{
-  return 3;
-}
-
-
-/**
- * A session is timing out.  Clean up.
- *
- * @param cls pointer to the Session
- */
-static void
-session_timeout (void *cls)
-{
-  struct GNUNET_ATS_Session *session = cls;
-  struct GNUNET_TIME_Relative left;
-
-  session->timeout_task = NULL;
-  left = GNUNET_TIME_absolute_get_remaining (session->timeout);
-  if (0 != left.rel_value_us)
-  {
-    session->timeout_task =
-      GNUNET_SCHEDULER_add_delayed (left,
-                                    &session_timeout,
-                                    session);
-    return;
-  }
-  wlan_plugin_disconnect_session (session->mac->plugin,
-                                  session);
-}
-
-
-/**
- * Lookup a new session
- *
- * @param endpoint pointer to the mac endpoint of the peer
- * @param peer peer identity to use for this session
- * @return returns the session or NULL
- */
-static struct GNUNET_ATS_Session *
-lookup_session (struct MacEndpoint *endpoint,
-                const struct GNUNET_PeerIdentity *peer)
-{
-  struct GNUNET_ATS_Session *session;
-
-  for (session = endpoint->sessions_head; NULL != session; session =
-         session->next)
-    if (0 == memcmp (peer, &session->target, sizeof(struct
-                                                    GNUNET_PeerIdentity)))
-      return session;
-  return NULL;
-}
-
-
-/**
- * Create a new session
- *
- * @param endpoint pointer to the mac endpoint of the peer
- * @param peer peer identity to use for this session
- * @return returns the session or NULL
- */
-static struct GNUNET_ATS_Session *
-create_session (struct MacEndpoint *endpoint,
-                const struct GNUNET_PeerIdentity *peer)
-{
-  struct GNUNET_ATS_Session *session;
-
-  GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                            _ ("# Sessions allocated"),
-                            1,
-                            GNUNET_NO);
-  session = GNUNET_new (struct GNUNET_ATS_Session);
-  GNUNET_CONTAINER_DLL_insert_tail (endpoint->sessions_head,
-                                    endpoint->sessions_tail,
-                                    session);
-  session->address = GNUNET_HELLO_address_allocate (peer,
-                                                    PLUGIN_NAME,
-                                                    &endpoint->wlan_addr,
-                                                    
sizeof(endpoint->wlan_addr),
-                                                    
GNUNET_HELLO_ADDRESS_INFO_NONE);
-  session->mac = endpoint;
-  session->target = *peer;
-  session->timeout = GNUNET_TIME_relative_to_absolute (
-    GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-  session->timeout_task =
-    GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
-                                  &session_timeout,
-                                  session);
-  notify_session_monitor (endpoint->plugin,
-                          session,
-                          GNUNET_TRANSPORT_SS_INIT);
-  notify_session_monitor (endpoint->plugin,
-                          session,
-                          GNUNET_TRANSPORT_SS_UP);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Created new session %p for peer `%s' with endpoint %s\n",
-       session,
-       GNUNET_i2s (peer),
-       mac_to_string (&endpoint->wlan_addr.mac));
-
-  return session;
-}
-
-
-/**
- * Look up a session for a peer and create a new session if none is found
- *
- * @param endpoint pointer to the mac endpoint of the peer
- * @param peer peer identity to use for this session
- * @return returns the session
- */
-static struct GNUNET_ATS_Session *
-get_session (struct MacEndpoint *endpoint,
-             const struct GNUNET_PeerIdentity *peer)
-{
-  struct GNUNET_ATS_Session *session;
-
-  if (NULL != (session = lookup_session (endpoint, peer)))
-    return session;
-  return create_session (endpoint, peer);
-}
-
-
-/**
- * Function called once we have successfully given the fragment
- * message to the SUID helper process and we are thus ready for
- * the next fragment.
- *
- * @param cls the `struct FragmentMessage *`
- * @param result result of the operation (#GNUNET_OK on success,
- *        #GNUNET_NO if the helper died, #GNUNET_SYSERR
- *        if the helper was stopped)
- */
-static void
-fragment_transmission_done (void *cls,
-                            int result)
-{
-  struct FragmentMessage *fm = cls;
-
-  fm->sh = NULL;
-  GNUNET_FRAGMENT_context_transmission_done (fm->fragcontext);
-}
-
-
-/**
- * Transmit a fragment of a message.
- *
- * @param cls `struct FragmentMessage *` this fragment message belongs to
- * @param hdr pointer to the start of the fragment message
- */
-static void
-transmit_fragment (void *cls,
-                   const struct GNUNET_MessageHeader *hdr)
-{
-  struct FragmentMessage *fm = cls;
-  struct MacEndpoint *endpoint = fm->macendpoint;
-  size_t size;
-  uint16_t msize;
-
-  if (NULL == endpoint)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  msize = ntohs (hdr->size);
-  size = sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) + msize;
-  {
-    char buf[size];
-    struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *radio_header;
-
-    radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf;
-    get_radiotap_header (endpoint, radio_header, size);
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Sending %u bytes of data to MAC `%s'\n",
-         (unsigned int) msize,
-         mac_to_string (&endpoint->wlan_addr.mac));
-
-    get_wlan_header (endpoint->plugin,
-                     &radio_header->frame,
-                     &endpoint->wlan_addr.mac,
-                     sizeof(endpoint->wlan_addr.mac));
-    GNUNET_memcpy (&radio_header[1], hdr, msize);
-    GNUNET_assert (NULL == fm->sh);
-    fm->sh = GNUNET_HELPER_send (endpoint->plugin->suid_helper,
-                                 &radio_header->header,
-                                 GNUNET_NO,
-                                 &fragment_transmission_done, fm);
-    fm->size_on_wire += size;
-    if (NULL != fm->sh)
-    {
-      GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                                _ ("# message fragments sent"),
-                                1,
-                                GNUNET_NO);
-    }
-    else
-    {
-      GNUNET_FRAGMENT_context_transmission_done (fm->fragcontext);
-    }
-    GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                              "# bytes currently in buffers",
-                              -msize, GNUNET_NO);
-    GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                              "# bytes transmitted",
-                              msize, GNUNET_NO);
-  }
-}
-
-
-/**
- * Frees the space of a message in the fragment queue (send queue)
- *
- * @param fm message to free
- */
-static void
-free_fragment_message (struct FragmentMessage *fm)
-{
-  struct MacEndpoint *endpoint = fm->macendpoint;
-
-  GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
-                            _ ("# messages pending (with fragmentation)"),
-                            -1, GNUNET_NO);
-  GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head,
-                               endpoint->sending_messages_tail,
-                               fm);
-  if (NULL != fm->sh)
-  {
-    GNUNET_HELPER_send_cancel (fm->sh);
-    fm->sh = NULL;
-  }
-  if (NULL != fm->msg)
-  {
-    GNUNET_free (fm->msg);
-    fm->msg = NULL;
-  }
-  if (NULL != fm->fragcontext)
-  {
-    GNUNET_FRAGMENT_context_destroy (fm->fragcontext,
-                                     &endpoint->msg_delay,
-                                     &endpoint->ack_delay);
-    fm->fragcontext = NULL;
-  }
-  if (NULL != fm->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (fm->timeout_task);
-    fm->timeout_task = NULL;
-  }
-  GNUNET_free (fm);
-}
-
-
-/**
- * A FragmentMessage has timed out.  Remove it.
- *
- * @param cls pointer to the 'struct FragmentMessage'
- */
-static void
-fragmentmessage_timeout (void *cls)
-{
-  struct FragmentMessage *fm = cls;
-
-  fm->timeout_task = NULL;
-  if (NULL != fm->cont)
-  {
-    fm->cont (fm->cont_cls,
-              &fm->target,
-              GNUNET_SYSERR,
-              fm->size_payload,
-              fm->size_on_wire);
-    fm->cont = NULL;
-  }
-  free_fragment_message (fm);
-}
-
-
-/**
- * Transmit a message to the given destination with fragmentation.
- *
- * @param endpoint desired destination
- * @param timeout how long can the message wait?
- * @param target peer that should receive the message
- * @param msg message to transmit
- * @param payload_size bytes of payload
- * @param cont continuation to call once the message has
- *        been transmitted (or if the transport is ready
- *        for the next transmission call; or if the
- *        peer disconnected...); can be NULL
- * @param cont_cls closure for @a cont
- */
-static void
-send_with_fragmentation (struct MacEndpoint *endpoint,
-                         struct GNUNET_TIME_Relative timeout,
-                         const struct GNUNET_PeerIdentity *target,
-                         const struct GNUNET_MessageHeader *msg,
-                         size_t payload_size,
-                         GNUNET_TRANSPORT_TransmitContinuation cont,
-                         void *cont_cls)
-
-{
-  struct FragmentMessage *fm;
-  struct Plugin *plugin;
-
-  plugin = endpoint->plugin;
-  fm = GNUNET_new (struct FragmentMessage);
-  fm->macendpoint = endpoint;
-  fm->target = *target;
-  fm->size_payload = payload_size;
-  fm->timeout = GNUNET_TIME_relative_to_absolute (timeout);
-  fm->cont = cont;
-  fm->cont_cls = cont_cls;
-  /* 1 MBit/s typical data rate, 1430 byte fragments => ~100 ms per message */
-  fm->timeout_task =
-    GNUNET_SCHEDULER_add_delayed (timeout,
-                                  &fragmentmessage_timeout,
-                                  fm);
-  if (GNUNET_YES == plugin->have_mac)
-  {
-    fm->fragcontext =
-      GNUNET_FRAGMENT_context_create (plugin->env->stats,
-                                      WLAN_MTU,
-                                      &plugin->tracker,
-                                      fm->macendpoint->msg_delay,
-                                      fm->macendpoint->ack_delay,
-                                      msg,
-                                      &transmit_fragment, fm);
-  }
-  else
-  {
-    fm->msg = GNUNET_copy_message (msg);
-  }
-  GNUNET_CONTAINER_DLL_insert_tail (endpoint->sending_messages_head,
-                                    endpoint->sending_messages_tail,
-                                    fm);
-}
-
-
-/**
- * Free a MAC endpoint.
- *
- * @param endpoint pointer to the MacEndpoint to free
- */
-static void
-free_macendpoint (struct MacEndpoint *endpoint)
-{
-  struct Plugin *plugin = endpoint->plugin;
-  struct FragmentMessage *fm;
-  struct GNUNET_ATS_Session *session;
-
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            _ ("# MAC endpoints allocated"),
-                            -1,
-                            GNUNET_NO);
-  while (NULL != (session = endpoint->sessions_head))
-    wlan_plugin_disconnect_session (plugin,
-                                    session);
-  while (NULL != (fm = endpoint->sending_messages_head))
-    free_fragment_message (fm);
-  GNUNET_CONTAINER_DLL_remove (plugin->mac_head,
-                               plugin->mac_tail,
-                               endpoint);
-
-  if (NULL != endpoint->defrag)
-  {
-    GNUNET_DEFRAGMENT_context_destroy (endpoint->defrag);
-    endpoint->defrag = NULL;
-  }
-
-  plugin->mac_count--;
-  if (NULL != endpoint->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (endpoint->timeout_task);
-    endpoint->timeout_task = NULL;
-  }
-  GNUNET_free (endpoint);
-}
-
-
-/**
- * A MAC endpoint is timing out.  Clean up.
- *
- * @param cls pointer to the `struct MacEndpoint *`
- */
-static void
-macendpoint_timeout (void *cls)
-{
-  struct MacEndpoint *endpoint = cls;
-  struct GNUNET_TIME_Relative timeout;
-
-  endpoint->timeout_task = NULL;
-  timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout);
-  if (0 == timeout.rel_value_us)
-  {
-    free_macendpoint (endpoint);
-    return;
-  }
-  endpoint->timeout_task =
-    GNUNET_SCHEDULER_add_delayed (timeout,
-                                  &macendpoint_timeout,
-                                  endpoint);
-}
-
-
-/**
- * Find (or create) a MacEndpoint with a specific MAC address
- *
- * @param plugin pointer to the plugin struct
- * @param mac the MAC address of the endpoint
- * @return handle to our data structure for this MAC
- */
-static struct MacEndpoint *
-create_macendpoint (struct Plugin *plugin,
-                    struct WlanAddress *mac)
-{
-  struct MacEndpoint *pos;
-
-  for (pos = plugin->mac_head; NULL != pos; pos = pos->next)
-    if (0 == memcmp (mac, &pos->wlan_addr, sizeof(pos->wlan_addr)))
-      return pos;
-  pos = GNUNET_new (struct MacEndpoint);
-  pos->wlan_addr = (*mac);
-  pos->plugin = plugin;
-  pos->defrag =
-    GNUNET_DEFRAGMENT_context_create (plugin->env->stats,
-                                      WLAN_MTU,
-                                      MESSAGES_IN_DEFRAG_QUEUE_PER_MAC,
-                                      pos,
-                                      &wlan_data_message_handler,
-                                      &send_ack);
-
-  pos->msg_delay = GNUNET_TIME_UNIT_MILLISECONDS;
-  pos->ack_delay = GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_MILLISECONDS,
-                                                  100);
-  pos->timeout = GNUNET_TIME_relative_to_absolute (MACENDPOINT_TIMEOUT);
-  pos->timeout_task =
-    GNUNET_SCHEDULER_add_delayed (MACENDPOINT_TIMEOUT, &macendpoint_timeout,
-                                  pos);
-  GNUNET_CONTAINER_DLL_insert (plugin->mac_head,
-                               plugin->mac_tail,
-                               pos);
-  plugin->mac_count++;
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            _ ("# MAC endpoints allocated"),
-                            1, GNUNET_NO);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "New MAC endpoint `%s'\n",
-       wlan_plugin_address_to_string (NULL,
-                                      &pos->wlan_addr,
-                                      sizeof(struct WlanAddress)));
-  return pos;
-}
-
-
-/**
- * Function obtain the network type for a session
- *
- * @param cls closure (`struct Plugin*`)
- * @param session the session
- * @return the network type in HBO or #GNUNET_SYSERR
- */
-static enum GNUNET_NetworkType
-wlan_plugin_get_network (void *cls,
-                         struct GNUNET_ATS_Session *session)
-{
-#if BUILD_WLAN
-  return GNUNET_NT_WLAN;
-#else
-  return GNUNET_NT_BT;
-#endif
-}
-
-
-/**
- * Function obtain the network type for an address.
- *
- * @param cls closure (`struct Plugin *`)
- * @param address the address
- * @return the network type
- */
-static enum GNUNET_NetworkType
-wlan_plugin_get_network_for_address (void *cls,
-                                     const struct GNUNET_HELLO_Address 
*address)
-{
-#if BUILD_WLAN
-  return GNUNET_NT_WLAN;
-#else
-  return GNUNET_NT_BT;
-#endif
-}
-
-
-/**
- * Creates a new outbound session the transport service will use to
- * send data to the peer
- *
- * @param cls the `struct Plugin *`
- * @param address the address
- * @return the session or NULL of max connections exceeded
- */
-static struct GNUNET_ATS_Session *
-wlan_plugin_get_session (void *cls,
-                         const struct GNUNET_HELLO_Address *address)
-{
-  struct Plugin *plugin = cls;
-  struct MacEndpoint *endpoint;
-
-  if (NULL == address)
-    return NULL;
-  if (sizeof(struct WlanAddress) != address->address_length)
-  {
-    GNUNET_break (0);
-    return NULL;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Service asked to create session for peer `%s' with MAC `%s'\n",
-       GNUNET_i2s (&address->peer),
-       wlan_plugin_address_to_string (NULL,
-                                      address->address,
-                                      address->address_length));
-  endpoint = create_macendpoint (plugin,
-                                 (struct WlanAddress *) address->address);
-  return get_session (endpoint, &address->peer);
-}
-
-
-/**
- * Function that can be used to force the plugin to disconnect
- * from the given peer and cancel all previous transmissions
- * (and their continuation).
- *
- * @param cls closure
- * @param target peer from which to disconnect
- */
-static void
-wlan_plugin_disconnect_peer (void *cls,
-                             const struct GNUNET_PeerIdentity *target)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_ATS_Session *session;
-  struct MacEndpoint *endpoint;
-
-  for (endpoint = plugin->mac_head; NULL != endpoint; endpoint = 
endpoint->next)
-    for (session = endpoint->sessions_head; NULL != session; session =
-           session->next)
-      if (0 == memcmp (target, &session->target,
-                       sizeof(struct GNUNET_PeerIdentity)))
-      {
-        wlan_plugin_disconnect_session (plugin, session);
-        break;   /* inner-loop only (in case peer has another MAC as well!) */
-      }
-}
-
-
-/**
- * Function that can be used by the transport service to transmit
- * a message using the plugin.   Note that in the case of a
- * peer disconnecting, the continuation MUST be called
- * prior to the disconnect notification itself.  This function
- * will be called with this peer's HELLO message to initiate
- * a fresh connection to another peer.
- *
- * @param cls closure
- * @param session which session must be used
- * @param msgbuf the message to transmit
- * @param msgbuf_size number of bytes in @a msgbuf
- * @param priority how important is the message (most plugins will
- *                 ignore message priority and just FIFO)
- * @param to how long to wait at most for the transmission (does not
- *                require plugins to discard the message after the timeout,
- *                just advisory for the desired delay; most plugins will ignore
- *                this as well)
- * @param cont continuation to call once the message has
- *        been transmitted (or if the transport is ready
- *        for the next transmission call; or if the
- *        peer disconnected...); can be NULL
- * @param cont_cls closure for @a cont
- * @return number of bytes used (on the physical network, with overheads);
- *         -1 on hard errors (i.e. address invalid); 0 is a legal value
- *         and does NOT mean that the message was not transmitted (DV)
- */
-static ssize_t
-wlan_plugin_send (void *cls,
-                  struct GNUNET_ATS_Session *session,
-                  const char *msgbuf, size_t msgbuf_size,
-                  unsigned int priority,
-                  struct GNUNET_TIME_Relative to,
-                  GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls)
-{
-  struct Plugin *plugin = cls;
-  struct WlanHeader *wlanheader;
-  size_t size = msgbuf_size + sizeof(struct WlanHeader);
-  char buf[size] GNUNET_ALIGN;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Transmitting %llu bytes of payload to peer `%s' (starting with %u byte 
message of type %u)\n",
-       (unsigned long long) msgbuf_size,
-       GNUNET_i2s (&session->target),
-       (unsigned int) ntohs (((struct GNUNET_MessageHeader*) msgbuf)->size),
-       (unsigned int) ntohs (((struct GNUNET_MessageHeader*) msgbuf)->type));
-  wlanheader = (struct WlanHeader *) buf;
-  wlanheader->header.size = htons (msgbuf_size + sizeof(struct WlanHeader));
-  wlanheader->header.type = htons (GNUNET_MESSAGE_TYPE_WLAN_DATA);
-  wlanheader->sender = *plugin->env->my_identity;
-  wlanheader->target = session->target;
-  wlanheader->crc = htonl (GNUNET_CRYPTO_crc32_n (msgbuf, msgbuf_size));
-  GNUNET_memcpy (&wlanheader[1],
-                 msgbuf,
-                 msgbuf_size);
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            "# bytes currently in buffers",
-                            msgbuf_size,
-                            GNUNET_NO);
-  send_with_fragmentation (session->mac,
-                           to,
-                           &session->target,
-                           &wlanheader->header,
-                           msgbuf_size,
-                           cont, cont_cls);
-  return size;
-}
-
-
-/**
- * We have received data from the WLAN via some session.  Process depending
- * on the message type (HELLO, DATA, FRAGMENTATION or FRAGMENTATION-ACK).
- *
- * @param cls pointer to the plugin
- * @param client pointer to the session this message belongs to
- * @param hdr start of the message
- */
-static int
-process_data (void *cls,
-              void *client,
-              const struct GNUNET_MessageHeader *hdr)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_HELLO_Address *address;
-  struct MacAndSession *mas = client;
-  struct FragmentMessage *fm;
-  struct GNUNET_PeerIdentity tmpsource;
-  const struct WlanHeader *wlanheader;
-  int ret;
-  uint16_t msize;
-
-  msize = ntohs (hdr->size);
-
-  GNUNET_STATISTICS_update (plugin->env->stats,
-                            "# bytes received",
-                            msize, GNUNET_NO);
-
-  switch (ntohs (hdr->type))
-  {
-  case GNUNET_MESSAGE_TYPE_HELLO:
-
-    if (GNUNET_OK !=
-        GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hdr,
-                             &tmpsource))
-    {
-      GNUNET_break_op (0);
-      break;
-    }
-    if (NULL == mas->endpoint)
-    {
-      GNUNET_break (0);
-      break;
-    }
-
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Processing %u bytes of HELLO from peer `%s' at MAC %s\n",
-         (unsigned int) msize,
-         GNUNET_i2s (&tmpsource),
-         wlan_plugin_address_to_string (NULL,
-                                        &mas->endpoint->wlan_addr,
-                                        sizeof(mas->endpoint->wlan_addr)));
-
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              _ ("# HELLO messages received"), 1,
-                              GNUNET_NO);
-    address = GNUNET_HELLO_address_allocate (&tmpsource,
-                                             PLUGIN_NAME,
-                                             &mas->endpoint->wlan_addr,
-                                             sizeof(mas->endpoint->wlan_addr),
-                                             GNUNET_HELLO_ADDRESS_INFO_NONE);
-    mas->session = lookup_session (mas->endpoint,
-                                   &tmpsource);
-    if (NULL == mas->session)
-    {
-      mas->session = create_session (mas->endpoint,
-                                     &tmpsource);
-      plugin->env->session_start (plugin->env->cls,
-                                  address,
-                                  mas->session,
-                                  scope);
-    }
-    plugin->env->receive (plugin->env->cls,
-                          address,
-                          mas->session,
-                          hdr);
-    GNUNET_HELLO_address_free (address);
-    break;
-
-  case GNUNET_MESSAGE_TYPE_FRAGMENT:
-    if (NULL == mas->endpoint)
-    {
-      GNUNET_break (0);
-      break;
-    }
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Processing %u bytes of FRAGMENT from MAC %s\n",
-         (unsigned int) msize,
-         wlan_plugin_address_to_string (NULL,
-                                        &mas->endpoint->wlan_addr,
-                                        sizeof(mas->endpoint->wlan_addr)));
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              _ ("# fragments received"),
-                              1,
-                              GNUNET_NO);
-    (void) GNUNET_DEFRAGMENT_process_fragment (mas->endpoint->defrag,
-                                               hdr);
-    break;
-
-  case GNUNET_MESSAGE_TYPE_FRAGMENT_ACK:
-    if (NULL == mas->endpoint)
-    {
-      GNUNET_break (0);
-      break;
-    }
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              _ ("# ACKs received"),
-                              1, GNUNET_NO);
-    for (fm = mas->endpoint->sending_messages_head; NULL != fm; fm = fm->next)
-    {
-      ret = GNUNET_FRAGMENT_process_ack (fm->fragcontext, hdr);
-      if (GNUNET_OK == ret)
-      {
-        LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "Got last ACK, finished message transmission to `%s' (%p)\n",
-             wlan_plugin_address_to_string (NULL,
-                                            &mas->endpoint->wlan_addr,
-                                            sizeof(mas->endpoint->wlan_addr)),
-             fm);
-        mas->endpoint->timeout = GNUNET_TIME_relative_to_absolute (
-          MACENDPOINT_TIMEOUT);
-        if (NULL != fm->cont)
-        {
-          fm->cont (fm->cont_cls,
-                    &fm->target,
-                    GNUNET_OK,
-                    fm->size_payload,
-                    fm->size_on_wire);
-          fm->cont = NULL;
-        }
-        free_fragment_message (fm);
-        break;
-      }
-      if (GNUNET_NO == ret)
-      {
-        LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "Got an ACK, message transmission to `%s' not yet finished\n",
-             wlan_plugin_address_to_string (NULL,
-                                            &mas->endpoint->wlan_addr,
-                                            sizeof(mas->endpoint->wlan_addr)));
-        break;
-      }
-    }
-    if (NULL == fm)
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "ACK not matched against any active fragmentation with MAC `%s'\n",
-           wlan_plugin_address_to_string (NULL,
-                                          &mas->endpoint->wlan_addr,
-                                          sizeof(mas->endpoint->wlan_addr)));
-    break;
-
-  case GNUNET_MESSAGE_TYPE_WLAN_DATA:
-    if (NULL == mas->endpoint)
-    {
-      GNUNET_break (0);
-      break;
-    }
-    if (msize < sizeof(struct WlanHeader))
-    {
-      GNUNET_break (0);
-      break;
-    }
-    wlanheader = (const struct WlanHeader *) hdr;
-    if (0 != memcmp (&wlanheader->target,
-                     plugin->env->my_identity,
-                     sizeof(struct GNUNET_PeerIdentity)))
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Data for `%s', not for me, ignoring\n",
-           GNUNET_i2s (&wlanheader->target));
-      break;
-    }
-    if (ntohl (wlanheader->crc) !=
-        GNUNET_CRYPTO_crc32_n (&wlanheader[1],
-                               msize - sizeof(struct WlanHeader)))
-    {
-      GNUNET_STATISTICS_update (plugin->env->stats,
-                                _ (
-                                  "# DATA messages discarded due to CRC32 
error"),
-                                1,
-                                GNUNET_NO);
-      break;
-    }
-    mas->session = lookup_session (mas->endpoint,
-                                   &wlanheader->sender);
-    if (NULL == mas->session)
-    {
-      mas->session = create_session (mas->endpoint,
-                                     &wlanheader->sender);
-      address = GNUNET_HELLO_address_allocate (&wlanheader->sender,
-                                               PLUGIN_NAME,
-                                               &mas->endpoint->wlan_addr,
-                                               sizeof(struct WlanAddress),
-                                               GNUNET_HELLO_ADDRESS_INFO_NONE);
-      plugin->env->session_start (plugin->env->cls,
-                                  address,
-                                  mas->session,
-                                  scope);
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Notifying transport about peer `%s''s new session %p \n",
-           GNUNET_i2s (&wlanheader->sender),
-           mas->session);
-      GNUNET_HELLO_address_free (address);
-    }
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Processing %u bytes of DATA from peer `%s'\n",
-         (unsigned int) msize,
-         GNUNET_i2s (&wlanheader->sender));
-    mas->session->timeout = GNUNET_TIME_relative_to_absolute (
-      GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-    (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer,
-                                      mas,
-                                      (const char *) &wlanheader[1],
-                                      msize - sizeof(struct WlanHeader),
-                                      GNUNET_YES,
-                                      GNUNET_NO);
-    break;
-
-  default:
-    if (NULL == mas->endpoint)
-    {
-      GNUNET_break (0);
-      break;
-    }
-    if (NULL == mas->session)
-    {
-      GNUNET_break (0);
-      break;
-    }
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Received packet with %u bytes of type %u from peer %s\n",
-         (unsigned int) msize,
-         (unsigned int) ntohs (hdr->type),
-         GNUNET_i2s (&mas->session->target));
-    plugin->env->receive (plugin->env->cls,
-                          mas->session->address,
-                          mas->session,
-                          hdr);
-    break;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Task to (periodically) send a HELLO beacon
- *
- * @param cls pointer to the plugin struct
- */
-static void
-send_hello_beacon (void *cls)
-{
-  struct Plugin *plugin = cls;
-  uint16_t size;
-  uint16_t hello_size;
-  struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *radioHeader;
-  const struct GNUNET_MessageHeader *hello;
-
-  hello = plugin->env->get_our_hello ();
-  if (NULL != hello)
-  {
-    hello_size = GNUNET_HELLO_size ((struct GNUNET_HELLO_Message *) hello);
-    GNUNET_assert (sizeof(struct WlanHeader) + hello_size <= WLAN_MTU);
-    size = sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage)
-           + hello_size;
-    {
-      char buf[size] GNUNET_ALIGN;
-
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Sending %u byte HELLO beacon\n",
-           (unsigned int) size);
-      radioHeader = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*) buf;
-      get_radiotap_header (NULL, radioHeader, size);
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Broadcasting %u bytes of data to MAC `%s'\n",
-           (unsigned int) size,
-           mac_to_string (&bc_all_mac));
-      get_wlan_header (plugin, &radioHeader->frame, &bc_all_mac, size);
-      GNUNET_memcpy (&radioHeader[1], hello, hello_size);
-      if (NULL !=
-          GNUNET_HELPER_send (plugin->suid_helper,
-                              &radioHeader->header,
-                              GNUNET_YES /* can drop */,
-                              NULL, NULL))
-        GNUNET_STATISTICS_update (plugin->env->stats,
-                                  _ ("# HELLO beacons sent"),
-                                  1, GNUNET_NO);
-    }
-  }
-  plugin->beacon_task =
-    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
-                                    (HELLO_BEACON_SCALING_FACTOR,
-                                    plugin->mac_count + 1),
-                                  &send_hello_beacon,
-                                  plugin);
-}
-
-
-/**
- * Function used for to process the data from the suid process
- *
- * @param cls the plugin handle
- * @param hdr header of the GNUNET_MessageHeader
- */
-static int
-handle_helper_message (void *cls,
-                       const struct GNUNET_MessageHeader *hdr)
-{
-  struct Plugin *plugin = cls;
-  struct GNUNET_HELLO_Address *my_address;
-  const struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *rxinfo;
-  const struct GNUNET_TRANSPORT_WLAN_HelperControlMessage *cm;
-  struct WlanAddress wa;
-  struct MacAndSession mas;
-  uint16_t msize;
-  struct FragmentMessage *fm;
-  struct MacEndpoint *endpoint;
-
-  msize = ntohs (hdr->size);
-  switch (ntohs (hdr->type))
-  {
-  case GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL:
-    if (msize != sizeof(struct GNUNET_TRANSPORT_WLAN_HelperControlMessage))
-    {
-      GNUNET_break (0);
-      break;
-    }
-    cm = (const struct GNUNET_TRANSPORT_WLAN_HelperControlMessage *) hdr;
-    if (GNUNET_YES == plugin->have_mac)
-    {
-      if (0 == memcmp (&plugin->mac_address,
-                       &cm->mac,
-                       sizeof(struct GNUNET_TRANSPORT_WLAN_MacAddress)))
-        break;     /* no change */
-      /* remove old address */
-      memset (&wa, 0, sizeof(struct WlanAddress));
-      wa.mac = plugin->mac_address;
-      wa.options = htonl (plugin->options);
-      my_address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                                  PLUGIN_NAME,
-                                                  &wa, sizeof(wa),
-                                                  
GNUNET_HELLO_ADDRESS_INFO_NONE);
-      plugin->env->notify_address (plugin->env->cls,
-                                   GNUNET_NO,
-                                   my_address);
-      GNUNET_HELLO_address_free (my_address);
-      plugin->mac_address = cm->mac;
-    }
-    else
-    {
-      plugin->mac_address = cm->mac;
-      plugin->have_mac = GNUNET_YES;
-      for (endpoint = plugin->mac_head; NULL != endpoint; endpoint =
-             endpoint->next)
-      {
-        for (fm = endpoint->sending_messages_head; NULL != fm; fm = fm->next)
-        {
-          if (NULL != fm->fragcontext)
-          {
-            GNUNET_break (0);          /* should not happen */
-            continue;
-          }
-          fm->fragcontext =
-            GNUNET_FRAGMENT_context_create (plugin->env->stats,
-                                            WLAN_MTU,
-                                            &plugin->tracker,
-                                            fm->macendpoint->msg_delay,
-                                            fm->macendpoint->ack_delay,
-                                            fm->msg,
-                                            &transmit_fragment, fm);
-          GNUNET_free (fm->msg);
-          fm->msg = NULL;
-        }
-      }
-      GNUNET_break (NULL == plugin->beacon_task);
-      plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon,
-                                                      plugin);
-    }
-
-    memset (&wa, 0, sizeof(struct WlanAddress));
-    wa.mac = plugin->mac_address;
-    wa.options = htonl (plugin->options);
-    my_address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                                PLUGIN_NAME,
-                                                &wa, sizeof(wa),
-                                                
GNUNET_HELLO_ADDRESS_INFO_NONE);
-
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Received WLAN_HELPER_CONTROL message with MAC address `%s' for peer 
`%s'\n",
-         mac_to_string (&cm->mac),
-         GNUNET_i2s (plugin->env->my_identity));
-    plugin->env->notify_address (plugin->env->cls,
-                                 GNUNET_YES,
-                                 my_address);
-    GNUNET_HELLO_address_free (my_address);
-    break;
-
-  case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER:
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Got data message from helper with %u bytes\n",
-         msize);
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              _ ("# DATA messages received"), 1,
-                              GNUNET_NO);
-    if (msize < sizeof(struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage))
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Size of packet is too small (%llu bytes < %llu)\n",
-           (unsigned long long) msize,
-           (unsigned long long) sizeof(struct
-                                       
GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage));
-      break;
-    }
-    rxinfo = (const struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage *) hdr;
-
-    /* check if message is actually for us */
-    if (0 != memcmp (&rxinfo->frame.addr3, &mac_bssid_gnunet,
-                     sizeof(struct GNUNET_TRANSPORT_WLAN_MacAddress)))
-    {
-      /* Not the GNUnet BSSID */
-      break;
-    }
-    if ((0 != memcmp (&rxinfo->frame.addr1, &bc_all_mac,
-                      sizeof(struct GNUNET_TRANSPORT_WLAN_MacAddress))) &&
-        (0 != memcmp (&rxinfo->frame.addr1, &plugin->mac_address,
-                      sizeof(struct GNUNET_TRANSPORT_WLAN_MacAddress))))
-    {
-      /* Neither broadcast nor specifically for us */
-      break;
-    }
-    if (0 == memcmp (&rxinfo->frame.addr2, &plugin->mac_address,
-                     sizeof(struct GNUNET_TRANSPORT_WLAN_MacAddress)))
-    {
-      /* packet is FROM us, thus not FOR us */
-      break;
-    }
-
-    GNUNET_STATISTICS_update (plugin->env->stats,
-                              _ ("# DATA messages processed"),
-                              1, GNUNET_NO);
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Receiving %u bytes of data from MAC `%s'\n",
-         (unsigned int) (msize - sizeof(struct
-                                        
GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)),
-         mac_to_string (&rxinfo->frame.addr2));
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Receiving %u bytes of data to MAC `%s'\n",
-         (unsigned int) (msize - sizeof(struct
-                                        
GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)),
-         mac_to_string (&rxinfo->frame.addr1));
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Receiving %u bytes of data with BSSID MAC `%s'\n",
-         (unsigned int) (msize - sizeof(struct
-                                        
GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)),
-         mac_to_string (&rxinfo->frame.addr3));
-    wa.mac = rxinfo->frame.addr2;
-    wa.options = htonl (0);
-    mas.endpoint = create_macendpoint (plugin, &wa);
-    mas.session = NULL;
-    (void) GNUNET_SERVER_mst_receive (plugin->helper_payload_tokenizer,
-                                      &mas,
-                                      (const char *) &rxinfo[1],
-                                      msize - sizeof(struct
-                                                     
GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage),
-                                      GNUNET_YES, GNUNET_NO);
-    break;
-
-  default:
-    GNUNET_break (0);
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Unexpected message of type %u (%u bytes)",
-         ntohs (hdr->type),
-         ntohs (hdr->size));
-    break;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Another peer has suggested an address for this
- * peer and transport plugin.  Check that this could be a valid
- * address.  If so, consider adding it to the list
- * of addresses.
- *
- * @param cls closure
- * @param addr pointer to the address
- * @param addrlen length of @a addr
- * @return #GNUNET_OK if this is a plausible address for this peer
- *         and transport
- */
-static int
-wlan_plugin_address_suggested (void *cls,
-                               const void *addr,
-                               size_t addrlen)
-{
-  struct Plugin *plugin = cls;
-  struct WlanAddress *wa = (struct WlanAddress *) addr;
-
-  if (addrlen != sizeof(struct WlanAddress))
-  {
-    GNUNET_break_op (0);
-    return GNUNET_SYSERR;
-  }
-  if (GNUNET_YES != plugin->have_mac)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Rejecting MAC `%s': I don't know my MAC!\n",
-         mac_to_string (addr));
-    return GNUNET_NO;   /* don't know my MAC */
-  }
-  if (0 != memcmp (&wa->mac,
-                   &plugin->mac_address,
-                   sizeof(wa->mac)))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Rejecting MAC `%s': not my MAC!\n",
-         mac_to_string (addr));
-    return GNUNET_NO;   /* not my MAC */
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Convert the transports address to a nice, human-readable format.
- *
- * @param cls closure
- * @param type name of the transport that generated the address
- * @param addr one of the addresses of the host, NULL for the last address
- *        the specific address format depends on the transport
- * @param addrlen length of the address
- * @param numeric should (IP) addresses be displayed in numeric form?
- * @param timeout after how long should we give up?
- * @param asc function to call on each string
- * @param asc_cls closure for @a asc
- */
-static void
-wlan_plugin_address_pretty_printer (void *cls,
-                                    const char *type,
-                                    const void *addr,
-                                    size_t addrlen,
-                                    int numeric,
-                                    struct GNUNET_TIME_Relative timeout,
-                                    GNUNET_TRANSPORT_AddressStringCallback asc,
-                                    void *asc_cls)
-{
-  const char *ret;
-
-  if (sizeof(struct WlanAddress) == addrlen)
-    ret = wlan_plugin_address_to_string (NULL,
-                                         addr,
-                                         addrlen);
-  else
-    ret = NULL;
-  asc (asc_cls,
-       ret,
-       (NULL == ret) ? GNUNET_SYSERR : GNUNET_OK);
-  asc (asc_cls, NULL, GNUNET_OK);
-}
-
-
-/**
- * Exit point from the plugin.
- *
- * @param cls pointer to the api struct
- */
-void *
-LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls)
-{
-  struct WlanAddress wa;
-  struct GNUNET_HELLO_Address *address;
-  struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
-  struct Plugin *plugin = api->cls;
-  struct MacEndpoint *endpoint;
-  struct MacEndpoint *endpoint_next;
-
-  if (NULL == plugin)
-  {
-    GNUNET_free (api);
-    return NULL;
-  }
-  if (GNUNET_YES == plugin->have_mac)
-  {
-    memset (&wa, 0, sizeof(wa));
-    wa.options = htonl (plugin->options);
-    wa.mac = plugin->mac_address;
-    address = GNUNET_HELLO_address_allocate (plugin->env->my_identity,
-                                             PLUGIN_NAME,
-                                             &wa, sizeof(struct WlanAddress),
-                                             GNUNET_HELLO_ADDRESS_INFO_NONE);
-
-    plugin->env->notify_address (plugin->env->cls,
-                                 GNUNET_NO,
-                                 address);
-    plugin->have_mac = GNUNET_NO;
-    GNUNET_HELLO_address_free (address);
-  }
-
-  if (NULL != plugin->beacon_task)
-  {
-    GNUNET_SCHEDULER_cancel (plugin->beacon_task);
-    plugin->beacon_task = NULL;
-  }
-  if (NULL != plugin->suid_helper)
-  {
-    GNUNET_HELPER_stop (plugin->suid_helper,
-                        GNUNET_NO);
-    plugin->suid_helper = NULL;
-  }
-  endpoint_next = plugin->mac_head;
-  while (NULL != (endpoint = endpoint_next))
-  {
-    endpoint_next = endpoint->next;
-    free_macendpoint (endpoint);
-  }
-  if (NULL != plugin->fragment_data_tokenizer)
-  {
-    GNUNET_SERVER_mst_destroy (plugin->fragment_data_tokenizer);
-    plugin->fragment_data_tokenizer = NULL;
-  }
-  if (NULL != plugin->wlan_header_payload_tokenizer)
-  {
-    GNUNET_SERVER_mst_destroy (plugin->wlan_header_payload_tokenizer);
-    plugin->wlan_header_payload_tokenizer = NULL;
-  }
-  if (NULL != plugin->helper_payload_tokenizer)
-  {
-    GNUNET_SERVER_mst_destroy (plugin->helper_payload_tokenizer);
-    plugin->helper_payload_tokenizer = NULL;
-  }
-  GNUNET_free (plugin->wlan_interface);
-  GNUNET_free (plugin);
-  GNUNET_free (api);
-  return NULL;
-}
-
-
-/**
- * Function called to convert a string address to
- * a binary address.
- *
- * @param cls closure (`struct Plugin *`)
- * @param addr string address
- * @param addrlen length of the address
- * @param buf location to store the buffer
- * @param added location to store the number of bytes in the buffer.
- *        If the function returns #GNUNET_SYSERR, its contents are undefined.
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
-static int
-wlan_plugin_string_to_address (void *cls,
-                               const char *addr,
-                               uint16_t addrlen,
-                               void **buf,
-                               size_t *added)
-{
-  struct WlanAddress *wa;
-  unsigned int a[6];
-  unsigned int i;
-  char plugin[5];
-  uint32_t options;
-
-  if ((NULL == addr) || (0 == addrlen))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if ('\0' != addr[addrlen - 1])
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if (strlen (addr) != addrlen - 1)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-
-  if (8 != sscanf (addr,
-                   "%4s.%u.%X:%X:%X:%X:%X:%X",
-                   plugin, &options,
-                   &a[0], &a[1], &a[2],
-                   &a[3], &a[4], &a[5]))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  wa = GNUNET_new (struct WlanAddress);
-  for (i = 0; i < 6; i++)
-    wa->mac.mac[i] = a[i];
-  wa->options = htonl (0);
-  *buf = wa;
-  *added = sizeof(struct WlanAddress);
-  return GNUNET_OK;
-}
-
-
-/**
- * Begin monitoring sessions of a plugin.  There can only
- * be one active monitor per plugin (i.e. if there are
- * multiple monitors, the transport service needs to
- * multiplex the generated events over all of them).
- *
- * @param cls closure of the plugin
- * @param sic callback to invoke, NULL to disable monitor;
- *            plugin will being by iterating over all active
- *            sessions immediately and then enter monitor mode
- * @param sic_cls closure for @a sic
- */
-static void
-wlan_plugin_setup_monitor (void *cls,
-                           GNUNET_TRANSPORT_SessionInfoCallback sic,
-                           void *sic_cls)
-{
-  struct Plugin *plugin = cls;
-  struct MacEndpoint *mac;
-  struct GNUNET_ATS_Session *session;
-
-  plugin->sic = sic;
-  plugin->sic_cls = sic_cls;
-  if (NULL != sic)
-  {
-    for (mac = plugin->mac_head; NULL != mac; mac = mac->next)
-      for (session = mac->sessions_head; NULL != session; session =
-             session->next)
-      {
-        notify_session_monitor (plugin,
-                                session,
-                                GNUNET_TRANSPORT_SS_INIT);
-        notify_session_monitor (plugin,
-                                session,
-                                GNUNET_TRANSPORT_SS_UP);
-      }
-    sic (sic_cls, NULL, NULL);
-  }
-}
-
-
-/**
- * Function that will be called whenever the transport service wants to
- * notify the plugin that a session is still active and in use and
- * therefore the session timeout for this session has to be updated
- *
- * @param cls closure
- * @param peer which peer was the session for
- * @param session which session is being updated
- */
-static void
-wlan_plugin_update_session_timeout (void *cls,
-                                    const struct GNUNET_PeerIdentity *peer,
-                                    struct GNUNET_ATS_Session *session)
-{
-  GNUNET_assert (NULL != session->timeout_task);
-  session->timeout = GNUNET_TIME_relative_to_absolute (
-    GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-}
-
-
-/**
- * Function that will be called whenever the transport service wants to
- * notify the plugin that the inbound quota changed and that the plugin
- * should update it's delay for the next receive value
- *
- * @param cls closure
- * @param peer which peer was the session for
- * @param session which session is being updated
- * @param delay new delay to use for receiving
- */
-static void
-wlan_plugin_update_inbound_delay (void *cls,
-                                  const struct GNUNET_PeerIdentity *peer,
-                                  struct GNUNET_ATS_Session *session,
-                                  struct GNUNET_TIME_Relative delay)
-{
-  /* does nothing, as inbound delay is not supported by WLAN */
-}
-
-
-/**
- * Entry point for the plugin.
- *
- * @param cls closure, the `struct GNUNET_TRANSPORT_PluginEnvironment *`
- * @return the `struct GNUNET_TRANSPORT_PluginFunctions *` or NULL on error
- */
-void *
-LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginEnvironment *env = cls;
-  struct GNUNET_TRANSPORT_PluginFunctions *api;
-  struct Plugin *plugin;
-  char *wlan_interface;
-  unsigned long long testmode;
-  char *binary;
-
-  /* check for 'special' mode */
-  if (NULL == env->receive)
-  {
-    /* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully
-       initialize the plugin or the API */
-    api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-    api->cls = NULL;
-    api->address_pretty_printer = &wlan_plugin_address_pretty_printer;
-    api->address_to_string = &wlan_plugin_address_to_string;
-    api->string_to_address = &wlan_plugin_string_to_address;
-    return api;
-  }
-
-  testmode = 0;
-  /* check configuration */
-  if ((GNUNET_YES ==
-       GNUNET_CONFIGURATION_have_value (env->cfg,
-                                        CONFIG_NAME,
-                                        "TESTMODE")) &&
-      ((GNUNET_SYSERR ==
-        GNUNET_CONFIGURATION_get_value_number (env->cfg,
-                                               CONFIG_NAME,
-                                               "TESTMODE",
-                                               &testmode)) ||
-       (testmode > 2)))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               CONFIG_NAME,
-                               "TESTMODE");
-    return NULL;
-  }
-  binary = GNUNET_OS_get_libexec_binary_path (HELPER_NAME);
-  if ((0 == testmode) &&
-      (GNUNET_YES !=
-       GNUNET_OS_check_helper_binary (binary,
-                                      GNUNET_YES,
-                                      NULL)))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ ("Helper binary `%s' not SUID, cannot run WLAN transport\n"),
-         HELPER_NAME);
-    GNUNET_free (binary);
-    return NULL;
-  }
-  GNUNET_free (binary);
-  if (GNUNET_YES !=
-      GNUNET_CONFIGURATION_get_value_string (env->cfg,
-                                             CONFIG_NAME,
-                                             "INTERFACE",
-                                             &wlan_interface))
-  {
-    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
-                               CONFIG_NAME,
-                               "INTERFACE");
-    return NULL;
-  }
-
-  plugin = GNUNET_new (struct Plugin);
-  plugin->wlan_interface = wlan_interface;
-  plugin->env = env;
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         _ ("# sessions allocated"),
-                         0, GNUNET_NO);
-  GNUNET_STATISTICS_set (plugin->env->stats,
-                         _ ("# MAC endpoints allocated"),
-                         0, 0);
-  GNUNET_BANDWIDTH_tracker_init (&plugin->tracker, NULL, NULL,
-                                 GNUNET_BANDWIDTH_value_init (100 * 1024
-                                                              * 1024 / 8),
-                                 100);
-  plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data,
-                                                              plugin);
-  plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (
-    &process_data,
-    plugin);
-  plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data,
-                                                               plugin);
-
-  plugin->options = 0;
-
-  /* some compilers do not like switch on 'long long'... */
-  switch ((unsigned int) testmode)
-  {
-  case 0:   /* normal */
-    plugin->helper_argv[0] = (char *) HELPER_NAME;
-    plugin->helper_argv[1] = wlan_interface;
-    plugin->helper_argv[2] = NULL;
-    plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
-                                               HELPER_NAME,
-                                               plugin->helper_argv,
-                                               &handle_helper_message,
-                                               NULL,
-                                               plugin);
-    break;
-
-  case 1:   /* testmode, peer 1 */
-    plugin->helper_argv[0] = (char *) DUMMY_HELPER_NAME;
-    plugin->helper_argv[1] = (char *) "1";
-    plugin->helper_argv[2] = NULL;
-    plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
-                                               DUMMY_HELPER_NAME,
-                                               plugin->helper_argv,
-                                               &handle_helper_message,
-                                               NULL,
-                                               plugin);
-    break;
-
-  case 2:   /* testmode, peer 2 */
-    plugin->helper_argv[0] = (char *) DUMMY_HELPER_NAME;
-    plugin->helper_argv[1] = (char *) "2";
-    plugin->helper_argv[2] = NULL;
-    plugin->suid_helper = GNUNET_HELPER_start (GNUNET_NO,
-                                               DUMMY_HELPER_NAME,
-                                               plugin->helper_argv,
-                                               &handle_helper_message,
-                                               NULL,
-                                               plugin);
-    break;
-
-  default:
-    GNUNET_assert (0);
-  }
-
-  api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
-  api->cls = plugin;
-  api->send = &wlan_plugin_send;
-  api->get_session = &wlan_plugin_get_session;
-  api->disconnect_peer = &wlan_plugin_disconnect_peer;
-  api->disconnect_session = &wlan_plugin_disconnect_session;
-  api->query_keepalive_factor = &wlan_plugin_query_keepalive_factor;
-  api->address_pretty_printer = &wlan_plugin_address_pretty_printer;
-  api->check_address = &wlan_plugin_address_suggested;
-  api->address_to_string = &wlan_plugin_address_to_string;
-  api->string_to_address = &wlan_plugin_string_to_address;
-  api->get_network = &wlan_plugin_get_network;
-  api->get_network_for_address = &wlan_plugin_get_network_for_address;
-  api->update_session_timeout = &wlan_plugin_update_session_timeout;
-  api->update_inbound_delay = &wlan_plugin_update_inbound_delay;
-  api->setup_monitor = &wlan_plugin_setup_monitor;
-  return api;
-}
-
-
-/* end of plugin_transport_wlan.c */
diff --git a/src/transport/plugin_transport_wlan.h 
b/src/transport/plugin_transport_wlan.h
deleted file mode 100644
index 6cb11f648..000000000
--- a/src/transport/plugin_transport_wlan.h
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
-   This file is part of GNUnet
-   Copyright (C) 2010, 2011 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/plugin_transport_wlan.h
- * @brief header for transport plugin and the helper for wlan
- * @author David Brodski
- */
-#ifndef PLUGIN_TRANSPORT_WLAN
-#define PLUGIN_TRANSPORT_WLAN
-
-#include "gnunet_util_lib.h"
-#include "gnunet_common.h"
-
-/**
- * Number fo bytes in a mac address.
- */
-#define MAC_ADDR_SIZE 6
-
-/**
- * Value for "Management" in the 'frame_control' field of the
- * struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame.
- */
-#define IEEE80211_FC0_TYPE_MGT                  0x00
-
-/**
- * Value for "Control" in the 'frame_control' field of the
- * struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame.
- */
-#define IEEE80211_FC0_TYPE_CTL                  0x04
-
-/**
- * Value for DATA in the 'frame_control' field of the
- * struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame.
- */
-#define IEEE80211_FC0_TYPE_DATA                 0x08
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * A MAC Address.
- */
-struct GNUNET_TRANSPORT_WLAN_MacAddress
-{
-  uint8_t mac[MAC_ADDR_SIZE];
-};
-
-/**
- * Format of a WLAN Control Message.
- */
-struct GNUNET_TRANSPORT_WLAN_HelperControlMessage
-{
-  /**
-   * Message header.  Type is
-   * GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL
-   */
-  struct GNUNET_MessageHeader hdr;
-
-  /**
-   * MAC Address of the local WLAN interface.
-   */
-  struct GNUNET_TRANSPORT_WLAN_MacAddress mac;
-};
-
-/**
- * generic definitions for IEEE 802.3 frames
- */
-struct GNUNET_TRANSPORT_WLAN_Ieee8023Frame
-{
-  /**
-   * Address 1: destination address in ad-hoc mode or AP, BSSID if station,
-   */
-  struct GNUNET_TRANSPORT_WLAN_MacAddress dst;
-
-  /**
-   * Address 2: source address if in ad-hoc-mode or station, BSSID if AP
-   */
-  struct GNUNET_TRANSPORT_WLAN_MacAddress src;
-
-  /**
-   * Packet type ID.
-   */
-  uint16_t type;
-};
-
-
-/**
- * generic definitions for IEEE 802.11 frames
- */
-struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame
-{
-  /**
-   * 802.11 Frame Control field.  A bitmask.  The overall field is a
-   * 16-bit mask of the respective fields.  The lowest two bits should
-   * be 0, then comes the "type" (2 bits, see IEEE80211_FC0_TYPE_*
-   * constants), followed by 4-bit subtype (all zeros for ad-hoc),
-   * followed by various flags (to DS, from DS, more frag, retry,
-   * power management, more data, WEP, strict), all of which we also
-   * keep at zero.
-   */
-  uint16_t frame_control GNUNET_PACKED;
-
-  /**
-   * Microseconds to reserve link (duration), 0 by default
-   */
-  uint16_t duration GNUNET_PACKED;
-
-  /**
-   * Address 1: destination address in ad-hoc mode or AP, BSSID if station,
-   */
-  struct GNUNET_TRANSPORT_WLAN_MacAddress addr1;
-
-  /**
-   * Address 2: source address if in ad-hoc-mode or station, BSSID if AP
-   */
-  struct GNUNET_TRANSPORT_WLAN_MacAddress addr2;
-
-  /**
-   * Address 3: BSSID in ad-hoc mode, Destination if station, source if AP
-   */
-  struct GNUNET_TRANSPORT_WLAN_MacAddress addr3;
-
-  /**
-   * 802.11 sequence control field; contains fragment number an sequence
-   * number (we set this to all zeros).
-   */
-  uint16_t sequence_control GNUNET_PACKED;
-
-  /**
-   * Link layer control (LLC).  Set to a GNUnet-specific value.
-   */
-  u_int8_t llc[4];
-
-  /* payload */
-} GNUNET_PACKED;
-
-
-/**
- * Message from the plugin to the WLAN helper: send the given message with the
- * given connection parameters.
- */
-struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage
-{
-  /**
-   * Type is 'GNUNET_MESSAGE_TYPE_WLAN_DATA_TO_HELPER'.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * wlan send rate
-   */
-  uint8_t rate;
-
-  /**
-   * Antenna; the first antenna is 0.
-   */
-  uint8_t antenna;
-
-  /**
-   * Transmit power expressed as unitless distance from max power set at 
factory calibration.
-   * 0 is max power. Monotonically nondecreasing with lower power levels.
-   */
-  uint16_t tx_power GNUNET_PACKED;
-
-  /**
-   * IEEE Frame to transmit (the sender MAC address will be overwritten by the 
helper as it does not
-   * trust the plugin to set it correctly).
-   */
-  struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame frame;
-
-  /* actual payload follows */
-};
-
-
-/**
- * Message from the WLAN helper to the plugin: we have received the given 
message with the
- * given performance characteristics.
- */
-/**
- * struct to represent infos gathered form the radiotap fields, see 
RadiotapHeader for more Infos
- */
-struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage
-{
-  /**
-   * Type is 'GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER'.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Information about which of the fields below are actually valid.
-   * 0 for none.  FIXME: not properly initialized so far (always zero).
-   */
-  uint32_t ri_present GNUNET_PACKED;
-
-  /**
-   * IEEE80211_RADIOTAP_TSFT, 0 if unknown.
-   */
-  uint64_t ri_mactime GNUNET_PACKED;
-
-  /**
-   * from radiotap
-   * either IEEE80211_RADIOTAP_DBM_ANTSIGNAL
-   * or IEEE80211_RADIOTAP_DB_ANTSIGNAL, 0 if unknown.
-   */
-  int32_t ri_power GNUNET_PACKED;
-
-  /**
-   * either IEEE80211_RADIOTAP_DBM_ANTNOISE
-   * or IEEE80211_RADIOTAP_DB_ANTNOISE, 0 if unknown.
-   */
-  int32_t ri_noise GNUNET_PACKED;
-
-  /**
-   * IEEE80211_RADIOTAP_CHANNEL, 0 if unknown.
-   */
-  uint32_t ri_channel GNUNET_PACKED;
-
-  /**
-   * Frequency we use.  0 if unknown.
-   */
-  uint32_t ri_freq GNUNET_PACKED;
-
-  /**
-   * IEEE80211_RADIOTAP_RATE * 50000, 0 if unknown.
-   */
-  uint32_t ri_rate GNUNET_PACKED;
-
-  /**
-   * IEEE80211_RADIOTAP_ANTENNA, 0 if unknown.
-   */
-  uint32_t ri_antenna GNUNET_PACKED;
-
-  /**
-   * IEEE Frame.
-   */
-  struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame frame;
-
-  /* followed by payload */
-};
-
-GNUNET_NETWORK_STRUCT_END
-
-/**
- * GNUnet bssid
- */
-static const struct GNUNET_TRANSPORT_WLAN_MacAddress mac_bssid_gnunet = {
-  { 0x13, 0x22, 0x33, 0x44, 0x55, 0x66 }
-};
-
-
-/**
- * Broadcast MAC
- */
-static const struct GNUNET_TRANSPORT_WLAN_MacAddress bc_all_mac = {
-  { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
-};
-
-#endif
diff --git a/src/transport/tcp_connection_legacy.c 
b/src/transport/tcp_connection_legacy.c
deleted file mode 100644
index 551e79055..000000000
--- a/src/transport/tcp_connection_legacy.c
+++ /dev/null
@@ -1,1597 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009-2013 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file util/connection.c
- * @brief  TCP connection management
- * @author Christian Grothoff
- *
- * This code is rather complex.  Only modify it if you
- * 1) Have a NEW testcase showing that the new code
- *    is needed and correct
- * 2) All EXISTING testcases pass with the new code
- * These rules should apply in general, but for this
- * module they are VERY, VERY important.
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_resolver_service.h"
-
-
-/**
- * Timeout we use on TCP connect before trying another
- * result from the DNS resolver.  Actual value used
- * is this value divided by the number of address families.
- * Default is 5s.
- */
-#define CONNECT_RETRY_TIMEOUT \
-  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
-
-
-#define LOG_STRERROR(kind, syscall) \
-  GNUNET_log_from_strerror (kind, "util-connection", syscall)
-
-
-/**
- * Transmission handle.  There can only be one for each connection.
- */
-struct GNUNET_CONNECTION_TransmitHandle
-{
-  /**
-   * Function to call if the send buffer has notify_size
-   * bytes available.
-   */
-  GNUNET_CONNECTION_TransmitReadyNotify notify_ready;
-
-  /**
-   * Closure for notify_ready.
-   */
-  void *notify_ready_cls;
-
-  /**
-   * Our connection handle.
-   */
-  struct GNUNET_CONNECTION_Handle *connection;
-
-  /**
-   * Timeout for receiving (in absolute time).
-   */
-  struct GNUNET_TIME_Absolute transmit_timeout;
-
-  /**
-   * Task called on timeout.
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * At what number of bytes available in the
-   * write buffer should the notify method be called?
-   */
-  size_t notify_size;
-};
-
-
-/**
- * During connect, we try multiple possible IP addresses
- * to find out which one might work.
- */
-struct AddressProbe
-{
-  /**
-   * This is a linked list.
-   */
-  struct AddressProbe *next;
-
-  /**
-   * This is a doubly-linked list.
-   */
-  struct AddressProbe *prev;
-
-  /**
-   * The address; do not free (allocated at the end of this struct).
-   */
-  const struct sockaddr *addr;
-
-  /**
-   * Underlying OS's socket.
-   */
-  struct GNUNET_NETWORK_Handle *sock;
-
-  /**
-   * Connection for which we are probing.
-   */
-  struct GNUNET_CONNECTION_Handle *connection;
-
-  /**
-   * Length of addr.
-   */
-  socklen_t addrlen;
-
-  /**
-   * Task waiting for the connection to finish connecting.
-   */
-  struct GNUNET_SCHEDULER_Task *task;
-};
-
-
-/**
- * @brief handle for a network connection
- */
-struct GNUNET_CONNECTION_Handle
-{
-  /**
-   * Configuration to use.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Linked list of sockets we are currently trying out
-   * (during connect).
-   */
-  struct AddressProbe *ap_head;
-
-  /**
-   * Linked list of sockets we are currently trying out
-   * (during connect).
-   */
-  struct AddressProbe *ap_tail;
-
-  /**
-   * Network address of the other end-point, may be NULL.
-   */
-  struct sockaddr *addr;
-
-  /**
-   * Pointer to the hostname if connection was
-   * created using DNS lookup, otherwise NULL.
-   */
-  char *hostname;
-
-  /**
-   * Underlying OS's socket, set to NULL after fatal errors.
-   */
-  struct GNUNET_NETWORK_Handle *sock;
-
-  /**
-   * Function to call on data received, NULL if no receive is pending.
-   */
-  GNUNET_CONNECTION_Receiver receiver;
-
-  /**
-   * Closure for @e receiver.
-   */
-  void *receiver_cls;
-
-  /**
-   * Pointer to our write buffer.
-   */
-  char *write_buffer;
-
-  /**
-   * Current size of our @e write_buffer.
-   */
-  size_t write_buffer_size;
-
-  /**
-   * Current write-offset in @e write_buffer (where
-   * would we write next).
-   */
-  size_t write_buffer_off;
-
-  /**
-   * Current read-offset in @e write_buffer (how many
-   * bytes have already been sent).
-   */
-  size_t write_buffer_pos;
-
-  /**
-   * Length of @e addr.
-   */
-  socklen_t addrlen;
-
-  /**
-   * Read task that we may need to wait for.
-   */
-  struct GNUNET_SCHEDULER_Task *read_task;
-
-  /**
-   * Write task that we may need to wait for.
-   */
-  struct GNUNET_SCHEDULER_Task *write_task;
-
-  /**
-   * Handle to a pending DNS lookup request.
-   */
-  struct GNUNET_RESOLVER_RequestHandle *dns_active;
-
-  /**
-   * The handle we return for #GNUNET_CONNECTION_notify_transmit_ready().
-   */
-  struct GNUNET_CONNECTION_TransmitHandle nth;
-
-  /**
-   * Timeout for receiving (in absolute time).
-   */
-  struct GNUNET_TIME_Absolute receive_timeout;
-
-  /**
-   * Maximum number of bytes to read (for receiving).
-   */
-  size_t max;
-
-  /**
-   * Port to connect to.
-   */
-  uint16_t port;
-
-  /**
-   * When shutdown, do not ever actually close the socket, but
-   * free resources.  Only should ever be set if using program
-   * termination as a signal (because only then will the leaked
-   * socket be freed!)
-   */
-  int8_t persist;
-
-  /**
-   * Usually 0.  Set to 1 if this handle is in use, and should
-   * #GNUNET_CONNECTION_destroy() be called right now, the action needs
-   * to be deferred by setting it to -1.
-   */
-  int8_t destroy_later;
-
-  /**
-   * Handle to subsequent connection after proxy handshake completes,
-   */
-  struct GNUNET_CONNECTION_Handle *proxy_handshake;
-};
-
-
-/**
- * Set the persist option on this connection handle.  Indicates
- * that the underlying socket or fd should never really be closed.
- * Used for indicating process death.
- *
- * @param connection the connection to set persistent
- */
-void
-GNUNET_CONNECTION_persist_ (struct GNUNET_CONNECTION_Handle *connection)
-{
-  connection->persist = GNUNET_YES;
-}
-
-
-/**
- * Disable the "CORK" feature for communication with the given connection,
- * forcing the OS to immediately flush the buffer on transmission
- * instead of potentially buffering multiple messages.  Essentially
- * reduces the OS send buffers to zero.
- * Used to make sure that the last messages sent through the connection
- * reach the other side before the process is terminated.
- *
- * @param connection the connection to make flushing and blocking
- * @return #GNUNET_OK on success
- */
-int
-GNUNET_CONNECTION_disable_corking (struct GNUNET_CONNECTION_Handle *connection)
-{
-  return GNUNET_NETWORK_socket_disable_corking (connection->sock);
-}
-
-
-/**
- * Create a connection handle by boxing an existing OS socket.  The OS
- * socket should henceforth be no longer used directly.
- * #GNUNET_connection_destroy() will close it.
- *
- * @param osSocket existing socket to box
- * @return the boxed connection handle
- */
-struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_create_from_existing (struct GNUNET_NETWORK_Handle *osSocket)
-{
-  struct GNUNET_CONNECTION_Handle *connection;
-
-  connection = GNUNET_new (struct GNUNET_CONNECTION_Handle);
-  connection->write_buffer_size = GNUNET_MIN_MESSAGE_SIZE;
-  connection->write_buffer = GNUNET_malloc (connection->write_buffer_size);
-  connection->sock = osSocket;
-  return connection;
-}
-
-
-/**
- * Create a connection handle by accepting on a listen socket.  This
- * function may block if the listen socket has no connection ready.
- *
- * @param access_cb function to use to check if access is allowed
- * @param access_cb_cls closure for @a access_cb
- * @param lsock listen socket
- * @return the connection handle, NULL on error
- */
-struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access_cb,
-                                      void *access_cb_cls,
-                                      struct GNUNET_NETWORK_Handle *lsock)
-{
-  struct GNUNET_CONNECTION_Handle *connection;
-  char addr[128];
-  socklen_t addrlen;
-  struct GNUNET_NETWORK_Handle *sock;
-  int aret;
-  struct sockaddr_in *v4;
-  struct sockaddr_in6 *v6;
-  struct sockaddr *sa;
-  void *uaddr;
-
-#ifdef SO_PEERCRED
-  struct ucred uc;
-  socklen_t olen;
-#endif
-  struct GNUNET_CONNECTION_Credentials *gcp;
-#if HAVE_GETPEEREID || defined(SO_PEERCRED) || HAVE_GETPEERUCRED
-  struct GNUNET_CONNECTION_Credentials gc;
-
-  gc.uid = 0;
-  gc.gid = 0;
-#endif
-
-  addrlen = sizeof(addr);
-  sock =
-    GNUNET_NETWORK_socket_accept (lsock, (struct sockaddr *) &addr, &addrlen);
-  if (NULL == sock)
-  {
-    if (EAGAIN != errno)
-      LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "accept");
-    return NULL;
-  }
-  if ((addrlen > sizeof(addr)) || (addrlen < sizeof(sa_family_t)))
-  {
-    GNUNET_break (0);
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
-    return NULL;
-  }
-
-  sa = (struct sockaddr *) addr;
-  v6 = (struct sockaddr_in6 *) addr;
-  if ((AF_INET6 == sa->sa_family) && (IN6_IS_ADDR_V4MAPPED (&v6->sin6_addr)))
-  {
-    /* convert to V4 address */
-    v4 = GNUNET_new (struct sockaddr_in);
-    memset (v4, 0, sizeof(struct sockaddr_in));
-    v4->sin_family = AF_INET;
-#if HAVE_SOCKADDR_IN_SIN_LEN
-    v4->sin_len = (u_char) sizeof(struct sockaddr_in);
-#endif
-    GNUNET_memcpy (&v4->sin_addr,
-                   &((char *) &v6->sin6_addr)[sizeof(struct in6_addr)
-                                              - sizeof(struct in_addr)],
-                   sizeof(struct in_addr));
-    v4->sin_port = v6->sin6_port;
-    uaddr = v4;
-    addrlen = sizeof(struct sockaddr_in);
-  }
-  else
-  {
-    uaddr = GNUNET_malloc (addrlen);
-    GNUNET_memcpy (uaddr, addr, addrlen);
-  }
-  gcp = NULL;
-  if (AF_UNIX == sa->sa_family)
-  {
-#if HAVE_GETPEEREID
-    /* most BSDs */
-    if (0 == getpeereid (GNUNET_NETWORK_get_fd (sock), &gc.uid, &gc.gid))
-      gcp = &gc;
-#else
-#ifdef SO_PEERCRED
-    /* largely traditional GNU/Linux */
-    olen = sizeof(uc);
-    if ((0 == getsockopt (GNUNET_NETWORK_get_fd (sock),
-                          SOL_SOCKET,
-                          SO_PEERCRED,
-                          &uc,
-                          &olen)) &&
-        (olen == sizeof(uc)))
-    {
-      gc.uid = uc.uid;
-      gc.gid = uc.gid;
-      gcp = &gc;
-    }
-#else
-#if HAVE_GETPEERUCRED
-    /* this is for Solaris 10 */
-    ucred_t *uc;
-
-    uc = NULL;
-    if (0 == getpeerucred (GNUNET_NETWORK_get_fd (sock), &uc))
-    {
-      gc.uid = ucred_geteuid (uc);
-      gc.gid = ucred_getegid (uc);
-      gcp = &gc;
-    }
-    ucred_free (uc);
-#endif
-#endif
-#endif
-  }
-
-  if ((NULL != access_cb) &&
-      (GNUNET_YES != (aret = access_cb (access_cb_cls, gcp, uaddr, addrlen))))
-  {
-    if (GNUNET_NO == aret)
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           _ ("Access denied to `%s'\n"),
-           GNUNET_a2s (uaddr, addrlen));
-    GNUNET_break (GNUNET_OK ==
-                  GNUNET_NETWORK_socket_shutdown (sock, SHUT_RDWR));
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
-    GNUNET_free (uaddr);
-    return NULL;
-  }
-  connection = GNUNET_new (struct GNUNET_CONNECTION_Handle);
-  connection->write_buffer_size = GNUNET_MIN_MESSAGE_SIZE;
-  connection->write_buffer = GNUNET_malloc (connection->write_buffer_size);
-  connection->addr = uaddr;
-  connection->addrlen = addrlen;
-  connection->sock = sock;
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       _ ("Accepting connection from `%s': %p\n"),
-       GNUNET_a2s (uaddr, addrlen),
-       connection);
-  return connection;
-}
-
-
-/**
- * Obtain the network address of the other party.
- *
- * @param connection the client to get the address for
- * @param addr where to store the address
- * @param addrlen where to store the length of the @a addr
- * @return #GNUNET_OK on success
- */
-int
-GNUNET_CONNECTION_get_address (struct GNUNET_CONNECTION_Handle *connection,
-                               void **addr,
-                               size_t *addrlen)
-{
-  if ((NULL == connection->addr) || (0 == connection->addrlen))
-    return GNUNET_NO;
-  *addr = GNUNET_malloc (connection->addrlen);
-  GNUNET_memcpy (*addr, connection->addr, connection->addrlen);
-  *addrlen = connection->addrlen;
-  return GNUNET_OK;
-}
-
-
-/**
- * Tell the receiver callback that we had an IO error.
- *
- * @param connection connection to signal error
- * @param errcode error code to send
- */
-static void
-signal_receive_error (struct GNUNET_CONNECTION_Handle *connection, int errcode)
-{
-  GNUNET_CONNECTION_Receiver receiver;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Receive encounters error (%s), connection closed (%p)\n",
-       strerror (errcode),
-       connection);
-  GNUNET_assert (NULL != (receiver = connection->receiver));
-  connection->receiver = NULL;
-  receiver (connection->receiver_cls,
-            NULL,
-            0,
-            connection->addr,
-            connection->addrlen,
-            errcode);
-}
-
-
-/**
- * Tell the receiver callback that a timeout was reached.
- *
- * @param connection connection to signal for
- */
-static void
-signal_receive_timeout (struct GNUNET_CONNECTION_Handle *connection)
-{
-  GNUNET_CONNECTION_Receiver receiver;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Connection signals timeout to receiver (%p)!\n",
-       connection);
-  GNUNET_assert (NULL != (receiver = connection->receiver));
-  connection->receiver = NULL;
-  receiver (connection->receiver_cls, NULL, 0, NULL, 0, 0);
-}
-
-
-/**
- * We failed to transmit data to the service, signal the error.
- *
- * @param connection handle that had trouble
- * @param ecode error code (errno)
- */
-static void
-signal_transmit_error (struct GNUNET_CONNECTION_Handle *connection, int ecode)
-{
-  GNUNET_CONNECTION_TransmitReadyNotify notify;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Transmission encountered error (%s), connection closed (%p)\n",
-       strerror (ecode),
-       connection);
-  if (NULL != connection->sock)
-  {
-    (void) GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR);
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (connection->sock));
-    connection->sock = NULL;
-    GNUNET_assert (NULL == connection->write_task);
-  }
-  if (NULL != connection->read_task)
-  {
-    /* send errors trigger read errors... */
-    GNUNET_SCHEDULER_cancel (connection->read_task);
-    connection->read_task = NULL;
-    signal_receive_timeout (connection);
-    return;
-  }
-  if (NULL == connection->nth.notify_ready)
-    return; /* nobody to tell about it */
-  notify = connection->nth.notify_ready;
-  connection->nth.notify_ready = NULL;
-  notify (connection->nth.notify_ready_cls, 0, NULL);
-}
-
-
-/**
- * We've failed for good to establish a connection (timeout or
- * no more addresses to try).
- *
- * @param connection the connection we tried to establish
- */
-static void
-connect_fail_continuation (struct GNUNET_CONNECTION_Handle *connection)
-{
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "Failed to establish TCP connection to `%s:%u', no further addresses to 
try.\n",
-       connection->hostname,
-       connection->port);
-  GNUNET_break (NULL == connection->ap_head);
-  GNUNET_break (NULL == connection->ap_tail);
-  GNUNET_break (GNUNET_NO == connection->dns_active);
-  GNUNET_break (NULL == connection->sock);
-  GNUNET_assert (NULL == connection->write_task);
-  GNUNET_assert (NULL == connection->proxy_handshake);
-
-  /* signal errors for jobs that used to wait on the connection */
-  connection->destroy_later = 1;
-  if (NULL != connection->receiver)
-    signal_receive_error (connection, ECONNREFUSED);
-  if (NULL != connection->nth.notify_ready)
-  {
-    GNUNET_assert (NULL != connection->nth.timeout_task);
-    GNUNET_SCHEDULER_cancel (connection->nth.timeout_task);
-    connection->nth.timeout_task = NULL;
-    signal_transmit_error (connection, ECONNREFUSED);
-  }
-  if (-1 == connection->destroy_later)
-  {
-    /* do it now */
-    connection->destroy_later = 0;
-    GNUNET_CONNECTION_destroy (connection);
-    return;
-  }
-  connection->destroy_later = 0;
-}
-
-
-/**
- * We are ready to transmit (or got a timeout).
- *
- * @param cls our connection handle
- */
-static void
-transmit_ready (void *cls);
-
-
-/**
- * This function is called once we either timeout or have data ready
- * to read.
- *
- * @param cls connection to read from
- */
-static void
-receive_ready (void *cls);
-
-
-/**
- * We've succeeded in establishing a connection.
- *
- * @param connection the connection we tried to establish
- */
-static void
-connect_success_continuation (struct GNUNET_CONNECTION_Handle *connection)
-{
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Connection to `%s' succeeded! (%p)\n",
-       GNUNET_a2s (connection->addr, connection->addrlen),
-       connection);
-  /* trigger jobs that waited for the connection */
-  if (NULL != connection->receiver)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Connection succeeded, starting with receiving data (%p)\n",
-         connection);
-    GNUNET_assert (NULL == connection->read_task);
-    connection->read_task =
-      GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_absolute_get_remaining (
-                                       connection->receive_timeout),
-                                     connection->sock,
-                                     &receive_ready,
-                                     connection);
-  }
-  if (NULL != connection->nth.notify_ready)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Connection succeeded, starting with sending data (%p)\n",
-         connection);
-    GNUNET_assert (connection->nth.timeout_task != NULL);
-    GNUNET_SCHEDULER_cancel (connection->nth.timeout_task);
-    connection->nth.timeout_task = NULL;
-    GNUNET_assert (connection->write_task == NULL);
-    connection->write_task =
-      GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_absolute_get_remaining (
-                                        connection->nth.transmit_timeout),
-                                      connection->sock,
-                                      &transmit_ready,
-                                      connection);
-  }
-}
-
-
-/**
- * Scheduler let us know that we're either ready to write on the
- * socket OR connect timed out.  Do the right thing.
- *
- * @param cls the `struct AddressProbe *` with the address that we are probing
- */
-static void
-connect_probe_continuation (void *cls)
-{
-  struct AddressProbe *ap = cls;
-  struct GNUNET_CONNECTION_Handle *connection = ap->connection;
-  const struct GNUNET_SCHEDULER_TaskContext *tc;
-  struct AddressProbe *pos;
-  int error;
-  socklen_t len;
-
-  GNUNET_assert (NULL != ap->sock);
-  GNUNET_CONTAINER_DLL_remove (connection->ap_head, connection->ap_tail, ap);
-  len = sizeof(error);
-  errno = 0;
-  error = 0;
-  tc = GNUNET_SCHEDULER_get_task_context ();
-  if ((0 == (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) ||
-      (GNUNET_OK != GNUNET_NETWORK_socket_getsockopt (ap->sock,
-                                                      SOL_SOCKET,
-                                                      SO_ERROR,
-                                                      &error,
-                                                      &len)) ||
-      (0 != error))
-  {
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (ap->sock));
-    GNUNET_free (ap);
-    if ((NULL == connection->ap_head) &&
-        (GNUNET_NO == connection->dns_active) &&
-        (NULL == connection->proxy_handshake))
-      connect_fail_continuation (connection);
-    return;
-  }
-  GNUNET_assert (NULL == connection->sock);
-  connection->sock = ap->sock;
-  GNUNET_assert (NULL == connection->addr);
-  connection->addr = GNUNET_malloc (ap->addrlen);
-  GNUNET_memcpy (connection->addr, ap->addr, ap->addrlen);
-  connection->addrlen = ap->addrlen;
-  GNUNET_free (ap);
-  /* cancel all other attempts */
-  while (NULL != (pos = connection->ap_head))
-  {
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (pos->sock));
-    GNUNET_SCHEDULER_cancel (pos->task);
-    GNUNET_CONTAINER_DLL_remove (connection->ap_head, connection->ap_tail, 
pos);
-    GNUNET_free (pos);
-  }
-  connect_success_continuation (connection);
-}
-
-
-/**
- * Try to establish a connection given the specified address.
- * This function is called by the resolver once we have a DNS reply.
- *
- * @param cls our `struct GNUNET_CONNECTION_Handle *`
- * @param addr address to try, NULL for "last call"
- * @param addrlen length of @a addr
- */
-static void
-try_connect_using_address (void *cls,
-                           const struct sockaddr *addr,
-                           socklen_t addrlen)
-{
-  struct GNUNET_CONNECTION_Handle *connection = cls;
-  struct AddressProbe *ap;
-  struct GNUNET_TIME_Relative delay;
-
-  if (NULL == addr)
-  {
-    connection->dns_active = NULL;
-    if ((NULL == connection->ap_head) && (NULL == connection->sock) &&
-        (NULL == connection->proxy_handshake))
-      connect_fail_continuation (connection);
-    return;
-  }
-  if (NULL != connection->sock)
-    return; /* already connected */
-  GNUNET_assert (NULL == connection->addr);
-  /* try to connect */
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Trying to connect using address `%s:%u/%s:%u'\n",
-       connection->hostname,
-       connection->port,
-       GNUNET_a2s (addr, addrlen),
-       connection->port);
-  ap = GNUNET_malloc (sizeof(struct AddressProbe) + addrlen);
-  ap->addr = (const struct sockaddr *) &ap[1];
-  GNUNET_memcpy (&ap[1], addr, addrlen);
-  ap->addrlen = addrlen;
-  ap->connection = connection;
-
-  switch (ap->addr->sa_family)
-  {
-  case AF_INET:
-    ((struct sockaddr_in *) ap->addr)->sin_port = htons (connection->port);
-    break;
-
-  case AF_INET6:
-    ((struct sockaddr_in6 *) ap->addr)->sin6_port = htons (connection->port);
-    break;
-
-  default:
-    GNUNET_break (0);
-    GNUNET_free (ap);
-    return;   /* not supported by us */
-  }
-  ap->sock = GNUNET_NETWORK_socket_create (ap->addr->sa_family, SOCK_STREAM, 
0);
-  if (NULL == ap->sock)
-  {
-    GNUNET_free (ap);
-    return;   /* not supported by OS */
-  }
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "Trying to connect to `%s' (%p)\n",
-       GNUNET_a2s (ap->addr, ap->addrlen),
-       connection);
-  if ((GNUNET_OK !=
-       GNUNET_NETWORK_socket_connect (ap->sock, ap->addr, ap->addrlen)) &&
-      (EINPROGRESS != errno))
-  {
-    /* maybe refused / unsupported address, try next */
-    LOG_STRERROR (GNUNET_ERROR_TYPE_INFO, "connect");
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (ap->sock));
-    GNUNET_free (ap);
-    return;
-  }
-  GNUNET_CONTAINER_DLL_insert (connection->ap_head, connection->ap_tail, ap);
-  delay = CONNECT_RETRY_TIMEOUT;
-  if (NULL != connection->nth.notify_ready)
-    delay = GNUNET_TIME_relative_min (delay,
-                                      GNUNET_TIME_absolute_get_remaining (
-                                        connection->nth.transmit_timeout));
-  if (NULL != connection->receiver)
-    delay = GNUNET_TIME_relative_min (delay,
-                                      GNUNET_TIME_absolute_get_remaining (
-                                        connection->receive_timeout));
-  ap->task = GNUNET_SCHEDULER_add_write_net (delay,
-                                             ap->sock,
-                                             &connect_probe_continuation,
-                                             ap);
-}
-
-
-/**
- * Create a connection handle by (asynchronously) connecting to a host.
- * This function returns immediately, even if the connection has not
- * yet been established.  This function only creates TCP connections.
- *
- * @param cfg configuration to use
- * @param hostname name of the host to connect to
- * @param port port to connect to
- * @return the connection handle
- */
-struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_create_from_connect (
-  const struct GNUNET_CONFIGURATION_Handle *cfg,
-  const char *hostname,
-  uint16_t port)
-{
-  struct GNUNET_CONNECTION_Handle *connection;
-
-  GNUNET_assert (0 < strlen (hostname));   /* sanity check */
-  connection = GNUNET_new (struct GNUNET_CONNECTION_Handle);
-  connection->cfg = cfg;
-  connection->write_buffer_size = GNUNET_MIN_MESSAGE_SIZE;
-  connection->write_buffer = GNUNET_malloc (connection->write_buffer_size);
-  connection->port = port;
-  connection->hostname = GNUNET_strdup (hostname);
-  connection->dns_active = GNUNET_RESOLVER_ip_get (connection->hostname,
-                                                   AF_UNSPEC,
-                                                   CONNECT_RETRY_TIMEOUT,
-                                                   &try_connect_using_address,
-                                                   connection);
-  return connection;
-}
-
-
-/**
- * Create a connection handle by connecting to a UNIX domain service.
- * This function returns immediately, even if the connection has not
- * yet been established.  This function only creates UNIX connections.
- *
- * @param cfg configuration to use
- * @param unixpath path to connect to
- * @return the connection handle, NULL on systems without UNIX support
- */
-struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_create_from_connect_to_unixpath (
-  const struct GNUNET_CONFIGURATION_Handle *cfg,
-  const char *unixpath)
-{
-#ifdef AF_UNIX
-  struct GNUNET_CONNECTION_Handle *connection;
-  struct sockaddr_un *un;
-
-  GNUNET_assert (0 < strlen (unixpath));   /* sanity check */
-  un = GNUNET_new (struct sockaddr_un);
-  un->sun_family = AF_UNIX;
-  GNUNET_strlcpy (un->sun_path, unixpath, sizeof(un->sun_path));
-#ifdef __linux__
-  {
-    int abstract;
-
-    abstract = GNUNET_CONFIGURATION_get_value_yesno (cfg,
-                                                     "TESTING",
-                                                     "USE_ABSTRACT_SOCKETS");
-    if (GNUNET_YES == abstract)
-      un->sun_path[0] = '\0';
-  }
-#endif
-#if HAVE_SOCKADDR_UN_SUN_LEN
-  un->sun_len = (u_char) sizeof(struct sockaddr_un);
-#endif
-  connection = GNUNET_new (struct GNUNET_CONNECTION_Handle);
-  connection->cfg = cfg;
-  connection->write_buffer_size = GNUNET_MIN_MESSAGE_SIZE;
-  connection->write_buffer = GNUNET_malloc (connection->write_buffer_size);
-  connection->port = 0;
-  connection->hostname = NULL;
-  connection->addr = (struct sockaddr *) un;
-  connection->addrlen = sizeof(struct sockaddr_un);
-  connection->sock = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0);
-  if (NULL == connection->sock)
-  {
-    GNUNET_free (connection->addr);
-    GNUNET_free (connection->write_buffer);
-    GNUNET_free (connection);
-    return NULL;
-  }
-  if ((GNUNET_OK != GNUNET_NETWORK_socket_connect (connection->sock,
-                                                   connection->addr,
-                                                   connection->addrlen)) &&
-      (EINPROGRESS != errno))
-  {
-    /* Just return; we expect everything to work eventually so don't fail HARD 
*/
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (connection->sock));
-    connection->sock = NULL;
-    return connection;
-  }
-  connect_success_continuation (connection);
-  return connection;
-#else
-  return NULL;
-#endif
-}
-
-
-/**
- * Create a connection handle by (asynchronously) connecting to a host.
- * This function returns immediately, even if the connection has not
- * yet been established.  This function only creates TCP connections.
- *
- * @param s socket to connect
- * @param serv_addr server address
- * @param addrlen length of @a serv_addr
- * @return the connection handle
- */
-struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_connect_socket (struct GNUNET_NETWORK_Handle *s,
-                                  const struct sockaddr *serv_addr,
-                                  socklen_t addrlen)
-{
-  struct GNUNET_CONNECTION_Handle *connection;
-
-  if ((GNUNET_OK != GNUNET_NETWORK_socket_connect (s, serv_addr, addrlen)) &&
-      (EINPROGRESS != errno))
-  {
-    /* maybe refused / unsupported address, try next */
-    LOG_STRERROR (GNUNET_ERROR_TYPE_DEBUG, "connect");
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Attempt to connect to `%s' failed\n",
-         GNUNET_a2s (serv_addr, addrlen));
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (s));
-    return NULL;
-  }
-  connection = GNUNET_CONNECTION_create_from_existing (s);
-  connection->addr = GNUNET_malloc (addrlen);
-  GNUNET_memcpy (connection->addr, serv_addr, addrlen);
-  connection->addrlen = addrlen;
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "Trying to connect to `%s' (%p)\n",
-       GNUNET_a2s (serv_addr, addrlen),
-       connection);
-  return connection;
-}
-
-
-/**
- * Create a connection handle by creating a socket and
- * (asynchronously) connecting to a host.  This function returns
- * immediately, even if the connection has not yet been established.
- * This function only creates TCP connections.
- *
- * @param af_family address family to use
- * @param serv_addr server address
- * @param addrlen length of @a serv_addr
- * @return the connection handle
- */
-struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_create_from_sockaddr (int af_family,
-                                        const struct sockaddr *serv_addr,
-                                        socklen_t addrlen)
-{
-  struct GNUNET_NETWORK_Handle *s;
-
-  s = GNUNET_NETWORK_socket_create (af_family, SOCK_STREAM, 0);
-  if (NULL == s)
-  {
-    LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, 
"socket");
-    return NULL;
-  }
-  return GNUNET_CONNECTION_connect_socket (s, serv_addr, addrlen);
-}
-
-
-/**
- * Check if connection is valid (no fatal errors have happened so far).
- * Note that a connection that is still trying to connect is considered
- * valid.
- *
- * @param connection connection to check
- * @return #GNUNET_YES if valid, #GNUNET_NO otherwise
- */
-int
-GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle *connection)
-{
-  if ((NULL != connection->ap_head) || (NULL != connection->dns_active) ||
-      (NULL != connection->proxy_handshake))
-    return GNUNET_YES; /* still trying to connect */
-  if ((0 != connection->destroy_later) || (NULL == connection->sock))
-    return GNUNET_NO;
-  return GNUNET_YES;
-}
-
-
-/**
- * Close the connection and free associated resources.  There must
- * not be any pending requests for reading or writing to the
- * connection at this time.
- *
- * @param connection connection to destroy
- */
-void
-GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *connection)
-{
-  struct AddressProbe *pos;
-
-  if (0 != connection->destroy_later)
-  {
-    connection->destroy_later = -1;
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down connection (%p)\n", connection);
-  GNUNET_assert (NULL == connection->nth.notify_ready);
-  GNUNET_assert (NULL == connection->receiver);
-  if (NULL != connection->write_task)
-  {
-    GNUNET_SCHEDULER_cancel (connection->write_task);
-    connection->write_task = NULL;
-    connection->write_buffer_off = 0;
-  }
-  if (NULL != connection->read_task)
-  {
-    GNUNET_SCHEDULER_cancel (connection->read_task);
-    connection->read_task = NULL;
-  }
-  if (NULL != connection->nth.timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (connection->nth.timeout_task);
-    connection->nth.timeout_task = NULL;
-  }
-  connection->nth.notify_ready = NULL;
-  if (NULL != connection->dns_active)
-  {
-    GNUNET_RESOLVER_request_cancel (connection->dns_active);
-    connection->dns_active = NULL;
-  }
-  if (NULL != connection->proxy_handshake)
-  {
-    /* GNUNET_CONNECTION_destroy (connection->proxy_handshake); */
-    connection->proxy_handshake->destroy_later = -1;
-    connection->proxy_handshake = NULL;   /* Not leaked ??? */
-  }
-  while (NULL != (pos = connection->ap_head))
-  {
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (pos->sock));
-    GNUNET_SCHEDULER_cancel (pos->task);
-    GNUNET_CONTAINER_DLL_remove (connection->ap_head, connection->ap_tail, 
pos);
-    GNUNET_free (pos);
-  }
-  if ((NULL != connection->sock) && (GNUNET_YES != connection->persist))
-  {
-    if ((GNUNET_OK !=
-         GNUNET_NETWORK_socket_shutdown (connection->sock, SHUT_RDWR)) &&
-        (ENOTCONN != errno) && (ECONNRESET != errno))
-      LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "shutdown");
-  }
-  if (NULL != connection->sock)
-  {
-    if (GNUNET_YES != connection->persist)
-    {
-      GNUNET_break (GNUNET_OK ==
-                    GNUNET_NETWORK_socket_close (connection->sock));
-    }
-    else
-    {
-      GNUNET_NETWORK_socket_free_memory_only_ (
-        connection->sock);     /* at least no memory leak (we deliberately
-                                * leak the socket in this special case) ... */
-    }
-  }
-  GNUNET_free (connection->addr);
-  GNUNET_free (connection->hostname);
-  GNUNET_free (connection->write_buffer);
-  GNUNET_free (connection);
-}
-
-
-/**
- * This function is called once we either timeout
- * or have data ready to read.
- *
- * @param cls connection to read from
- */
-static void
-receive_ready (void *cls)
-{
-  struct GNUNET_CONNECTION_Handle *connection = cls;
-  const struct GNUNET_SCHEDULER_TaskContext *tc;
-  char buffer[connection->max];
-  ssize_t ret;
-  GNUNET_CONNECTION_Receiver receiver;
-
-  connection->read_task = NULL;
-  tc = GNUNET_SCHEDULER_get_task_context ();
-  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Receive from `%s' encounters error: timeout (%s, %p)\n",
-         GNUNET_a2s (connection->addr, connection->addrlen),
-         GNUNET_STRINGS_relative_time_to_string (
-           GNUNET_TIME_absolute_get_duration (
-             connection->receive_timeout),
-           GNUNET_YES),
-         connection);
-    signal_receive_timeout (connection);
-    return;
-  }
-  if (NULL == connection->sock)
-  {
-    /* connect failed for good */
-    signal_receive_error (connection, ECONNREFUSED);
-    return;
-  }
-  GNUNET_assert (GNUNET_NETWORK_fdset_isset (tc->read_ready, 
connection->sock));
-RETRY:
-  ret = GNUNET_NETWORK_socket_recv (connection->sock, buffer, connection->max);
-  if (-1 == ret)
-  {
-    if (EINTR == errno)
-      goto RETRY;
-    signal_receive_error (connection, errno);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "receive_ready read %lu/%lu bytes from `%s' (%p)!\n",
-       (unsigned long) ret,
-       (unsigned long) connection->max,
-       GNUNET_a2s (connection->addr, connection->addrlen),
-       connection);
-  GNUNET_assert (NULL != (receiver = connection->receiver));
-  connection->receiver = NULL;
-  receiver (connection->receiver_cls,
-            buffer,
-            ret,
-            connection->addr,
-            connection->addrlen,
-            0);
-}
-
-
-/**
- * Receive data from the given connection.  Note that this function
- * will call @a receiver asynchronously using the scheduler.  It will
- * "immediately" return.  Note that there MUST only be one active
- * receive call per connection at any given point in time (so do not
- * call receive again until the receiver callback has been invoked).
- *
- * @param connection connection handle
- * @param max maximum number of bytes to read
- * @param timeout maximum amount of time to wait
- * @param receiver function to call with received data
- * @param receiver_cls closure for @a receiver
- * @return #GNUNET_SYSERR if @a connection died (receiver was
- *          called with error)
- */
-int
-GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *connection,
-                           size_t max,
-                           struct GNUNET_TIME_Relative timeout,
-                           GNUNET_CONNECTION_Receiver receiver,
-                           void *receiver_cls)
-{
-  GNUNET_assert ((NULL == connection->read_task) &&
-                 (NULL == connection->receiver));
-  GNUNET_assert (NULL != receiver);
-  connection->receiver = receiver;
-  connection->receiver_cls = receiver_cls;
-  connection->receive_timeout = GNUNET_TIME_relative_to_absolute (timeout);
-  connection->max = max;
-  if (NULL != connection->sock)
-  {
-    connection->read_task =
-      GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_absolute_get_remaining (
-                                       connection->receive_timeout),
-                                     connection->sock,
-                                     &receive_ready,
-                                     connection);
-    return GNUNET_OK;
-  }
-  if ((NULL == connection->dns_active) && (NULL == connection->ap_head) &&
-      (NULL == connection->proxy_handshake))
-  {
-    connection->receiver = NULL;
-    receiver (receiver_cls, NULL, 0, NULL, 0, ETIMEDOUT);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Cancel receive job on the given connection.  Note that the
- * receiver callback must not have been called yet in order
- * for the cancellation to be valid.
- *
- * @param connection connection handle
- * @return closure of the original receiver callback closure
- */
-void *
-GNUNET_CONNECTION_receive_cancel (struct GNUNET_CONNECTION_Handle *connection)
-{
-  if (NULL != connection->read_task)
-  {
-    GNUNET_assert (connection ==
-                   GNUNET_SCHEDULER_cancel (connection->read_task));
-    connection->read_task = NULL;
-  }
-  connection->receiver = NULL;
-  return connection->receiver_cls;
-}
-
-
-/**
- * Try to call the transmit notify method (check if we do
- * have enough space available first)!
- *
- * @param connection connection for which we should do this processing
- * @return #GNUNET_YES if we were able to call notify
- */
-static int
-process_notify (struct GNUNET_CONNECTION_Handle *connection)
-{
-  size_t used;
-  size_t avail;
-  size_t size;
-  GNUNET_CONNECTION_TransmitReadyNotify notify;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "process_notify is running\n");
-  GNUNET_assert (NULL == connection->write_task);
-  if (NULL == (notify = connection->nth.notify_ready))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "No one to notify\n");
-    return GNUNET_NO;
-  }
-  used = connection->write_buffer_off - connection->write_buffer_pos;
-  avail = connection->write_buffer_size - used;
-  size = connection->nth.notify_size;
-  if (size > avail)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Not enough buffer\n");
-    return GNUNET_NO;
-  }
-  connection->nth.notify_ready = NULL;
-  if (connection->write_buffer_size - connection->write_buffer_off < size)
-  {
-    /* need to compact */
-    memmove (connection->write_buffer,
-             &connection->write_buffer[connection->write_buffer_pos],
-             used);
-    connection->write_buffer_off -= connection->write_buffer_pos;
-    connection->write_buffer_pos = 0;
-  }
-  avail = connection->write_buffer_size - connection->write_buffer_off;
-  GNUNET_assert (avail >= size);
-  size = notify (connection->nth.notify_ready_cls,
-                 avail,
-                 &connection->write_buffer[connection->write_buffer_off]);
-  GNUNET_assert (size <= avail);
-  if (0 != size)
-    connection->write_buffer_off += size;
-  return GNUNET_YES;
-}
-
-
-/**
- * Task invoked by the scheduler when a call to transmit
- * is timing out (we never got enough buffer space to call
- * the callback function before the specified timeout
- * expired).
- *
- * This task notifies the client about the timeout.
- *
- * @param cls the `struct GNUNET_CONNECTION_Handle`
- */
-static void
-transmit_timeout (void *cls)
-{
-  struct GNUNET_CONNECTION_Handle *connection = cls;
-  GNUNET_CONNECTION_TransmitReadyNotify notify;
-
-  connection->nth.timeout_task = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Transmit to `%s:%u/%s' fails, time out reached (%p).\n",
-       connection->hostname,
-       connection->port,
-       GNUNET_a2s (connection->addr, connection->addrlen),
-       connection);
-  notify = connection->nth.notify_ready;
-  GNUNET_assert (NULL != notify);
-  connection->nth.notify_ready = NULL;
-  notify (connection->nth.notify_ready_cls, 0, NULL);
-}
-
-
-/**
- * Task invoked by the scheduler when we failed to connect
- * at the time of being asked to transmit.
- *
- * This task notifies the client about the error.
- *
- * @param cls the `struct GNUNET_CONNECTION_Handle`
- */
-static void
-connect_error (void *cls)
-{
-  struct GNUNET_CONNECTION_Handle *connection = cls;
-  GNUNET_CONNECTION_TransmitReadyNotify notify;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Transmission request of size %lu fails (%s/%u), connection failed 
(%p).\n",
-       (unsigned long) connection->nth.notify_size,
-       connection->hostname,
-       connection->port,
-       connection);
-  connection->write_task = NULL;
-  notify = connection->nth.notify_ready;
-  connection->nth.notify_ready = NULL;
-  notify (connection->nth.notify_ready_cls, 0, NULL);
-}
-
-
-/**
- * We are ready to transmit (or got a timeout).
- *
- * @param cls our connection handle
- */
-static void
-transmit_ready (void *cls)
-{
-  struct GNUNET_CONNECTION_Handle *connection = cls;
-  GNUNET_CONNECTION_TransmitReadyNotify notify;
-  const struct GNUNET_SCHEDULER_TaskContext *tc;
-  ssize_t ret;
-  size_t have;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "transmit_ready running (%p).\n", connection);
-  GNUNET_assert (NULL != connection->write_task);
-  connection->write_task = NULL;
-  GNUNET_assert (NULL == connection->nth.timeout_task);
-  tc = GNUNET_SCHEDULER_get_task_context ();
-  if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT))
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Transmit to `%s' fails, time out reached (%p).\n",
-         GNUNET_a2s (connection->addr, connection->addrlen),
-         connection);
-    notify = connection->nth.notify_ready;
-    GNUNET_assert (NULL != notify);
-    connection->nth.notify_ready = NULL;
-    notify (connection->nth.notify_ready_cls, 0, NULL);
-    return;
-  }
-  GNUNET_assert (NULL != connection->sock);
-  if (NULL == tc->write_ready)
-  {
-    /* special circumstances (in particular, PREREQ_DONE after
-     * connect): not yet ready to write, but no "fatal" error either.
-     * Hence retry.  */
-    goto SCHEDULE_WRITE;
-  }
-  if (! GNUNET_NETWORK_fdset_isset (tc->write_ready, connection->sock))
-  {
-    GNUNET_assert (NULL == connection->write_task);
-    /* special circumstances (in particular, shutdown): not yet ready
-     * to write, but no "fatal" error either.  Hence retry.  */
-    goto SCHEDULE_WRITE;
-  }
-  GNUNET_assert (connection->write_buffer_off >= connection->write_buffer_pos);
-  if ((NULL != connection->nth.notify_ready) &&
-      (connection->write_buffer_size < connection->nth.notify_size))
-  {
-    connection->write_buffer =
-      GNUNET_realloc (connection->write_buffer, connection->nth.notify_size);
-    connection->write_buffer_size = connection->nth.notify_size;
-  }
-  process_notify (connection);
-  have = connection->write_buffer_off - connection->write_buffer_pos;
-  if (0 == have)
-  {
-    /* no data ready for writing, terminate write loop */
-    return;
-  }
-  GNUNET_assert (have <= connection->write_buffer_size);
-  GNUNET_assert (have + connection->write_buffer_pos <=
-                 connection->write_buffer_size);
-  GNUNET_assert (connection->write_buffer_pos <= 
connection->write_buffer_size);
-RETRY:
-  ret =
-    GNUNET_NETWORK_socket_send (connection->sock,
-                                &connection
-                                ->write_buffer[connection->write_buffer_pos],
-                                have);
-  if (-1 == ret)
-  {
-    if (EINTR == errno)
-      goto RETRY;
-    if (NULL != connection->write_task)
-    {
-      GNUNET_SCHEDULER_cancel (connection->write_task);
-      connection->write_task = NULL;
-    }
-    signal_transmit_error (connection, errno);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Connection transmitted %lu/%lu bytes to `%s' (%p)\n",
-       (unsigned long) ret,
-       (unsigned long) have,
-       GNUNET_a2s (connection->addr, connection->addrlen),
-       connection);
-  connection->write_buffer_pos += ret;
-  if (connection->write_buffer_pos == connection->write_buffer_off)
-  {
-    /* transmitted all pending data */
-    connection->write_buffer_pos = 0;
-    connection->write_buffer_off = 0;
-  }
-  if ((0 == connection->write_buffer_off) &&
-      (NULL == connection->nth.notify_ready))
-    return; /* all data sent! */
-  /* not done writing, schedule more */
-SCHEDULE_WRITE:
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Re-scheduling transmit_ready (more to do) (%p).\n",
-       connection);
-  have = connection->write_buffer_off - connection->write_buffer_pos;
-  GNUNET_assert ((NULL != connection->nth.notify_ready) || (have > 0));
-  if (NULL == connection->write_task)
-    connection->write_task =
-      GNUNET_SCHEDULER_add_write_net ((connection->nth.notify_ready == NULL)
-                                      ? GNUNET_TIME_UNIT_FOREVER_REL
-                                      : GNUNET_TIME_absolute_get_remaining (
-                                        connection->nth.transmit_timeout),
-                                      connection->sock,
-                                      &transmit_ready,
-                                      connection);
-}
-
-
-/**
- * Ask the connection to call us once the specified number of bytes
- * are free in the transmission buffer.  Will never call the @a notify
- * callback in this task, but always first go into the scheduler.
- *
- * @param connection connection
- * @param size number of bytes to send
- * @param timeout after how long should we give up (and call
- *        @a notify with buf NULL and size 0)?
- * @param notify function to call
- * @param notify_cls closure for @a notify
- * @return non-NULL if the notify callback was queued,
- *         NULL if we are already going to notify someone else (busy)
- */
-struct GNUNET_CONNECTION_TransmitHandle *
-GNUNET_CONNECTION_notify_transmit_ready (
-  struct GNUNET_CONNECTION_Handle *connection,
-  size_t size,
-  struct GNUNET_TIME_Relative timeout,
-  GNUNET_CONNECTION_TransmitReadyNotify notify,
-  void *notify_cls)
-{
-  if (NULL != connection->nth.notify_ready)
-  {
-    GNUNET_assert (0);
-    return NULL;
-  }
-  GNUNET_assert (NULL != notify);
-  GNUNET_assert (size < GNUNET_MAX_MESSAGE_SIZE);
-  GNUNET_assert (connection->write_buffer_off <= 
connection->write_buffer_size);
-  GNUNET_assert (connection->write_buffer_pos <= 
connection->write_buffer_size);
-  GNUNET_assert (connection->write_buffer_pos <= connection->write_buffer_off);
-  connection->nth.notify_ready = notify;
-  connection->nth.notify_ready_cls = notify_cls;
-  connection->nth.connection = connection;
-  connection->nth.notify_size = size;
-  connection->nth.transmit_timeout = GNUNET_TIME_relative_to_absolute 
(timeout);
-  GNUNET_assert (NULL == connection->nth.timeout_task);
-  if ((NULL == connection->sock) && (NULL == connection->ap_head) &&
-      (NULL == connection->dns_active) && (NULL == 
connection->proxy_handshake))
-  {
-    if (NULL != connection->write_task)
-      GNUNET_SCHEDULER_cancel (connection->write_task);
-    connection->write_task =
-      GNUNET_SCHEDULER_add_now (&connect_error, connection);
-    return &connection->nth;
-  }
-  if (NULL != connection->write_task)
-    return &connection->nth; /* previous transmission still in progress */
-  if (NULL != connection->sock)
-  {
-    /* connected, try to transmit now */
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Scheduling transmission (%p).\n",
-         connection);
-    connection->write_task =
-      GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_absolute_get_remaining (
-                                        connection->nth.transmit_timeout),
-                                      connection->sock,
-                                      &transmit_ready,
-                                      connection);
-    return &connection->nth;
-  }
-  /* not yet connected, wait for connection */
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Need to wait to schedule transmission for connection, adding timeout 
task (%p).\n",
-       connection);
-  connection->nth.timeout_task =
-    GNUNET_SCHEDULER_add_delayed (timeout, &transmit_timeout, connection);
-  return &connection->nth;
-}
-
-
-/**
- * Cancel the specified transmission-ready notification.
- *
- * @param th notification to cancel
- */
-void
-GNUNET_CONNECTION_notify_transmit_ready_cancel (
-  struct GNUNET_CONNECTION_TransmitHandle *th)
-{
-  GNUNET_assert (NULL != th->notify_ready);
-  th->notify_ready = NULL;
-  if (NULL != th->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (th->timeout_task);
-    th->timeout_task = NULL;
-  }
-  if (NULL != th->connection->write_task)
-  {
-    GNUNET_SCHEDULER_cancel (th->connection->write_task);
-    th->connection->write_task = NULL;
-  }
-}
-
-
-/**
- * Create a connection to be proxied using a given connection.
- *
- * @param cph connection to proxy server
- * @return connection to be proxied
- */
-struct GNUNET_CONNECTION_Handle *
-GNUNET_CONNECTION_create_proxied_from_handshake (
-  struct GNUNET_CONNECTION_Handle *cph)
-{
-  struct GNUNET_CONNECTION_Handle *proxied =
-    GNUNET_CONNECTION_create_from_existing (NULL);
-
-  proxied->proxy_handshake = cph;
-  return proxied;
-}
-
-
-/**
- * Activate proxied connection and destroy initial proxy handshake connection.
- * There must not be any pending requests for reading or writing to the
- * proxy hadshake connection at this time.
- *
- * @param proxied connection connection to proxy server
- */
-void
-GNUNET_CONNECTION_acivate_proxied (struct GNUNET_CONNECTION_Handle *proxied)
-{
-  struct GNUNET_CONNECTION_Handle *cph = proxied->proxy_handshake;
-
-  GNUNET_assert (NULL != cph);
-  GNUNET_assert (NULL == proxied->sock);
-  GNUNET_assert (NULL != cph->sock);
-  proxied->sock = cph->sock;
-  cph->sock = NULL;
-  GNUNET_CONNECTION_destroy (cph);
-  connect_success_continuation (proxied);
-}
-
-
-/* end of connection.c */
diff --git a/src/transport/tcp_server_legacy.c 
b/src/transport/tcp_server_legacy.c
deleted file mode 100644
index bb572c843..000000000
--- a/src/transport/tcp_server_legacy.c
+++ /dev/null
@@ -1,1728 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009-2013 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file util/server.c
- * @brief library for building GNUnet network servers
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_protocols.h"
-
-#define LOG_STRERROR_FILE(kind, syscall, \
-                          filename) GNUNET_log_from_strerror_file (kind, \
-                                                                   
"util-server", \
-                                                                   syscall, \
-                                                                   filename)
-
-
-/**
- * List of arrays of message handlers.
- */
-struct HandlerList
-{
-  /**
-   * This is a linked list.
-   */
-  struct HandlerList *next;
-
-  /**
-   * NULL-terminated array of handlers.
-   */
-  const struct GNUNET_SERVER_MessageHandler *handlers;
-};
-
-
-/**
- * List of arrays of message handlers.
- */
-struct NotifyList
-{
-  /**
-   * This is a doubly linked list.
-   */
-  struct NotifyList *next;
-
-  /**
-   * This is a doubly linked list.
-   */
-  struct NotifyList *prev;
-
-  /**
-   * Function to call.
-   */
-  GNUNET_SERVER_DisconnectCallback callback;
-
-  /**
-   * Closure for callback.
-   */
-  void *callback_cls;
-};
-
-
-/**
- * @brief handle for a server
- */
-struct GNUNET_SERVER_Handle
-{
-  /**
-   * List of handlers for incoming messages.
-   */
-  struct HandlerList *handlers;
-
-  /**
-   * Head of list of our current clients.
-   */
-  struct GNUNET_SERVER_Client *clients_head;
-
-  /**
-   * Head of list of our current clients.
-   */
-  struct GNUNET_SERVER_Client *clients_tail;
-
-  /**
-   * Head of linked list of functions to call on disconnects by clients.
-   */
-  struct NotifyList *disconnect_notify_list_head;
-
-  /**
-   * Tail of linked list of functions to call on disconnects by clients.
-   */
-  struct NotifyList *disconnect_notify_list_tail;
-
-  /**
-   * Head of linked list of functions to call on connects by clients.
-   */
-  struct NotifyList *connect_notify_list_head;
-
-  /**
-   * Tail of linked list of functions to call on connects by clients.
-   */
-  struct NotifyList *connect_notify_list_tail;
-
-  /**
-   * Function to call for access control.
-   */
-  GNUNET_CONNECTION_AccessCheck access_cb;
-
-  /**
-   * Closure for @e access_cb.
-   */
-  void *access_cb_cls;
-
-  /**
-   * NULL-terminated array of sockets used to listen for new
-   * connections.
-   */
-  struct GNUNET_NETWORK_Handle **listen_sockets;
-
-  /**
-   * After how long should an idle connection time
-   * out (on write).
-   */
-  struct GNUNET_TIME_Relative idle_timeout;
-
-  /**
-   * Task scheduled to do the listening.
-   */
-  struct GNUNET_SCHEDULER_Task *listen_task;
-
-  /**
-   * Alternative function to create a MST instance.
-   */
-  GNUNET_SERVER_MstCreateCallback mst_create;
-
-  /**
-   * Alternative function to destroy a MST instance.
-   */
-  GNUNET_SERVER_MstDestroyCallback mst_destroy;
-
-  /**
-   * Alternative function to give data to a MST instance.
-   */
-  GNUNET_SERVER_MstReceiveCallback mst_receive;
-
-  /**
-   * Closure for 'mst_'-callbacks.
-   */
-  void *mst_cls;
-
-  /**
-   * Do we ignore messages of types that we do not understand or do we
-   * require that a handler is found (and if not kill the connection)?
-   */
-  int require_found;
-
-  /**
-   * Set to #GNUNET_YES once we are in 'soft' shutdown where we wait for
-   * all non-monitor clients to disconnect before we call
-   * #GNUNET_SERVER_destroy.  See test_monitor_clients().  Set to
-   * #GNUNET_SYSERR once the final destroy task has been scheduled
-   * (we cannot run it in the same task).
-   */
-  int in_soft_shutdown;
-};
-
-
-/**
- * Handle server returns for aborting transmission to a client.
- */
-struct GNUNET_SERVER_TransmitHandle
-{
-  /**
-   * Function to call to get the message.
-   */
-  GNUNET_CONNECTION_TransmitReadyNotify callback;
-
-  /**
-   * Closure for @e callback
-   */
-  void *callback_cls;
-
-  /**
-   * Active connection transmission handle.
-   */
-  struct GNUNET_CONNECTION_TransmitHandle *cth;
-};
-
-
-/**
- * @brief handle for a client of the server
- */
-struct GNUNET_SERVER_Client
-{
-  /**
-   * This is a doubly linked list.
-   */
-  struct GNUNET_SERVER_Client *next;
-
-  /**
-   * This is a doubly linked list.
-   */
-  struct GNUNET_SERVER_Client *prev;
-
-  /**
-   * Processing of incoming data.
-   */
-  void *mst;
-
-  /**
-   * Server that this client belongs to.
-   */
-  struct GNUNET_SERVER_Handle *server;
-
-  /**
-   * Client closure for callbacks.
-   */
-  struct GNUNET_CONNECTION_Handle *connection;
-
-  /**
-   * User context value, manipulated using
-   * 'GNUNET_SERVER_client_{get/set}_user_context' functions.
-   */
-  void *user_context;
-
-  /**
-   * ID of task used to restart processing.
-   */
-  struct GNUNET_SCHEDULER_Task *restart_task;
-
-  /**
-   * Task that warns about missing calls to #GNUNET_SERVER_receive_done.
-   */
-  struct GNUNET_SCHEDULER_Task *warn_task;
-
-  /**
-   * Time when the warn task was started.
-   */
-  struct GNUNET_TIME_Absolute warn_start;
-
-  /**
-   * Last activity on this socket (used to time it out
-   * if reference_count == 0).
-   */
-  struct GNUNET_TIME_Absolute last_activity;
-
-  /**
-   * Transmission handle we return for this client from
-   * #GNUNET_SERVER_notify_transmit_ready.
-   */
-  struct GNUNET_SERVER_TransmitHandle th;
-
-  /**
-   * After how long should an idle connection time
-   * out (on write).
-   */
-  struct GNUNET_TIME_Relative idle_timeout;
-
-  /**
-   * Number of external entities with a reference to
-   * this client object.
-   */
-  unsigned int reference_count;
-
-  /**
-   * Was processing if incoming messages suspended while
-   * we were still processing data already received?
-   * This is a counter saying how often processing was
-   * suspended (once per handler invoked).
-   */
-  unsigned int suspended;
-
-  /**
-   * Last size given when user context was initialized; used for
-   * sanity check.
-   */
-  size_t user_context_size;
-
-  /**
-   * Are we currently in the "process_client_buffer" function (and
-   * will hence restart the receive job on exit if suspended == 0 once
-   * we are done?).  If this is set, then "receive_done" will
-   * essentially only decrement suspended; if this is not set, then
-   * "receive_done" may need to restart the receive process (either
-   * from the side-buffer or via select/recv).
-   */
-  int in_process_client_buffer;
-
-  /**
-   * We're about to close down this client.
-   */
-  int shutdown_now;
-
-  /**
-   * Are we currently trying to receive? (#GNUNET_YES if we are,
-   * #GNUNET_NO if we are not, #GNUNET_SYSERR if data is already
-   * available in MST).
-   */
-  int receive_pending;
-
-  /**
-   * Persist the file handle for this client no matter what happens,
-   * force the OS to close once the process actually dies.  Should only
-   * be used in special cases!
-   */
-  int persist;
-
-  /**
-   * Is this client a 'monitor' client that should not be counted
-   * when deciding on destroying the server during soft shutdown?
-   * (see also #GNUNET_SERVICE_start)
-   */
-  int is_monitor;
-
-  /**
-   * Type of last message processed (for warn_no_receive_done).
-   */
-  uint16_t warn_type;
-};
-
-
-/**
- * Return user context associated with the given client.
- * Note: you should probably use the macro (call without the underscore).
- *
- * @param client client to query
- * @param size number of bytes in user context struct (for verification only)
- * @return pointer to user context
- */
-void *
-GNUNET_SERVER_client_get_user_context_ (struct GNUNET_SERVER_Client *client,
-                                        size_t size)
-{
-  if ((0 == client->user_context_size) &&
-      (NULL == client->user_context))
-    return NULL; /* never set */
-  GNUNET_assert (size == client->user_context_size);
-  return client->user_context;
-}
-
-
-/**
- * Set user context to be associated with the given client.
- * Note: you should probably use the macro (call without the underscore).
- *
- * @param client client to query
- * @param ptr pointer to user context
- * @param size number of bytes in user context struct (for verification only)
- */
-void
-GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client,
-                                        void *ptr,
-                                        size_t size)
-{
-  if (NULL == ptr)
-  {
-    client->user_context_size = 0;
-    client->user_context = ptr;
-    return;
-  }
-  client->user_context_size = size;
-  client->user_context = ptr;
-}
-
-
-/**
- * Scheduler says our listen socket is ready.  Process it!
- *
- * @param cls handle to our server for which we are processing the listen
- *        socket
- */
-static void
-process_listen_socket (void *cls)
-{
-  struct GNUNET_SERVER_Handle *server = cls;
-  const struct GNUNET_SCHEDULER_TaskContext *tc;
-  struct GNUNET_CONNECTION_Handle *sock;
-  unsigned int i;
-
-  server->listen_task = NULL;
-  tc = GNUNET_SCHEDULER_get_task_context ();
-  for (i = 0; NULL != server->listen_sockets[i]; i++)
-  {
-    if (GNUNET_NETWORK_fdset_isset (tc->read_ready,
-                                    server->listen_sockets[i]))
-    {
-      sock =
-        GNUNET_CONNECTION_create_from_accept (server->access_cb,
-                                              server->access_cb_cls,
-                                              server->listen_sockets[i]);
-      if (NULL != sock)
-      {
-        LOG (GNUNET_ERROR_TYPE_DEBUG,
-             "Server accepted incoming connection.\n");
-        (void) GNUNET_SERVER_connect_socket (server,
-                                             sock);
-      }
-    }
-  }
-  /* listen for more! */
-  GNUNET_SERVER_resume (server);
-}
-
-
-/**
- * Create and initialize a listen socket for the server.
- *
- * @param server_addr address to listen on
- * @param socklen length of @a server_addr
- * @return NULL on error, otherwise the listen socket
- */
-static struct GNUNET_NETWORK_Handle *
-open_listen_socket (const struct sockaddr *server_addr,
-                    socklen_t socklen)
-{
-  struct GNUNET_NETWORK_Handle *sock;
-  uint16_t port;
-  int eno;
-
-  switch (server_addr->sa_family)
-  {
-  case AF_INET:
-    port = ntohs (((const struct sockaddr_in *) server_addr)->sin_port);
-    break;
-
-  case AF_INET6:
-    port = ntohs (((const struct sockaddr_in6 *) server_addr)->sin6_port);
-    break;
-
-  case AF_UNIX:
-    port = 0;
-    break;
-
-  default:
-    GNUNET_break (0);
-    port = 0;
-    break;
-  }
-  sock = GNUNET_NETWORK_socket_create (server_addr->sa_family, SOCK_STREAM, 0);
-  if (NULL == sock)
-  {
-    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "socket");
-    errno = 0;
-    return NULL;
-  }
-  /* bind the socket */
-  if (GNUNET_OK != GNUNET_NETWORK_socket_bind (sock, server_addr, socklen))
-  {
-    eno = errno;
-    if (EADDRINUSE != errno)
-    {
-      /* we don't log 'EADDRINUSE' here since an IPv4 bind may
-       * fail if we already took the port on IPv6; if both IPv4 and
-       * IPv6 binds fail, then our caller will log using the
-       * errno preserved in 'eno' */
-      LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
-                    "bind");
-      if (0 != port)
-        LOG (GNUNET_ERROR_TYPE_ERROR,
-             _ ("`%s' failed for port %d (%s).\n"),
-             "bind",
-             port,
-             (AF_INET == server_addr->sa_family) ? "IPv4" : "IPv6");
-      eno = 0;
-    }
-    else
-    {
-      if (0 != port)
-        LOG (GNUNET_ERROR_TYPE_WARNING,
-             _ ("`%s' failed for port %d (%s): address already in use\n"),
-             "bind", port,
-             (AF_INET == server_addr->sa_family) ? "IPv4" : "IPv6");
-      else if (AF_UNIX == server_addr->sa_family)
-      {
-        LOG (GNUNET_ERROR_TYPE_WARNING,
-             _ ("`%s' failed for `%s': address already in use\n"),
-             "bind",
-             GNUNET_a2s (server_addr, socklen));
-      }
-    }
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
-    errno = eno;
-    return NULL;
-  }
-  if (GNUNET_OK != GNUNET_NETWORK_socket_listen (sock, 5))
-  {
-    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
-                  "listen");
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
-    errno = 0;
-    return NULL;
-  }
-  if (0 != port)
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Server starts to listen on port %u.\n",
-         port);
-  return sock;
-}
-
-
-/**
- * Create a new server.
- *
- * @param access_cb function for access control
- * @param access_cb_cls closure for @a access_cb
- * @param lsocks NULL-terminated array of listen sockets
- * @param idle_timeout after how long should we timeout idle connections?
- * @param require_found if #GNUNET_YES, connections sending messages of 
unknown type
- *        will be closed
- * @return handle for the new server, NULL on error
- *         (typically, "port" already in use)
- */
-struct GNUNET_SERVER_Handle *
-GNUNET_SERVER_create_with_sockets (GNUNET_CONNECTION_AccessCheck access_cb,
-                                   void *access_cb_cls,
-                                   struct GNUNET_NETWORK_Handle **lsocks,
-                                   struct GNUNET_TIME_Relative idle_timeout,
-                                   int require_found)
-{
-  struct GNUNET_SERVER_Handle *server;
-
-  server = GNUNET_new (struct GNUNET_SERVER_Handle);
-  server->idle_timeout = idle_timeout;
-  server->listen_sockets = lsocks;
-  server->access_cb = access_cb;
-  server->access_cb_cls = access_cb_cls;
-  server->require_found = require_found;
-  if (NULL != lsocks)
-    GNUNET_SERVER_resume (server);
-  return server;
-}
-
-
-/**
- * Create a new server.
- *
- * @param access_cb function for access control
- * @param access_cb_cls closure for @a access_cb
- * @param server_addr address to listen on (including port), NULL terminated 
array
- * @param socklen length of server_addr
- * @param idle_timeout after how long should we timeout idle connections?
- * @param require_found if YES, connections sending messages of unknown type
- *        will be closed
- * @return handle for the new server, NULL on error
- *         (typically, "port" already in use)
- */
-struct GNUNET_SERVER_Handle *
-GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck access_cb,
-                      void *access_cb_cls,
-                      struct sockaddr *const *server_addr,
-                      const socklen_t *socklen,
-                      struct GNUNET_TIME_Relative idle_timeout,
-                      int require_found)
-{
-  struct GNUNET_NETWORK_Handle **lsocks;
-  unsigned int i;
-  unsigned int j;
-  unsigned int k;
-  int seen;
-
-  i = 0;
-  while (NULL != server_addr[i])
-    i++;
-  if (i > 0)
-  {
-    lsocks = GNUNET_malloc (sizeof(struct GNUNET_NETWORK_Handle *) * (i + 1));
-    i = 0;
-    j = 0;
-    while (NULL != server_addr[i])
-    {
-      seen = 0;
-      for (k = 0; k < i; k++)
-        if ((socklen[k] == socklen[i]) &&
-            (0 == memcmp (server_addr[k], server_addr[i], socklen[i])))
-        {
-          seen = 1;
-          break;
-        }
-      if (0 != seen)
-      {
-        /* duplicate address, skip */
-        i++;
-        continue;
-      }
-      lsocks[j] = open_listen_socket (server_addr[i], socklen[i]);
-      if (NULL != lsocks[j])
-        j++;
-      i++;
-    }
-    if (0 == j)
-    {
-      if (0 != errno)
-        LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "bind");
-      GNUNET_free (lsocks);
-      lsocks = NULL;
-    }
-  }
-  else
-  {
-    lsocks = NULL;
-  }
-  return GNUNET_SERVER_create_with_sockets (access_cb,
-                                            access_cb_cls,
-                                            lsocks,
-                                            idle_timeout,
-                                            require_found);
-}
-
-
-/**
- * Set the 'monitor' flag on this client.  Clients which have been
- * marked as 'monitors' won't prevent the server from shutting down
- * once '#GNUNET_SERVER_stop_listening()' has been invoked.  The idea is
- * that for "normal" clients we likely want to allow them to process
- * their requests; however, monitor-clients are likely to 'never'
- * disconnect during shutdown and thus will not be considered when
- * determining if the server should continue to exist after
- * #GNUNET_SERVER_destroy() has been called.
- *
- * @param client the client to set the 'monitor' flag on
- */
-void
-GNUNET_SERVER_client_mark_monitor (struct GNUNET_SERVER_Client *client)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Marking client as monitor!\n");
-  client->is_monitor = GNUNET_YES;
-}
-
-
-/**
- * Helper function for #test_monitor_clients() to trigger
- * #GNUNET_SERVER_destroy() after the stack has unwound.
- *
- * @param cls the `struct GNUNET_SERVER_Handle *` to destroy
- */
-static void
-do_destroy (void *cls)
-{
-  struct GNUNET_SERVER_Handle *server = cls;
-
-  GNUNET_SERVER_destroy (server);
-}
-
-
-/**
- * Check if only 'monitor' clients are left.  If so, destroy the
- * server completely.
- *
- * @param server server to test for full shutdown
- */
-static void
-test_monitor_clients (struct GNUNET_SERVER_Handle *server)
-{
-  struct GNUNET_SERVER_Client *client;
-
-  if (GNUNET_YES != server->in_soft_shutdown)
-    return;
-  for (client = server->clients_head; NULL != client; client = client->next)
-    if (GNUNET_NO == client->is_monitor)
-      return;
-  /* not done yet */
-  server->in_soft_shutdown = GNUNET_SYSERR;
-  (void) GNUNET_SCHEDULER_add_now (&do_destroy, server);
-}
-
-
-/**
- * Suspend accepting connections from the listen socket temporarily.
- *
- * @param server server to stop accepting connections.
- */
-void
-GNUNET_SERVER_suspend (struct GNUNET_SERVER_Handle *server)
-{
-  if (NULL != server->listen_task)
-  {
-    GNUNET_SCHEDULER_cancel (server->listen_task);
-    server->listen_task = NULL;
-  }
-}
-
-
-void
-GNUNET_SERVER_resume (struct GNUNET_SERVER_Handle *server)
-{
-  struct GNUNET_NETWORK_FDSet *r;
-  unsigned int i;
-
-  if (NULL == server->listen_sockets)
-    return;
-  if (NULL == server->listen_sockets[0])
-    return; /* nothing to do, no listen sockets! */
-  if (NULL == server->listen_sockets[1])
-  {
-    /* simplified method: no fd set needed; this is then much simpler
-       and much more efficient */
-    server->listen_task =
-      GNUNET_SCHEDULER_add_read_net_with_priority 
(GNUNET_TIME_UNIT_FOREVER_REL,
-                                                   
GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                                   server->listen_sockets[0],
-                                                   &process_listen_socket,
-                                                   server);
-    return;
-  }
-  r = GNUNET_NETWORK_fdset_create ();
-  i = 0;
-  while (NULL != server->listen_sockets[i])
-    GNUNET_NETWORK_fdset_set (r, server->listen_sockets[i++]);
-  server->listen_task =
-    GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                 GNUNET_TIME_UNIT_FOREVER_REL, r, NULL,
-                                 &process_listen_socket, server);
-  GNUNET_NETWORK_fdset_destroy (r);
-}
-
-
-/**
- * Stop the listen socket and get ready to shutdown the server
- * once only 'monitor' clients are left.
- *
- * @param server server to stop listening on
- */
-void
-GNUNET_SERVER_stop_listening (struct GNUNET_SERVER_Handle *server)
-{
-  unsigned int i;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Server in soft shutdown\n");
-  if (NULL != server->listen_task)
-  {
-    GNUNET_SCHEDULER_cancel (server->listen_task);
-    server->listen_task = NULL;
-  }
-  if (NULL != server->listen_sockets)
-  {
-    i = 0;
-    while (NULL != server->listen_sockets[i])
-      GNUNET_break (GNUNET_OK ==
-                    GNUNET_NETWORK_socket_close (server->listen_sockets[i++]));
-    GNUNET_free (server->listen_sockets);
-    server->listen_sockets = NULL;
-  }
-  if (GNUNET_NO == server->in_soft_shutdown)
-    server->in_soft_shutdown = GNUNET_YES;
-  test_monitor_clients (server);
-}
-
-
-/**
- * Free resources held by this server.
- *
- * @param server server to destroy
- */
-void
-GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *server)
-{
-  struct HandlerList *hpos;
-  struct NotifyList *npos;
-  unsigned int i;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Server shutting down.\n");
-  if (NULL != server->listen_task)
-  {
-    GNUNET_SCHEDULER_cancel (server->listen_task);
-    server->listen_task = NULL;
-  }
-  if (NULL != server->listen_sockets)
-  {
-    i = 0;
-    while (NULL != server->listen_sockets[i])
-      GNUNET_break (GNUNET_OK ==
-                    GNUNET_NETWORK_socket_close (server->listen_sockets[i++]));
-    GNUNET_free (server->listen_sockets);
-    server->listen_sockets = NULL;
-  }
-  while (NULL != server->clients_head)
-    GNUNET_SERVER_client_disconnect (server->clients_head);
-  while (NULL != (hpos = server->handlers))
-  {
-    server->handlers = hpos->next;
-    GNUNET_free (hpos);
-  }
-  while (NULL != (npos = server->disconnect_notify_list_head))
-  {
-    npos->callback (npos->callback_cls,
-                    NULL);
-    GNUNET_CONTAINER_DLL_remove (server->disconnect_notify_list_head,
-                                 server->disconnect_notify_list_tail,
-                                 npos);
-    GNUNET_free (npos);
-  }
-  while (NULL != (npos = server->connect_notify_list_head))
-  {
-    npos->callback (npos->callback_cls,
-                    NULL);
-    GNUNET_CONTAINER_DLL_remove (server->connect_notify_list_head,
-                                 server->connect_notify_list_tail,
-                                 npos);
-    GNUNET_free (npos);
-  }
-  GNUNET_free (server);
-}
-
-
-/**
- * Add additional handlers to an existing server.
- *
- * @param server the server to add handlers to
- * @param handlers array of message handlers for
- *        incoming messages; the last entry must
- *        have "NULL" for the "callback"; multiple
- *        entries for the same type are allowed,
- *        they will be called in order of occurrence.
- *        These handlers can be removed later;
- *        the handlers array must exist until removed
- *        (or server is destroyed).
- */
-void
-GNUNET_SERVER_add_handlers (struct GNUNET_SERVER_Handle *server,
-                            const struct GNUNET_SERVER_MessageHandler 
*handlers)
-{
-  struct HandlerList *p;
-
-  p = GNUNET_new (struct HandlerList);
-  p->handlers = handlers;
-  p->next = server->handlers;
-  server->handlers = p;
-}
-
-
-/**
- * Change functions used by the server to tokenize the message stream.
- * (very rarely used).
- *
- * @param server server to modify
- * @param create new tokenizer initialization function
- * @param destroy new tokenizer destruction function
- * @param receive new tokenizer receive function
- * @param cls closure for @a create, @a receive, @a destroy
- */
-void
-GNUNET_SERVER_set_callbacks (struct GNUNET_SERVER_Handle *server,
-                             GNUNET_SERVER_MstCreateCallback create,
-                             GNUNET_SERVER_MstDestroyCallback destroy,
-                             GNUNET_SERVER_MstReceiveCallback receive,
-                             void *cls)
-{
-  server->mst_create = create;
-  server->mst_destroy = destroy;
-  server->mst_receive = receive;
-  server->mst_cls = cls;
-}
-
-
-/**
- * Task run to warn about missing calls to #GNUNET_SERVER_receive_done.
- *
- * @param cls our `struct GNUNET_SERVER_Client *` to process more requests from
- */
-static void
-warn_no_receive_done (void *cls)
-{
-  struct GNUNET_SERVER_Client *client = cls;
-
-  GNUNET_break (0 != client->warn_type);  /* type should never be 0 here, as 
we don't use 0 */
-  client->warn_task =
-    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
-                                  &warn_no_receive_done, client);
-  LOG (GNUNET_ERROR_TYPE_WARNING,
-       _ (
-         "Processing code for message of type %u did not call 
`GNUNET_SERVER_receive_done' after %s\n"),
-       (unsigned int) client->warn_type,
-       GNUNET_STRINGS_relative_time_to_string (
-         GNUNET_TIME_absolute_get_duration (client->warn_start),
-         GNUNET_YES));
-}
-
-
-/**
- * Disable the warning the server issues if a message is not acknowledged
- * in a timely fashion.  Use this call if a client is intentionally delayed
- * for a while.  Only applies to the current message.
- *
- * @param client client for which to disable the warning
- */
-void
-GNUNET_SERVER_disable_receive_done_warning (struct GNUNET_SERVER_Client 
*client)
-{
-  if (NULL != client->warn_task)
-  {
-    GNUNET_SCHEDULER_cancel (client->warn_task);
-    client->warn_task = NULL;
-  }
-}
-
-
-/**
- * Inject a message into the server, pretend it came
- * from the specified client.  Delivery of the message
- * will happen instantly (if a handler is installed;
- * otherwise the call does nothing).
- *
- * @param server the server receiving the message
- * @param sender the "pretended" sender of the message
- *        can be NULL!
- * @param message message to transmit
- * @return #GNUNET_OK if the message was OK and the
- *                   connection can stay open
- *         #GNUNET_SYSERR if the connection to the
- *         client should be shut down
- */
-int
-GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server,
-                      struct GNUNET_SERVER_Client *sender,
-                      const struct GNUNET_MessageHeader *message)
-{
-  struct HandlerList *pos;
-  const struct GNUNET_SERVER_MessageHandler *mh;
-  unsigned int i;
-  uint16_t type;
-  uint16_t size;
-  int found;
-
-  type = ntohs (message->type);
-  size = ntohs (message->size);
-  LOG (GNUNET_ERROR_TYPE_INFO,
-       "Received message of type %u and size %u from client\n",
-       type, size);
-  found = GNUNET_NO;
-  for (pos = server->handlers; NULL != pos; pos = pos->next)
-  {
-    i = 0;
-    while (pos->handlers[i].callback != NULL)
-    {
-      mh = &pos->handlers[i];
-      if ((mh->type == type) || (mh->type == GNUNET_MESSAGE_TYPE_ALL))
-      {
-        if ((0 != mh->expected_size) && (mh->expected_size != size))
-        {
-#if GNUNET8_NETWORK_IS_DEAD
-          LOG (GNUNET_ERROR_TYPE_WARNING,
-               "Expected %u bytes for message of type %u, got %u\n",
-               mh->expected_size, mh->type, size);
-          GNUNET_break_op (0);
-#else
-          LOG (GNUNET_ERROR_TYPE_DEBUG,
-               "Expected %u bytes for message of type %u, got %u\n",
-               mh->expected_size, mh->type, size);
-#endif
-          return GNUNET_SYSERR;
-        }
-        if (NULL != sender)
-        {
-          if ((0 == sender->suspended) &&
-              (NULL == sender->warn_task))
-          {
-            GNUNET_break (0 != type);          /* type should never be 0 here, 
as we don't use 0 */
-            sender->warn_start = GNUNET_TIME_absolute_get ();
-            sender->warn_task =
-              GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
-                                            &warn_no_receive_done,
-                                            sender);
-            sender->warn_type = type;
-          }
-          sender->suspended++;
-        }
-        mh->callback (mh->callback_cls, sender, message);
-        found = GNUNET_YES;
-      }
-      i++;
-    }
-  }
-  if (GNUNET_NO == found)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
-         "Received message of unknown type %d\n", type);
-    if (GNUNET_YES == server->require_found)
-      return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * We are receiving an incoming message.  Process it.
- *
- * @param cls our closure (handle for the client)
- * @param buf buffer with data received from network
- * @param available number of bytes available in buf
- * @param addr address of the sender
- * @param addrlen length of @a addr
- * @param errCode code indicating errors receiving, 0 for success
- */
-static void
-process_incoming (void *cls,
-                  const void *buf,
-                  size_t available,
-                  const struct sockaddr *addr,
-                  socklen_t addrlen,
-                  int errCode);
-
-
-/**
- * Process messages from the client's message tokenizer until either
- * the tokenizer is empty (and then schedule receiving more), or
- * until some handler is not immediately done (then wait for 
restart_processing)
- * or shutdown.
- *
- * @param client the client to process, RC must have already been increased
- *        using #GNUNET_SERVER_client_keep and will be decreased by one in this
- *        function
- * @param ret #GNUNET_NO to start processing from the buffer,
- *            #GNUNET_OK if the mst buffer is drained and we should instantly 
go back to receiving
- *            #GNUNET_SYSERR if we should instantly abort due to error in a 
previous step
- */
-static void
-process_mst (struct GNUNET_SERVER_Client *client,
-             int ret)
-{
-  while ((GNUNET_SYSERR != ret) && (NULL != client->server) &&
-         (GNUNET_YES != client->shutdown_now) && (0 == client->suspended))
-  {
-    if (GNUNET_OK == ret)
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Server re-enters receive loop, timeout: %s.\n",
-           GNUNET_STRINGS_relative_time_to_string (client->idle_timeout,
-                                                   GNUNET_YES));
-      client->receive_pending = GNUNET_YES;
-      if (GNUNET_OK !=
-          GNUNET_CONNECTION_receive (client->connection,
-                                     GNUNET_MAX_MESSAGE_SIZE - 1,
-                                     client->idle_timeout,
-                                     &process_incoming,
-                                     client))
-        return;
-      break;
-    }
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Server processes additional messages instantly.\n");
-    if (NULL != client->server->mst_receive)
-      ret =
-        client->server->mst_receive (client->server->mst_cls, client->mst,
-                                     client, NULL, 0, GNUNET_NO, GNUNET_YES);
-    else
-      ret =
-        GNUNET_SERVER_mst_receive (client->mst, client, NULL, 0, GNUNET_NO,
-                                   GNUNET_YES);
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Server leaves instant processing loop: ret = %d, server = %p, shutdown 
= %d, suspended = %u\n",
-       ret, client->server,
-       client->shutdown_now,
-       client->suspended);
-  if (GNUNET_NO == ret)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Server has more data pending but is suspended.\n");
-    client->receive_pending = GNUNET_SYSERR;    /* data pending */
-  }
-  if ((GNUNET_SYSERR == ret) ||
-      (GNUNET_YES == client->shutdown_now))
-    GNUNET_SERVER_client_disconnect (client);
-}
-
-
-/**
- * We are receiving an incoming message.  Process it.
- *
- * @param cls our closure (handle for the client)
- * @param buf buffer with data received from network
- * @param available number of bytes available in buf
- * @param addr address of the sender
- * @param addrlen length of @a addr
- * @param errCode code indicating errors receiving, 0 for success
- */
-static void
-process_incoming (void *cls,
-                  const void *buf,
-                  size_t available,
-                  const struct sockaddr *addr,
-                  socklen_t addrlen,
-                  int errCode)
-{
-  struct GNUNET_SERVER_Client *client = cls;
-  struct GNUNET_SERVER_Handle *server = client->server;
-  struct GNUNET_TIME_Absolute end;
-  struct GNUNET_TIME_Absolute now;
-  int ret;
-
-  GNUNET_assert (GNUNET_YES == client->receive_pending);
-  client->receive_pending = GNUNET_NO;
-  now = GNUNET_TIME_absolute_get ();
-  end = GNUNET_TIME_absolute_add (client->last_activity,
-                                  client->idle_timeout);
-
-  if ((NULL == buf) &&
-      (0 == available) &&
-      (NULL == addr) &&
-      (0 == errCode) &&
-      (GNUNET_YES != client->shutdown_now) &&
-      (NULL != server) &&
-      (GNUNET_YES == GNUNET_CONNECTION_check (client->connection)) &&
-      (end.abs_value_us > now.abs_value_us))
-  {
-    /* wait longer, timeout changed (i.e. due to us sending) */
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Receive time out, but no disconnect due to sending (%p)\n",
-         client);
-    client->receive_pending = GNUNET_YES;
-    GNUNET_CONNECTION_receive (client->connection,
-                               GNUNET_MAX_MESSAGE_SIZE - 1,
-                               GNUNET_TIME_absolute_get_remaining (end),
-                               &process_incoming,
-                               client);
-    return;
-  }
-  if ((NULL == buf) ||
-      (0 == available) ||
-      (0 != errCode) ||
-      (NULL == server) ||
-      (GNUNET_YES == client->shutdown_now) ||
-      (GNUNET_YES != GNUNET_CONNECTION_check (client->connection)))
-  {
-    /* other side closed connection, error connecting, etc. */
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Failed to connect or other side closed connection (%p)\n",
-         client);
-    GNUNET_SERVER_client_disconnect (client);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Server receives %u bytes from `%s'.\n",
-       (unsigned int) available,
-       GNUNET_a2s (addr, addrlen));
-  GNUNET_SERVER_client_keep (client);
-  client->last_activity = now;
-
-  if (NULL != server->mst_receive)
-  {
-    ret = client->server->mst_receive (client->server->mst_cls,
-                                       client->mst,
-                                       client,
-                                       buf,
-                                       available,
-                                       GNUNET_NO,
-                                       GNUNET_YES);
-  }
-  else if (NULL != client->mst)
-  {
-    ret =
-      GNUNET_SERVER_mst_receive (client->mst,
-                                 client,
-                                 buf,
-                                 available,
-                                 GNUNET_NO,
-                                 GNUNET_YES);
-  }
-  else
-  {
-    GNUNET_break (0);
-    return;
-  }
-  process_mst (client,
-               ret);
-  GNUNET_SERVER_client_drop (client);
-}
-
-
-/**
- * Task run to start again receiving from the network
- * and process requests.
- *
- * @param cls our `struct GNUNET_SERVER_Client *` to process more requests from
- */
-static void
-restart_processing (void *cls)
-{
-  struct GNUNET_SERVER_Client *client = cls;
-
-  GNUNET_assert (GNUNET_YES != client->shutdown_now);
-  client->restart_task = NULL;
-  if (GNUNET_NO == client->receive_pending)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Server begins to read again from 
client.\n");
-    client->receive_pending = GNUNET_YES;
-    GNUNET_CONNECTION_receive (client->connection,
-                               GNUNET_MAX_MESSAGE_SIZE - 1,
-                               client->idle_timeout,
-                               &process_incoming,
-                               client);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Server continues processing messages still in the buffer.\n");
-  GNUNET_SERVER_client_keep (client);
-  client->receive_pending = GNUNET_NO;
-  process_mst (client,
-               GNUNET_NO);
-  GNUNET_SERVER_client_drop (client);
-}
-
-
-/**
- * This function is called whenever our inbound message tokenizer has
- * received a complete message.
- *
- * @param cls closure (struct GNUNET_SERVER_Handle)
- * @param client identification of the client (`struct GNUNET_SERVER_Client *`)
- * @param message the actual message
- *
- * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
- */
-static int
-client_message_tokenizer_callback (void *cls,
-                                   void *client,
-                                   const struct GNUNET_MessageHeader *message)
-{
-  struct GNUNET_SERVER_Handle *server = cls;
-  struct GNUNET_SERVER_Client *sender = client;
-  int ret;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Tokenizer gives server message of type %u and size %u from client\n",
-       ntohs (message->type), ntohs (message->size));
-  sender->in_process_client_buffer = GNUNET_YES;
-  ret = GNUNET_SERVER_inject (server, sender, message);
-  sender->in_process_client_buffer = GNUNET_NO;
-  if ((GNUNET_OK != ret) || (GNUNET_YES == sender->shutdown_now))
-  {
-    GNUNET_SERVER_client_disconnect (sender);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Add a TCP socket-based connection to the set of handles managed by
- * this server.  Use this function for outgoing (P2P) connections that
- * we initiated (and where this server should process incoming
- * messages).
- *
- * @param server the server to use
- * @param connection the connection to manage (client must
- *        stop using this connection from now on)
- * @return the client handle
- */
-struct GNUNET_SERVER_Client *
-GNUNET_SERVER_connect_socket (struct GNUNET_SERVER_Handle *server,
-                              struct GNUNET_CONNECTION_Handle *connection)
-{
-  struct GNUNET_SERVER_Client *client;
-  struct NotifyList *n;
-
-  client = GNUNET_new (struct GNUNET_SERVER_Client);
-  client->connection = connection;
-  client->server = server;
-  client->last_activity = GNUNET_TIME_absolute_get ();
-  client->idle_timeout = server->idle_timeout;
-  GNUNET_CONTAINER_DLL_insert (server->clients_head,
-                               server->clients_tail,
-                               client);
-  if (NULL != server->mst_create)
-    client->mst =
-      server->mst_create (server->mst_cls, client);
-  else
-    client->mst =
-      GNUNET_SERVER_mst_create (&client_message_tokenizer_callback,
-                                server);
-  GNUNET_assert (NULL != client->mst);
-  for (n = server->connect_notify_list_head; NULL != n; n = n->next)
-    n->callback (n->callback_cls, client);
-  client->receive_pending = GNUNET_YES;
-  if (GNUNET_SYSERR ==
-      GNUNET_CONNECTION_receive (client->connection,
-                                 GNUNET_MAX_MESSAGE_SIZE - 1,
-                                 client->idle_timeout,
-                                 &process_incoming,
-                                 client))
-    return NULL;
-  return client;
-}
-
-
-/**
- * Change the timeout for a particular client.  Decreasing the timeout
- * may not go into effect immediately (only after the previous timeout
- * times out or activity happens on the socket).
- *
- * @param client the client to update
- * @param timeout new timeout for activities on the socket
- */
-void
-GNUNET_SERVER_client_set_timeout (struct GNUNET_SERVER_Client *client,
-                                  struct GNUNET_TIME_Relative timeout)
-{
-  client->idle_timeout = timeout;
-}
-
-
-/**
- * Notify the server that the given client handle should
- * be kept (keeps the connection up if possible, increments
- * the internal reference counter).
- *
- * @param client the client to keep
- */
-void
-GNUNET_SERVER_client_keep (struct GNUNET_SERVER_Client *client)
-{
-  client->reference_count++;
-}
-
-
-/**
- * Notify the server that the given client handle is no
- * longer required.  Decrements the reference counter.  If
- * that counter reaches zero an inactive connection maybe
- * closed.
- *
- * @param client the client to drop
- */
-void
-GNUNET_SERVER_client_drop (struct GNUNET_SERVER_Client *client)
-{
-  GNUNET_assert (client->reference_count > 0);
-  client->reference_count--;
-  if ((GNUNET_YES == client->shutdown_now) && (0 == client->reference_count))
-    GNUNET_SERVER_client_disconnect (client);
-}
-
-
-/**
- * Obtain the network address of the other party.
- *
- * @param client the client to get the address for
- * @param addr where to store the address
- * @param addrlen where to store the length of the @a addr
- * @return #GNUNET_OK on success
- */
-int
-GNUNET_SERVER_client_get_address (struct GNUNET_SERVER_Client *client,
-                                  void **addr, size_t *addrlen)
-{
-  return GNUNET_CONNECTION_get_address (client->connection, addr, addrlen);
-}
-
-
-/**
- * Ask the server to notify us whenever a client disconnects.
- * This function is called whenever the actual network connection
- * is closed; the reference count may be zero or larger than zero
- * at this point.
- *
- * @param server the server manageing the clients
- * @param callback function to call on disconnect
- * @param callback_cls closure for @a callback
- */
-void
-GNUNET_SERVER_disconnect_notify (struct GNUNET_SERVER_Handle *server,
-                                 GNUNET_SERVER_DisconnectCallback callback,
-                                 void *callback_cls)
-{
-  struct NotifyList *n;
-
-  n = GNUNET_new (struct NotifyList);
-  n->callback = callback;
-  n->callback_cls = callback_cls;
-  GNUNET_CONTAINER_DLL_insert (server->disconnect_notify_list_head,
-                               server->disconnect_notify_list_tail,
-                               n);
-}
-
-
-/**
- * Ask the server to notify us whenever a client connects.
- * This function is called whenever the actual network connection
- * is opened. If the server is destroyed before this
- * notification is explicitly cancelled, the 'callback' will
- * once be called with a 'client' argument of NULL to indicate
- * that the server itself is now gone (and that the callback
- * won't be called anymore and also can no longer be cancelled).
- *
- * @param server the server manageing the clients
- * @param callback function to call on sconnect
- * @param callback_cls closure for @a callback
- */
-void
-GNUNET_SERVER_connect_notify (struct GNUNET_SERVER_Handle *server,
-                              GNUNET_SERVER_ConnectCallback callback,
-                              void *callback_cls)
-{
-  struct NotifyList *n;
-  struct GNUNET_SERVER_Client *client;
-
-  n = GNUNET_new (struct NotifyList);
-  n->callback = callback;
-  n->callback_cls = callback_cls;
-  GNUNET_CONTAINER_DLL_insert (server->connect_notify_list_head,
-                               server->connect_notify_list_tail,
-                               n);
-  for (client = server->clients_head; NULL != client; client = client->next)
-    callback (callback_cls, client);
-}
-
-
-/**
- * Ask the server to stop notifying us whenever a client connects.
- *
- * @param server the server manageing the clients
- * @param callback function to call on connect
- * @param callback_cls closure for @a callback
- */
-void
-GNUNET_SERVER_disconnect_notify_cancel (struct GNUNET_SERVER_Handle *server,
-                                        GNUNET_SERVER_DisconnectCallback
-                                        callback,
-                                        void *callback_cls)
-{
-  struct NotifyList *pos;
-
-  for (pos = server->disconnect_notify_list_head; NULL != pos; pos = pos->next)
-    if ((pos->callback == callback) && (pos->callback_cls == callback_cls))
-      break;
-  if (NULL == pos)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GNUNET_CONTAINER_DLL_remove (server->disconnect_notify_list_head,
-                               server->disconnect_notify_list_tail,
-                               pos);
-  GNUNET_free (pos);
-}
-
-
-/**
- * Ask the server to stop notifying us whenever a client disconnects.
- *
- * @param server the server manageing the clients
- * @param callback function to call on disconnect
- * @param callback_cls closure for @a callback
- */
-void
-GNUNET_SERVER_connect_notify_cancel (struct GNUNET_SERVER_Handle *server,
-                                     GNUNET_SERVER_ConnectCallback callback,
-                                     void *callback_cls)
-{
-  struct NotifyList *pos;
-
-  for (pos = server->connect_notify_list_head; NULL != pos; pos = pos->next)
-    if ((pos->callback == callback) && (pos->callback_cls == callback_cls))
-      break;
-  if (NULL == pos)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  GNUNET_CONTAINER_DLL_remove (server->connect_notify_list_head,
-                               server->connect_notify_list_tail,
-                               pos);
-  GNUNET_free (pos);
-}
-
-
-/**
- * Ask the server to disconnect from the given client.
- * This is the same as returning #GNUNET_SYSERR from a message
- * handler, except that it allows dropping of a client even
- * when not handling a message from that client.
- *
- * @param client the client to disconnect from
- */
-void
-GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client)
-{
-  struct GNUNET_SERVER_Handle *server = client->server;
-  struct NotifyList *n;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Client is being disconnected from the server.\n");
-  if (NULL != client->restart_task)
-  {
-    GNUNET_SCHEDULER_cancel (client->restart_task);
-    client->restart_task = NULL;
-  }
-  if (NULL != client->warn_task)
-  {
-    GNUNET_SCHEDULER_cancel (client->warn_task);
-    client->warn_task = NULL;
-  }
-  if (GNUNET_YES == client->receive_pending)
-  {
-    GNUNET_CONNECTION_receive_cancel (client->connection);
-    client->receive_pending = GNUNET_NO;
-  }
-  client->shutdown_now = GNUNET_YES;
-  client->reference_count++; /* make sure nobody else clean up client... */
-  if ((NULL != client->mst) &&
-      (NULL != server))
-  {
-    GNUNET_CONTAINER_DLL_remove (server->clients_head,
-                                 server->clients_tail,
-                                 client);
-    if (NULL != server->mst_destroy)
-      server->mst_destroy (server->mst_cls,
-                           client->mst);
-    else
-      GNUNET_SERVER_mst_destroy (client->mst);
-    client->mst = NULL;
-    for (n = server->disconnect_notify_list_head; NULL != n; n = n->next)
-      n->callback (n->callback_cls,
-                   client);
-  }
-  client->reference_count--;
-  if (client->reference_count > 0)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "RC of %p still positive, not destroying everything.\n",
-         client);
-    client->server = NULL;
-    return;
-  }
-  if (GNUNET_YES == client->in_process_client_buffer)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Still processing inputs of %p, not destroying everything.\n",
-         client);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "RC of %p now zero, destroying everything.\n",
-       client);
-  if (GNUNET_YES == client->persist)
-    GNUNET_CONNECTION_persist_ (client->connection);
-  if (NULL != client->th.cth)
-    GNUNET_SERVER_notify_transmit_ready_cancel (&client->th);
-  GNUNET_CONNECTION_destroy (client->connection);
-  /* need to cancel again, as it might have been re-added
-     in the meantime (i.e. during callbacks) */
-  if (NULL != client->warn_task)
-  {
-    GNUNET_SCHEDULER_cancel (client->warn_task);
-    client->warn_task = NULL;
-  }
-  if (GNUNET_YES == client->receive_pending)
-  {
-    GNUNET_CONNECTION_receive_cancel (client->connection);
-    client->receive_pending = GNUNET_NO;
-  }
-  GNUNET_free (client);
-  /* we might be in soft-shutdown, test if we're done */
-  if (NULL != server)
-    test_monitor_clients (server);
-}
-
-
-/**
- * Disable the "CORK" feature for communication with the given client,
- * forcing the OS to immediately flush the buffer on transmission
- * instead of potentially buffering multiple messages.
- *
- * @param client handle to the client
- * @return #GNUNET_OK on success
- */
-int
-GNUNET_SERVER_client_disable_corking (struct GNUNET_SERVER_Client *client)
-{
-  return GNUNET_CONNECTION_disable_corking (client->connection);
-}
-
-
-/**
- * Wrapper for transmission notification that calls the original
- * callback and update the last activity time for our connection.
- *
- * @param cls the `struct GNUNET_SERVER_Client *`
- * @param size number of bytes we can transmit
- * @param buf where to copy the message
- * @return number of bytes actually transmitted
- */
-static size_t
-transmit_ready_callback_wrapper (void *cls, size_t size, void *buf)
-{
-  struct GNUNET_SERVER_Client *client = cls;
-  GNUNET_CONNECTION_TransmitReadyNotify callback;
-
-  client->th.cth = NULL;
-  callback = client->th.callback;
-  client->th.callback = NULL;
-  client->last_activity = GNUNET_TIME_absolute_get ();
-  return callback (client->th.callback_cls, size, buf);
-}
-
-
-struct GNUNET_SERVER_TransmitHandle *
-GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client,
-                                     size_t size,
-                                     struct GNUNET_TIME_Relative timeout,
-                                     GNUNET_CONNECTION_TransmitReadyNotify
-                                     callback,
-                                     void *callback_cls)
-{
-  if (NULL != client->th.callback)
-    return NULL;
-  client->th.callback_cls = callback_cls;
-  client->th.callback = callback;
-  client->th.cth = GNUNET_CONNECTION_notify_transmit_ready (client->connection,
-                                                            size,
-                                                            timeout,
-                                                            &
-                                                            
transmit_ready_callback_wrapper,
-                                                            client);
-  return &client->th;
-}
-
-
-/**
- * Abort transmission request.
- *
- * @param th request to abort
- */
-void
-GNUNET_SERVER_notify_transmit_ready_cancel (struct
-                                            GNUNET_SERVER_TransmitHandle *th)
-{
-  GNUNET_CONNECTION_notify_transmit_ready_cancel (th->cth);
-  th->cth = NULL;
-  th->callback = NULL;
-}
-
-
-/**
- * Set the persistent flag on this client, used to setup client connection
- * to only be killed when the service it's connected to is actually dead.
- *
- * @param client the client to set the persistent flag on
- */
-void
-GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client)
-{
-  client->persist = GNUNET_YES;
-}
-
-
-/**
- * Resume receiving from this client, we are done processing the
- * current request.  This function must be called from within each
- * GNUNET_SERVER_MessageCallback (or its respective continuations).
- *
- * @param client client we were processing a message of
- * @param success #GNUNET_OK to keep the connection open and
- *                          continue to receive
- *                #GNUNET_NO to close the connection (normal behavior)
- *                #GNUNET_SYSERR to close the connection (signal
- *                          serious error)
- */
-void
-GNUNET_SERVER_receive_done (struct GNUNET_SERVER_Client *client,
-                            int success)
-{
-  if (NULL == client)
-    return;
-  GNUNET_assert (client->suspended > 0);
-  client->suspended--;
-  if (GNUNET_OK != success)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "GNUNET_SERVER_receive_done called with failure indication\n");
-    if ((client->reference_count > 0) || (client->suspended > 0))
-      client->shutdown_now = GNUNET_YES;
-    else
-      GNUNET_SERVER_client_disconnect (client);
-    return;
-  }
-  if (client->suspended > 0)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "GNUNET_SERVER_receive_done called, but more clients pending\n");
-    return;
-  }
-  if (NULL != client->warn_task)
-  {
-    GNUNET_SCHEDULER_cancel (client->warn_task);
-    client->warn_task = NULL;
-  }
-  if (GNUNET_YES == client->in_process_client_buffer)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "GNUNET_SERVER_receive_done called while still in processing loop\n");
-    return;
-  }
-  if ((NULL == client->server) || (GNUNET_YES == client->shutdown_now))
-  {
-    GNUNET_SERVER_client_disconnect (client);
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "GNUNET_SERVER_receive_done causes restart in reading from the 
socket\n");
-  GNUNET_assert (NULL == client->restart_task);
-  client->restart_task = GNUNET_SCHEDULER_add_now (&restart_processing,
-                                                   client);
-}
-
-
-/* end of server.c */
diff --git a/src/transport/tcp_server_mst_legacy.c 
b/src/transport/tcp_server_mst_legacy.c
deleted file mode 100644
index bed6874c9..000000000
--- a/src/transport/tcp_server_mst_legacy.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file util/server_mst.c
- * @brief convenience functions for handling inbound message buffers
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_util_lib.h"
-
-
-#if HAVE_UNALIGNED_64_ACCESS
-#define ALIGN_FACTOR 4
-#else
-#define ALIGN_FACTOR 8
-#endif
-
-
-/**
- * Handle to a message stream tokenizer.
- */
-struct GNUNET_SERVER_MessageStreamTokenizer
-{
-  /**
-   * Function to call on completed messages.
-   */
-  GNUNET_SERVER_MessageTokenizerCallback cb;
-
-  /**
-   * Closure for @e cb.
-   */
-  void *cb_cls;
-
-  /**
-   * Size of the buffer (starting at @e hdr).
-   */
-  size_t curr_buf;
-
-  /**
-   * How many bytes in buffer have we already processed?
-   */
-  size_t off;
-
-  /**
-   * How many bytes in buffer are valid right now?
-   */
-  size_t pos;
-
-  /**
-   * Beginning of the buffer.  Typed like this to force alignment.
-   */
-  struct GNUNET_MessageHeader *hdr;
-};
-
-
-/**
- * Create a message stream tokenizer.
- *
- * @param cb function to call on completed messages
- * @param cb_cls closure for @a cb
- * @return handle to tokenizer
- */
-struct GNUNET_SERVER_MessageStreamTokenizer *
-GNUNET_SERVER_mst_create (GNUNET_SERVER_MessageTokenizerCallback cb,
-                          void *cb_cls)
-{
-  struct GNUNET_SERVER_MessageStreamTokenizer *ret;
-
-  ret = GNUNET_new (struct GNUNET_SERVER_MessageStreamTokenizer);
-  ret->hdr = GNUNET_malloc (GNUNET_MIN_MESSAGE_SIZE);
-  ret->curr_buf = GNUNET_MIN_MESSAGE_SIZE;
-  ret->cb = cb;
-  ret->cb_cls = cb_cls;
-  return ret;
-}
-
-
-/**
- * Add incoming data to the receive buffer and call the
- * callback for all complete messages.
- *
- * @param mst tokenizer to use
- * @param client_identity ID of client for which this is a buffer
- * @param buf input data to add
- * @param size number of bytes in @a buf
- * @param purge should any excess bytes in the buffer be discarded
- *       (i.e. for packet-based services like UDP)
- * @param one_shot only call callback once, keep rest of message in buffer
- * @return #GNUNET_OK if we are done processing (need more data)
- *         #GNUNET_NO if @a one_shot was set and we have another message ready
- *         #GNUNET_SYSERR if the data stream is corrupt
- */
-int
-GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst,
-                           void *client_identity,
-                           const char *buf, size_t size,
-                           int purge, int one_shot)
-{
-  const struct GNUNET_MessageHeader *hdr;
-  size_t delta;
-  uint16_t want;
-  char *ibuf;
-  int need_align;
-  unsigned long offset;
-  int ret;
-
-  GNUNET_assert (mst->off <= mst->pos);
-  GNUNET_assert (mst->pos <= mst->curr_buf);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Server-mst receives %u bytes with %u bytes already in private 
buffer\n",
-       (unsigned int) size, (unsigned int) (mst->pos - mst->off));
-  ret = GNUNET_OK;
-  ibuf = (char *) mst->hdr;
-  while (mst->pos > 0)
-  {
-do_align:
-    GNUNET_assert (mst->pos >= mst->off);
-    if ((mst->curr_buf - mst->off < sizeof(struct GNUNET_MessageHeader)) ||
-        (0 != (mst->off % ALIGN_FACTOR)))
-    {
-      /* need to align or need more space */
-      mst->pos -= mst->off;
-      memmove (ibuf, &ibuf[mst->off], mst->pos);
-      mst->off = 0;
-    }
-    if (mst->pos - mst->off < sizeof(struct GNUNET_MessageHeader))
-    {
-      delta =
-        GNUNET_MIN (sizeof(struct GNUNET_MessageHeader)
-                    - (mst->pos - mst->off), size);
-      GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
-      mst->pos += delta;
-      buf += delta;
-      size -= delta;
-    }
-    if (mst->pos - mst->off < sizeof(struct GNUNET_MessageHeader))
-    {
-      if (purge)
-      {
-        mst->off = 0;
-        mst->pos = 0;
-      }
-      return GNUNET_OK;
-    }
-    hdr = (const struct GNUNET_MessageHeader *) &ibuf[mst->off];
-    want = ntohs (hdr->size);
-    if (want < sizeof(struct GNUNET_MessageHeader))
-    {
-      GNUNET_break_op (0);
-      return GNUNET_SYSERR;
-    }
-    if ((mst->curr_buf - mst->off < want) &&
-        (mst->off > 0))
-    {
-      /* can get more space by moving */
-      mst->pos -= mst->off;
-      memmove (ibuf, &ibuf[mst->off], mst->pos);
-      mst->off = 0;
-    }
-    if (mst->curr_buf < want)
-    {
-      /* need to get more space by growing buffer */
-      GNUNET_assert (0 == mst->off);
-      mst->hdr = GNUNET_realloc (mst->hdr, want);
-      ibuf = (char *) mst->hdr;
-      mst->curr_buf = want;
-    }
-    hdr = (const struct GNUNET_MessageHeader *) &ibuf[mst->off];
-    if (mst->pos - mst->off < want)
-    {
-      delta = GNUNET_MIN (want - (mst->pos - mst->off), size);
-      GNUNET_assert (mst->pos + delta <= mst->curr_buf);
-      GNUNET_memcpy (&ibuf[mst->pos], buf, delta);
-      mst->pos += delta;
-      buf += delta;
-      size -= delta;
-    }
-    if (mst->pos - mst->off < want)
-    {
-      if (purge)
-      {
-        mst->off = 0;
-        mst->pos = 0;
-      }
-      return GNUNET_OK;
-    }
-    if (one_shot == GNUNET_SYSERR)
-    {
-      /* cannot call callback again, but return value saying that
-       * we have another full message in the buffer */
-      ret = GNUNET_NO;
-      goto copy;
-    }
-    if (one_shot == GNUNET_YES)
-      one_shot = GNUNET_SYSERR;
-    mst->off += want;
-    if (GNUNET_SYSERR == mst->cb (mst->cb_cls, client_identity, hdr))
-      return GNUNET_SYSERR;
-    if (mst->off == mst->pos)
-    {
-      /* reset to beginning of buffer, it's free right now! */
-      mst->off = 0;
-      mst->pos = 0;
-    }
-  }
-  GNUNET_assert (0 == mst->pos);
-  while (size > 0)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Server-mst has %u bytes left in inbound buffer\n",
-         (unsigned int) size);
-    if (size < sizeof(struct GNUNET_MessageHeader))
-      break;
-    offset = (unsigned long) buf;
-    need_align = (0 != (offset % ALIGN_FACTOR)) ? GNUNET_YES : GNUNET_NO;
-    if (GNUNET_NO == need_align)
-    {
-      /* can try to do zero-copy and process directly from original buffer */
-      hdr = (const struct GNUNET_MessageHeader *) buf;
-      want = ntohs (hdr->size);
-      if (want < sizeof(struct GNUNET_MessageHeader))
-      {
-        GNUNET_break_op (0);
-        mst->off = 0;
-        return GNUNET_SYSERR;
-      }
-      if (size < want)
-        break;                  /* or not: buffer incomplete, so copy to 
private buffer... */
-      if (one_shot == GNUNET_SYSERR)
-      {
-        /* cannot call callback again, but return value saying that
-         * we have another full message in the buffer */
-        ret = GNUNET_NO;
-        goto copy;
-      }
-      if (one_shot == GNUNET_YES)
-        one_shot = GNUNET_SYSERR;
-      if (GNUNET_SYSERR == mst->cb (mst->cb_cls, client_identity, hdr))
-        return GNUNET_SYSERR;
-      buf += want;
-      size -= want;
-    }
-    else
-    {
-      /* need to copy to private buffer to align;
-       * yes, we go a bit more spaghetti than usual here */
-      goto do_align;
-    }
-  }
-copy:
-  if ((size > 0) && (! purge))
-  {
-    if (size + mst->pos > mst->curr_buf)
-    {
-      mst->hdr = GNUNET_realloc (mst->hdr, size + mst->pos);
-      ibuf = (char *) mst->hdr;
-      mst->curr_buf = size + mst->pos;
-    }
-    GNUNET_assert (size + mst->pos <= mst->curr_buf);
-    GNUNET_memcpy (&ibuf[mst->pos], buf, size);
-    mst->pos += size;
-  }
-  if (purge)
-  {
-    mst->off = 0;
-    mst->pos = 0;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Server-mst leaves %u bytes in private buffer\n",
-       (unsigned int) (mst->pos - mst->off));
-  return ret;
-}
-
-
-/**
- * Destroys a tokenizer.
- *
- * @param mst tokenizer to destroy
- */
-void
-GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer *mst)
-{
-  GNUNET_free (mst->hdr);
-  GNUNET_free (mst);
-}
-
-
-/* end of server_mst.c */
diff --git a/src/transport/tcp_service_legacy.c 
b/src/transport/tcp_service_legacy.c
deleted file mode 100644
index 65b090187..000000000
--- a/src/transport/tcp_service_legacy.c
+++ /dev/null
@@ -1,1646 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2012 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file util/service.c
- * @brief functions related to starting services
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_constants.h"
-#include "gnunet_resolver_service.h"
-
-#if HAVE_MALLINFO2
-#include <malloc.h>
-#include "gauger.h"
-#endif
-
-
-/* ******************* access control ******************** */
-
-/**
- * Check if the given IP address is in the list of IP addresses.
- *
- * @param list a list of networks
- * @param add the IP to check (in network byte order)
- * @return #GNUNET_NO if the IP is not in the list, #GNUNET_YES if it it is
- */
-static int
-check_ipv4_listed (const struct GNUNET_STRINGS_IPv4NetworkPolicy *list,
-                   const struct in_addr *add)
-{
-  unsigned int i;
-
-  if (NULL == list)
-    return GNUNET_NO;
-  i = 0;
-  while ((list[i].network.s_addr != 0) || (list[i].netmask.s_addr != 0))
-  {
-    if ((add->s_addr & list[i].netmask.s_addr) ==
-        (list[i].network.s_addr & list[i].netmask.s_addr))
-      return GNUNET_YES;
-    i++;
-  }
-  return GNUNET_NO;
-}
-
-
-/**
- * Check if the given IP address is in the list of IP addresses.
- *
- * @param list a list of networks
- * @param ip the IP to check (in network byte order)
- * @return #GNUNET_NO if the IP is not in the list, #GNUNET_YES if it it is
- */
-static int
-check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list,
-                   const struct in6_addr *ip)
-{
-  unsigned int i;
-  unsigned int j;
-  struct in6_addr zero;
-
-  if (NULL == list)
-    return GNUNET_NO;
-  memset (&zero, 0, sizeof(struct in6_addr));
-  i = 0;
-NEXT:
-  while (0 != memcmp (&zero, &list[i].network, sizeof(struct in6_addr)))
-  {
-    for (j = 0; j < sizeof(struct in6_addr) / sizeof(int); j++)
-      if (((((int *) ip)[j] & ((int *) &list[i].netmask)[j])) !=
-          (((int *) &list[i].network)[j] & ((int *) &list[i].netmask)[j]))
-      {
-        i++;
-        goto NEXT;
-      }
-    return GNUNET_YES;
-  }
-  return GNUNET_NO;
-}
-
-
-/* ****************** service struct ****************** */
-
-
-/**
- * Context for "service_task".
- */
-struct LEGACY_SERVICE_Context
-{
-  /**
-   * Our configuration.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Handle for the server.
-   */
-  struct GNUNET_SERVER_Handle *server;
-
-  /**
-   * NULL-terminated array of addresses to bind to, NULL if we got pre-bound
-   * listen sockets.
-   */
-  struct sockaddr **addrs;
-
-  /**
-   * Name of our service.
-   */
-  const char *service_name;
-
-  /**
-   * Main service-specific task to run.
-   */
-  LEGACY_SERVICE_Main task;
-
-  /**
-   * Closure for @e task.
-   */
-  void *task_cls;
-
-  /**
-   * IPv4 addresses that are not allowed to connect.
-   */
-  struct GNUNET_STRINGS_IPv4NetworkPolicy *v4_denied;
-
-  /**
-   * IPv6 addresses that are not allowed to connect.
-   */
-  struct GNUNET_STRINGS_IPv6NetworkPolicy *v6_denied;
-
-  /**
-   * IPv4 addresses that are allowed to connect (if not
-   * set, all are allowed).
-   */
-  struct GNUNET_STRINGS_IPv4NetworkPolicy *v4_allowed;
-
-  /**
-   * IPv6 addresses that are allowed to connect (if not
-   * set, all are allowed).
-   */
-  struct GNUNET_STRINGS_IPv6NetworkPolicy *v6_allowed;
-
-  /**
-   * My (default) message handlers.  Adjusted copy
-   * of "defhandlers".
-   */
-  struct GNUNET_SERVER_MessageHandler *my_handlers;
-
-  /**
-   * Array of the lengths of the entries in addrs.
-   */
-  socklen_t *addrlens;
-
-  /**
-   * NULL-terminated array of listen sockets we should take over.
-   */
-  struct GNUNET_NETWORK_Handle **lsocks;
-
-  /**
-   * Task ID of the shutdown task.
-   */
-  struct GNUNET_SCHEDULER_Task *shutdown_task;
-
-  /**
-   * Idle timeout for server.
-   */
-  struct GNUNET_TIME_Relative timeout;
-
-  /**
-   * Overall success/failure of the service start.
-   */
-  int ret;
-
-  /**
-   * If we are daemonizing, this FD is set to the
-   * pipe to the parent.  Send '.' if we started
-   * ok, '!' if not.  -1 if we are not daemonizing.
-   */
-  int ready_confirm_fd;
-
-  /**
-   * Do we close connections if we receive messages
-   * for which we have no handler?
-   */
-  int require_found;
-
-  /**
-   * Do we require a matching UID for UNIX domain socket connections?
-   * #GNUNET_NO means that the UID does not have to match (however,
-   * @e match_gid may still impose other access control checks).
-   */
-  int match_uid;
-
-  /**
-   * Do we require a matching GID for UNIX domain socket connections?
-   * Ignored if @e match_uid is #GNUNET_YES.  Note that this is about
-   * checking that the client's UID is in our group OR that the
-   * client's GID is our GID.  If both "match_gid" and @e match_uid are
-   * #GNUNET_NO, all users on the local system have access.
-   */
-  int match_gid;
-
-  /**
-   * Our options.
-   */
-  enum LEGACY_SERVICE_Options options;
-};
-
-
-/* ****************** message handlers ****************** */
-
-/**
- * Send a 'TEST' message back to the client.
- *
- * @param cls the 'struct GNUNET_SERVER_Client' to send TEST to
- * @param size number of bytes available in 'buf'
- * @param buf where to copy the message
- * @return number of bytes written to 'buf'
- */
-static size_t
-write_test (void *cls, size_t size, void *buf)
-{
-  struct GNUNET_SERVER_Client *client = cls;
-  struct GNUNET_MessageHeader *msg;
-
-  if (size < sizeof(struct GNUNET_MessageHeader))
-  {
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    return 0;   /* client disconnected */
-  }
-  msg = (struct GNUNET_MessageHeader *) buf;
-  msg->type = htons (GNUNET_MESSAGE_TYPE_TEST);
-  msg->size = htons (sizeof(struct GNUNET_MessageHeader));
-  GNUNET_SERVER_receive_done (client, GNUNET_OK);
-  return sizeof(struct GNUNET_MessageHeader);
-}
-
-
-/**
- * Handler for TEST message.
- *
- * @param cls closure (refers to service)
- * @param client identification of the client
- * @param message the actual message
- */
-static void
-handle_test (void *cls,
-             struct GNUNET_SERVER_Client *client,
-             const struct GNUNET_MessageHeader *message)
-{
-  /* simply bounce message back to acknowledge */
-  if (NULL ==
-      GNUNET_SERVER_notify_transmit_ready (client,
-                                           sizeof(struct GNUNET_MessageHeader),
-                                           GNUNET_TIME_UNIT_FOREVER_REL,
-                                           &write_test,
-                                           client))
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-}
-
-
-/**
- * Default handlers for all services.  Will be copied and the
- * "callback_cls" fields will be replaced with the specific service
- * struct.
- */
-static const struct GNUNET_SERVER_MessageHandler defhandlers[] =
-{ { &handle_test,
-    NULL,
-    GNUNET_MESSAGE_TYPE_TEST,
-    sizeof(struct GNUNET_MessageHeader) },
-  { NULL, NULL, 0, 0 } };
-
-
-/* ****************** service core routines ************** */
-
-
-/**
- * Check if access to the service is allowed from the given address.
- *
- * @param cls closure
- * @param uc credentials, if available, otherwise NULL
- * @param addr address
- * @param addrlen length of address
- * @return #GNUNET_YES to allow, #GNUNET_NO to deny, #GNUNET_SYSERR
- *   for unknown address family (will be denied).
- */
-static int
-check_access (void *cls,
-              const struct GNUNET_CONNECTION_Credentials *uc,
-              const struct sockaddr *addr,
-              socklen_t addrlen)
-{
-  struct LEGACY_SERVICE_Context *sctx = cls;
-  const struct sockaddr_in *i4;
-  const struct sockaddr_in6 *i6;
-  int ret;
-
-  switch (addr->sa_family)
-  {
-  case AF_INET:
-    GNUNET_assert (addrlen == sizeof(struct sockaddr_in));
-    i4 = (const struct sockaddr_in *) addr;
-    ret = ((NULL == sctx->v4_allowed) ||
-           (check_ipv4_listed (sctx->v4_allowed, &i4->sin_addr))) &&
-          ((NULL == sctx->v4_denied) ||
-           (! check_ipv4_listed (sctx->v4_denied, &i4->sin_addr)));
-    break;
-
-  case AF_INET6:
-    GNUNET_assert (addrlen == sizeof(struct sockaddr_in6));
-    i6 = (const struct sockaddr_in6 *) addr;
-    ret = ((NULL == sctx->v6_allowed) ||
-           (check_ipv6_listed (sctx->v6_allowed, &i6->sin6_addr))) &&
-          ((NULL == sctx->v6_denied) ||
-           (! check_ipv6_listed (sctx->v6_denied, &i6->sin6_addr)));
-    break;
-
-  case AF_UNIX:
-    ret = GNUNET_OK;   /* controlled using file-system ACL now */
-    break;
-
-  default:
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         _ ("Unknown address family %d\n"),
-         addr->sa_family);
-    return GNUNET_SYSERR;
-  }
-  if (GNUNET_OK != ret)
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         _ ("Access from `%s' denied to service `%s'\n"),
-         GNUNET_a2s (addr, addrlen),
-         sctx->service_name);
-  }
-  return ret;
-}
-
-
-/**
- * Get the name of the file where we will
- * write the PID of the service.
- *
- * @param sctx service context
- * @return name of the file for the process ID
- */
-static char *
-get_pid_file_name (struct LEGACY_SERVICE_Context *sctx)
-{
-  char *pif;
-
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (sctx->cfg,
-                                                            sctx->service_name,
-                                                            "PIDFILE",
-                                                            &pif))
-    return NULL;
-  return pif;
-}
-
-
-/**
- * Parse an IPv4 access control list.
- *
- * @param ret location where to write the ACL (set)
- * @param sctx service context to use to get the configuration
- * @param option name of the ACL option to parse
- * @return #GNUNET_SYSERR on parse error, #GNUNET_OK on success (including
- *         no ACL configured)
- */
-static int
-process_acl4 (struct GNUNET_STRINGS_IPv4NetworkPolicy **ret,
-              struct LEGACY_SERVICE_Context *sctx,
-              const char *option)
-{
-  char *opt;
-
-  if (! GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, 
option))
-  {
-    *ret = NULL;
-    return GNUNET_OK;
-  }
-  GNUNET_break (GNUNET_OK ==
-                GNUNET_CONFIGURATION_get_value_string (sctx->cfg,
-                                                       sctx->service_name,
-                                                       option,
-                                                       &opt));
-  if (NULL == (*ret = GNUNET_STRINGS_parse_ipv4_policy (opt)))
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         _ ("Could not parse IPv4 network specification `%s' for `%s:%s'\n"),
-         opt,
-         sctx->service_name,
-         option);
-    GNUNET_free (opt);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (opt);
-  return GNUNET_OK;
-}
-
-
-/**
- * Parse an IPv6 access control list.
- *
- * @param ret location where to write the ACL (set)
- * @param sctx service context to use to get the configuration
- * @param option name of the ACL option to parse
- * @return #GNUNET_SYSERR on parse error, #GNUNET_OK on success (including
- *         no ACL configured)
- */
-static int
-process_acl6 (struct GNUNET_STRINGS_IPv6NetworkPolicy **ret,
-              struct LEGACY_SERVICE_Context *sctx,
-              const char *option)
-{
-  char *opt;
-
-  if (! GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, 
option))
-  {
-    *ret = NULL;
-    return GNUNET_OK;
-  }
-  GNUNET_break (GNUNET_OK ==
-                GNUNET_CONFIGURATION_get_value_string (sctx->cfg,
-                                                       sctx->service_name,
-                                                       option,
-                                                       &opt));
-  if (NULL == (*ret = GNUNET_STRINGS_parse_ipv6_policy (opt)))
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING,
-         _ ("Could not parse IPv6 network specification `%s' for `%s:%s'\n"),
-         opt,
-         sctx->service_name,
-         option);
-    GNUNET_free (opt);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (opt);
-  return GNUNET_OK;
-}
-
-
-/**
- * Add the given UNIX domain path as an address to the
- * list (as the first entry).
- *
- * @param saddrs array to update
- * @param saddrlens where to store the address length
- * @param unixpath path to add
- * @param abstract #GNUNET_YES to add an abstract UNIX domain socket.  This
- *          parameter is ignore on systems other than LINUX
- */
-static void
-add_unixpath (struct sockaddr **saddrs,
-              socklen_t *saddrlens,
-              const char *unixpath,
-              int abstract)
-{
-#ifdef AF_UNIX
-  struct sockaddr_un *un;
-
-  un = GNUNET_new (struct sockaddr_un);
-  un->sun_family = AF_UNIX;
-  GNUNET_strlcpy (un->sun_path, unixpath, sizeof(un->sun_path));
-#ifdef __linux__
-  if (GNUNET_YES == abstract)
-    un->sun_path[0] = '\0';
-#endif
-#if HAVE_SOCKADDR_UN_SUN_LEN
-  un->sun_len = (u_char) sizeof(struct sockaddr_un);
-#endif
-  *saddrs = (struct sockaddr *) un;
-  *saddrlens = sizeof(struct sockaddr_un);
-#else
-  /* this function should never be called
-   * unless AF_UNIX is defined! */
-  GNUNET_assert (0);
-#endif
-}
-
-
-/**
- * Get the list of addresses that a server for the given service
- * should bind to.
- *
- * @param service_name name of the service
- * @param cfg configuration (which specifies the addresses)
- * @param addrs set (call by reference) to an array of pointers to the
- *              addresses the server should bind to and listen on; the
- *              array will be NULL-terminated (on success)
- * @param addr_lens set (call by reference) to an array of the lengths
- *              of the respective `struct sockaddr` struct in the @a addrs
- *              array (on success)
- * @return number of addresses found on success,
- *              #GNUNET_SYSERR if the configuration
- *              did not specify reasonable finding information or
- *              if it specified a hostname that could not be resolved;
- *              #GNUNET_NO if the number of addresses configured is
- *              zero (in this case, `*addrs` and `*addr_lens` will be
- *              set to NULL).
- */
-int
-LEGACY_SERVICE_get_server_addresses (
-  const char *service_name,
-  const struct GNUNET_CONFIGURATION_Handle *cfg,
-  struct sockaddr ***addrs,
-  socklen_t **addr_lens)
-{
-  int disablev6;
-  struct GNUNET_NETWORK_Handle *desc;
-  unsigned long long port;
-  char *unixpath;
-  struct addrinfo hints;
-  struct addrinfo *res;
-  struct addrinfo *pos;
-  struct addrinfo *next;
-  unsigned int i;
-  int resi;
-  int ret;
-  int abstract;
-  struct sockaddr **saddrs;
-  socklen_t *saddrlens;
-  char *hostname;
-
-  *addrs = NULL;
-  *addr_lens = NULL;
-  desc = NULL;
-  if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "DISABLEV6"))
-  {
-    if (GNUNET_SYSERR ==
-        (disablev6 = GNUNET_CONFIGURATION_get_value_yesno (cfg,
-                                                           service_name,
-                                                           "DISABLEV6")))
-      return GNUNET_SYSERR;
-  }
-  else
-    disablev6 = GNUNET_NO;
-
-  if (! disablev6)
-  {
-    /* probe IPv6 support */
-    desc = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0);
-    if (NULL == desc)
-    {
-      if ((ENOBUFS == errno) || (ENOMEM == errno) || (ENFILE == errno) ||
-          (EACCES == errno))
-      {
-        LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "socket");
-        return GNUNET_SYSERR;
-      }
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           _ (
-             "Disabling IPv6 support for service `%s', failed to create IPv6 
socket: %s\n"),
-           service_name,
-           strerror (errno));
-      disablev6 = GNUNET_YES;
-    }
-    else
-    {
-      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (desc));
-      desc = NULL;
-    }
-  }
-
-  port = 0;
-  if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT"))
-  {
-    if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
-                                                            service_name,
-                                                            "PORT",
-                                                            &port))
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Require valid port number for service `%s' in 
configuration!\n"),
-           service_name);
-    }
-    if (port > 65535)
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Require valid port number for service `%s' in 
configuration!\n"),
-           service_name);
-      return GNUNET_SYSERR;
-    }
-  }
-
-  if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "BINDTO"))
-  {
-    GNUNET_break (GNUNET_OK ==
-                  GNUNET_CONFIGURATION_get_value_string (cfg,
-                                                         service_name,
-                                                         "BINDTO",
-                                                         &hostname));
-  }
-  else
-    hostname = NULL;
-
-  unixpath = NULL;
-  abstract = GNUNET_NO;
-#ifdef AF_UNIX
-  if ((GNUNET_YES ==
-       GNUNET_CONFIGURATION_have_value (cfg, service_name, "UNIXPATH")) &&
-      (GNUNET_OK == GNUNET_CONFIGURATION_get_value_filename (cfg,
-                                                             service_name,
-                                                             "UNIXPATH",
-                                                             &unixpath)) &&
-      (0 < strlen (unixpath)))
-  {
-    /* probe UNIX support */
-    struct sockaddr_un s_un;
-
-    if (strlen (unixpath) >= sizeof(s_un.sun_path))
-    {
-      LOG (GNUNET_ERROR_TYPE_WARNING,
-           _ ("UNIXPATH `%s' too long, maximum length is %llu\n"),
-           unixpath,
-           (unsigned long long) sizeof(s_un.sun_path));
-      unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath);
-      LOG (GNUNET_ERROR_TYPE_INFO, _ ("Using `%s' instead\n"), unixpath);
-    }
-#ifdef __linux__
-    abstract = GNUNET_CONFIGURATION_get_value_yesno (cfg,
-                                                     "TESTING",
-                                                     "USE_ABSTRACT_SOCKETS");
-    if (GNUNET_SYSERR == abstract)
-      abstract = GNUNET_NO;
-#endif
-    if ((GNUNET_YES != abstract) &&
-        (GNUNET_OK != GNUNET_DISK_directory_create_for_file (unixpath)))
-      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "mkdir", unixpath);
-  }
-  if (NULL != unixpath)
-  {
-    desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0);
-    if (NULL == desc)
-    {
-      if ((ENOBUFS == errno) || (ENOMEM == errno) || (ENFILE == errno) ||
-          (EACCES == errno))
-      {
-        LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "socket");
-        GNUNET_free (hostname);
-        GNUNET_free (unixpath);
-        return GNUNET_SYSERR;
-      }
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           _ (
-             "Disabling UNIX domain socket support for service `%s', failed to 
create UNIX domain socket: %s\n"),
-           service_name,
-           strerror (errno));
-      GNUNET_free (unixpath);
-      unixpath = NULL;
-    }
-    else
-    {
-      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (desc));
-      desc = NULL;
-    }
-  }
-#endif
-
-  if ((0 == port) && (NULL == unixpath))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ (
-           "Have neither PORT nor UNIXPATH for service `%s', but one is 
required\n"),
-         service_name);
-    GNUNET_free (hostname);
-    return GNUNET_SYSERR;
-  }
-  if (0 == port)
-  {
-    saddrs = GNUNET_malloc (2 * sizeof(struct sockaddr *));
-    saddrlens = GNUNET_malloc (2 * sizeof(socklen_t));
-    add_unixpath (saddrs, saddrlens, unixpath, abstract);
-    GNUNET_free (unixpath);
-    GNUNET_free (hostname);
-    *addrs = saddrs;
-    *addr_lens = saddrlens;
-    return 1;
-  }
-
-  if (NULL != hostname)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Resolving `%s' since that is where `%s' will bind to.\n",
-         hostname,
-         service_name);
-    memset (&hints, 0, sizeof(struct addrinfo));
-    if (disablev6)
-      hints.ai_family = AF_INET;
-    hints.ai_protocol = IPPROTO_TCP;
-    if ((0 != (ret = getaddrinfo (hostname, NULL, &hints, &res))) ||
-        (NULL == res))
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Failed to resolve `%s': %s\n"),
-           hostname,
-           gai_strerror (ret));
-      GNUNET_free (hostname);
-      GNUNET_free (unixpath);
-      return GNUNET_SYSERR;
-    }
-    next = res;
-    i = 0;
-    while (NULL != (pos = next))
-    {
-      next = pos->ai_next;
-      if ((disablev6) && (pos->ai_family == AF_INET6))
-        continue;
-      i++;
-    }
-    if (0 == i)
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Failed to find %saddress for `%s'.\n"),
-           disablev6 ? "IPv4 " : "",
-           hostname);
-      freeaddrinfo (res);
-      GNUNET_free (hostname);
-      GNUNET_free (unixpath);
-      return GNUNET_SYSERR;
-    }
-    resi = i;
-    if (NULL != unixpath)
-      resi++;
-    saddrs = GNUNET_malloc ((resi + 1) * sizeof(struct sockaddr *));
-    saddrlens = GNUNET_malloc ((resi + 1) * sizeof(socklen_t));
-    i = 0;
-    if (NULL != unixpath)
-    {
-      add_unixpath (saddrs, saddrlens, unixpath, abstract);
-      i++;
-    }
-    next = res;
-    while (NULL != (pos = next))
-    {
-      next = pos->ai_next;
-      if ((disablev6) && (AF_INET6 == pos->ai_family))
-        continue;
-      if ((IPPROTO_TCP != pos->ai_protocol) && (0 != pos->ai_protocol))
-        continue;     /* not TCP */
-      if ((SOCK_STREAM != pos->ai_socktype) && (0 != pos->ai_socktype))
-        continue;     /* huh? */
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Service `%s' will bind to `%s'\n",
-           service_name,
-           GNUNET_a2s (pos->ai_addr, pos->ai_addrlen));
-      if (AF_INET == pos->ai_family)
-      {
-        GNUNET_assert (sizeof(struct sockaddr_in) == pos->ai_addrlen);
-        saddrlens[i] = pos->ai_addrlen;
-        saddrs[i] = GNUNET_malloc (saddrlens[i]);
-        GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
-        ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
-      }
-      else
-      {
-        GNUNET_assert (AF_INET6 == pos->ai_family);
-        GNUNET_assert (sizeof(struct sockaddr_in6) == pos->ai_addrlen);
-        saddrlens[i] = pos->ai_addrlen;
-        saddrs[i] = GNUNET_malloc (saddrlens[i]);
-        GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
-        ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
-      }
-      i++;
-    }
-    GNUNET_free (hostname);
-    freeaddrinfo (res);
-    resi = i;
-  }
-  else
-  {
-    /* will bind against everything, just set port */
-    if (disablev6)
-    {
-      /* V4-only */
-      resi = 1;
-      if (NULL != unixpath)
-        resi++;
-      i = 0;
-      saddrs = GNUNET_malloc ((resi + 1) * sizeof(struct sockaddr *));
-      saddrlens = GNUNET_malloc ((resi + 1) * sizeof(socklen_t));
-      if (NULL != unixpath)
-      {
-        add_unixpath (saddrs, saddrlens, unixpath, abstract);
-        i++;
-      }
-      saddrlens[i] = sizeof(struct sockaddr_in);
-      saddrs[i] = GNUNET_malloc (saddrlens[i]);
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[i];
-#endif
-      ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET;
-      ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
-    }
-    else
-    {
-      /* dual stack */
-      resi = 2;
-      if (NULL != unixpath)
-        resi++;
-      saddrs = GNUNET_malloc ((resi + 1) * sizeof(struct sockaddr *));
-      saddrlens = GNUNET_malloc ((resi + 1) * sizeof(socklen_t));
-      i = 0;
-      if (NULL != unixpath)
-      {
-        add_unixpath (saddrs, saddrlens, unixpath, abstract);
-        i++;
-      }
-      saddrlens[i] = sizeof(struct sockaddr_in6);
-      saddrs[i] = GNUNET_malloc (saddrlens[i]);
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      ((struct sockaddr_in6 *) saddrs[i])->sin6_len = saddrlens[0];
-#endif
-      ((struct sockaddr_in6 *) saddrs[i])->sin6_family = AF_INET6;
-      ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
-      i++;
-      saddrlens[i] = sizeof(struct sockaddr_in);
-      saddrs[i] = GNUNET_malloc (saddrlens[i]);
-#if HAVE_SOCKADDR_IN_SIN_LEN
-      ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[1];
-#endif
-      ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET;
-      ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
-    }
-  }
-  GNUNET_free (unixpath);
-  *addrs = saddrs;
-  *addr_lens = saddrlens;
-  return resi;
-}
-
-
-/**
- * Setup addr, addrlen, idle_timeout
- * based on configuration!
- *
- * Configuration may specify:
- * - PORT (where to bind to for TCP)
- * - UNIXPATH (where to bind to for UNIX domain sockets)
- * - TIMEOUT (after how many ms does an inactive service timeout);
- * - DISABLEV6 (disable support for IPv6, otherwise we use dual-stack)
- * - BINDTO (hostname or IP address to bind to, otherwise we take everything)
- * - ACCEPT_FROM  (only allow connections from specified IPv4 subnets)
- * - ACCEPT_FROM6 (only allow connections from specified IPv6 subnets)
- * - REJECT_FROM  (disallow allow connections from specified IPv4 subnets)
- * - REJECT_FROM6 (disallow allow connections from specified IPv6 subnets)
- *
- * @param sctx service context to initialize
- * @return #GNUNET_OK if configuration succeeded
- */
-static int
-setup_service (struct LEGACY_SERVICE_Context *sctx)
-{
-  struct GNUNET_TIME_Relative idleout;
-  int tolerant;
-  const char *nfds;
-  unsigned int cnt;
-  int flags;
-
-  if (GNUNET_CONFIGURATION_have_value (sctx->cfg,
-                                       sctx->service_name,
-                                       "TIMEOUT"))
-  {
-    if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (sctx->cfg,
-                                                          sctx->service_name,
-                                                          "TIMEOUT",
-                                                          &idleout))
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Specified value for `%s' of service `%s' is invalid\n"),
-           "TIMEOUT",
-           sctx->service_name);
-      return GNUNET_SYSERR;
-    }
-    sctx->timeout = idleout;
-  }
-  else
-    sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
-
-  if (GNUNET_CONFIGURATION_have_value (sctx->cfg,
-                                       sctx->service_name,
-                                       "TOLERANT"))
-  {
-    if (GNUNET_SYSERR ==
-        (tolerant = GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg,
-                                                          sctx->service_name,
-                                                          "TOLERANT")))
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Specified value for `%s' of service `%s' is invalid\n"),
-           "TOLERANT",
-           sctx->service_name);
-      return GNUNET_SYSERR;
-    }
-  }
-  else
-    tolerant = GNUNET_NO;
-
-  errno = 0;
-  if ((NULL != (nfds = getenv ("LISTEN_FDS"))) &&
-      (1 == sscanf (nfds, "%u", &cnt)) && (cnt > 0) && (cnt < FD_SETSIZE) &&
-      (cnt + 4 < FD_SETSIZE))
-  {
-    sctx->lsocks =
-      GNUNET_malloc (sizeof(struct GNUNET_NETWORK_Handle *) * (cnt + 1));
-    while (0 < cnt--)
-    {
-      flags = fcntl (3 + cnt, F_GETFD);
-      if ((flags < 0) || (0 != (flags & FD_CLOEXEC)) ||
-          (NULL ==
-           (sctx->lsocks[cnt] = GNUNET_NETWORK_socket_box_native (3 + cnt))))
-      {
-        LOG (GNUNET_ERROR_TYPE_ERROR,
-             _ (
-               "Could not access pre-bound socket %u, will try to bind 
myself\n"),
-             (unsigned int) 3 + cnt);
-        cnt++;
-        while (sctx->lsocks[cnt] != NULL)
-          GNUNET_break (0 == GNUNET_NETWORK_socket_close 
(sctx->lsocks[cnt++]));
-        GNUNET_free (sctx->lsocks);
-        sctx->lsocks = NULL;
-        break;
-      }
-    }
-    unsetenv ("LISTEN_FDS");
-  }
-
-  if ((NULL == sctx->lsocks) &&
-      (GNUNET_SYSERR == LEGACY_SERVICE_get_server_addresses 
(sctx->service_name,
-                                                             sctx->cfg,
-                                                             &sctx->addrs,
-                                                             &sctx->addrlens)))
-    return GNUNET_SYSERR;
-  sctx->require_found = tolerant ? GNUNET_NO : GNUNET_YES;
-  sctx->match_uid = GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg,
-                                                          sctx->service_name,
-                                                          "UNIX_MATCH_UID");
-  sctx->match_gid = GNUNET_CONFIGURATION_get_value_yesno (sctx->cfg,
-                                                          sctx->service_name,
-                                                          "UNIX_MATCH_GID");
-  process_acl4 (&sctx->v4_denied, sctx, "REJECT_FROM");
-  process_acl4 (&sctx->v4_allowed, sctx, "ACCEPT_FROM");
-  process_acl6 (&sctx->v6_denied, sctx, "REJECT_FROM6");
-  process_acl6 (&sctx->v6_allowed, sctx, "ACCEPT_FROM6");
-
-  return GNUNET_OK;
-}
-
-
-/**
- * Get the name of the user that'll be used
- * to provide the service.
- *
- * @param sctx service context
- * @return value of the 'USERNAME' option
- */
-static char *
-get_user_name (struct LEGACY_SERVICE_Context *sctx)
-{
-  char *un;
-
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (sctx->cfg,
-                                                            sctx->service_name,
-                                                            "USERNAME",
-                                                            &un))
-    return NULL;
-  return un;
-}
-
-
-/**
- * Write PID file.
- *
- * @param sctx service context
- * @param pid PID to write (should be equal to 'getpid()'
- * @return  #GNUNET_OK on success (including no work to be done)
- */
-static int
-write_pid_file (struct LEGACY_SERVICE_Context *sctx, pid_t pid)
-{
-  FILE *pidfd;
-  char *pif;
-  char *user;
-  char *rdir;
-  int len;
-
-  if (NULL == (pif = get_pid_file_name (sctx)))
-    return GNUNET_OK; /* no file desired */
-  user = get_user_name (sctx);
-  rdir = GNUNET_strdup (pif);
-  len = strlen (rdir);
-  while ((len > 0) && (rdir[len] != DIR_SEPARATOR))
-    len--;
-  rdir[len] = '\0';
-  if (0 != access (rdir, F_OK))
-  {
-    /* we get to create a directory -- and claim it
-     * as ours! */
-    (void) GNUNET_DISK_directory_create (rdir);
-    if ((NULL != user) && (0 < strlen (user)))
-      GNUNET_DISK_file_change_owner (rdir, user);
-  }
-  if (0 != access (rdir, W_OK | X_OK))
-  {
-    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "access", rdir);
-    GNUNET_free (rdir);
-    GNUNET_free (user);
-    GNUNET_free (pif);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_free (rdir);
-  pidfd = fopen (pif, "w");
-  if (NULL == pidfd)
-  {
-    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "fopen", pif);
-    GNUNET_free (pif);
-    GNUNET_free (user);
-    return GNUNET_SYSERR;
-  }
-  if (0 > fprintf (pidfd, "%u", pid))
-    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fprintf", pif);
-  GNUNET_break (0 == fclose (pidfd));
-  if ((NULL != user) && (0 < strlen (user)))
-    GNUNET_DISK_file_change_owner (pif, user);
-  GNUNET_free (user);
-  GNUNET_free (pif);
-  return GNUNET_OK;
-}
-
-
-/**
- * Task run during shutdown.  Stops the server/service.
- *
- * @param cls the `struct LEGACY_SERVICE_Context`
- */
-static void
-shutdown_task (void *cls)
-{
-  struct LEGACY_SERVICE_Context *service = cls;
-  struct GNUNET_SERVER_Handle *server = service->server;
-
-  service->shutdown_task = NULL;
-  if (0 != (service->options & LEGACY_SERVICE_OPTION_SOFT_SHUTDOWN))
-    GNUNET_SERVER_stop_listening (server);
-  else
-    GNUNET_SERVER_destroy (server);
-}
-
-
-/**
- * Initial task for the service.
- *
- * @param cls service context
- */
-static void
-service_task (void *cls)
-{
-  struct LEGACY_SERVICE_Context *sctx = cls;
-  unsigned int i;
-
-  GNUNET_RESOLVER_connect (sctx->cfg);
-  if (NULL != sctx->lsocks)
-    sctx->server = GNUNET_SERVER_create_with_sockets (&check_access,
-                                                      sctx,
-                                                      sctx->lsocks,
-                                                      sctx->timeout,
-                                                      sctx->require_found);
-  else
-    sctx->server = GNUNET_SERVER_create (&check_access,
-                                         sctx,
-                                         sctx->addrs,
-                                         sctx->addrlens,
-                                         sctx->timeout,
-                                         sctx->require_found);
-  if (NULL == sctx->server)
-  {
-    if (NULL != sctx->addrs)
-      for (i = 0; NULL != sctx->addrs[i]; i++)
-        LOG (GNUNET_ERROR_TYPE_INFO,
-             _ ("Failed to start `%s' at `%s'\n"),
-             sctx->service_name,
-             GNUNET_a2s (sctx->addrs[i], sctx->addrlens[i]));
-    sctx->ret = GNUNET_SYSERR;
-    return;
-  }
-
-  if (NULL != sctx->addrs)
-    for (i = 0; NULL != sctx->addrs[i]; i++)
-      if ((AF_UNIX == sctx->addrs[i]->sa_family) &&
-          ('\0' != ((const struct sockaddr_un *) sctx->addrs[i])->sun_path[0]))
-        GNUNET_DISK_fix_permissions (((const struct sockaddr_un *)
-                                      sctx->addrs[i])
-                                     ->sun_path,
-                                     sctx->match_uid,
-                                     sctx->match_gid);
-
-  if (0 == (sctx->options & LEGACY_SERVICE_OPTION_MANUAL_SHUTDOWN))
-  {
-    /* install a task that will kill the server
-     * process if the scheduler ever gets a shutdown signal */
-    sctx->shutdown_task = GNUNET_SCHEDULER_add_shutdown (&shutdown_task, sctx);
-  }
-  sctx->my_handlers = GNUNET_malloc (sizeof(defhandlers));
-  GNUNET_memcpy (sctx->my_handlers, defhandlers, sizeof(defhandlers));
-  i = 0;
-  while (NULL != sctx->my_handlers[i].callback)
-    sctx->my_handlers[i++].callback_cls = sctx;
-  GNUNET_SERVER_add_handlers (sctx->server, sctx->my_handlers);
-  if (-1 != sctx->ready_confirm_fd)
-  {
-    GNUNET_break (1 == write (sctx->ready_confirm_fd, ".", 1));
-    GNUNET_break (0 == close (sctx->ready_confirm_fd));
-    sctx->ready_confirm_fd = -1;
-    write_pid_file (sctx, getpid ());
-  }
-  if (NULL != sctx->addrs)
-  {
-    i = 0;
-    while (NULL != sctx->addrs[i])
-    {
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           _ ("Service `%s' runs at %s\n"),
-           sctx->service_name,
-           GNUNET_a2s (sctx->addrs[i], sctx->addrlens[i]));
-      i++;
-    }
-  }
-  sctx->task (sctx->task_cls, sctx->server, sctx->cfg);
-}
-
-
-/**
- * Detach from terminal.
- *
- * @param sctx service context
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-static int
-detach_terminal (struct LEGACY_SERVICE_Context *sctx)
-{
-  pid_t pid;
-  int nullfd;
-  int filedes[2];
-
-  if (0 != pipe (filedes))
-  {
-    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "pipe");
-    return GNUNET_SYSERR;
-  }
-  pid = fork ();
-  if (pid < 0)
-  {
-    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "fork");
-    return GNUNET_SYSERR;
-  }
-  if (0 != pid)
-  {
-    /* Parent */
-    char c;
-
-    GNUNET_break (0 == close (filedes[1]));
-    c = 'X';
-    if (1 != read (filedes[0], &c, sizeof(char)))
-      LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "read");
-    fflush (stdout);
-    switch (c)
-    {
-    case '.':
-      exit (0);
-
-    case 'I':
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           _ ("Service process failed to initialize\n"));
-      break;
-
-    case 'S':
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           _ ("Service process could not initialize server function\n"));
-      break;
-
-    case 'X':
-      LOG (GNUNET_ERROR_TYPE_INFO,
-           _ ("Service process failed to report status\n"));
-      break;
-    }
-    exit (1);  /* child reported error */
-  }
-  GNUNET_break (0 == close (0));
-  GNUNET_break (0 == close (1));
-  GNUNET_break (0 == close (filedes[0]));
-  nullfd = open ("/dev/null", O_RDWR | O_APPEND);
-  if (nullfd < 0)
-    return GNUNET_SYSERR;
-  /* set stdin/stdout to /dev/null */
-  if ((dup2 (nullfd, 0) < 0) || (dup2 (nullfd, 1) < 0))
-  {
-    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "dup2");
-    (void) close (nullfd);
-    return GNUNET_SYSERR;
-  }
-  (void) close (nullfd);
-  /* Detach from controlling terminal */
-  pid = setsid ();
-  if (-1 == pid)
-    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "setsid");
-  sctx->ready_confirm_fd = filedes[1];
-
-  return GNUNET_OK;
-}
-
-
-/**
- * Set user ID.
- *
- * @param sctx service context
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
-static int
-set_user_id (struct LEGACY_SERVICE_Context *sctx)
-{
-  char *user;
-
-  if (NULL == (user = get_user_name (sctx)))
-    return GNUNET_OK; /* keep */
-
-  struct passwd *pws;
-
-  errno = 0;
-  pws = getpwnam (user);
-  if (NULL == pws)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         _ ("Cannot obtain information about user `%s': %s\n"),
-         user,
-         errno == 0 ? _ ("No such user") : strerror (errno));
-    GNUNET_free (user);
-    return GNUNET_SYSERR;
-  }
-  if ((0 != setgid (pws->pw_gid)) || (0 != setegid (pws->pw_gid)) ||
-#if HAVE_INITGROUPS
-      (0 != initgroups (user, pws->pw_gid)) ||
-#endif
-      (0 != setuid (pws->pw_uid)) || (0 != seteuid (pws->pw_uid)))
-  {
-    if ((0 != setregid (pws->pw_gid, pws->pw_gid)) ||
-        (0 != setreuid (pws->pw_uid, pws->pw_uid)))
-    {
-      LOG (GNUNET_ERROR_TYPE_ERROR,
-           _ ("Cannot change user/group to `%s': %s\n"),
-           user,
-           strerror (errno));
-      GNUNET_free (user);
-      return GNUNET_SYSERR;
-    }
-  }
-
-  GNUNET_free (user);
-  return GNUNET_OK;
-}
-
-
-/**
- * Delete the PID file that was created by our parent.
- *
- * @param sctx service context
- */
-static void
-pid_file_delete (struct LEGACY_SERVICE_Context *sctx)
-{
-  char *pif = get_pid_file_name (sctx);
-
-  if (NULL == pif)
-    return; /* no PID file */
-  if (0 != unlink (pif))
-    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "unlink", pif);
-  GNUNET_free (pif);
-}
-
-
-/**
- * Run a standard GNUnet service startup sequence (initialize loggers
- * and configuration, parse options).
- *
- * @param argc number of command line arguments
- * @param argv command line arguments
- * @param service_name our service name
- * @param options service options
- * @param task main task of the service
- * @param task_cls closure for @a task
- * @return #GNUNET_SYSERR on error, #GNUNET_OK
- *         if we shutdown nicely
- */
-int
-LEGACY_SERVICE_run (int argc,
-                    char *const *argv,
-                    const char *service_name,
-                    enum LEGACY_SERVICE_Options options,
-                    LEGACY_SERVICE_Main task,
-                    void *task_cls)
-{
-#define HANDLE_ERROR  \
-  do                  \
-  {                   \
-    GNUNET_break (0); \
-    goto shutdown;    \
-  } while (0)
-
-  int err;
-  int ret;
-  char *cfg_fn;
-  char *opt_cfg_fn;
-  char *loglev;
-  char *logfile;
-  int do_daemonize;
-  unsigned int i;
-  unsigned long long skew_offset;
-  unsigned long long skew_variance;
-  long long clock_offset;
-  struct LEGACY_SERVICE_Context sctx;
-  struct GNUNET_CONFIGURATION_Handle *cfg;
-  const char *xdg;
-
-  struct GNUNET_GETOPT_CommandLineOption service_options[] =
-  { GNUNET_GETOPT_option_cfgfile (&opt_cfg_fn),
-    GNUNET_GETOPT_option_flag ('d',
-                               "daemonize",
-                               gettext_noop (
-                                 "do daemonize (detach from terminal)"),
-                               &do_daemonize),
-    GNUNET_GETOPT_option_help (NULL),
-    GNUNET_GETOPT_option_loglevel (&loglev),
-    GNUNET_GETOPT_option_logfile (&logfile),
-    GNUNET_GETOPT_option_version (PACKAGE_VERSION " " VCS_VERSION),
-    GNUNET_GETOPT_OPTION_END };
-  err = 1;
-  do_daemonize = 0;
-  logfile = NULL;
-  loglev = NULL;
-  opt_cfg_fn = NULL;
-  xdg = getenv ("XDG_CONFIG_HOME");
-  if (NULL != xdg)
-    GNUNET_asprintf (&cfg_fn,
-                     "%s%s%s",
-                     xdg,
-                     DIR_SEPARATOR_STR,
-                     GNUNET_OS_project_data_get ()->config_file);
-  else
-    cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file);
-  memset (&sctx, 0, sizeof(sctx));
-  sctx.options = options;
-  sctx.ready_confirm_fd = -1;
-  sctx.ret = GNUNET_OK;
-  sctx.timeout = GNUNET_TIME_UNIT_FOREVER_REL;
-  sctx.task = task;
-  sctx.task_cls = task_cls;
-  sctx.service_name = service_name;
-  sctx.cfg = cfg = GNUNET_CONFIGURATION_create ();
-
-  /* setup subsystems */
-  ret = GNUNET_GETOPT_run (service_name, service_options, argc, argv);
-  if (GNUNET_SYSERR == ret)
-    goto shutdown;
-  if (GNUNET_NO == ret)
-  {
-    err = 0;
-    goto shutdown;
-  }
-  if (GNUNET_OK != GNUNET_log_setup (service_name, loglev, logfile))
-    HANDLE_ERROR;
-  if (NULL == opt_cfg_fn)
-    opt_cfg_fn = GNUNET_strdup (cfg_fn);
-  if (GNUNET_YES == GNUNET_DISK_file_test (opt_cfg_fn))
-  {
-    if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, opt_cfg_fn))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Malformed configuration file `%s', exit ...\n"),
-                  opt_cfg_fn);
-      goto shutdown;
-    }
-  }
-  else
-  {
-    if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, NULL))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Malformed configuration, exit ...\n"));
-      goto shutdown;
-    }
-    if (0 != strcmp (opt_cfg_fn, cfg_fn))
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _ ("Could not access configuration file `%s'\n"),
-                  opt_cfg_fn);
-  }
-  if (GNUNET_OK != setup_service (&sctx))
-    goto shutdown;
-  if ((1 == do_daemonize) && (GNUNET_OK != detach_terminal (&sctx)))
-    HANDLE_ERROR;
-  if (GNUNET_OK != set_user_id (&sctx))
-    goto shutdown;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Service `%s' runs with configuration from `%s'\n",
-       service_name,
-       opt_cfg_fn);
-  if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (sctx.cfg,
-                                                           "TESTING",
-                                                           "SKEW_OFFSET",
-                                                           &skew_offset)) &&
-      (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (sctx.cfg,
-                                                           "TESTING",
-                                                           "SKEW_VARIANCE",
-                                                           &skew_variance)))
-  {
-    clock_offset = skew_offset - skew_variance;
-    GNUNET_TIME_set_offset (clock_offset);
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Skewing clock by %lld ms\n", clock_offset);
-  }
-  /* actually run service */
-  err = 0;
-  GNUNET_SCHEDULER_run (&service_task, &sctx);
-  /* shutdown */
-  if ((1 == do_daemonize) && (NULL != sctx.server))
-    pid_file_delete (&sctx);
-  GNUNET_free (sctx.my_handlers);
-
-shutdown:
-  if (-1 != sctx.ready_confirm_fd)
-  {
-    if (1 != write (sctx.ready_confirm_fd, err ? "I" : "S", 1))
-      LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "write");
-    GNUNET_break (0 == close (sctx.ready_confirm_fd));
-  }
-#if HAVE_MALLINFO2
-  {
-    char *counter;
-
-    if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (sctx.cfg,
-                                                        service_name,
-                                                        "GAUGER_HEAP")) &&
-        (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (sctx.cfg,
-                                                             service_name,
-                                                             "GAUGER_HEAP",
-                                                             &counter)))
-    {
-      struct mallinfo2 mi;
-
-      mi = mallinfo2 ();
-      GAUGER (service_name, counter, mi.usmblks, "blocks");
-      GNUNET_free (counter);
-    }
-  }
-#endif
-  GNUNET_CONFIGURATION_destroy (cfg);
-  i = 0;
-  if (NULL != sctx.addrs)
-    while (NULL != sctx.addrs[i])
-      GNUNET_free_nz (sctx.addrs[i++]);
-  GNUNET_free (sctx.addrs);
-  GNUNET_free (sctx.addrlens);
-  GNUNET_free (logfile);
-  GNUNET_free (loglev);
-  GNUNET_free (cfg_fn);
-  GNUNET_free (opt_cfg_fn);
-  GNUNET_free (sctx.v4_denied);
-  GNUNET_free (sctx.v6_denied);
-  GNUNET_free (sctx.v4_allowed);
-  GNUNET_free (sctx.v6_allowed);
-
-  return err ? GNUNET_SYSERR : sctx.ret;
-}
-
-
-/**
- * Run a service startup sequence within an existing
- * initialized system.
- *
- * @param service_name our service name
- * @param cfg configuration to use
- * @param options service options
- * @return NULL on error, service handle
- */
-struct LEGACY_SERVICE_Context *
-LEGACY_SERVICE_start (const char *service_name,
-                      const struct GNUNET_CONFIGURATION_Handle *cfg,
-                      enum LEGACY_SERVICE_Options options)
-{
-  int i;
-  struct LEGACY_SERVICE_Context *sctx;
-
-  sctx = GNUNET_new (struct LEGACY_SERVICE_Context);
-  sctx->ready_confirm_fd = -1; /* no daemonizing */
-  sctx->ret = GNUNET_OK;
-  sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
-  sctx->service_name = service_name;
-  sctx->cfg = cfg;
-  sctx->options = options;
-
-  /* setup subsystems */
-  if (GNUNET_OK != setup_service (sctx))
-  {
-    LEGACY_SERVICE_stop (sctx);
-    return NULL;
-  }
-  if (NULL != sctx->lsocks)
-    sctx->server = GNUNET_SERVER_create_with_sockets (&check_access,
-                                                      sctx,
-                                                      sctx->lsocks,
-                                                      sctx->timeout,
-                                                      sctx->require_found);
-  else
-    sctx->server = GNUNET_SERVER_create (&check_access,
-                                         sctx,
-                                         sctx->addrs,
-                                         sctx->addrlens,
-                                         sctx->timeout,
-                                         sctx->require_found);
-
-  if (NULL == sctx->server)
-  {
-    LEGACY_SERVICE_stop (sctx);
-    return NULL;
-  }
-
-  if (NULL != sctx->addrs)
-    for (i = 0; NULL != sctx->addrs[i]; i++)
-      if ((AF_UNIX == sctx->addrs[i]->sa_family) &&
-          ('\0' != ((const struct sockaddr_un *) sctx->addrs[i])->sun_path[0]))
-        GNUNET_DISK_fix_permissions (((const struct sockaddr_un *)
-                                      sctx->addrs[i])
-                                     ->sun_path,
-                                     sctx->match_uid,
-                                     sctx->match_gid);
-
-  sctx->my_handlers = GNUNET_malloc (sizeof(defhandlers));
-  GNUNET_memcpy (sctx->my_handlers, defhandlers, sizeof(defhandlers));
-  i = 0;
-  while ((sctx->my_handlers[i].callback != NULL))
-    sctx->my_handlers[i++].callback_cls = sctx;
-  GNUNET_SERVER_add_handlers (sctx->server, sctx->my_handlers);
-  return sctx;
-}
-
-
-/**
- * Obtain the server used by a service.  Note that the server must NOT
- * be destroyed by the caller.
- *
- * @param ctx the service context returned from the start function
- * @return handle to the server for this service, NULL if there is none
- */
-struct GNUNET_SERVER_Handle *
-LEGACY_SERVICE_get_server (struct LEGACY_SERVICE_Context *ctx)
-{
-  return ctx->server;
-}
-
-
-/**
- * Get the NULL-terminated array of listen sockets for this service.
- *
- * @param ctx service context to query
- * @return NULL if there are no listen sockets, otherwise NULL-terminated
- *              array of listen sockets.
- */
-struct GNUNET_NETWORK_Handle *const *
-LEGACY_SERVICE_get_listen_sockets (struct LEGACY_SERVICE_Context *ctx)
-{
-  return ctx->lsocks;
-}
-
-
-/**
- * Stop a service that was started with "LEGACY_SERVICE_start".
- *
- * @param sctx the service context returned from the start function
- */
-void
-LEGACY_SERVICE_stop (struct LEGACY_SERVICE_Context *sctx)
-{
-  unsigned int i;
-
-#if HAVE_MALLINFO2
-  {
-    char *counter;
-
-    if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (sctx->cfg,
-                                                        sctx->service_name,
-                                                        "GAUGER_HEAP")) &&
-        (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (sctx->cfg,
-                                                             
sctx->service_name,
-                                                             "GAUGER_HEAP",
-                                                             &counter)))
-    {
-      struct mallinfo2 mi;
-
-      mi = mallinfo2 ();
-      GAUGER (sctx->service_name, counter, mi.usmblks, "blocks");
-      GNUNET_free (counter);
-    }
-  }
-#endif
-  if (NULL != sctx->shutdown_task)
-  {
-    GNUNET_SCHEDULER_cancel (sctx->shutdown_task);
-    sctx->shutdown_task = NULL;
-  }
-  if (NULL != sctx->server)
-    GNUNET_SERVER_destroy (sctx->server);
-  GNUNET_free (sctx->my_handlers);
-  if (NULL != sctx->addrs)
-  {
-    i = 0;
-    while (NULL != sctx->addrs[i])
-      GNUNET_free_nz (sctx->addrs[i++]);
-    GNUNET_free (sctx->addrs);
-  }
-  GNUNET_free (sctx->addrlens);
-  GNUNET_free (sctx->v4_denied);
-  GNUNET_free (sctx->v6_denied);
-  GNUNET_free (sctx->v4_allowed);
-  GNUNET_free (sctx->v6_allowed);
-  GNUNET_free (sctx);
-}
-
-
-/* end of service.c */
diff --git a/src/transport/test_transport_api_reliability_tcp_peer1.conf 
b/src/transport/template_tng_cfg_peer1.conf
similarity index 64%
rename from src/transport/test_transport_api_reliability_tcp_peer1.conf
rename to src/transport/template_tng_cfg_peer1.conf
index 305605d63..b6198d72c 100644
--- a/src/transport/test_transport_api_reliability_tcp_peer1.conf
+++ b/src/transport/template_tng_cfg_peer1.conf
@@ -1,10 +1,12 @@
-@INLINE@ template_cfg_peer1.conf
+@INLINE@ test_tng_defaults.conf
 [PATHS]
 GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
+GNUNET_RUNTIME_DIR = $GNUNET_TEST_HOME/runtime/
+GNUNET_USER_RUNTIME_DIR = $GNUNET_TEST_HOME/runtime/
 
-[transport-tcp]
-PORT = 12000
-TIMEOUT = 5 s
+[nat]
+RETURN_LOCAL_ADDRESSES = YES
+DISABLEV6 = NO
 
 [arm]
 PORT = 12005
@@ -21,9 +23,12 @@ UNIXPATH = 
$GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
 [peerinfo]
 PORT = 12002
 UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
+USE_INCLUDED_HELLOS = NO
 
 [transport]
+#PREFIX = valgrind --leak-check=full
 PORT = 12001
-PLUGINS = tcp
 UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
 
+[hostlist]
+SERVERS = dummy
diff --git a/src/transport/test_http_common.c b/src/transport/test_http_common.c
deleted file mode 100644
index fe6e4faa3..000000000
--- a/src/transport/test_http_common.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_http_common.c
- * @brief base test case for common http functionality
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing.h"
-#include "plugin_transport_http_common.h"
-
-
-static void
-clean (struct SplittedHTTPAddress *addr)
-{
-  if (NULL == addr)
-    return;
-  GNUNET_free (addr->host);
-  GNUNET_free (addr->path);
-  GNUNET_free (addr->protocol);
-  GNUNET_free (addr);
-}
-
-
-static int
-check (struct SplittedHTTPAddress *addr,
-       const char *protocol,
-       const char *host,
-       int port,
-       const char *path)
-{
-  if (NULL == addr)
-    return GNUNET_NO;
-  if (((NULL == addr->protocol) && (NULL != protocol)) ||
-      ((NULL != addr->protocol) && (NULL == protocol)))
-  {
-    GNUNET_break (0);
-    return GNUNET_NO;
-  }
-  else if ((NULL != addr->protocol) && (NULL != protocol))
-  {
-    if (0 != strcmp (addr->protocol, protocol))
-    {
-      GNUNET_break (0);
-      return GNUNET_NO;
-    }
-  }
-
-  if (((NULL == addr->host) && (NULL != host)) ||
-      ((NULL != addr->host) && (NULL == host)))
-  {
-    GNUNET_break (0);
-    return GNUNET_NO;
-  }
-  else if ((NULL != addr->host) && (NULL != host))
-  {
-    if (0 != strcmp (addr->host, host))
-    {
-      GNUNET_break (0);
-      return GNUNET_NO;
-    }
-  }
-
-  if (((NULL == addr->path) && (NULL != path)) ||
-      ((NULL != addr->path) && (NULL == path)))
-  {
-    GNUNET_break (0);
-    return GNUNET_NO;
-  }
-  else if ((NULL != addr->path) && (NULL != path))
-  {
-    if (0 != strcmp (addr->path, path))
-    {
-      GNUNET_break (0);
-      return GNUNET_NO;
-    }
-  }
-
-  if ((addr->port != port))
-  {
-    GNUNET_break (0);
-    return GNUNET_NO;
-  }
-  return GNUNET_OK;
-}
-
-
-static int
-check_pass (const char *src,
-            const char *protocol,
-            const char *host,
-            int port,
-            const char *path)
-{
-  struct SplittedHTTPAddress *spa;
-
-  spa = http_split_address (src);
-  if (NULL == spa)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if (GNUNET_OK != check (spa, protocol, host, port, path))
-  {
-    clean (spa);
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  clean (spa);
-  return GNUNET_OK;
-}
-
-
-static int
-check_fail (const char *src)
-{
-  struct SplittedHTTPAddress *spa;
-
-  spa = http_split_address (src);
-  if (NULL != spa)
-  {
-    GNUNET_break (0);
-    clean (spa);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-static void
-test_pass_hostname ()
-{
-  check_pass ("http://test.local";, "http", "test.local", HTTP_DEFAULT_PORT, 
"");
-  check_pass ("http://test.local/";, "http", "test.local", HTTP_DEFAULT_PORT,
-              "/");
-  check_pass ("http://test.local/path";, "http", "test.local", 
HTTP_DEFAULT_PORT,
-              "/path");
-  check_pass ("http://test.local/path/";, "http", "test.local",
-              HTTP_DEFAULT_PORT, "/path/");
-  check_pass ("http://test.local/path/more";, "http", "test.local",
-              HTTP_DEFAULT_PORT, "/path/more");
-  check_pass ("http://test.local:81";, "http", "test.local", 81, "");
-  check_pass ("http://test.local:81/";, "http", "test.local", 81, "/");
-  check_pass ("http://test.local:81/path";, "http", "test.local", 81, "/path");
-  check_pass ("http://test.local:81/path/";, "http", "test.local", 81, 
"/path/");
-  check_pass ("http://test.local:81/path/more";, "http", "test.local", 81,
-              "/path/more");
-}
-
-
-static void
-test_pass_ipv4 ()
-{
-  check_pass ("http://127.0.0.1";, "http", "127.0.0.1", HTTP_DEFAULT_PORT, "");
-  check_pass ("http://127.0.0.1/";, "http", "127.0.0.1", HTTP_DEFAULT_PORT, 
"/");
-  check_pass ("http://127.0.0.1/path";, "http", "127.0.0.1", HTTP_DEFAULT_PORT,
-              "/path");
-  check_pass ("http://127.0.0.1/path/";, "http", "127.0.0.1", HTTP_DEFAULT_PORT,
-              "/path/");
-  check_pass ("http://127.0.0.1:81";, "http", "127.0.0.1", 81, "");
-  check_pass ("http://127.0.0.1:81/";, "http", "127.0.0.1", 81, "/");
-  check_pass ("http://127.0.0.1:81/path";, "http", "127.0.0.1", 81, "/path");
-  check_pass ("http://127.0.0.1:81/path/";, "http", "127.0.0.1", 81, "/path/");
-  check_pass ("http://127.0.0.1:81/path/more";, "http", "127.0.0.1", 81,
-              "/path/more");
-}
-
-
-static void
-test_fail_ipv6 ()
-{
-  check_pass ("http://[::1]";, "http", "[::1]", HTTP_DEFAULT_PORT, "");
-  check_pass ("http://[::1]/";, "http", "[::1]", HTTP_DEFAULT_PORT, "/");
-  check_pass ("http://[::1]/path";, "http", "[::1]", HTTP_DEFAULT_PORT, 
"/path");
-  check_pass ("http://[::1]/path/";, "http", "[::1]", HTTP_DEFAULT_PORT,
-              "/path/");
-  check_pass ("http://[::1]:81";, "http", "[::1]", 81, "");
-  check_pass ("http://[::1]:81/";, "http", "[::1]", 81, "/");
-  check_pass ("http://[::1]:81/path";, "http", "[::1]", 81, "/path");
-  check_pass ("http://[::1]:81/path/";, "http", "[::1]", 81, "/path/");
-  check_pass ("http://[::1]:81/path/more";, "http", "[::1]", 81, "/path/more");
-}
-
-
-static void
-test_fail ()
-{
-  if (GNUNET_SYSERR == check_fail (""))
-    GNUNET_break (0);
-  if (GNUNET_SYSERR == check_fail ("http"))
-    GNUNET_break (0);
-  if (GNUNET_SYSERR == check_fail ("://"))
-    GNUNET_break (0);
-  if (GNUNET_SYSERR == check_fail ("http://";))
-    GNUNET_break (0);
-  if (GNUNET_SYSERR == check_fail ("//localhost"))
-    GNUNET_break (0);
-  if (GNUNET_SYSERR == check_fail ("//:80"))
-    GNUNET_break (0);
-  if (GNUNET_SYSERR == check_fail ("//:80/"))
-    GNUNET_break (0);
-  if (GNUNET_SYSERR == check_fail ("//:80:"))
-    GNUNET_break (0);
-  if (GNUNET_SYSERR == check_fail ("http://localhost:a/";))
-    GNUNET_break (0);
-  if (GNUNET_SYSERR == check_fail ("http://127.0.0.1:a/";))
-    GNUNET_break (0);
-}
-
-
-int
-main (int argc, char *argv[])
-{
-  int ret = 0;
-  struct SplittedHTTPAddress *spa;
-
-  GNUNET_log_setup ("test", "DEBUG", NULL);
-  spa = http_split_address ("");
-  if (NULL != spa)
-  {
-    clean (spa);
-    spa = NULL;
-    GNUNET_break (0);
-  }
-
-  spa = http_split_address ("http://";);
-  if (NULL != spa)
-  {
-    clean (spa);
-    GNUNET_break (0);
-  }
-
-  spa = http_split_address ("://");
-  if (NULL != spa)
-  {
-    clean (spa);
-    GNUNET_break (0);
-  }
-
-  test_pass_hostname ();
-  test_pass_ipv4 ();
-  test_fail_ipv6 ();
-  test_fail ();
-
-  return ret;
-}
-
-
-/* end of test_http_common.c */
diff --git a/src/transport/test_plugin_transport.c 
b/src/transport/test_plugin_transport.c
deleted file mode 100644
index 04687d845..000000000
--- a/src/transport/test_plugin_transport.c
+++ /dev/null
@@ -1,797 +0,0 @@
-/*
-   This file is part of GNUnet.
-   Copyright (C) 2009, 2018 GNUnet e.V.
-
-   GNUnet is free software: you can redistribute it and/or modify it
-   under the terms of the GNU Affero General Public License as published
-   by the Free Software Foundation, either version 3 of the License,
-   or (at your option) any later version.
-
-   GNUnet is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Affero General Public License for more details.
-
-   You should have received a copy of the GNU Affero General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_plugin_transport.c
- * @brief testcase for transport_api.c
- * @author Sailor Siraj
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_peerinfo_service.h"
-#include "gnunet_statistics_service.h"
-#include "gnunet_protocols.h"
-#include "gnunet_transport_plugin.h"
-#include "transport.h"
-
-/**
- * How long until we give up on transmitting the message?
- */
-#define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
-
-#define HOSTKEY_FILE "test_plugin_hostkey.ecc"
-
-/**
- * Our public key.
- */
-static struct GNUNET_PeerIdentity my_identity;
-
-/**
- * Our private key.
- */
-static struct GNUNET_CRYPTO_EddsaPrivateKey my_private_key;
-
-/**
- * Our configuration.
- */
-const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-/**
- * Our configuration.
- */
-struct GNUNET_STATISTICS_Handle *stats;
-
-/**
- * Our HELLO
- */
-struct GNUNET_HELLO_Message *hello;
-
-/**
- * Number of neighbours we'd like to have.
- */
-static uint32_t max_connect_per_transport;
-
-/**
- * Environment for this plugin.
- */
-struct GNUNET_TRANSPORT_PluginEnvironment env;
-
-/**
- * handle for the api provided by this plugin
- */
-struct GNUNET_TRANSPORT_PluginFunctions *api;
-
-/**
- * Helper handler
- */
-struct GNUNET_HELPER_Handle *suid_helper;
-
-/**
- * Timeout task
- */
-static struct GNUNET_SCHEDULER_Task *timeout_endbadly;
-
-/**
- * Timeout task
- */
-static struct GNUNET_SCHEDULER_Task *timeout_wait;
-
-/**
- * Library name
- */
-static char *libname;
-
-/**
- * Plugin addresses head
- */
-struct AddressWrapper *head;
-
-/**
- * Plugin addresses tail
- */
-struct AddressWrapper *tail;
-
-unsigned int addresses_reported;
-
-unsigned int pretty_printers_running;
-
-/**
- * Did the test pass or fail?
- */
-static int ok;
-
-struct AddressWrapper
-{
-  struct AddressWrapper *next;
-
-  struct AddressWrapper *prev;
-
-  struct GNUNET_HELLO_Address *address;
-
-  char *addrstring;
-
-  struct GNUNET_SCHEDULER_Task *test_task;
-};
-
-
-static void
-end ()
-{
-  struct AddressWrapper *w;
-  int c = 0;
-
-  ok = 0;
-
-  if (NULL != timeout_endbadly)
-  {
-    GNUNET_SCHEDULER_cancel (timeout_endbadly);
-    timeout_endbadly = NULL;
-  }
-  if (NULL != api)
-    GNUNET_PLUGIN_unload (libname, api);
-
-  while (NULL != head)
-  {
-    w = head;
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Plugin did not remove address `%s'\n",
-                w->addrstring);
-    GNUNET_CONTAINER_DLL_remove (head, tail, w);
-    c++;
-    GNUNET_HELLO_address_free (w->address);
-    GNUNET_free (w->addrstring);
-    GNUNET_free (w);
-  }
-  if (c > 0)
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Plugin did not remove %u addresses \n",
-                c);
-    ok = 1;
-  }
-
-  GNUNET_free (libname);
-  libname = NULL;
-  GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
-  stats = NULL;
-
-  if (NULL != suid_helper)
-  {
-    GNUNET_HELPER_stop (suid_helper, GNUNET_NO);
-    suid_helper = NULL;
-  }
-}
-
-
-static void
-end_badly (void *cls)
-{
-  struct AddressWrapper *w;
-  int c = 0;
-
-  timeout_endbadly = NULL;
-  if (NULL != timeout_wait)
-  {
-    GNUNET_SCHEDULER_cancel (timeout_wait);
-    timeout_wait = NULL;
-  }
-
-  if (pretty_printers_running > 0)
-  {
-    timeout_endbadly = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                                     &end_badly, &ok);
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Have pending calls to pretty_printer ... deferring 
shutdown\n");
-    return;
-  }
-
-  if (NULL != cls)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Test took too long to execute, timeout .... \n");
-  }
-
-  if (NULL != libname)
-  {
-    if (NULL != api)
-      GNUNET_PLUGIN_unload (libname, api);
-    GNUNET_free (libname);
-    libname = NULL;
-  }
-
-  while (NULL != head)
-  {
-    w = head;
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Plugin did not remove address 
`%s'\n",
-                w->addrstring);
-    GNUNET_CONTAINER_DLL_remove (head, tail, w);
-    c++;
-    GNUNET_HELLO_address_free (w->address);
-    if (NULL != w->test_task)
-      GNUNET_SCHEDULER_cancel (w->test_task);
-    GNUNET_free (w->addrstring);
-    GNUNET_free (w);
-  }
-  if (c > 0)
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Plugin did not remove %u 
addresses\n",
-                c);
-  }
-
-  if (NULL != stats)
-  {
-    GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
-    stats = NULL;
-  }
-
-  if (NULL != suid_helper)
-  {
-    GNUNET_HELPER_stop (suid_helper, GNUNET_NO);
-    suid_helper = NULL;
-  }
-
-  ok = 1;
-}
-
-
-static void
-wait_end (void *cls)
-{
-  timeout_wait = NULL;
-  if (0 == addresses_reported)
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Plugin did not report any addresses, could not check address 
conversion functions\n");
-  end ();
-}
-
-
-static void
-end_badly_now ()
-{
-  if (NULL != timeout_wait)
-  {
-    GNUNET_SCHEDULER_cancel (timeout_wait);
-    timeout_wait = NULL;
-  }
-  if (NULL != timeout_endbadly)
-  {
-    GNUNET_SCHEDULER_cancel (timeout_endbadly);
-    timeout_endbadly = NULL;
-  }
-  timeout_endbadly = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
-}
-
-
-static struct GNUNET_TIME_Relative
-env_receive (void *cls,
-             const struct GNUNET_HELLO_Address *address,
-             struct GNUNET_ATS_Session *session,
-             const struct GNUNET_MessageHeader *message)
-{
-  /* do nothing */
-  return GNUNET_TIME_relative_get_zero_ ();
-}
-
-
-static int got_reply;
-
-
-/**
- * Take the given address and append it to the set of results sent back to
- * the client.
- *
- * @param cls closure
- * @param address the address to print
- * @param res result code
- */
-static void
-address_pretty_printer_cb (void *cls, const char *address, int res)
-{
-  if (NULL != address)
-  {
-    got_reply = GNUNET_YES;
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Pretty address : `%s'\n", address);
-    pretty_printers_running--;
-  }
-  else
-  {
-    if (GNUNET_NO == got_reply)
-    {
-      pretty_printers_running--;
-      GNUNET_break (0);
-      end_badly_now ();
-    }
-  }
-}
-
-
-static void
-test_addr_string (void *cls)
-{
-  struct AddressWrapper *w = cls;
-  void *s2a;
-  size_t s2a_len;
-
-  w->test_task = NULL;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Testing: address_to_string \n");
-  w->addrstring = GNUNET_strdup (api->address_to_string (api,
-                                                         w->address->address,
-                                                         w->address->
-                                                         address_length));
-  if (NULL == w->addrstring)
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Plugin cannot convert address to string!\n");
-    end_badly_now ();
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Plugin added address `%s'\n",
-              w->addrstring);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Testing address_to_string: OK\n");
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Testing: string_to_address \n");
-  s2a = NULL;
-  s2a_len = 0;
-  if ((GNUNET_OK !=
-       api->string_to_address (api, w->addrstring,
-                               strlen (w->addrstring) + 1,
-                               &s2a, &s2a_len)) ||
-      (NULL == s2a))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Plugin cannot convert string to address!\n");
-    end_badly_now ();
-    return;
-  }
-
-  /*
-     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-     "Plugin creates `%s' %u\n",api->address_to_string (api, s2a, s2a_len), 
s2a_len);
-
-     int c1;
-     for (c1 = 0; c1 < s2a_len; c1++ )
-     fprintf (stderr, "%u == %u\n", ((char *) s2a)[c1], ((char *) 
w->addr)[c1]);
-   */if (s2a_len != w->address->address_length)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Plugin creates different address length when converting 
address->string->address: %u != %u\n",
-                (unsigned int) w->address->address_length,
-                (unsigned int) s2a_len);
-  }
-  else if (0 != memcmp (s2a, w->address->address, s2a_len))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Plugin creates different address length when converting back 
and forth %i!\n",
-                memcmp (s2a,
-                        w->address->address,
-                        s2a_len));
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Testing string_to_address: OK\n");
-  }
-  GNUNET_free (s2a);
-
-  pretty_printers_running++;
-  api->address_pretty_printer (api->cls,
-                               w->address->transport_name,
-                               w->address->address,
-                               w->address->address_length,
-                               GNUNET_YES,
-                               GNUNET_TIME_UNIT_MINUTES,
-                               &address_pretty_printer_cb, w);
-
-  if (GNUNET_OK !=
-      api->check_address (api->cls,
-                          w->address->address,
-                          w->address->address_length))
-  {
-    GNUNET_break (0);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Plugin refuses added address!\n");
-    end_badly_now ();
-    return;
-  }
-  if (NULL != timeout_wait)
-  {
-    GNUNET_SCHEDULER_cancel (timeout_wait);
-    timeout_wait = NULL;
-  }
-  timeout_wait = GNUNET_SCHEDULER_add_delayed (WAIT, &wait_end, NULL);
-}
-
-
-static void
-env_notify_address (void *cls,
-                    int add_remove,
-                    const struct GNUNET_HELLO_Address *address)
-{
-  struct AddressWrapper *w;
-  struct AddressWrapper *wtmp;
-
-  if (GNUNET_YES == add_remove)
-  {
-    addresses_reported++;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Adding address of length %u\n",
-                (unsigned int) address->address_length);
-
-    for (wtmp = head; NULL != wtmp; wtmp = wtmp->next)
-    {
-      if ((address->address_length == wtmp->address->address_length) &&
-          (0 == memcmp (address->address, wtmp->address->address,
-                        address->address_length)))
-      {
-        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                    "Duplicate address notification .... \n");
-        return;
-      }
-    }
-
-    w = GNUNET_new (struct AddressWrapper);
-    w->address = GNUNET_HELLO_address_copy (address);
-    GNUNET_CONTAINER_DLL_insert (head, tail, w);
-    got_reply = GNUNET_NO;
-    w->test_task = GNUNET_SCHEDULER_add_now (&test_addr_string,
-                                             w);
-    return;
-  }
-
-  if (GNUNET_NO == add_remove)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Removing address of length %u\n",
-                (unsigned int) address->address_length);
-    w = head;
-    while (NULL != w)
-    {
-      if ((address->address_length == w->address->address_length) &&
-          (0 == memcmp (w->address->address, address->address,
-                        address->address_length)))
-      {
-        break;
-      }
-      w = w->next;
-    }
-
-    if (w == NULL)
-    {
-      GNUNET_break (0);
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Plugin removes address never added!\n");
-      end_badly_now ();
-      return;
-    }
-
-    GNUNET_CONTAINER_DLL_remove (head, tail, w);
-    GNUNET_HELLO_address_free (w->address);
-    GNUNET_free (w->addrstring);
-    GNUNET_free (w);
-    return;
-  }
-  GNUNET_break (0);
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Invalid operation: %u\n",
-              add_remove);
-  end_badly_now ();
-}
-
-
-static enum GNUNET_NetworkType
-env_get_address_type (void *cls,
-                      const struct sockaddr *addr,
-                      size_t addrlen)
-{
-  return GNUNET_NT_LOOPBACK;
-}
-
-
-static const struct GNUNET_MessageHeader *
-env_get_our_hello ()
-{
-  return (const struct GNUNET_MessageHeader *) hello;
-}
-
-
-static void
-env_session_end (void *cls,
-                 const struct GNUNET_HELLO_Address *address,
-                 struct GNUNET_ATS_Session *session)
-{
-}
-
-
-static void
-env_update_distance (void *cls,
-                     const struct GNUNET_HELLO_Address *address,
-                     uint32_t distance)
-{
-}
-
-
-static void
-setup_plugin_environment ()
-{
-  env.cfg = cfg;
-  env.cls = &env;
-  env.my_identity = &my_identity;
-  env.max_connections = max_connect_per_transport;
-  env.stats = stats;
-  env.receive = &env_receive;
-  env.notify_address = &env_notify_address;
-  env.get_address_type = &env_get_address_type;
-  env.update_address_distance = &env_update_distance;
-  env.get_our_hello = &env_get_our_hello;
-  env.session_end = &env_session_end;
-}
-
-
-static int
-handle_helper_message (void *cls,
-                       const struct GNUNET_MessageHeader *hdr)
-{
-  return GNUNET_OK;
-}
-
-
-/**
- * Runs the test.
- *
- * @param cls closure
- * @param c configuration to use
- */
-static void
-run (void *cls,
-     char *const *args,
-     const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *c)
-{
-  char *const *argv = cls;
-  unsigned long long tneigh;
-  char *keyfile;
-  char *plugin;
-  char *sep;
-
-  timeout_endbadly = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
-                                                   &end_badly,
-                                                   &ok);
-  cfg = c;
-  /* parse configuration */
-  if ((GNUNET_OK !=
-       GNUNET_CONFIGURATION_get_value_number (c,
-                                              "TRANSPORT",
-                                              "NEIGHBOUR_LIMIT",
-                                              &tneigh)) ||
-      (GNUNET_OK !=
-       GNUNET_CONFIGURATION_get_value_filename (c,
-                                                "PEER",
-                                                "PRIVATE_KEY",
-                                                &keyfile)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Transport service is lacking key configuration settings.  
Exiting.\n");
-    return;
-  }
-
-  if (NULL == (stats = GNUNET_STATISTICS_create ("transport",
-                                                 cfg)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Could not create statistics.  Exiting.\n");
-    GNUNET_free (keyfile);
-    end_badly_now ();
-    return;
-  }
-
-  if (GNUNET_OK != GNUNET_DISK_file_test (HOSTKEY_FILE))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Hostkey `%s' missing.  Exiting.\n",
-                HOSTKEY_FILE);
-    GNUNET_free (keyfile);
-    end_badly_now ();
-    return;
-  }
-
-  if (GNUNET_OK !=
-      GNUNET_DISK_directory_create_for_file (keyfile))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Could not create a directory for hostkey `%s'.  Exiting.\n",
-                keyfile);
-    GNUNET_free (keyfile);
-    end_badly_now ();
-    return;
-  }
-
-  if (GNUNET_OK !=
-      GNUNET_DISK_file_copy (HOSTKEY_FILE,
-                             keyfile))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Could not copy hostkey `%s' to destination `%s'.  Exiting.\n",
-                HOSTKEY_FILE,
-                keyfile);
-    GNUNET_free (keyfile);
-    end_badly_now ();
-    return;
-  }
-
-  max_connect_per_transport = (uint32_t) tneigh;
-  if (GNUNET_SYSERR ==
-      GNUNET_CRYPTO_eddsa_key_from_file (keyfile,
-                                         GNUNET_YES,
-                                         &my_private_key))
-  {
-    GNUNET_free (keyfile);
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Could not access hostkey.  Exiting.\n");
-    end_badly_now ();
-    return;
-  }
-  GNUNET_free (keyfile);
-  GNUNET_CRYPTO_eddsa_key_get_public (&my_private_key,
-                                      &my_identity.public_key);
-
-  hello = GNUNET_HELLO_create (&my_identity.public_key, NULL, NULL, GNUNET_NO);
-
-  /* load plugins... */
-  setup_plugin_environment ();
-
-  GNUNET_assert (strlen (argv[0]) > strlen ("test_plugin_"));
-  plugin = strstr (argv[0], "test_plugin_");
-  sep = strrchr (argv[0], '.');
-  if (NULL == plugin)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Not a valid test name\n");
-    end_badly_now ();
-    return;
-  }
-  plugin += strlen ("test_plugin_");
-  if (NULL != sep)
-    sep[0] = '\0';
-
-  /* Hack for WLAN: start a second helper */
-  if (0 == strcmp (plugin, "wlan"))
-  {
-    char *helper_argv[3];
-    helper_argv[0] = (char *) "gnunet-helper-transport-wlan-dummy";
-    helper_argv[1] = (char *) "2";
-    helper_argv[2] = NULL;
-    suid_helper = GNUNET_HELPER_start (GNUNET_NO,
-                                       "gnunet-helper-transport-wlan-dummy",
-                                       helper_argv,
-                                       &handle_helper_message, NULL, NULL);
-  }
-
-  /* Loading plugin */
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Loading transport plugin %s\n", plugin);
-  GNUNET_asprintf (&libname, "libgnunet_plugin_transport_%s", plugin);
-  api = GNUNET_PLUGIN_load (libname, &env);
-  if (NULL == api)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to load transport plugin for %s\n", plugin);
-    end_badly_now ();
-    return;
-  }
-
-  timeout_wait = GNUNET_SCHEDULER_add_delayed (WAIT, &wait_end, NULL);
-
-  /* Check if all functions are implemented */
-  if (NULL == api->address_pretty_printer)
-  {
-    GNUNET_break (0);
-    end_badly_now ();
-    return;
-  }
-  if (NULL == api->address_to_string)
-  {
-    GNUNET_break (0);
-    end_badly_now ();
-    return;
-  }
-  GNUNET_assert (NULL != api->check_address);
-  if (NULL == api->check_address)
-  {
-    GNUNET_break (0);
-    end_badly_now ();
-    return;
-  }
-  GNUNET_assert (NULL != api->disconnect_peer);
-  if (NULL == api->disconnect_peer)
-  {
-    GNUNET_break (0);
-    end_badly_now ();
-    return;
-  }
-  GNUNET_assert (NULL != api->get_session);
-  if (NULL == api->get_session)
-  {
-    GNUNET_break (0);
-    end_badly_now ();
-    return;
-  }
-  if (NULL == api->address_pretty_printer)
-  {
-    GNUNET_break (0);
-    end_badly_now ();
-    return;
-  }
-  if (NULL == api->string_to_address)
-  {
-    GNUNET_break (0);
-    end_badly_now ();
-    return;
-  }
-}
-
-
-/**
- * The main function for the test
- *
- * @param argc number of arguments from the command line
- * @param argv command line arguments
- * @return 0 ok, 1 on error
- */
-int
-main (int argc,
-      char *const *argv)
-{
-  static struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_OPTION_END
-  };
-  int ret;
-  char *const argv_prog[] = {
-    "test_plugin_transport",
-    "-c",
-    "test_plugin_transport_data.conf",
-    NULL
-  };
-
-  GNUNET_log_setup ("test-plugin-transport",
-                    "WARNING",
-                    NULL);
-  GNUNET_DISK_purge_cfg_dir ("test_plugin_transport_data.conf",
-                             "GNUNET_TEST_HOME");
-  ok = 1; /* set to fail */
-  ret =
-    (GNUNET_OK
-     == GNUNET_PROGRAM_run (3, argv_prog, "test-plugin-transport",
-                            "testcase", options, &run, (void *) argv)) ? ok : 
1;
-  GNUNET_DISK_purge_cfg_dir ("test_plugin_transport_data.conf",
-                             "GNUNET_TEST_HOME");
-  return ret;
-}
-
-
-/* end of test_plugin_transport.c */
diff --git a/src/transport/test_plugin_transport_data.conf 
b/src/transport/test_plugin_transport_data.conf
deleted file mode 100644
index b667a4854..000000000
--- a/src/transport/test_plugin_transport_data.conf
+++ /dev/null
@@ -1,47 +0,0 @@
-@INLINE@ test_transport_defaults.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunetd-plugin-transport/
-
-[transport-tcp]
-PORT = 52400
-
-[transport-udp]
-PORT = 52401
-
-[transport-wlan]
-INTERFACE = mon0
-TESTMODE = 1
-
-[transport-bluetooth]
-INTERFACE = hci0
-TESTMODE = 1
-
-[transport-http_server]
-PORT = 52402
-
-[transport-https_server]
-PORT = 52403
-
-[arm]
-PORT = 52360
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-arm.sock
-
-[statistics]
-PORT = 52361
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics.sock
-
-[resolver]
-PORT = 52362
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver.sock
-
-[peerinfo]
-PORT = 52363
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-peerinfo.sock
-
-[transport]
-PORT = 52364
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport.sock
-
-[nat]
-RETURN_LOCAL_ADDRESSES = YES
-DISABLEV6 = NO
diff --git a/src/transport/test_plugin_transport_data_udp.conf 
b/src/transport/test_plugin_transport_data_udp.conf
deleted file mode 100644
index 8b1378917..000000000
--- a/src/transport/test_plugin_transport_data_udp.conf
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/transport/test_quota_compliance.c 
b/src/transport/test_quota_compliance.c
deleted file mode 100644
index c3c46db37..000000000
--- a/src/transport/test_quota_compliance.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2011, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_quota_compliance.c
- * @brief base test case for transport implementations
- *
- * This test case tests quota compliance both on transport level
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_ats_service.h"
-#include "gauger.h"
-#include "transport-testing.h"
-
-/**
- * Testcase timeout
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 480)
-
-#define DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 80)
-
-
-static struct GNUNET_SCHEDULER_Task *measure_task;
-
-static char *gen_cfgs[2];
-
-static unsigned long long quota_in[] = { 10000, 10000 };
-
-static unsigned long long quota_out[] = { 10000, 10000 };
-
-static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-
-/**
- * Note that this value must not significantly exceed
- * 'MAX_PENDING' in 'gnunet-service-transport.c', otherwise
- * messages may be dropped even for a reliable transport.
- */
-#define TOTAL_MSGS (1024 * 32)
-
-static unsigned long long total_bytes_recv;
-
-static struct GNUNET_TIME_Absolute start_time;
-
-
-static void
-report ()
-{
-  unsigned long long delta;
-  unsigned long long datarate;
-
-  delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
-  if (0 == delta)
-    delta = 1;
-  datarate = (total_bytes_recv * 1000 * 1000) / delta;
-
-  fprintf (stderr,
-           "Throughput was %llu b/s\n",
-           datarate);
-  ccc->global_ret = GNUNET_OK;
-  if (datarate > 1.5 * quota_in[1])
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Datarate of %llu b/s significantly higher than allowed 
inbound quota of %llu b/s\n",
-                datarate,
-                quota_in[1]);
-    ccc->global_ret = GNUNET_SYSERR;
-  }
-  if (datarate > 1.5 * quota_out[0])
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Datarate of %llu b/s significantly higher than allowed 
outbound quota of %llu b/s\n",
-                datarate,
-                quota_out[0]);
-    ccc->global_ret = GNUNET_SYSERR;
-  }
-  if (GNUNET_OK == ccc->global_ret)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Datarate of %llu b/s complied to allowed outbound quota of 
%llu b/s and inbound quota of %llu b/s\n",
-                datarate,
-                quota_out[0],
-                quota_in[1]);
-  }
-}
-
-
-static void
-custom_shutdown (void *cls)
-{
-  if (NULL != measure_task)
-  {
-    GNUNET_SCHEDULER_cancel (measure_task);
-    measure_task = NULL;
-  }
-  report ();
-}
-
-
-static size_t
-get_size (unsigned int iter)
-{
-  size_t ret;
-
-  ret = (iter * iter * iter) % 60000;
-  ret += sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage);
-  return ret;
-}
-
-
-static void
-notify_receive (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-                const struct GNUNET_PeerIdentity *sender,
-                const struct GNUNET_TRANSPORT_TESTING_TestMessage *hdr)
-{
-  if (GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE != ntohs (hdr->header.type))
-    return;
-  total_bytes_recv += ntohs (hdr->header.size);
-
-  {
-    char *ps = GNUNET_strdup (GNUNET_i2s (&receiver->id));
-
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Peer %u (`%s') got message %u of size %u from peer (`%s')\n",
-                receiver->no,
-                ps,
-                ntohl (hdr->num),
-                ntohs (hdr->header.size),
-                GNUNET_i2s (sender));
-    GNUNET_free (ps);
-  }
-}
-
-
-static void
-measure (void *cls)
-{
-  static int counter;
-
-  measure_task = NULL;
-  counter++;
-  if ((DURATION.rel_value_us / 1000 / 1000LL) < counter)
-  {
-    fprintf (stderr, "%s", ".\n");
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-  fprintf (stderr, "%s", ".");
-  measure_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                               &measure,
-                                               NULL);
-}
-
-
-static void
-start_task (void *cls)
-{
-  static struct GNUNET_TRANSPORT_TESTING_SendClosure sc = {
-    .num_messages = TOTAL_MSGS,
-    .get_size_cb = &get_size
-  };
-
-  sc.ccc = ccc;
-  measure_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                               &measure,
-                                               NULL);
-  start_time = GNUNET_TIME_absolute_get ();
-  GNUNET_SCHEDULER_add_now (&GNUNET_TRANSPORT_TESTING_simple_send,
-                            &sc);
-}
-
-
-static char *
-generate_config (const char *cfg_file,
-                 unsigned long long quota_in,
-                 unsigned long long quota_out)
-{
-  char *in_name;
-  char *out_name;
-  char *fname = NULL;
-  struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create ();
-
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONFIGURATION_load (cfg,
-                                            cfg_file));
-  GNUNET_asprintf (&fname,
-                   "q_in_%llu_q_out_%llu_%s",
-                   quota_in,
-                   quota_out,
-                   cfg_file);
-  GNUNET_CONFIGURATION_set_value_string (cfg,
-                                         "PATHS",
-                                         "DEFAULTCONFIG",
-                                         fname);
-  for (int c = 0; c < GNUNET_NT_COUNT; c++)
-  {
-    GNUNET_asprintf (&in_name,
-                     "%s_QUOTA_IN",
-                     GNUNET_NT_to_string (c));
-    GNUNET_asprintf (&out_name,
-                     "%s_QUOTA_OUT",
-                     GNUNET_NT_to_string (c));
-    GNUNET_CONFIGURATION_set_value_number (cfg,
-                                           "ats",
-                                           in_name,
-                                           quota_in);
-    GNUNET_CONFIGURATION_set_value_number (cfg,
-                                           "ats",
-                                           out_name,
-                                           quota_out);
-    GNUNET_free (in_name);
-    GNUNET_free (out_name);
-  }
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONFIGURATION_write (cfg,
-                                             fname));
-  GNUNET_CONFIGURATION_destroy (cfg);
-  return fname;
-}
-
-
-static int
-check (void *cls,
-       struct GNUNET_TRANSPORT_TESTING_Handle *tth_,
-       const char *test_plugin_,
-       const char *test_name_,
-       unsigned int num_peers,
-       char *cfg_files[])
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
-    .connect_continuation = &start_task,
-    .config_file = "test_quota_compliance_data.conf",
-    .rec = &notify_receive,
-    .nc = &GNUNET_TRANSPORT_TESTING_log_connect,
-    .nd = &GNUNET_TRANSPORT_TESTING_log_disconnect,
-    .shutdown_task = &custom_shutdown,
-    .timeout = TIMEOUT
-  };
-
-  ccc = &my_ccc;
-
-  if (NULL != strstr (test_name_,
-                      "asymmetric"))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Running asymmetric test with sending peer unlimited, 
receiving peer (in/out): %llu/%llu b/s \n",
-                quota_in[1],
-                quota_out[1]);
-    quota_out[0] = 1024 * 1024 * 1024;
-    quota_in[0] = 1024 * 1024 * 1024;
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Running symmetric test with (in/out) %llu/%llu b/s \n",
-                quota_in[1],
-                quota_out[1]);
-  }
-  for (unsigned int i = 0; i < 2; i++)
-  {
-    gen_cfgs[i] = generate_config (cfg_files[i],
-                                   quota_in[i],
-                                   quota_out[i]);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Generated config file `%s'\n",
-                gen_cfgs[i]);
-  }
-
-  return GNUNET_TRANSPORT_TESTING_connect_check (&my_ccc,
-                                                 tth_,
-                                                 test_plugin_,
-                                                 test_name_,
-                                                 num_peers,
-                                                 gen_cfgs);
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  if (GNUNET_OK !=
-      GNUNET_TRANSPORT_TESTING_main (2,
-                                     &check,
-                                     NULL))
-  {
-    GNUNET_break (0);
-    return 1;
-  }
-  for (unsigned int i = 0; i < 2; i++)
-  {
-    if ((NULL != gen_cfgs[i]) &&
-        (GNUNET_YES == GNUNET_DISK_file_test (gen_cfgs[i])))
-    {
-      GNUNET_DISK_directory_remove (gen_cfgs[i]);
-      GNUNET_free (gen_cfgs[i]);
-    }
-  }
-  return 0;
-}
-
-
-/* end of test_quota_compliance.c */
diff --git 
a/src/transport/test_quota_compliance_bluetooth_asymmetric_peer1.conf 
b/src/transport/test_quota_compliance_bluetooth_asymmetric_peer1.conf
deleted file mode 100644
index 86bdf6db4..000000000
--- a/src/transport/test_quota_compliance_bluetooth_asymmetric_peer1.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/
-
-[transport-bluetooth]
-INTERFACE = hci0
-TESTMODE = 1
-
-[transport]
-PLUGINS = bluetooth
-
-
diff --git 
a/src/transport/test_quota_compliance_bluetooth_asymmetric_peer2.conf 
b/src/transport/test_quota_compliance_bluetooth_asymmetric_peer2.conf
deleted file mode 100644
index 086688e73..000000000
--- a/src/transport/test_quota_compliance_bluetooth_asymmetric_peer2.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/
-
-[transport-bluetooth]
-INTERFACE = hci1
-TESTMODE = 2
-
-[transport]
-PLUGINS = bluetooth
-
diff --git a/src/transport/test_quota_compliance_bluetooth_peer1.conf 
b/src/transport/test_quota_compliance_bluetooth_peer1.conf
deleted file mode 100644
index 3f86ee940..000000000
--- a/src/transport/test_quota_compliance_bluetooth_peer1.conf
+++ /dev/null
@@ -1,30 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/
-
-[transport-bluetooth]
-INTERFACE = hci0
-TESTMODE = 1
-
-[arm]
-PORT = 12164
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12163
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12162
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12161
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12160
-PLUGINS = bluetooth
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-
diff --git a/src/transport/test_quota_compliance_bluetooth_peer2.conf 
b/src/transport/test_quota_compliance_bluetooth_peer2.conf
deleted file mode 100644
index 5fc178395..000000000
--- a/src/transport/test_quota_compliance_bluetooth_peer2.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/
-
-[transport-bluetooth]
-INTERFACE = hci1
-TESTMODE = 2
-
-[arm]
-PORT = 12174
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12173
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12172
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12171
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12170
-PLUGINS = bluetooth
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git a/src/transport/test_quota_compliance_data.conf 
b/src/transport/test_quota_compliance_data.conf
deleted file mode 100644
index 1bc607770..000000000
--- a/src/transport/test_quota_compliance_data.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-@INLINE@ test_transport_defaults.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunetd-plugin-transport/
-
-[transport-tcp]
-PORT = 52368
-TIMEOUT = 5 s
-
-[arm]
-PORT = 52366
-
-[statistics]
-PORT = 52367
-
-[resolver]
-PORT = 52364
-
-[peerinfo]
-PORT = 52369
-
-[transport]
-PORT = 52365
-
-
diff --git a/src/transport/test_quota_compliance_http_asymmetric_peer1.conf 
b/src/transport/test_quota_compliance_http_asymmetric_peer1.conf
deleted file mode 100644
index b2ff1913f..000000000
--- a/src/transport/test_quota_compliance_http_asymmetric_peer1.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1
-
-[transport-http_client]
-
-[arm]
-PORT = 54015
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer1.sock
-
-[statistics]
-PORT = 54014
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer1.sock
-
-[resolver]
-PORT = 54013
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer1.sock
-
-[peerinfo]
-PORT = 54012
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer1.sock
-
-[transport]
-PORT = 54011
-PLUGINS = http_client
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer1.sock
-
-
diff --git a/src/transport/test_quota_compliance_http_asymmetric_peer2.conf 
b/src/transport/test_quota_compliance_http_asymmetric_peer2.conf
deleted file mode 100644
index 3408d9f2e..000000000
--- a/src/transport/test_quota_compliance_http_asymmetric_peer2.conf
+++ /dev/null
@@ -1,32 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2
-
-[transport-http_server]
-PORT = 53010
-USE_IPv6 = NO
-BINDTO = 127.0.0.1
-
-
-[arm]
-PORT = 53015
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer2.sock
-
-[statistics]
-PORT = 53014
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer2.sock
-
-[resolver]
-PORT = 53013
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer2.sock
-
-[peerinfo]
-PORT = 53012
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer2.sock
-
-[transport]
-PORT = 53011
-PLUGINS = http_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer2.sock
-
-
diff --git a/src/transport/test_quota_compliance_http_peer1.conf 
b/src/transport/test_quota_compliance_http_peer1.conf
deleted file mode 100644
index b2ff1913f..000000000
--- a/src/transport/test_quota_compliance_http_peer1.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1
-
-[transport-http_client]
-
-[arm]
-PORT = 54015
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer1.sock
-
-[statistics]
-PORT = 54014
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer1.sock
-
-[resolver]
-PORT = 54013
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer1.sock
-
-[peerinfo]
-PORT = 54012
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer1.sock
-
-[transport]
-PORT = 54011
-PLUGINS = http_client
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer1.sock
-
-
diff --git a/src/transport/test_quota_compliance_http_peer2.conf 
b/src/transport/test_quota_compliance_http_peer2.conf
deleted file mode 100644
index 3408d9f2e..000000000
--- a/src/transport/test_quota_compliance_http_peer2.conf
+++ /dev/null
@@ -1,32 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2
-
-[transport-http_server]
-PORT = 53010
-USE_IPv6 = NO
-BINDTO = 127.0.0.1
-
-
-[arm]
-PORT = 53015
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer2.sock
-
-[statistics]
-PORT = 53014
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer2.sock
-
-[resolver]
-PORT = 53013
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer2.sock
-
-[peerinfo]
-PORT = 53012
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer2.sock
-
-[transport]
-PORT = 53011
-PLUGINS = http_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer2.sock
-
-
diff --git a/src/transport/test_quota_compliance_https_asymmetric_peer1.conf 
b/src/transport/test_quota_compliance_https_asymmetric_peer1.conf
deleted file mode 100644
index 94aa534ef..000000000
--- a/src/transport/test_quota_compliance_https_asymmetric_peer1.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/
-
-[transport-https_client]
-
-[arm]
-PORT = 54006
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer1.sock
-
-[statistics]
-PORT = 54005
-UNIXPATH = 
$GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer1.sock
-
-[resolver]
-PORT = 54004
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer1.sock
-
-[peerinfo]
-PORT = 54003
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer1.sock
-
-[transport]
-PORT = 54002
-PLUGINS = https_client
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_transport_peer1.sock
-
-
diff --git a/src/transport/test_quota_compliance_https_asymmetric_peer2.conf 
b/src/transport/test_quota_compliance_https_asymmetric_peer2.conf
deleted file mode 100644
index 8fb8861cd..000000000
--- a/src/transport/test_quota_compliance_https_asymmetric_peer2.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2
-
-[transport-https_server]
-PORT = 53001
-KEY_FILE = https_key_quota_p2.key
-CERT_FILE = https_cert_qutoa_p2.crt
-
-[arm]
-PORT = 53006
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer2.sock
-
-[statistics]
-PORT = 53005
-UNIXPATH = 
$GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer2.sock
-
-[resolver]
-PORT = 53004
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer2.sock
-
-[peerinfo]
-PORT = 53003
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer2.sock
-
-[transport]
-PORT = 53002
-PLUGINS = https_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/https_transport_peer2.sock
-
-
diff --git a/src/transport/test_quota_compliance_https_peer1.conf 
b/src/transport/test_quota_compliance_https_peer1.conf
deleted file mode 100644
index 94aa534ef..000000000
--- a/src/transport/test_quota_compliance_https_peer1.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/
-
-[transport-https_client]
-
-[arm]
-PORT = 54006
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer1.sock
-
-[statistics]
-PORT = 54005
-UNIXPATH = 
$GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer1.sock
-
-[resolver]
-PORT = 54004
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer1.sock
-
-[peerinfo]
-PORT = 54003
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer1.sock
-
-[transport]
-PORT = 54002
-PLUGINS = https_client
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_transport_peer1.sock
-
-
diff --git a/src/transport/test_quota_compliance_https_peer2.conf 
b/src/transport/test_quota_compliance_https_peer2.conf
deleted file mode 100644
index 8fb8861cd..000000000
--- a/src/transport/test_quota_compliance_https_peer2.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2
-
-[transport-https_server]
-PORT = 53001
-KEY_FILE = https_key_quota_p2.key
-CERT_FILE = https_cert_qutoa_p2.crt
-
-[arm]
-PORT = 53006
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer2.sock
-
-[statistics]
-PORT = 53005
-UNIXPATH = 
$GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer2.sock
-
-[resolver]
-PORT = 53004
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer2.sock
-
-[peerinfo]
-PORT = 53003
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer2.sock
-
-[transport]
-PORT = 53002
-PLUGINS = https_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/https_transport_peer2.sock
-
-
diff --git a/src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf 
b/src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf
deleted file mode 100644
index 0e0cbff24..000000000
--- a/src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf
+++ /dev/null
@@ -1,32 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/quota-tcp-p1/
-
-[transport-tcp]
-PORT = 54094
-
-[transport-udp]
-PORT = 54094
-
-[arm]
-PORT = 54087
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_arm_peer1.sock
-
-[statistics]
-PORT = 54088
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_statistics_peer1.sock
-
-[resolver]
-PORT = 54089
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_resolver_peer1.sock
-
-[peerinfo]
-PORT = 54090
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_peerinfo_peer1.sock
-
-[transport]
-PORT = 54091
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_transport_peer1.sock
-
-
diff --git a/src/transport/test_quota_compliance_tcp_asymmetric_peer2.conf 
b/src/transport/test_quota_compliance_tcp_asymmetric_peer2.conf
deleted file mode 100644
index e9757b080..000000000
--- a/src/transport/test_quota_compliance_tcp_asymmetric_peer2.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/quota-tcp-p2/
-
-[transport-tcp]
-PORT = 12015
-TIMEOUT = 5 s
-
-[arm]
-PORT = 12014
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12013
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12012
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12011
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12010
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git a/src/transport/test_quota_compliance_tcp_peer1.conf 
b/src/transport/test_quota_compliance_tcp_peer1.conf
deleted file mode 100644
index 0e0cbff24..000000000
--- a/src/transport/test_quota_compliance_tcp_peer1.conf
+++ /dev/null
@@ -1,32 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/quota-tcp-p1/
-
-[transport-tcp]
-PORT = 54094
-
-[transport-udp]
-PORT = 54094
-
-[arm]
-PORT = 54087
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_arm_peer1.sock
-
-[statistics]
-PORT = 54088
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_statistics_peer1.sock
-
-[resolver]
-PORT = 54089
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_resolver_peer1.sock
-
-[peerinfo]
-PORT = 54090
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_peerinfo_peer1.sock
-
-[transport]
-PORT = 54091
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_transport_peer1.sock
-
-
diff --git a/src/transport/test_quota_compliance_tcp_peer2.conf 
b/src/transport/test_quota_compliance_tcp_peer2.conf
deleted file mode 100644
index a7b2cf90b..000000000
--- a/src/transport/test_quota_compliance_tcp_peer2.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport-tcp]
-PORT = 12015
-TIMEOUT = 5 s
-
-[arm]
-PORT = 12014
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12013
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12012
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12011
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12010
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git a/src/transport/test_quota_compliance_udp_peer1.conf 
b/src/transport/test_quota_compliance_udp_peer1.conf
deleted file mode 100644
index bba75c168..000000000
--- a/src/transport/test_quota_compliance_udp_peer1.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/
-
-[transport-udp]
-PORT = 54368
-MAX_BPS = 50000000
-
-[arm]
-PORT = 54087
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_arm_peer1.sock
-
-[statistics]
-PORT = 54088
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_statistics_peer1.sock
-
-[resolver]
-PORT = 54089
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_resolver_peer1.sock
-
-[peerinfo]
-PORT = 54090
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_peerinfo_peer1.sock
-
-[transport]
-PORT = 54091
-PLUGINS = udp
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_transport_peer1.sock
-
diff --git a/src/transport/test_quota_compliance_udp_peer2.conf 
b/src/transport/test_quota_compliance_udp_peer2.conf
deleted file mode 100644
index 1cb04038c..000000000
--- a/src/transport/test_quota_compliance_udp_peer2.conf
+++ /dev/null
@@ -1,30 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2
-
-[transport-udp]
-PORT = 53368
-MAX_BPS = 50000000
-
-[arm]
-PORT = 53087
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_arm_peer2.sock
-
-[statistics]
-PORT = 53088
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_statistics_peer2.sock
-
-[resolver]
-PORT = 53089
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_resolver_peer2.sock
-
-[peerinfo]
-PORT = 53090
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_peerinfo_peer2.sock
-
-[transport]
-PORT = 53091
-PLUGINS = udp
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_transport_peer2.sock
-
-
diff --git a/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf 
b/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf
deleted file mode 100644
index a8ee6d77a..000000000
--- a/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/
-
-[arm]
-PORT = 54087
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer1.sock
-
-[statistics]
-PORT = 54088
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer1.sock
-
-[resolver]
-PORT = 54089
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer1.sock
-
-[peerinfo]
-PORT = 54090
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer1.sock
-
-[transport]
-PORT = 54091
-PLUGINS = unix
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer1.sock
-
-[transport-unix]
-PORT = 54092
-
diff --git a/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf 
b/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf
deleted file mode 100644
index 6edbcac9f..000000000
--- a/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2
-
-[arm]
-PORT = 53087
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer2.sock
-
-[statistics]
-PORT = 53088
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer2.sock
-
-[resolver]
-PORT = 53089
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer2.sock
-
-[peerinfo]
-PORT = 53090
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer2.sock
-
-[transport]
-PORT = 53091
-PLUGINS = unix
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer2.sock
-
-[transport-unix]
-PORT = 53368
-
diff --git a/src/transport/test_quota_compliance_unix_peer1.conf 
b/src/transport/test_quota_compliance_unix_peer1.conf
deleted file mode 100644
index 59c8d6d9e..000000000
--- a/src/transport/test_quota_compliance_unix_peer1.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/
-
-[transport-unix]
-PORT = 12120
-
-[arm]
-PORT = 54087
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer1.sock
-
-[statistics]
-PORT = 54088
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer1.sock
-
-[resolver]
-PORT = 54089
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer1.sock
-
-[peerinfo]
-PORT = 54090
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer1.sock
-
-[transport]
-PORT = 54091
-PLUGINS = unix
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer1.sock
diff --git a/src/transport/test_quota_compliance_unix_peer2.conf 
b/src/transport/test_quota_compliance_unix_peer2.conf
deleted file mode 100644
index 8c2f9989e..000000000
--- a/src/transport/test_quota_compliance_unix_peer2.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2
-
-[transport-unix]
-PORT = 12136
-
-[arm]
-PORT = 53087
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer2.sock
-
-[statistics]
-PORT = 53088
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer2.sock
-
-[resolver]
-PORT = 53089
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer2.sock
-
-[peerinfo]
-PORT = 53090
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer2.sock
-
-[transport]
-PORT = 53091
-PLUGINS = unix
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer2.sock
-
-[transport-unix]
-PORT = 53368
-
diff --git a/src/transport/test_quota_compliance_wlan_asymmetric_peer1.conf 
b/src/transport/test_quota_compliance_wlan_asymmetric_peer1.conf
deleted file mode 100644
index 78e280b68..000000000
--- a/src/transport/test_quota_compliance_wlan_asymmetric_peer1.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/
-
-[transport-wlan]
-TESTMODE = 1
-
-[arm]
-PORT = 12164
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12163
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12162
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12161
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12160
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-
diff --git a/src/transport/test_quota_compliance_wlan_asymmetric_peer2.conf 
b/src/transport/test_quota_compliance_wlan_asymmetric_peer2.conf
deleted file mode 100644
index e97ab3f38..000000000
--- a/src/transport/test_quota_compliance_wlan_asymmetric_peer2.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/
-
-[transport-wlan]
-INTERFACE = mon1
-TESTMODE = 2
-
-[arm]
-PORT = 12174
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12173
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12172
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12171
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12170
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git a/src/transport/test_quota_compliance_wlan_peer1.conf 
b/src/transport/test_quota_compliance_wlan_peer1.conf
deleted file mode 100644
index 78e280b68..000000000
--- a/src/transport/test_quota_compliance_wlan_peer1.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/
-
-[transport-wlan]
-TESTMODE = 1
-
-[arm]
-PORT = 12164
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12163
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12162
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12161
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12160
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-
diff --git a/src/transport/test_quota_compliance_wlan_peer2.conf 
b/src/transport/test_quota_compliance_wlan_peer2.conf
deleted file mode 100644
index e97ab3f38..000000000
--- a/src/transport/test_quota_compliance_wlan_peer2.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/
-
-[transport-wlan]
-INTERFACE = mon1
-TESTMODE = 2
-
-[arm]
-PORT = 12174
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12173
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12172
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12171
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12170
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git a/src/transport/test_transport_defaults.conf 
b/src/transport/test_tng_defaults.conf
similarity index 78%
copy from src/transport/test_transport_defaults.conf
copy to src/transport/test_tng_defaults.conf
index 3aed73f0c..e37dab25e 100644
--- a/src/transport/test_transport_defaults.conf
+++ b/src/transport/test_tng_defaults.conf
@@ -3,9 +3,6 @@
 [PATHS]
 GNUNET_TEST_HOME = $GNUNET_TMP/test-tng/
 
-[transport-tcp]
-TIMEOUT = 300 s
-
 [transport]
 # PREFIX = valgrind 
 
@@ -15,6 +12,3 @@ RETURN_LOCAL_ADDRESSES = YES
 BINDTO = 127.0.0.1
 INTERNAL_ADDRESS = 127.0.0.1
 EXTERNAL_ADDRESS = 127.0.0.1
-
-[transport-udp]
-BROADCAST_RECEIVE = no
diff --git a/src/transport/test_transport_address_switch_http_peer1.conf 
b/src/transport/test_transport_address_switch_http_peer1.conf
deleted file mode 100644
index b48c5f47f..000000000
--- a/src/transport/test_transport_address_switch_http_peer1.conf
+++ /dev/null
@@ -1,26 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[ats]
-UNSPECIFIED_QUOTA_IN = 8 KiB
-UNSPECIFIED_QUOTA_OUT = 8 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = 8 KiB
-LOOPBACK_QUOTA_OUT = 8 KiB
-# LAN
-LAN_QUOTA_IN = 8 KiB
-LAN_QUOTA_OUT = 8 KiB
-# WAN
-WAN_QUOTA_IN = 8 KiB
-WAN_QUOTA_OUT = 8 KiB
-# WLAN
-WLAN_QUOTA_IN = 8 KiB
-WLAN_QUOTA_OUT = 8 KiB
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = 8 KiB
-BLUETOOTH_QUOTA_OUT = 8 KiB
-
-[transport]
-PLUGINS = http_server http_client
-
diff --git a/src/transport/test_transport_address_switch_http_peer2.conf 
b/src/transport/test_transport_address_switch_http_peer2.conf
deleted file mode 100644
index be8fb506c..000000000
--- a/src/transport/test_transport_address_switch_http_peer2.conf
+++ /dev/null
@@ -1,26 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[ats]
-UNSPECIFIED_QUOTA_IN = 8 KiB
-UNSPECIFIED_QUOTA_OUT = 8 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = 8 KiB
-LOOPBACK_QUOTA_OUT = 8 KiB
-# LAN
-LAN_QUOTA_IN = 8 KiB
-LAN_QUOTA_OUT = 8 KiB
-# WAN
-WAN_QUOTA_IN = 8 KiB
-WAN_QUOTA_OUT = 8 KiB
-# WLAN
-WLAN_QUOTA_IN = 8 KiB
-WLAN_QUOTA_OUT = 8 KiB
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = 8 KiB
-BLUETOOTH_QUOTA_OUT = 8 KiB
-
-[transport]
-PLUGINS = http_client http_server
-
diff --git a/src/transport/test_transport_address_switch_https_peer1.conf 
b/src/transport/test_transport_address_switch_https_peer1.conf
deleted file mode 100644
index 1f9210130..000000000
--- a/src/transport/test_transport_address_switch_https_peer1.conf
+++ /dev/null
@@ -1,44 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[ats]
-UNSPECIFIED_QUOTA_IN = 8 KiB
-UNSPECIFIED_QUOTA_OUT = 8 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = 8 KiB
-LOOPBACK_QUOTA_OUT = 8 KiB
-# LAN
-LAN_QUOTA_IN = 8 KiB
-LAN_QUOTA_OUT = 8 KiB
-# WAN
-WAN_QUOTA_IN = 8 KiB
-WAN_QUOTA_OUT = 8 KiB
-# WLAN
-WLAN_QUOTA_IN = 8 KiB
-WLAN_QUOTA_OUT = 8 KiB
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = 8 KiB
-BLUETOOTH_QUOTA_OUT = 8 KiB
-
-[arm]
-PORT = 12005
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12004
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12003
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12002
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12001
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-PLUGINS = https_client https_server
-
diff --git a/src/transport/test_transport_address_switch_https_peer2.conf 
b/src/transport/test_transport_address_switch_https_peer2.conf
deleted file mode 100644
index c58839868..000000000
--- a/src/transport/test_transport_address_switch_https_peer2.conf
+++ /dev/null
@@ -1,44 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[ats]
-UNSPECIFIED_QUOTA_IN = 8 KiB
-UNSPECIFIED_QUOTA_OUT = 8 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = 8 KiB
-LOOPBACK_QUOTA_OUT = 8 KiB
-# LAN
-LAN_QUOTA_IN = 8 KiB
-LAN_QUOTA_OUT = 8 KiB
-# WAN
-WAN_QUOTA_IN = 8 KiB
-WAN_QUOTA_OUT = 8 KiB
-# WLAN
-WLAN_QUOTA_IN = 8 KiB
-WLAN_QUOTA_OUT = 8 KiB
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = 8 KiB
-BLUETOOTH_QUOTA_OUT = 8 KiB
-
-[arm]
-PORT = 12014
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12013
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12012
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12011
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12010
-PLUGINS = https_client https_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git a/src/transport/test_transport_api2_tcp_node1.conf 
b/src/transport/test_transport_api2_tng_node.conf
similarity index 88%
copy from src/transport/test_transport_api2_tcp_node1.conf
copy to src/transport/test_transport_api2_tng_node.conf
index 37b6f08d1..b2514b39f 100644
--- a/src/transport/test_transport_api2_tcp_node1.conf
+++ b/src/transport/test_transport_api2_tng_node.conf
@@ -1,10 +1,9 @@
-@INLINE@ template_cfg_peer1.conf
+@INLINE@ template_tng_cfg_peer1.conf
 [PATHS]
 GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
 
 [transport]
 BINARY = gnunet-service-tng
-PLUGINS = tcp
 #PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes 
--log-file=$GNUNET_TEST_HOME/vg_peer1-%p 
 UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p1.sock
 
@@ -31,5 +30,11 @@ UNIXPATH = $GNUNET_RUNTIME_DIR/udp-comm-p1.sock
 [peerstore]
 IMMEDIATE_START = YES
 
-#[transport]
-#PREFIX = valgrind
+[topology]
+IMMEDIATE_START = YES
+
+[dht]
+IMMEDIATE_START = YES
+
+[fs]
+IMMEDIATE_START = YES
diff --git a/src/transport/test_transport_api_blacklisting.c 
b/src/transport/test_transport_api_blacklisting.c
deleted file mode 100644
index 2ba88a863..000000000
--- a/src/transport/test_transport_api_blacklisting.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2011, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/test_transport_api_blacklisting.c
- * @brief test for the blacklisting API
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing.h"
-
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
-
-static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-static int connected;
-
-static int blacklist_request_p1;
-
-static int blacklist_request_p2;
-
-static struct GNUNET_TRANSPORT_Blacklist *blacklist_p1;
-
-static struct GNUNET_TRANSPORT_Blacklist *blacklist_p2;
-
-static struct GNUNET_SCHEDULER_Task *shutdown_task;
-
-
-static void
-end (void *cls)
-{
-  shutdown_task = NULL;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Stopping\n");
-  if ((GNUNET_YES == blacklist_request_p1) &&
-      (GNUNET_YES == blacklist_request_p2) &&
-      (GNUNET_NO == connected))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Peers were never connected, success\n");
-    ccc->global_ret = GNUNET_OK;
-  }
-  else
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Peers were not connected, fail\n");
-    ccc->global_ret = GNUNET_SYSERR;
-  }
-  GNUNET_SCHEDULER_shutdown ();
-}
-
-
-static void
-custom_shutdown (void *cls)
-{
-  if (NULL != shutdown_task)
-  {
-    GNUNET_SCHEDULER_cancel (shutdown_task);
-    shutdown_task = NULL;
-  }
-  if (NULL != blacklist_p1)
-  {
-    GNUNET_TRANSPORT_blacklist_cancel (blacklist_p1);
-    blacklist_p1 = NULL;
-  }
-  if (NULL != blacklist_p2)
-  {
-    GNUNET_TRANSPORT_blacklist_cancel (blacklist_p2);
-    blacklist_p2 = NULL;
-  }
-}
-
-
-static void
-notify_receive (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-                const struct GNUNET_PeerIdentity *sender,
-                const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Unexpectedly even received the message despite blacklist\n");
-  connected = GNUNET_YES;
-  GNUNET_SCHEDULER_cancel (shutdown_task);
-  end (NULL);
-}
-
-
-static void
-notify_connect (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
-                const struct GNUNET_PeerIdentity *other)
-{
-  GNUNET_TRANSPORT_TESTING_log_connect (cls,
-                                        me,
-                                        other);
-  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-              "Peers connected despite blacklist!\n");
-  connected = GNUNET_YES; /* this test now failed */
-  GNUNET_SCHEDULER_cancel (shutdown_task);
-  end (NULL);
-}
-
-
-static int
-blacklist_cb (void *cls,
-              const struct GNUNET_PeerIdentity *pid)
-{
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cls;
-  int res = GNUNET_SYSERR;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Peer %u: Blacklist request for peer `%s'\n",
-              p->no,
-              GNUNET_i2s (pid));
-
-  if (p == ccc->p[0])
-  {
-    blacklist_request_p1 = GNUNET_YES;
-    res = GNUNET_OK;
-  }
-  if (p == ccc->p[1])
-  {
-    blacklist_request_p2 = GNUNET_YES;
-    res = GNUNET_SYSERR;
-  }
-
-  if ((GNUNET_YES == blacklist_request_p2) &&
-      (GNUNET_YES == blacklist_request_p1) &&
-      (NULL == shutdown_task))
-  {
-    shutdown_task
-      = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (
-                                        GNUNET_TIME_UNIT_SECONDS, 3),
-                                      &end,
-                                      NULL);
-  }
-  return res;
-}
-
-
-static void
-start_blacklist (void *cls)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Starting blacklists\n");
-  blacklist_p1 = GNUNET_TRANSPORT_blacklist (ccc->p[0]->cfg,
-                                             &blacklist_cb,
-                                             ccc->p[0]);
-  GNUNET_assert (NULL != blacklist_p1);
-  blacklist_p2 = GNUNET_TRANSPORT_blacklist (ccc->p[1]->cfg,
-                                             &blacklist_cb,
-                                             ccc->p[1]);
-  GNUNET_assert (NULL != blacklist_p2);
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure sc = {
-    .num_messages = 1
-  };
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
-    .pre_connect_task = &start_blacklist,
-    .connect_continuation = &GNUNET_TRANSPORT_TESTING_simple_send,
-    .connect_continuation_cls = &sc,
-    .config_file = "test_transport_api_data.conf",
-    .rec = &notify_receive,
-    .nc = &notify_connect,
-    .nd = &GNUNET_TRANSPORT_TESTING_log_disconnect,
-    .shutdown_task = &custom_shutdown,
-    .timeout = TIMEOUT,
-    .bi_directional = GNUNET_YES
-  };
-
-  ccc = &my_ccc;
-  if (GNUNET_OK !=
-      GNUNET_TRANSPORT_TESTING_main (2,
-                                     &GNUNET_TRANSPORT_TESTING_connect_check,
-                                     ccc))
-    return 1;
-  return 0;
-}
-
-
-/* end of transport_api_blacklisting.c */
diff --git a/src/transport/test_transport_api_blacklisting_tcp_peer1.conf 
b/src/transport/test_transport_api_blacklisting_tcp_peer1.conf
deleted file mode 100644
index eabd6b701..000000000
--- a/src/transport/test_transport_api_blacklisting_tcp_peer1.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = tcp
-
-#[transport]
-#PREFIX = valgrind
diff --git a/src/transport/test_transport_api_blacklisting_tcp_peer2.conf 
b/src/transport/test_transport_api_blacklisting_tcp_peer2.conf
deleted file mode 100644
index 58ce0777f..000000000
--- a/src/transport/test_transport_api_blacklisting_tcp_peer2.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = tcp
-
-#[transport]
-#PREFIX = valgrind
diff --git a/src/transport/test_transport_api_bluetooth_peer1.conf 
b/src/transport/test_transport_api_bluetooth_peer1.conf
deleted file mode 100644
index b1209e44b..000000000
--- a/src/transport/test_transport_api_bluetooth_peer1.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/
-
-[transport-bluetooth]
-INTERFACE = hci0
-TESTMODE = 1
-
-[transport]
-PLUGINS = bluetooth
diff --git a/src/transport/test_transport_api_bluetooth_peer2.conf 
b/src/transport/test_transport_api_bluetooth_peer2.conf
deleted file mode 100644
index 371a5d3b0..000000000
--- a/src/transport/test_transport_api_bluetooth_peer2.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/
-
-[transport-bluetooth]
-INTERFACE = hci1
-TESTMODE = 2
-
-[transport]
-PLUGINS = bluetooth
diff --git a/src/transport/test_transport_api_disconnect.c 
b/src/transport/test_transport_api_disconnect.c
deleted file mode 100644
index c469f28bc..000000000
--- a/src/transport/test_transport_api_disconnect.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_transport_api_disconnect.c
- * @brief base test case for transport implementations
- *
- * This test case tests disconnect notifications in peer shutdown.
- * Starts two peers, has them connect, sends a message in between,
- * stops one peer, expects the others to send a disconnect notification.
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing.h"
-
-/**
- * How long until we give up on transmitting the message?
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
-
-
-static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-static int shutdown_;
-
-
-static void
-notify_disconnect (void *cls,
-                   struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
-                   const struct GNUNET_PeerIdentity *other)
-{
-  if (me != ccc->p[0])
-    return;
-  GNUNET_TRANSPORT_TESTING_log_disconnect (cls,
-                                           me,
-                                           other);
-  if (GNUNET_YES == shutdown_)
-  {
-    ccc->global_ret = GNUNET_OK;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Test good, shutting down...\n");
-    GNUNET_SCHEDULER_shutdown ();
-  }
-}
-
-
-static void
-stop_peer (void *cls)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Shutting down peer %u (`%s')\n",
-              ccc->p[1]->no,
-              GNUNET_i2s (&ccc->p[1]->id));
-  shutdown_ = GNUNET_YES;
-  GNUNET_TRANSPORT_TESTING_stop_peer (ccc->p[1]);
-  ccc->p[1] = NULL;
-}
-
-
-static void
-notify_receive (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-                const struct GNUNET_PeerIdentity *sender,
-                const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  {
-    char *ps = GNUNET_strdup (GNUNET_i2s (&receiver->id));
-
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Peer %u (`%s') received message of type %d and size %u size 
from peer %s!\n",
-                receiver->no,
-                ps,
-                ntohs (message->header.type),
-                ntohs (message->header.size),
-                GNUNET_i2s (sender));
-    GNUNET_free (ps);
-  }
-  if ((GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE == ntohs (message->header.type)) 
&&
-      (sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage) == ntohs (
-         message->header.size)))
-  {
-    GNUNET_SCHEDULER_add_now (&stop_peer,
-                              NULL);
-    return;
-  }
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure sc = {
-    .num_messages = 1
-  };
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
-    .connect_continuation = &GNUNET_TRANSPORT_TESTING_simple_send,
-    .connect_continuation_cls = &sc,
-    .config_file = "test_transport_api_data.conf",
-    .rec = &notify_receive,
-    .nc = &GNUNET_TRANSPORT_TESTING_log_connect,
-    .nd = &notify_disconnect,
-    .timeout = TIMEOUT,
-    .global_ret = GNUNET_SYSERR
-  };
-
-  ccc = &my_ccc;
-  sc.ccc = ccc;
-  if (GNUNET_OK !=
-      GNUNET_TRANSPORT_TESTING_main (2,
-                                     &GNUNET_TRANSPORT_TESTING_connect_check,
-                                     ccc))
-    return 1;
-  return 0;
-}
-
-
-/* end of test_transport_api_disconnect.c */
diff --git a/src/transport/test_transport_api_disconnect_tcp_peer1.conf 
b/src/transport/test_transport_api_disconnect_tcp_peer1.conf
deleted file mode 100644
index 8530ba310..000000000
--- a/src/transport/test_transport_api_disconnect_tcp_peer1.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = tcp
-
diff --git a/src/transport/test_transport_api_disconnect_tcp_peer2.conf 
b/src/transport/test_transport_api_disconnect_tcp_peer2.conf
deleted file mode 100644
index ce9c2f885..000000000
--- a/src/transport/test_transport_api_disconnect_tcp_peer2.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = tcp
-
-
diff --git a/src/transport/test_transport_api_http_peer1.conf 
b/src/transport/test_transport_api_http_peer1.conf
deleted file mode 100644
index 2a622ae02..000000000
--- a/src/transport/test_transport_api_http_peer1.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p1/
-
-[transport]
-PLUGINS = http_client
diff --git a/src/transport/test_transport_api_http_peer2.conf 
b/src/transport/test_transport_api_http_peer2.conf
deleted file mode 100644
index aca41804b..000000000
--- a/src/transport/test_transport_api_http_peer2.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p2/
-
-[transport]
-PLUGINS = http_server
diff --git a/src/transport/test_transport_api_http_reverse_peer1.conf 
b/src/transport/test_transport_api_http_reverse_peer1.conf
deleted file mode 100644
index 67640d7bb..000000000
--- a/src/transport/test_transport_api_http_reverse_peer1.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p1/
-
-[transport]
-PLUGINS = http_client
-
-[ats]
-WAN_QUOTA_IN = unlimited
-WAN_QUOTA_OUT = unlimited
-
diff --git a/src/transport/test_transport_api_http_reverse_peer2.conf 
b/src/transport/test_transport_api_http_reverse_peer2.conf
deleted file mode 100644
index 0e7a2ea05..000000000
--- a/src/transport/test_transport_api_http_reverse_peer2.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p2/
-
-[transport-http_server]
-PORT = 8080
-EXTERNAL_HOSTNAME = fulcrum.net.in.tum.de/gnunet
-EXTERNAL_HOSTNAME_ONLY = YES
-
-[transport]
-PLUGINS = http_server
-
diff --git a/src/transport/test_transport_api_https_peer1.conf 
b/src/transport/test_transport_api_https_peer1.conf
deleted file mode 100644
index 55d119259..000000000
--- a/src/transport/test_transport_api_https_peer1.conf
+++ /dev/null
@@ -1,26 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p1/
-
-[arm]
-PORT = 12105
-
-[statistics]
-PORT = 12104
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12103
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12102
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12101
-PLUGINS = https_client
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-#PREFIX = valgrind
-
-
diff --git a/src/transport/test_transport_api_https_peer2.conf 
b/src/transport/test_transport_api_https_peer2.conf
deleted file mode 100644
index 3b1d55b0a..000000000
--- a/src/transport/test_transport_api_https_peer2.conf
+++ /dev/null
@@ -1,32 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p2/
-
-[transport-https_server]
-EXTERNAL_HOSTNAME = localhost
-EXTERNAL_HOSTNAME_ONLY = yes
-EXTERNAL_HOSTNAME_USE_PORT = YES
-
-[arm]
-PORT = 12115
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12114
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12113
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12112
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12111
-PLUGINS = https_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-#PREFIX = valgrind
-
-
diff --git a/src/transport/test_transport_api_limited_sockets.c 
b/src/transport/test_transport_api_limited_sockets.c
deleted file mode 100644
index 0e47800e8..000000000
--- a/src/transport/test_transport_api_limited_sockets.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_transport_api_limited_sockets.c
- * @brief base test case for transport implementations
- *
- * This test case serves as a base for tcp, udp, and udp-nat
- * transport test cases.  Based on the executable being run
- * the correct test case will be performed.  Conservation of
- * C code apparently.
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing.h"
-
-/**
- * How long until we give up on transmitting the message?
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300)
-
-#define MAX_FILES 50
-
-
-#if HAVE_SETRLIMIT
-
-static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-
-static void
-notify_receive (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-                const struct GNUNET_PeerIdentity *sender,
-                const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received message of type %d from peer %s!\n",
-              ntohs (message->header.type),
-              GNUNET_i2s (sender));
-  if ((GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE ==
-       ntohs (message->header.type)) &&
-      (sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage) ==
-       ntohs (message->header.size)))
-  {
-    ccc->global_ret = GNUNET_OK;
-  }
-  else
-  {
-    GNUNET_break (0);
-  }
-  GNUNET_SCHEDULER_shutdown ();
-}
-
-
-int
-main (int argc, char *argv[])
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure sc = {
-    .num_messages = 1
-  };
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
-    .connect_continuation = &GNUNET_TRANSPORT_TESTING_simple_send,
-    .connect_continuation_cls = &sc,
-    .config_file = "test_transport_api_data.conf",
-    .rec = &notify_receive,
-    .nc = &GNUNET_TRANSPORT_TESTING_log_connect,
-    .nd = &GNUNET_TRANSPORT_TESTING_log_disconnect,
-    .timeout = TIMEOUT,
-    .global_ret = GNUNET_SYSERR
-  };
-  struct rlimit r_file_old;
-  struct rlimit r_file_new;
-  int res;
-
-  sc.ccc = &my_ccc;
-  res = getrlimit (RLIMIT_NOFILE,
-                   &r_file_old);
-  r_file_new.rlim_cur = MAX_FILES;
-  r_file_new.rlim_max = r_file_old.rlim_max;
-  res = setrlimit (RLIMIT_NOFILE,
-                   &r_file_new);
-  if (0 != res)
-  {
-    fprintf (stderr,
-             "Setting limit failed: %s\n",
-             strerror (errno));
-    return 77;
-  }
-
-  ccc = &my_ccc;
-  ccc->global_ret = GNUNET_SYSERR;
-  if (GNUNET_OK !=
-      GNUNET_TRANSPORT_TESTING_main (2,
-                                     &GNUNET_TRANSPORT_TESTING_connect_check,
-                                     ccc))
-    return 1;
-  return 0;
-}
-
-
-#else
-/* cannot setrlimit */
-
-
-int
-main (int argc, char *argv[])
-{
-  fprintf (stderr,
-           "Cannot run test on this system\n");
-  return 77;
-}
-
-
-#endif
-
-/* end of test_transport_api_limited_sockets.c */
diff --git a/src/transport/test_transport_api_limited_sockets_tcp_peer1.conf 
b/src/transport/test_transport_api_limited_sockets_tcp_peer1.conf
deleted file mode 100644
index e0ad5f847..000000000
--- a/src/transport/test_transport_api_limited_sockets_tcp_peer1.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-@INLINE@ ../../contrib/conf/gnunet/no_autostart_above_core.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = tcp
diff --git a/src/transport/test_transport_api_limited_sockets_tcp_peer2.conf 
b/src/transport/test_transport_api_limited_sockets_tcp_peer2.conf
deleted file mode 100644
index bb466abba..000000000
--- a/src/transport/test_transport_api_limited_sockets_tcp_peer2.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-@INLINE@ ../../contrib/conf/gnunet/no_autostart_above_core.conf
-
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = tcp
diff --git a/src/transport/test_transport_api_manipulation_cfg.c 
b/src/transport/test_transport_api_manipulation_cfg.c
deleted file mode 100644
index 73c81114e..000000000
--- a/src/transport/test_transport_api_manipulation_cfg.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_transport_api_manipulation_cfg.c
- * @brief base test case for transport traffic manipulation implementation
- * based on cfg
- *
- * Peer 1 has inbound and outbound delay of 100ms
- * Peer 2 has no inbound and outbound delay
- *
- * We send a request from P1 to P2 and expect delay of >= TEST_DELAY us
- * Then we send response from P2 to P1 and expect delay of >= TEST_DELAY us
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing.h"
-
-/**
- * How long until we give up on transmitting the message?
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
-
-
-#define TEST_MESSAGE_SIZE 2600
-
-#define TEST_RESPONSE_MESSAGE_TYPE
-
-/**
- * Test delay, in microseconds.
- */
-#define TEST_DELAY 100 * 1000LL
-
-
-static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-static struct GNUNET_TIME_Absolute start_request;
-
-static struct GNUNET_TIME_Absolute start_response;
-
-
-static void
-sendtask_response_task (void *cls)
-{
-  int ret;
-
-  start_response = GNUNET_TIME_absolute_get ();
-  ret = GNUNET_TRANSPORT_TESTING_send (ccc->p[1],
-                                       ccc->p[0],
-                                       GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2,
-                                       TEST_MESSAGE_SIZE,
-                                       1,
-                                       NULL,
-                                       NULL);
-  if (GNUNET_NO == ret)
-  {
-    GNUNET_break (0);
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-  GNUNET_assert (GNUNET_SYSERR != ret);
-}
-
-
-static void
-notify_receive (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-                const struct GNUNET_PeerIdentity *sender,
-                const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  struct GNUNET_TIME_Relative duration;
-
-  {
-    char *ps = GNUNET_strdup (GNUNET_i2s (&receiver->id));
-
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Peer %u (`%s') received message of type %d and size %u size 
from peer %s)!\n",
-                receiver->no,
-                ps,
-                ntohs (message->header.type),
-                ntohs (message->header.size),
-                GNUNET_i2s (sender));
-    GNUNET_free (ps);
-  }
-
-  switch (ntohs (message->header.type))
-  {
-  case GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE:
-    duration = GNUNET_TIME_absolute_get_difference (start_request,
-                                                    GNUNET_TIME_absolute_get 
());
-    if (duration.rel_value_us >= TEST_DELAY)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Request message was delayed for %s\n",
-                  GNUNET_STRINGS_relative_time_to_string (duration,
-                                                          GNUNET_YES));
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Request message was delayed for unexpected duration %s\n",
-                  GNUNET_STRINGS_relative_time_to_string (duration,
-                                                          GNUNET_YES));
-      ccc->global_ret = GNUNET_SYSERR;
-      GNUNET_SCHEDULER_shutdown ();
-    }
-    /* Send response */
-    GNUNET_SCHEDULER_add_now (&sendtask_response_task,
-                              NULL);
-    return;
-
-  case GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2:
-    duration = GNUNET_TIME_absolute_get_difference (start_response,
-                                                    GNUNET_TIME_absolute_get 
());
-    if (duration.rel_value_us >= TEST_DELAY)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "Response message was delayed for %s\n",
-                  GNUNET_STRINGS_relative_time_to_string (duration,
-                                                          GNUNET_YES));
-      ccc->global_ret = GNUNET_OK;
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Response message was delayed for unexpected duration %s\n",
-                  GNUNET_STRINGS_relative_time_to_string (duration,
-                                                          GNUNET_YES));
-      ccc->global_ret = GNUNET_SYSERR;
-    }
-    GNUNET_SCHEDULER_shutdown ();
-    break;
-
-  default:
-    GNUNET_break (0);
-    break;
-  }
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure sc = {
-    .num_messages = 1
-  };
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
-    .connect_continuation = &GNUNET_TRANSPORT_TESTING_large_send,
-    .connect_continuation_cls = &sc,
-    .config_file = "test_transport_api_data.conf",
-    .rec = &notify_receive,
-    .nc = &GNUNET_TRANSPORT_TESTING_log_connect,
-    .nd = &GNUNET_TRANSPORT_TESTING_log_disconnect,
-    .timeout = TIMEOUT
-  };
-
-  ccc = &my_ccc;
-  sc.ccc = ccc;
-  start_request = GNUNET_TIME_absolute_get ();
-  if (GNUNET_OK !=
-      GNUNET_TRANSPORT_TESTING_main (2,
-                                     &GNUNET_TRANSPORT_TESTING_connect_check,
-                                     ccc))
-    return 1;
-  return 0;
-}
-
-
-/* end of test_transport_api_manipulation_cfg.c */
diff --git a/src/transport/test_transport_api_manipulation_cfg_peer1.conf 
b/src/transport/test_transport_api_manipulation_cfg_peer1.conf
deleted file mode 100644
index 77cdce2e2..000000000
--- a/src/transport/test_transport_api_manipulation_cfg_peer1.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = tcp
-MANIPULATE_DELAY_IN = 100 ms
-MANIPULATE_DELAY_OUT = 100 ms
diff --git a/src/transport/test_transport_api_manipulation_cfg_peer2.conf 
b/src/transport/test_transport_api_manipulation_cfg_peer2.conf
deleted file mode 100644
index 9cbaaddef..000000000
--- a/src/transport/test_transport_api_manipulation_cfg_peer2.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = tcp
-#MANIPULATE_DELAY_IN = 0 ms
-#MANIPULATE_DELAY_OUT = 0 ms
diff --git a/src/transport/test_transport_api_manipulation_recv_tcp.c 
b/src/transport/test_transport_api_manipulation_recv_tcp.c
deleted file mode 100644
index 207c4416f..000000000
--- a/src/transport/test_transport_api_manipulation_recv_tcp.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_transport_api_manipulation_recv_tcp.c
- * @brief base test case for transport traffic manipulation implementation
- *
- * This test case will setup 2 peers and connect them, the first message
- * will be sent without manipulation, then a receive delay of 1 second will
- * be configured and 2 more message will be sent. Time will be measured
- *
- * In addition the distance on receiver side will be manipulated to be 10
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing.h"
-
-/**
- * How long until we give up on transmitting the message?
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
-
-
-static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-static int messages_recv;
-
-static struct GNUNET_TIME_Absolute start_normal;
-
-static struct GNUNET_TIME_Relative dur_normal;
-
-static struct GNUNET_TIME_Absolute start_delayed;
-
-static struct GNUNET_TIME_Relative dur_delayed;
-
-
-static void
-do_free (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure *sc = cls;
-
-  GNUNET_free (sc);
-}
-
-
-static void
-delayed_transmit (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure *sc = cls;
-
-  start_delayed = GNUNET_TIME_absolute_get ();
-  GNUNET_TRANSPORT_TESTING_large_send (sc);
-}
-
-
-static void
-sendtask (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure *sc;
-  struct GNUNET_ATS_Properties prop;
-  struct GNUNET_TIME_Relative delay;
-
-  sc = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_SendClosure);
-  sc->num_messages = 1;
-  sc->ccc = ccc;
-  sc->cont = &do_free;
-  sc->cont_cls = sc;
-  if (0 == messages_recv)
-  {
-    start_normal = GNUNET_TIME_absolute_get ();
-  }
-  if (0 < messages_recv)
-  {
-    memset (&prop,
-            0,
-            sizeof(prop));
-    delay = GNUNET_TIME_UNIT_SECONDS;
-    GNUNET_TRANSPORT_manipulation_set (ccc->p[1]->tmh,
-                                       &ccc->p[0]->id,
-                                       &prop,
-                                       delay,
-                                       GNUNET_TIME_UNIT_ZERO);
-    /* wait 1s to allow manipulation to go into effect */
-    if (1 == messages_recv)
-    {
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                    &delayed_transmit,
-                                    sc);
-      return;
-    }
-  }
-  GNUNET_TRANSPORT_TESTING_large_send (sc);
-}
-
-
-static void
-notify_receive (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-                const struct GNUNET_PeerIdentity *sender,
-                const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  {
-    char *ps = GNUNET_strdup (GNUNET_i2s (&receiver->id));
-
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Peer %u (`%s') received message of type %d and size %u size 
from peer %s)!\n",
-                receiver->no,
-                ps,
-                ntohs (message->header.type),
-                ntohs (message->header.size),
-                GNUNET_i2s (sender));
-    GNUNET_free (ps);
-  }
-  if ((GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE != ntohs (message->header.type)) 
||
-      (GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE != ntohs (
-         message->header.size)))
-  {
-    GNUNET_break (0);
-    ccc->global_ret = GNUNET_SYSERR;
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-
-  if (messages_recv <= 2)
-  {
-    /* Received non-delayed message */
-    dur_normal = GNUNET_TIME_absolute_get_duration (start_normal);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Received non-delayed message %u after %s\n",
-                messages_recv,
-                GNUNET_STRINGS_relative_time_to_string (dur_normal,
-                                                        GNUNET_YES));
-    GNUNET_SCHEDULER_add_now (&sendtask,
-                              NULL);
-    messages_recv++;
-    return;
-  }
-  /* Received manipulated message */
-  dur_delayed = GNUNET_TIME_absolute_get_duration (start_delayed);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received delayed message %u after %s\n",
-              messages_recv,
-              GNUNET_STRINGS_relative_time_to_string (dur_delayed,
-                                                      GNUNET_YES));
-  if (dur_delayed.rel_value_us < GNUNET_TIME_UNIT_SECONDS.rel_value_us)
-  {
-    GNUNET_break (0);
-    ccc->global_ret = GNUNET_SYSERR;
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Delayed message was not delayed correctly: took only %s\n",
-                GNUNET_STRINGS_relative_time_to_string (dur_delayed,
-                                                        GNUNET_YES));
-  }
-  else
-  {
-    ccc->global_ret = GNUNET_OK;
-  }
-  /* shutdown */
-  GNUNET_SCHEDULER_shutdown ();
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
-    .connect_continuation = &sendtask,
-    .config_file = "test_transport_api_data.conf",
-    .rec = &notify_receive,
-    .nc = &GNUNET_TRANSPORT_TESTING_log_connect,
-    .nd = &GNUNET_TRANSPORT_TESTING_log_disconnect,
-    .timeout = TIMEOUT,
-    .global_ret = GNUNET_NO
-  };
-
-  ccc = &my_ccc;
-  if (GNUNET_OK !=
-      GNUNET_TRANSPORT_TESTING_main (2,
-                                     &GNUNET_TRANSPORT_TESTING_connect_check,
-                                     ccc))
-    return 1;
-  return 0;
-}
-
-
-/* end of test_transport_api_manipulation_recv_tcp.c */
diff --git a/src/transport/test_transport_api_manipulation_recv_tcp_peer1.conf 
b/src/transport/test_transport_api_manipulation_recv_tcp_peer1.conf
deleted file mode 100644
index 9150c7faf..000000000
--- a/src/transport/test_transport_api_manipulation_recv_tcp_peer1.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport-tcp]
-PORT = 12000
-TIMEOUT = 5 s
-
-[arm]
-PORT = 12005
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12004
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12003
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12002
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12001
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-PLUGINS = tcp
-
diff --git a/src/transport/test_transport_api_manipulation_recv_tcp_peer2.conf 
b/src/transport/test_transport_api_manipulation_recv_tcp_peer2.conf
deleted file mode 100644
index a7b2cf90b..000000000
--- a/src/transport/test_transport_api_manipulation_recv_tcp_peer2.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport-tcp]
-PORT = 12015
-TIMEOUT = 5 s
-
-[arm]
-PORT = 12014
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12013
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12012
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12011
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12010
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git a/src/transport/test_transport_api_manipulation_send_tcp.c 
b/src/transport/test_transport_api_manipulation_send_tcp.c
deleted file mode 100644
index ea735cfc6..000000000
--- a/src/transport/test_transport_api_manipulation_send_tcp.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_transport_api_manipulation_send_tcp.c
- * @brief base test case for transport traffic manipulation implementation
- *
- * This test case will setup 2 peers and connect them, the first message
- * will be sent without manipulation, then a send delay of 1 second will
- * be configured and 1 more message will be sent. Time will be measured.
- *
- * In addition the distance on receiver side will be manipulated to be 10
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing.h"
-
-/**
- * How long until we give up on transmitting the message?
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
-
-static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-static int messages_recv;
-
-static struct GNUNET_TIME_Absolute start_normal;
-
-static struct GNUNET_TIME_Relative dur_normal;
-
-static struct GNUNET_TIME_Absolute start_delayed;
-
-static struct GNUNET_TIME_Relative dur_delayed;
-
-
-static void
-do_free (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure *sc = cls;
-
-  GNUNET_free (sc);
-}
-
-
-static void
-delayed_transmit (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure *sc = cls;
-
-  start_delayed = GNUNET_TIME_absolute_get ();
-  GNUNET_TRANSPORT_TESTING_large_send (sc);
-}
-
-
-static void
-sendtask (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure *sc;
-  struct GNUNET_TIME_Relative delay;
-  struct GNUNET_ATS_Properties prop;
-
-  sc = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_SendClosure);
-  sc->num_messages = 1;
-  sc->ccc = ccc;
-  sc->cont = &do_free;
-  sc->cont_cls = sc;
-  if (0 == messages_recv)
-  {
-    start_normal = GNUNET_TIME_absolute_get ();
-  }
-  if (1 == messages_recv)
-  {
-    memset (&prop,
-            0,
-            sizeof(prop));
-    delay = GNUNET_TIME_UNIT_SECONDS;
-    GNUNET_TRANSPORT_manipulation_set (ccc->p[0]->tmh,
-                                       &ccc->p[1]->id,
-                                       &prop,
-                                       GNUNET_TIME_UNIT_ZERO,
-                                       delay);
-    /* wait 1s to allow manipulation to go into effect */
-    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                  &delayed_transmit,
-                                  sc);
-    return;
-  }
-  GNUNET_TRANSPORT_TESTING_large_send (sc);
-}
-
-
-static void
-notify_receive (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-                const struct GNUNET_PeerIdentity *sender,
-                const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  {
-    char *ps = GNUNET_strdup (GNUNET_i2s (&receiver->id));
-
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Peer %u (`%s') received message of type %d and size %u size 
from peer %s)!\n",
-                receiver->no,
-                ps,
-                ntohs (message->header.type),
-                ntohs (message->header.size),
-                GNUNET_i2s (sender));
-    GNUNET_free (ps);
-  }
-
-  if ((GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE != ntohs (message->header.type)) 
||
-      (GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE != ntohs (
-         message->header.size)))
-  {
-    GNUNET_break (0);
-    ccc->global_ret = GNUNET_SYSERR;
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-
-  if (0 == messages_recv)
-  {
-    /* Received non-delayed message */
-    dur_normal = GNUNET_TIME_absolute_get_duration (start_normal);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Received non-delayed message %u after %s\n",
-                messages_recv,
-                GNUNET_STRINGS_relative_time_to_string (dur_normal,
-                                                        GNUNET_YES));
-    GNUNET_SCHEDULER_add_now (&sendtask,
-                              NULL);
-    messages_recv++;
-    return;
-  }
-  /* Received manipulated message */
-  dur_delayed = GNUNET_TIME_absolute_get_duration (start_delayed);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received delayed message %u after %s\n",
-              messages_recv,
-              GNUNET_STRINGS_relative_time_to_string (dur_delayed,
-                                                      GNUNET_YES));
-  if (dur_delayed.rel_value_us < GNUNET_TIME_UNIT_SECONDS.rel_value_us)
-  {
-    GNUNET_break (0);
-    ccc->global_ret = GNUNET_SYSERR;
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Delayed message was not delayed correctly: took only %s\n",
-                GNUNET_STRINGS_relative_time_to_string (dur_delayed,
-                                                        GNUNET_YES));
-  }
-  else
-  {
-    ccc->global_ret = GNUNET_OK;
-  }
-  GNUNET_SCHEDULER_shutdown ();
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
-    .connect_continuation = &sendtask,
-    .config_file = "test_transport_api_data.conf",
-    .rec = &notify_receive,
-    .nc = &GNUNET_TRANSPORT_TESTING_log_connect,
-    .nd = &GNUNET_TRANSPORT_TESTING_log_disconnect,
-    .timeout = TIMEOUT,
-    .global_ret = GNUNET_NO
-  };
-
-  ccc = &my_ccc;
-  if (GNUNET_OK !=
-      GNUNET_TRANSPORT_TESTING_main (2,
-                                     &GNUNET_TRANSPORT_TESTING_connect_check,
-                                     ccc))
-    return 1;
-  return 0;
-}
-
-
-/* end of test_transport_api_manipulation_send_tcp.c */
diff --git a/src/transport/test_transport_api_manipulation_send_tcp_peer1.conf 
b/src/transport/test_transport_api_manipulation_send_tcp_peer1.conf
deleted file mode 100644
index 9150c7faf..000000000
--- a/src/transport/test_transport_api_manipulation_send_tcp_peer1.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport-tcp]
-PORT = 12000
-TIMEOUT = 5 s
-
-[arm]
-PORT = 12005
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12004
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12003
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12002
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12001
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-PLUGINS = tcp
-
diff --git a/src/transport/test_transport_api_manipulation_send_tcp_peer2.conf 
b/src/transport/test_transport_api_manipulation_send_tcp_peer2.conf
deleted file mode 100644
index a7b2cf90b..000000000
--- a/src/transport/test_transport_api_manipulation_send_tcp_peer2.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport-tcp]
-PORT = 12015
-TIMEOUT = 5 s
-
-[arm]
-PORT = 12014
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12013
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12012
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12011
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12010
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git a/src/transport/test_transport_api_reliability.c 
b/src/transport/test_transport_api_reliability.c
deleted file mode 100644
index 508fed4f5..000000000
--- a/src/transport/test_transport_api_reliability.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_transport_api_reliability.c
- * @brief base test case for transport implementations
- *
- * This test case serves ensures that messages are reliably sent between peers
- *
- * This test sends TOTAL_MSGS with message type MTYPE from peer 1 to peer 2
- * and ensures that all message were received.
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "gauger.h"
-#include "transport-testing.h"
-
-/**
- * Allow making the problem "bigger".
- */
-#define FACTOR 1
-
-/**
- * Total number of messages to send
- *
- * Note that this value must not significantly exceed
- * 'MAX_PENDING' in 'gnunet-service-transport_clients.c', otherwise
- * messages may be dropped even for a reliable transport.
- */
-#define TOTAL_MSGS (1024 * 3 * FACTOR)
-
-/**
- * Testcase timeout
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 450 \
-                                               * FACTOR)
-
-/**
- * If we are in an "xhdr" test, the factor by which we divide
- * #TOTAL_MSGS for a more sane test duration.
- */
-static unsigned int xhdr = 1;
-
-static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-/**
- * Total amount of bytes sent
- */
-static unsigned long long total_bytes;
-
-/**
- * Time of start
- */
-static struct GNUNET_TIME_Absolute start_time;
-
-/**
- * No. of last message received
- */
-static unsigned int msg_recv;
-
-/**
- * Bitmap storing which messages were received
- */
-static char bitmap[TOTAL_MSGS / 8];
-
-
-/**
- * Get the desired message size for message number @a iter.
- */
-static size_t
-get_size (unsigned int iter)
-{
-  size_t ret;
-
-  ret = (iter * iter * iter);
-#ifndef __linux__
-  /* FreeBSD/OSX etc. Unix DGRAMs do not work
-   * with large messages */
-  if (0 == strcmp ("unix", ccc->test_plugin))
-    return sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage) + (ret % 1024);
-#endif
-  return sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage) + (ret % 60000);
-}
-
-
-/**
- * Implementation of the callback for obtaining the
- * size of messages for transmission.  Counts the total
- * number of bytes sent as a side-effect.
- *
- * @param cnt_down count down from `TOTAL_MSGS - 1`
- * @return message size of the message
- */
-static size_t
-get_size_cnt (unsigned int cnt_down)
-{
-  size_t ret = get_size (TOTAL_MSGS / xhdr - 1 - cnt_down);
-
-  total_bytes += ret;
-  return ret;
-}
-
-
-/**
- * Sets a bit active in the bitmap.
- *
- * @param bitIdx which bit to set
- * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
- */
-static int
-set_bit (unsigned int bitIdx)
-{
-  size_t arraySlot;
-  unsigned int targetBit;
-
-  if (bitIdx >= sizeof(bitmap) * 8)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "tried to set bit %u of %u(!?!?)\n",
-                bitIdx,
-                (unsigned int) sizeof(bitmap) * 8);
-    return GNUNET_SYSERR;
-  }
-  arraySlot = bitIdx / 8;
-  targetBit = (1L << (bitIdx % 8));
-  bitmap[arraySlot] |= targetBit;
-  return GNUNET_OK;
-}
-
-
-/**
- * Obtain a bit from bitmap.
- * @param map the bitmap
- * @param bit index from bitmap
- *
- * @return Bit @a bit from @a map
- */
-static int
-get_bit (const char *map,
-         unsigned int bit)
-{
-  if (bit > TOTAL_MSGS)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "get bit %u of %u(!?!?)\n",
-                bit,
-                (unsigned int) sizeof(bitmap) * 8);
-    return 0;
-  }
-  return ((map)[bit >> 3] & (1 << (bit & 7))) > 0;
-}
-
-
-static void
-custom_shutdown (void *cls)
-{
-  unsigned long long delta;
-  unsigned long long rate;
-  int ok;
-
-  /* Calculate statistics   */
-  delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
-  if (0 == delta)
-    delta = 1;
-  rate = (1000LL * 1000ll * total_bytes) / (1024 * delta);
-  fprintf (stderr,
-           "\nThroughput was %llu KiBytes/s\n",
-           rate);
-  {
-    char *value_name;
-
-    GNUNET_asprintf (&value_name,
-                     "unreliable_%s",
-                     ccc->test_plugin);
-    GAUGER ("TRANSPORT",
-            value_name,
-            (int) rate,
-            "kb/s");
-    GNUNET_free (value_name);
-  }
-
-  ok = 0;
-  for (unsigned int i = 0; i < TOTAL_MSGS / xhdr; i++)
-  {
-    if (get_bit (bitmap, i) == 0)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Did not receive message %d\n",
-                  i);
-      ok = -1;
-    }
-  }
-  if (0 != ok)
-    ccc->global_ret = GNUNET_SYSERR; /* fail: messages missing! */
-}
-
-
-static void
-notify_receive (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-                const struct GNUNET_PeerIdentity *sender,
-                const struct GNUNET_TRANSPORT_TESTING_TestMessage *hdr)
-{
-  static int n;
-  unsigned int s;
-  char cbuf[GNUNET_MAX_MESSAGE_SIZE - 1];
-
-  if (GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE != ntohs (hdr->header.type))
-    return;
-  msg_recv = ntohl (hdr->num);
-  s = get_size (ntohl (hdr->num));
-
-  if (ntohs (hdr->header.size) != s)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Expected message %u of size %u, got %u bytes of message %u\n",
-                (uint32_t) ntohl (hdr->num),
-                s,
-                ntohs (hdr->header.size),
-                (uint32_t) ntohl (hdr->num));
-    ccc->global_ret = GNUNET_SYSERR;
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-
-  memset (cbuf,
-          ntohl (hdr->num),
-          s - sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage));
-  if (0 !=
-      memcmp (cbuf,
-              &hdr[1],
-              s - sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Expected message %u with bits %u, but body did not match\n",
-                (uint32_t) ntohl (hdr->num),
-                (unsigned char) ntohl (hdr->num));
-    ccc->global_ret = GNUNET_SYSERR;
-    GNUNET_SCHEDULER_shutdown ();
-    return;
-  }
-#if VERBOSE
-  if (0 == ntohl (hdr->num) % 5)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Got message %u of size %u\n",
-                (uint32_t) ntohl (hdr->num),
-                ntohs (hdr->header.size));
-  }
-#endif
-  n++;
-  if (GNUNET_SYSERR == set_bit (ntohl (hdr->num)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Message id %u is bigger than maxmimum number of messages %u 
expected\n",
-                (uint32_t) ntohl (hdr->num),
-                TOTAL_MSGS / xhdr);
-  }
-  if (0 == (n % (TOTAL_MSGS / xhdr / 100)))
-  {
-    fprintf (stderr, "%s", ".");
-  }
-  if (n == TOTAL_MSGS / xhdr)
-  {
-    /* end testcase with success */
-    ccc->global_ret = GNUNET_OK;
-    GNUNET_SCHEDULER_shutdown ();
-  }
-}
-
-
-int
-main (int argc, char *argv[])
-{
-  if (0 == strstr (argv[0], "xhdr"))
-    xhdr = 30;
-  struct GNUNET_TRANSPORT_TESTING_SendClosure sc = {
-    .num_messages = TOTAL_MSGS / xhdr,
-    .get_size_cb = &get_size_cnt
-  };
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
-    .connect_continuation = &GNUNET_TRANSPORT_TESTING_simple_send,
-    .connect_continuation_cls = &sc,
-    .config_file = "test_transport_api_data.conf",
-    .rec = &notify_receive,
-    .nc = &GNUNET_TRANSPORT_TESTING_log_connect,
-    .nd = &GNUNET_TRANSPORT_TESTING_log_disconnect,
-    .shutdown_task = &custom_shutdown,
-    .timeout = TIMEOUT,
-    .global_ret = GNUNET_SYSERR
-  };
-
-  ccc = &my_ccc;
-  sc.ccc = ccc;
-  start_time = GNUNET_TIME_absolute_get ();
-  if (GNUNET_OK !=
-      GNUNET_TRANSPORT_TESTING_main (2,
-                                     &GNUNET_TRANSPORT_TESTING_connect_check,
-                                     ccc))
-    return 1;
-  return 0;
-}
-
-
-/* end of test_transport_api_reliability.c */
diff --git a/src/transport/test_transport_api_reliability_bluetooth_peer1.conf 
b/src/transport/test_transport_api_reliability_bluetooth_peer1.conf
deleted file mode 100644
index 738255235..000000000
--- a/src/transport/test_transport_api_reliability_bluetooth_peer1.conf
+++ /dev/null
@@ -1,33 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/
-
-[transport-bluetooth]
-INTERFACE = hci0
-TESTMODE = 1
-
-[arm]
-PORT = 12164
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12163
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12162
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12161
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12160
-PLUGINS = bluetooth
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-
-[ats]
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
diff --git a/src/transport/test_transport_api_reliability_bluetooth_peer2.conf 
b/src/transport/test_transport_api_reliability_bluetooth_peer2.conf
deleted file mode 100644
index 9c68b5fbc..000000000
--- a/src/transport/test_transport_api_reliability_bluetooth_peer2.conf
+++ /dev/null
@@ -1,32 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/
-
-[transport-bluetooth]
-INTERFACE = hci1
-TESTMODE = 2
-
-[arm]
-PORT = 12174
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12173
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12172
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12171
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12170
-PLUGINS = bluetooth
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-[ats]
-BLUETOOTH_QUOTA_IN = unlimited
-BLUETOOTH_QUOTA_OUT = unlimited
diff --git a/src/transport/test_transport_api_reliability_http_peer1.conf 
b/src/transport/test_transport_api_reliability_http_peer1.conf
deleted file mode 100644
index a1e5c96ac..000000000
--- a/src/transport/test_transport_api_reliability_http_peer1.conf
+++ /dev/null
@@ -1,33 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p1/
-
-[transport-http_client]
-
-[transport-tcp]
-TIMEOUT = 5 s
-
-[transport-http]
-PORT = 12180
-
-[arm]
-PORT = 12185
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12184
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12183
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12182
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12181
-PLUGINS = http_client
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
diff --git a/src/transport/test_transport_api_reliability_http_peer2.conf 
b/src/transport/test_transport_api_reliability_http_peer2.conf
deleted file mode 100644
index 25a554f94..000000000
--- a/src/transport/test_transport_api_reliability_http_peer2.conf
+++ /dev/null
@@ -1,30 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p2/
-
-[transport-http_server]
-PORT = 12090
-USE_IPv6 = NO
-BINDTO = 127.0.0.1
-
-[arm]
-PORT = 12195
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12194
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12193
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12192
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12191
-PLUGINS = http_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git a/src/transport/test_transport_api_reliability_http_xhr_peer1.conf 
b/src/transport/test_transport_api_reliability_http_xhr_peer1.conf
deleted file mode 100644
index ba4101ebe..000000000
--- a/src/transport/test_transport_api_reliability_http_xhr_peer1.conf
+++ /dev/null
@@ -1,34 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p1/
-
-[transport-http_client]
-EMULATE_XHR = YES
-
-[transport-tcp]
-TIMEOUT = 5 s
-
-[transport-http]
-PORT = 12180
-
-[arm]
-PORT = 12185
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12184
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12183
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12182
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12181
-PLUGINS = http_client
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
diff --git a/src/transport/test_transport_api_reliability_http_xhr_peer2.conf 
b/src/transport/test_transport_api_reliability_http_xhr_peer2.conf
deleted file mode 100644
index 25a554f94..000000000
--- a/src/transport/test_transport_api_reliability_http_xhr_peer2.conf
+++ /dev/null
@@ -1,30 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p2/
-
-[transport-http_server]
-PORT = 12090
-USE_IPv6 = NO
-BINDTO = 127.0.0.1
-
-[arm]
-PORT = 12195
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12194
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12193
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12192
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12191
-PLUGINS = http_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git a/src/transport/test_transport_api_reliability_https_peer1.conf 
b/src/transport/test_transport_api_reliability_https_peer1.conf
deleted file mode 100644
index 1b51da130..000000000
--- a/src/transport/test_transport_api_reliability_https_peer1.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p1/
-
-[transport-https_client]
-
-[arm]
-PORT = 12305
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12304
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12303
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12302
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12301
-PLUGINS = https_client
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
diff --git a/src/transport/test_transport_api_reliability_https_peer2.conf 
b/src/transport/test_transport_api_reliability_https_peer2.conf
deleted file mode 100644
index 3dfb87a6d..000000000
--- a/src/transport/test_transport_api_reliability_https_peer2.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p2/
-
-[transport-https_server]
-PORT = 12310
-KEY_FILE = $GNUNET_TEST_HOME/https_key_p2.key
-CERT_FILE = $GNUNET_TEST_HOME/https_cert_p2.crt
-
-[arm]
-PORT = 12315
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12314
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12313
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12312
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12311
-PLUGINS = https_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_reliability_https_xhr_peer1.conf 
b/src/transport/test_transport_api_reliability_https_xhr_peer1.conf
deleted file mode 100644
index 5d042f2f9..000000000
--- a/src/transport/test_transport_api_reliability_https_xhr_peer1.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p1/
-
-[transport-https_client]
-EMULATE_XHR = YES
-
-[arm]
-PORT = 12305
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12304
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12303
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12302
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12301
-PLUGINS = https_client
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
diff --git a/src/transport/test_transport_api_reliability_https_xhr_peer2.conf 
b/src/transport/test_transport_api_reliability_https_xhr_peer2.conf
deleted file mode 100644
index 3dfb87a6d..000000000
--- a/src/transport/test_transport_api_reliability_https_xhr_peer2.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p2/
-
-[transport-https_server]
-PORT = 12310
-KEY_FILE = $GNUNET_TEST_HOME/https_key_p2.key
-CERT_FILE = $GNUNET_TEST_HOME/https_cert_p2.crt
-
-[arm]
-PORT = 12315
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12314
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12313
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12312
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12311
-PLUGINS = https_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_reliability_tcp_nat_peer1.conf 
b/src/transport/test_transport_api_reliability_tcp_nat_peer1.conf
deleted file mode 100644
index 6a2029b09..000000000
--- a/src/transport/test_transport_api_reliability_tcp_nat_peer1.conf
+++ /dev/null
@@ -1,35 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-reliability-tcp-nat-p1/
-
-[nat]
-BEHIND_NAT = YES
-ENABLE_NAT_SERVER = YES
-DISABLEV6 = YES
-
-[transport-tcp]
-PORT = 0
-TIMEOUT = 5 s
-
-[arm]
-PORT = 51204
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12023
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12022
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12021
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 29542
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_reliability_tcp_nat_peer2.conf 
b/src/transport/test_transport_api_reliability_tcp_nat_peer2.conf
deleted file mode 100644
index 2de9026f5..000000000
--- a/src/transport/test_transport_api_reliability_tcp_nat_peer2.conf
+++ /dev/null
@@ -1,34 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-reliability-tcp-nat-p2/
-
-[nat]
-DISABLEV6 = YES
-ENABLE_NAT_CLIENT = YES
-
-[transport-tcp]
-PORT = 12030
-TIMEOUT = 5 s
-
-[arm]
-PORT = 12034
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12033
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12032
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12031
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 45923
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_reliability_tcp_peer2.conf 
b/src/transport/test_transport_api_reliability_tcp_peer2.conf
deleted file mode 100644
index 43bb4ae37..000000000
--- a/src/transport/test_transport_api_reliability_tcp_peer2.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport-tcp]
-PORT = 12015
-TIMEOUT = 5 s
-
-[arm]
-PORT = 12014
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12013
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12012
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12011
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12010
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
diff --git a/src/transport/test_transport_api_reliability_udp_peer1.conf 
b/src/transport/test_transport_api_reliability_udp_peer1.conf
deleted file mode 100644
index 141fb0840..000000000
--- a/src/transport/test_transport_api_reliability_udp_peer1.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p1/
-
-[transport-udp]
-PORT = 12040
-# Override 1MB/s default limit.
-MAX_BPS = 500000000
-
-[arm]
-PORT = 12045
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12044
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12043
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12042
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12041
-PLUGINS = udp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
diff --git a/src/transport/test_transport_api_reliability_udp_peer2.conf 
b/src/transport/test_transport_api_reliability_udp_peer2.conf
deleted file mode 100644
index 7523db854..000000000
--- a/src/transport/test_transport_api_reliability_udp_peer2.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p2/
-
-[transport-udp]
-PORT = 12050
-# Override 1MB/s default limit.
-MAX_BPS = 500000000
-
-[arm]
-PORT = 12055
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12054
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12053
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12052
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12051
-PLUGINS = udp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
diff --git a/src/transport/test_transport_api_reliability_unix_peer1.conf 
b/src/transport/test_transport_api_reliability_unix_peer1.conf
deleted file mode 100644
index e253aad8c..000000000
--- a/src/transport/test_transport_api_reliability_unix_peer1.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p1/
-
-[arm]
-PORT = 12125
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12124
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12123
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12122
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12121
-PLUGINS = unix
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-[transport-unix]
-PORT = 12120
-
diff --git a/src/transport/test_transport_api_reliability_unix_peer2.conf 
b/src/transport/test_transport_api_reliability_unix_peer2.conf
deleted file mode 100644
index e0df47c07..000000000
--- a/src/transport/test_transport_api_reliability_unix_peer2.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p2/
-
-[arm]
-PORT = 12135
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12134
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12133
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12132
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12131
-PLUGINS = unix
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-[transport-unix]
-PORT = 12131
-
diff --git a/src/transport/test_transport_api_reliability_wlan_peer1.conf 
b/src/transport/test_transport_api_reliability_wlan_peer1.conf
deleted file mode 100644
index 19eb21456..000000000
--- a/src/transport/test_transport_api_reliability_wlan_peer1.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/
-
-[transport-wlan]
-TESTMODE = 1
-
-[arm]
-PORT = 12164
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12163
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12162
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12161
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12160
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-[ats]
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
\ No newline at end of file
diff --git a/src/transport/test_transport_api_reliability_wlan_peer2.conf 
b/src/transport/test_transport_api_reliability_wlan_peer2.conf
deleted file mode 100644
index d5c269b43..000000000
--- a/src/transport/test_transport_api_reliability_wlan_peer2.conf
+++ /dev/null
@@ -1,32 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/
-
-[transport-wlan]
-INTERFACE = mon1
-TESTMODE = 2
-
-[arm]
-PORT = 12174
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12173
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12172
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12171
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12170
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-[ats]
-WLAN_QUOTA_IN = unlimited
-WLAN_QUOTA_OUT = unlimited
diff --git a/src/transport/test_transport_api_restart_1peer_peer1.conf 
b/src/transport/test_transport_api_restart_1peer_peer1.conf
deleted file mode 100644
index eabd6b701..000000000
--- a/src/transport/test_transport_api_restart_1peer_peer1.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = tcp
-
-#[transport]
-#PREFIX = valgrind
diff --git a/src/transport/test_transport_api_restart_1peer_peer2.conf 
b/src/transport/test_transport_api_restart_1peer_peer2.conf
deleted file mode 100644
index 58ce0777f..000000000
--- a/src/transport/test_transport_api_restart_1peer_peer2.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = tcp
-
-#[transport]
-#PREFIX = valgrind
diff --git a/src/transport/test_transport_api_restart_2peers_peer1.conf 
b/src/transport/test_transport_api_restart_2peers_peer1.conf
deleted file mode 100644
index eabd6b701..000000000
--- a/src/transport/test_transport_api_restart_2peers_peer1.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = tcp
-
-#[transport]
-#PREFIX = valgrind
diff --git a/src/transport/test_transport_api_restart_2peers_peer2.conf 
b/src/transport/test_transport_api_restart_2peers_peer2.conf
deleted file mode 100644
index 58ce0777f..000000000
--- a/src/transport/test_transport_api_restart_2peers_peer2.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = tcp
-
-#[transport]
-#PREFIX = valgrind
diff --git a/src/transport/test_transport_api_restart_reconnect.c 
b/src/transport/test_transport_api_restart_reconnect.c
deleted file mode 100644
index d58c1de54..000000000
--- a/src/transport/test_transport_api_restart_reconnect.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2015, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_transport_api_restart_reconnect.c
- * @brief base test case for transport implementations
- *
- * This test case starts 2 peers, connects and exchanges a message.
- * Then, 1 or 2 peers are restarted and it is tested if peers reconnect.
- * How many peers are restarted is determined by the name of the binary.
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing.h"
-
-/**
- * How long until we give up on transmitting the message?
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
-
-
-static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-static struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh;
-
-static int p1_connected;
-
-static int p2_connected;
-
-static int restarted;
-
-
-static void
-custom_shutdown (void *cls)
-{
-  if (NULL != ats_sh)
-  {
-    GNUNET_ATS_connectivity_suggest_cancel (ats_sh);
-    ats_sh = NULL;
-  }
-}
-
-
-static void
-restart_cb (void *cls)
-{
-  static unsigned int c;
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cls;
-
-  c++;
-  if ((2 != c) &&
-      (NULL != strstr (ccc->test_name,
-                       "2peers")))
-    return;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Restarted peer %u (`%s'), issuing reconnect\n",
-              p->no,
-              GNUNET_i2s (&p->id));
-  ats_sh = GNUNET_ATS_connectivity_suggest (p->ats,
-                                            &ccc->p[1]->id,
-                                            1);
-}
-
-
-static void
-restart (struct GNUNET_TRANSPORT_TESTING_PeerContext *p)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Restarting peer %u (`%s')\n",
-              p->no,
-              GNUNET_i2s (&p->id));
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_TRANSPORT_TESTING_restart_peer (p,
-                                                        &restart_cb,
-                                                        p));
-}
-
-
-static void
-notify_receive (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-                const struct GNUNET_PeerIdentity *sender,
-                const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  {
-    char *ps = GNUNET_strdup (GNUNET_i2s (&receiver->id));
-
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Peer %u (`%s') received message of type %d and size %u size 
from peer %s!\n",
-                receiver->no,
-                ps,
-                ntohs (message->header.type),
-                ntohs (message->header.size),
-                GNUNET_i2s (sender));
-    GNUNET_free (ps);
-  }
-  if ((GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE == ntohs (message->header.type)) 
&&
-      (sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage) == ntohs (
-         message->header.size)))
-  {
-    if (GNUNET_NO == restarted)
-    {
-      restarted = GNUNET_YES;
-      fprintf (stderr, "TN: %s\n", ccc->test_name);
-      restart (ccc->p[0]);
-      if (NULL != strstr (ccc->test_name,
-                          "2peers"))
-        restart (ccc->p[1]);
-      return;
-    }
-    else
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                  "Restarted peers connected and message was sent, stopping 
test...\n");
-      ccc->global_ret = GNUNET_OK;
-      GNUNET_SCHEDULER_shutdown ();
-    }
-  }
-  else
-  {
-    GNUNET_break (0);
-    ccc->global_ret = GNUNET_SYSERR;
-    GNUNET_SCHEDULER_shutdown ();
-  }
-}
-
-
-static void
-notify_connect (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
-                const struct GNUNET_PeerIdentity *other)
-{
-  static struct GNUNET_TRANSPORT_TESTING_SendClosure sc = {
-    .num_messages = 1
-  };
-
-  sc.ccc = ccc;
-  GNUNET_TRANSPORT_TESTING_log_connect (cls,
-                                        me,
-                                        other);
-  if (me == ccc->p[0])
-    p1_connected = GNUNET_YES;
-  if (me == ccc->p[1])
-    p2_connected = GNUNET_YES;
-
-  if ((GNUNET_YES == restarted) &&
-      (GNUNET_YES == p1_connected) &&
-      (GNUNET_YES == p2_connected))
-  {
-    /* Peer was restarted and we received 3 connect messages (2 from first 
connect, 1 from reconnect) */
-    GNUNET_SCHEDULER_add_now (&GNUNET_TRANSPORT_TESTING_simple_send,
-                              &sc);
-  }
-}
-
-
-static void
-notify_disconnect (void *cls,
-                   struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
-                   const struct GNUNET_PeerIdentity *other)
-{
-  GNUNET_TRANSPORT_TESTING_log_disconnect (cls,
-                                           me,
-                                           other);
-  if (me == ccc->p[0])
-    p1_connected = GNUNET_NO;
-  if (me == ccc->p[1])
-    p2_connected = GNUNET_NO;
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure sc = {
-    .num_messages = 1
-  };
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
-    .connect_continuation = &GNUNET_TRANSPORT_TESTING_simple_send,
-    .connect_continuation_cls = &sc,
-    .config_file = "test_transport_api_data.conf",
-    .rec = &notify_receive,
-    .nc = &notify_connect,
-    .nd = &notify_disconnect,
-    .shutdown_task = &custom_shutdown,
-    .timeout = TIMEOUT
-  };
-
-  ccc = &my_ccc;
-  sc.ccc = ccc;
-  if (GNUNET_OK !=
-      GNUNET_TRANSPORT_TESTING_main (2,
-                                     &GNUNET_TRANSPORT_TESTING_connect_check,
-                                     ccc))
-    return 1;
-  return 0;
-}
-
-
-/* end of test_transport_api_restart_1peer.c */
diff --git a/src/transport/test_transport_api_slow_ats_peer1.conf 
b/src/transport/test_transport_api_slow_ats_peer1.conf
deleted file mode 100644
index a96f5e263..000000000
--- a/src/transport/test_transport_api_slow_ats_peer1.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-slow-ats-p1/
-
-[transport]
-PLUGINS = tcp
-
diff --git a/src/transport/test_transport_api_slow_ats_peer2.conf 
b/src/transport/test_transport_api_slow_ats_peer2.conf
deleted file mode 100644
index 3a6ed05d3..000000000
--- a/src/transport/test_transport_api_slow_ats_peer2.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-slow-ats-p2/
-
-[transport]
-PLUGINS = tcp
-
-[ats]
-PREFIX = ./test_delay -t 10 --
diff --git a/src/transport/test_transport_api_timeout.c 
b/src/transport/test_transport_api_timeout.c
deleted file mode 100644
index 9f8d3bb2b..000000000
--- a/src/transport/test_transport_api_timeout.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
-     This file is part of GNUnet.x
-     Copyright (C) 2009, 2010, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_transport_api_timeout.c
- * @brief test case for transport plugin implementations complying timeout
- * settings
- *
- *
- * This test case serves ensures that no peer disconnect events occurs
- * while plugins are idle
- */
-
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing.h"
-
-/**
- * How long until we give up on transmitting the message?
- */
-#define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
-
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90)
-
-#define MTYPE 12345
-
-static struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-static struct GNUNET_TIME_Relative time_running;
-
-static struct GNUNET_SCHEDULER_Task *timer_task;
-
-static int shutdown_flag;
-
-static unsigned int disconnects;
-
-
-static void
-custom_shutdown (void *cls)
-{
-  if (NULL != timer_task)
-  {
-    GNUNET_SCHEDULER_cancel (timer_task);
-    timer_task = NULL;
-  }
-  if (0 == disconnects)
-  {
-    ccc->global_ret = GNUNET_OK;
-  }
-  else
-  {
-    ccc->global_ret = -GNUNET_SYSERR;
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Fail! Had %u disconnects while waiting %s\n",
-                disconnects,
-                GNUNET_STRINGS_relative_time_to_string (WAIT,
-                                                        GNUNET_YES));
-  }
-}
-
-
-static void
-notify_receive (void *cls,
-                struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-                const struct GNUNET_PeerIdentity *sender,
-                const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received message of type %d from peer %s!\n",
-              ntohs (message->header.type),
-              GNUNET_i2s (sender));
-}
-
-
-static void
-notify_disconnect (void *cls,
-                   struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
-                   const struct GNUNET_PeerIdentity *other)
-{
-  GNUNET_TRANSPORT_TESTING_log_disconnect (cls,
-                                           me,
-                                           other);
-  if (shutdown_flag != GNUNET_YES)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "FAIL! Peer `%s' disconnected during waiting period!\n",
-                GNUNET_i2s (other));
-    disconnects++;
-  }
-}
-
-
-static void
-timer (void *cls)
-{
-  static unsigned int percentage;
-
-  timer_task = NULL;
-  percentage += 10;
-  time_running = GNUNET_TIME_relative_add (time_running,
-                                           GNUNET_TIME_relative_divide (WAIT,
-                                                                        10));
-
-  if (time_running.rel_value_us ==
-      GNUNET_TIME_relative_max (time_running, WAIT).rel_value_us)
-  {
-    fprintf (stderr, "%s", "100%%\n");
-    shutdown_flag = GNUNET_YES;
-    GNUNET_SCHEDULER_shutdown ();
-  }
-  else
-  {
-    fprintf (stderr,
-             "%u%%..",
-             percentage);
-    timer_task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide (WAIT, 10),
-                                    &timer,
-                                    NULL);
-  }
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
-    .connect_continuation = &timer,
-    .config_file = "test_transport_api_data.conf",
-    .rec = &notify_receive,
-    .nc = &GNUNET_TRANSPORT_TESTING_log_connect,
-    .nd = &notify_disconnect,
-    .shutdown_task = &custom_shutdown,
-    .timeout = TIMEOUT
-  };
-
-  ccc = &my_ccc;
-  if (GNUNET_OK !=
-      GNUNET_TRANSPORT_TESTING_main (2,
-                                     &GNUNET_TRANSPORT_TESTING_connect_check,
-                                     ccc))
-    return 1;
-  return 0;
-}
-
-
-/* end of test_transport_api_timeout.c*/
diff --git a/src/transport/test_transport_api_timeout_bluetooth_peer1.conf 
b/src/transport/test_transport_api_timeout_bluetooth_peer1.conf
deleted file mode 100644
index dcc159e45..000000000
--- a/src/transport/test_transport_api_timeout_bluetooth_peer1.conf
+++ /dev/null
@@ -1,35 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/
-
-[transport-bluetooth]
-INTERFACE = hci0
-TESTMODE = 1
-
-[arm]
-PORT = 12164
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12163
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12162
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12161
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12160
-PLUGINS = bluetooth
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-#PREFIX = xterm -T transport2 -e gdb --command=cmd --args
-#PREFIX = valgrind --leak-check=full --show-reachable=yes 
--main-stacksize=104857600
-#PREFIX = valgrind --leak-check=full --show-reachable=yes
-#PREFIX = valgrind --leak-check=full
-#PREFIX = valgrind --tool=massif
-#PREFIX = gdbserver :2345
-
diff --git a/src/transport/test_transport_api_timeout_bluetooth_peer2.conf 
b/src/transport/test_transport_api_timeout_bluetooth_peer2.conf
deleted file mode 100644
index 5cd550d0e..000000000
--- a/src/transport/test_transport_api_timeout_bluetooth_peer2.conf
+++ /dev/null
@@ -1,34 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/
-
-[transport-bluetooth]
-INTERFACE = hci1
-TESTMODE = 2
-
-[arm]
-PORT = 12174
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12173
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12172
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12171
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12170
-PLUGINS = bluetooth
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-#PREFIX = xterm -T transport2 -e gdb --command=cmd --args
-#PREFIX = valgrind --leak-check=full --show-reachable=yes 
--main-stacksize=104857600
-#PREFIX = valgrind --leak-check=full --show-reachable=yes
-#PREFIX = valgrind --leak-check=full
-#PREFIX = valgrind --tool=massif
-#PREFIX = gdbserver :2345
diff --git a/src/transport/test_transport_api_timeout_http_peer1.conf 
b/src/transport/test_transport_api_timeout_http_peer1.conf
deleted file mode 100644
index d7bc59ea3..000000000
--- a/src/transport/test_transport_api_timeout_http_peer1.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p1/
-
-[arm]
-PORT = 12085
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12084
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12083
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12082
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12081
-PLUGINS = http_client
-#BINARY = .libs/gnunet-service-transport
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-#PREFIX = valgrind --leak-check=full
-#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
-
diff --git a/src/transport/test_transport_api_timeout_http_peer2.conf 
b/src/transport/test_transport_api_timeout_http_peer2.conf
deleted file mode 100644
index 453c6d0c5..000000000
--- a/src/transport/test_transport_api_timeout_http_peer2.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p2/
-
-[transport-http_server]
-PORT = 12090
-USE_IPv6 = NO
-BINDTO = 127.0.0.1
-
-
-[arm]
-PORT = 12095
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12094
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12093
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12092
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12091
-PLUGINS = http_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-#PREFIX = valgrind --leak-check=full
diff --git a/src/transport/test_transport_api_timeout_https_peer1.conf 
b/src/transport/test_transport_api_timeout_https_peer1.conf
deleted file mode 100644
index c4f96814c..000000000
--- a/src/transport/test_transport_api_timeout_https_peer1.conf
+++ /dev/null
@@ -1,25 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p1/
-
-[arm]
-PORT = 12105
-
-[statistics]
-PORT = 12104
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12103
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12102
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12101
-PLUGINS = https_client
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_timeout_https_peer2.conf 
b/src/transport/test_transport_api_timeout_https_peer2.conf
deleted file mode 100644
index bfdf0caec..000000000
--- a/src/transport/test_transport_api_timeout_https_peer2.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p2/
-
-[transport-https_server]
-PORT = 12110
-KEY_FILE = $GNUNET_TEST_HOME/https_key_p2.key
-CERT_FILE = $GNUNET_TEST_HOME/https_cert_p2.crt
-
-[arm]
-PORT = 12115
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12114
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12113
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12112
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12111
-PLUGINS = https_server
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_timeout_tcp_peer1.conf 
b/src/transport/test_transport_api_timeout_tcp_peer1.conf
deleted file mode 100644
index 389250bec..000000000
--- a/src/transport/test_transport_api_timeout_tcp_peer1.conf
+++ /dev/null
@@ -1,30 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport-tcp]
-PORT = 12000
-TIMEOUT = 5 s
-
-[arm]
-PORT = 12005
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12004
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12003
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12002
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12001
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_timeout_tcp_peer2.conf 
b/src/transport/test_transport_api_timeout_tcp_peer2.conf
deleted file mode 100644
index 225b8fac2..000000000
--- a/src/transport/test_transport_api_timeout_tcp_peer2.conf
+++ /dev/null
@@ -1,32 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[nat]
-ALLOW_NAT = NO
-
-[transport-tcp]
-PORT = 12100
-
-[arm]
-PORT = 12014
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12013
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12012
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12011
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12010
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_timeout_udp_peer1.conf 
b/src/transport/test_transport_api_timeout_udp_peer1.conf
deleted file mode 100644
index e28e3a2e0..000000000
--- a/src/transport/test_transport_api_timeout_udp_peer1.conf
+++ /dev/null
@@ -1,33 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p1/
-
-[transport-udp]
-PORT = 12040
-BROADCAST = NO
-BROADCAST_INTERVAL = 30000
-MAX_BPS = 50000000
-
-[arm]
-PORT = 12045
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12044
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12043
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12042
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-#PREFIX = valgrind --leak-check=full
-PORT = 12041
-PLUGINS = udp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_timeout_udp_peer2.conf 
b/src/transport/test_transport_api_timeout_udp_peer2.conf
deleted file mode 100644
index 434ef4853..000000000
--- a/src/transport/test_transport_api_timeout_udp_peer2.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p2/
-
-[transport-udp]
-PORT = 12050
-BROADCAST = NO
-MAX_BPS = 50000000
-
-[arm]
-PORT = 12055
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12054
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12053
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12052
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12051
-PLUGINS = udp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_timeout_unix_peer1.conf 
b/src/transport/test_transport_api_timeout_unix_peer1.conf
deleted file mode 100644
index e253aad8c..000000000
--- a/src/transport/test_transport_api_timeout_unix_peer1.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p1/
-
-[arm]
-PORT = 12125
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12124
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12123
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12122
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12121
-PLUGINS = unix
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-[transport-unix]
-PORT = 12120
-
diff --git a/src/transport/test_transport_api_timeout_unix_peer2.conf 
b/src/transport/test_transport_api_timeout_unix_peer2.conf
deleted file mode 100644
index bd3fccbb3..000000000
--- a/src/transport/test_transport_api_timeout_unix_peer2.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p2/
-
-[arm]
-PORT = 12135
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12134
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12133
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12132
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12131
-PLUGINS = unix
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-[transport-unix]
-PORT = 12136
-
diff --git a/src/transport/test_transport_api_timeout_wlan_peer1.conf 
b/src/transport/test_transport_api_timeout_wlan_peer1.conf
deleted file mode 100644
index 68716d287..000000000
--- a/src/transport/test_transport_api_timeout_wlan_peer1.conf
+++ /dev/null
@@ -1,35 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/
-
-[transport-wlan]
-INTERFACE = mon0
-TESTMODE = 1
-
-[arm]
-PORT = 12164
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12163
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12162
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12161
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12160
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-#PREFIX = xterm -T transport2 -e gdb --command=cmd --args
-#PREFIX = valgrind --leak-check=full --show-reachable=yes 
--main-stacksize=104857600
-#PREFIX = valgrind --leak-check=full --show-reachable=yes
-#PREFIX = valgrind --leak-check=full
-#PREFIX = valgrind --tool=massif
-#PREFIX = gdbserver :2345
-
diff --git a/src/transport/test_transport_api_timeout_wlan_peer2.conf 
b/src/transport/test_transport_api_timeout_wlan_peer2.conf
deleted file mode 100644
index 98bbc6e2b..000000000
--- a/src/transport/test_transport_api_timeout_wlan_peer2.conf
+++ /dev/null
@@ -1,34 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/
-
-[transport-wlan]
-INTERFACE = mon1
-TESTMODE = 2
-
-[arm]
-PORT = 12174
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12173
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12172
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12171
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12170
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-#PREFIX = xterm -T transport2 -e gdb --command=cmd --args
-#PREFIX = valgrind --leak-check=full --show-reachable=yes 
--main-stacksize=104857600
-#PREFIX = valgrind --leak-check=full --show-reachable=yes
-#PREFIX = valgrind --leak-check=full
-#PREFIX = valgrind --tool=massif
-#PREFIX = gdbserver :2345
diff --git a/src/transport/test_transport_api_unix_abstract_peer1.conf 
b/src/transport/test_transport_api_unix_abstract_peer1.conf
deleted file mode 100644
index 103a483b4..000000000
--- a/src/transport/test_transport_api_unix_abstract_peer1.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p1/
-
-[arm]
-PORT = 12125
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12124
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12123
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12122
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12121
-PLUGINS = unix
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-[transport-unix]
-PORT = 12120
-
-[testing]
-USE_ABSTRACT_SOCKETS = YES
-
diff --git a/src/transport/test_transport_api_unix_abstract_peer2.conf 
b/src/transport/test_transport_api_unix_abstract_peer2.conf
deleted file mode 100644
index c3a5525d9..000000000
--- a/src/transport/test_transport_api_unix_abstract_peer2.conf
+++ /dev/null
@@ -1,31 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p2/
-
-[arm]
-PORT = 12135
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12134
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12133
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12132
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12131
-PLUGINS = unix
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-[transport-unix]
-PORT = 12136
-
-[testing]
-USE_ABSTRACT_SOCKETS = YES
-
diff --git 
a/src/transport/test_transport_api_unreliability_bluetooth_peer1.conf 
b/src/transport/test_transport_api_unreliability_bluetooth_peer1.conf
deleted file mode 100644
index 3f86ee940..000000000
--- a/src/transport/test_transport_api_unreliability_bluetooth_peer1.conf
+++ /dev/null
@@ -1,30 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/
-
-[transport-bluetooth]
-INTERFACE = hci0
-TESTMODE = 1
-
-[arm]
-PORT = 12164
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12163
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12162
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12161
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12160
-PLUGINS = bluetooth
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-
diff --git 
a/src/transport/test_transport_api_unreliability_bluetooth_peer2.conf 
b/src/transport/test_transport_api_unreliability_bluetooth_peer2.conf
deleted file mode 100644
index 5fc178395..000000000
--- a/src/transport/test_transport_api_unreliability_bluetooth_peer2.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/
-
-[transport-bluetooth]
-INTERFACE = hci1
-TESTMODE = 2
-
-[arm]
-PORT = 12174
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12173
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12172
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12171
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12170
-PLUGINS = bluetooth
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git 
a/src/transport/test_transport_api_unreliability_constant_udp_peer1.conf 
b/src/transport/test_transport_api_unreliability_constant_udp_peer1.conf
deleted file mode 100644
index 9f63c0ced..000000000
--- a/src/transport/test_transport_api_unreliability_constant_udp_peer1.conf
+++ /dev/null
@@ -1,30 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p1/
-
-[transport-udp]
-PORT = 12040
-MAX_BPS = 1073741824
-
-[arm]
-PORT = 12045
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12044
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12043
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12042
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12041
-PLUGINS = udp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-
diff --git 
a/src/transport/test_transport_api_unreliability_constant_udp_peer2.conf 
b/src/transport/test_transport_api_unreliability_constant_udp_peer2.conf
deleted file mode 100644
index cdf3d7bb4..000000000
--- a/src/transport/test_transport_api_unreliability_constant_udp_peer2.conf
+++ /dev/null
@@ -1,30 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p2/
-
-[transport-udp]
-PORT = 12050
-MAX_BPS = 1073741824
-
-[arm]
-PORT = 12055
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12054
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12053
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12052
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12051
-PLUGINS = udp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_unreliability_wlan_peer1.conf 
b/src/transport/test_transport_api_unreliability_wlan_peer1.conf
deleted file mode 100644
index 78e280b68..000000000
--- a/src/transport/test_transport_api_unreliability_wlan_peer1.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/
-
-[transport-wlan]
-TESTMODE = 1
-
-[arm]
-PORT = 12164
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12163
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12162
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12161
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12160
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-
-
diff --git a/src/transport/test_transport_api_unreliability_wlan_peer2.conf 
b/src/transport/test_transport_api_unreliability_wlan_peer2.conf
deleted file mode 100644
index e97ab3f38..000000000
--- a/src/transport/test_transport_api_unreliability_wlan_peer2.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/
-
-[transport-wlan]
-INTERFACE = mon1
-TESTMODE = 2
-
-[arm]
-PORT = 12174
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12173
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12172
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12171
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12170
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-
diff --git a/src/transport/test_transport_api_wlan_peer1.conf 
b/src/transport/test_transport_api_wlan_peer1.conf
deleted file mode 100644
index 68716d287..000000000
--- a/src/transport/test_transport_api_wlan_peer1.conf
+++ /dev/null
@@ -1,35 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/
-
-[transport-wlan]
-INTERFACE = mon0
-TESTMODE = 1
-
-[arm]
-PORT = 12164
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12163
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12162
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12161
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12160
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-#PREFIX = xterm -T transport2 -e gdb --command=cmd --args
-#PREFIX = valgrind --leak-check=full --show-reachable=yes 
--main-stacksize=104857600
-#PREFIX = valgrind --leak-check=full --show-reachable=yes
-#PREFIX = valgrind --leak-check=full
-#PREFIX = valgrind --tool=massif
-#PREFIX = gdbserver :2345
-
diff --git a/src/transport/test_transport_api_wlan_peer2.conf 
b/src/transport/test_transport_api_wlan_peer2.conf
deleted file mode 100644
index 98bbc6e2b..000000000
--- a/src/transport/test_transport_api_wlan_peer2.conf
+++ /dev/null
@@ -1,34 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/
-
-[transport-wlan]
-INTERFACE = mon1
-TESTMODE = 2
-
-[arm]
-PORT = 12174
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12173
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12172
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12171
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12170
-PLUGINS = wlan
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
-#PREFIX = xterm -T transport2 -e gdb --command=cmd --args
-#PREFIX = valgrind --leak-check=full --show-reachable=yes 
--main-stacksize=104857600
-#PREFIX = valgrind --leak-check=full --show-reachable=yes
-#PREFIX = valgrind --leak-check=full
-#PREFIX = valgrind --tool=massif
-#PREFIX = gdbserver :2345
diff --git a/src/transport/test_transport_blacklisting.c 
b/src/transport/test_transport_blacklisting.c
deleted file mode 100644
index 204935dcb..000000000
--- a/src/transport/test_transport_blacklisting.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2011 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/transport_api_blacklisting.c
- * @brief test for the blacklisting with blacklistings defined in cfg
- *
- * this file contains multiple tests:
- *
- * test_transport_blacklisting_no_bl:
- *      no blacklisting entries
- *      peers are expected to connect
- * test_transport_blacklisting_outbound_bl_full:
- *      both peers contain bl entries for full peer
- *      test is expected to not connect
- * test_transport_blacklisting_outbound_bl_plugin:
- *      both peers contain bl entries for plugin
- *      test is expected to not connect
- * test_transport_blacklisting_inbound_bl_plugin:
- *      peer 1 contains no bl entries
- *      peer 2 contain bl entries for full peer
- *      test is expected to not connect
- * test_transport_blacklisting_inbound_bl_full:
- *      peer 1 contains no bl entries
- *      peer 2 contain bl entries for plugin
- *      test is expected to not connect
- * test_transport_blacklisting_multiple_plugins:
- *      both peers contain bl entries for plugin
- *      test is expected to  connect with not bl'ed plugin
- *
- * @author Matthias Wachs
- *
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing.h"
-
-char *test_name;
-
-struct GNUNET_TRANSPORT_TESTING_PeerContext *p1;
-
-struct GNUNET_TRANSPORT_TESTING_PeerContext *p2;
-
-static struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc;
-
-struct GNUNET_TRANSPORT_TESTING_Handle *tth;
-
-/**
- * How long until we give up on transmitting the message?
- */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20)
-
-#define CONNECT_TIMEOUT GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, \
-                                                       10)
-
-static int stage;
-static int ok;
-static int connected;
-
-static struct GNUNET_SCHEDULER_Task *die_task;
-
-static struct GNUNET_SCHEDULER_Task *timeout_task;
-
-static struct GNUNET_SCHEDULER_Task *stage_task;
-
-#if VERBOSE
-#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, \
-                                 __FILE__, __LINE__); } while (0)
-#else
-#define OKPP do { ok++; } while (0)
-#endif
-
-
-static void
-run_stage (void *cls);
-
-
-static void
-end (void *cls)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping\n");
-
-  if (die_task != NULL)
-  {
-    GNUNET_SCHEDULER_cancel (die_task);
-    die_task = NULL;
-  }
-
-  if (timeout_task != NULL)
-  {
-    GNUNET_SCHEDULER_cancel (timeout_task);
-    timeout_task = NULL;
-  }
-
-  if (stage_task != NULL)
-  {
-    GNUNET_SCHEDULER_cancel (stage_task);
-    stage_task = NULL;
-  }
-
-  if (cc != NULL)
-  {
-    GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc);
-    cc = NULL;
-  }
-
-  if (p1 != NULL)
-  {
-    GNUNET_TRANSPORT_TESTING_stop_peer (p1);
-    p1 = NULL;
-  }
-  if (p2 != NULL)
-  {
-    GNUNET_TRANSPORT_TESTING_stop_peer (p2);
-    p2 = NULL;
-  }
-}
-
-
-static void
-end_badly (void *cls)
-{
-  die_task = NULL;
-
-  if (timeout_task != NULL)
-  {
-    GNUNET_SCHEDULER_cancel (timeout_task);
-    timeout_task = NULL;
-  }
-
-  if (stage_task != NULL)
-  {
-    GNUNET_SCHEDULER_cancel (stage_task);
-    stage_task = NULL;
-  }
-
-  if (cc != NULL)
-  {
-    GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc);
-    cc = NULL;
-  }
-  if (p1 != NULL)
-    GNUNET_TRANSPORT_TESTING_stop_peer (p1);
-  if (p2 != NULL)
-    GNUNET_TRANSPORT_TESTING_stop_peer (p2);
-
-  ok = GNUNET_SYSERR;
-}
-
-
-static void
-testing_connect_cb (void *cls)
-{
-  cc = NULL;
-  char *p1_c = GNUNET_strdup (GNUNET_i2s (&p1->id));
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Peers connected: %u (%s) <-> %u (%s)\n",
-              p1->no, p1_c, p2->no, GNUNET_i2s (&p2->id));
-  GNUNET_free (p1_c);
-  connected = GNUNET_YES;
-  stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL);
-}
-
-
-static void
-connect_timeout (void *cls)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Peers not connected, next stage\n");
-  timeout_task = NULL;
-  stage_task = GNUNET_SCHEDULER_add_now (&run_stage,
-                                         NULL);
-}
-
-
-static int started;
-
-
-static void
-start_cb (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cls;
-
-  started++;
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Peer %u (`%s') started\n",
-              p->no,
-              GNUNET_i2s_full (&p->id));
-
-  if (started != 2)
-    return;
-
-  char *sender_c = GNUNET_strdup (GNUNET_i2s (&p1->id));
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Test tries to connect peer %u (`%s') -> peer %u (`%s')\n",
-              p1->no,
-              sender_c,
-              p2->no,
-              GNUNET_i2s (&p2->id));
-  GNUNET_free (sender_c);
-
-  cc = GNUNET_TRANSPORT_TESTING_connect_peers (p1,
-                                               p2,
-                                               &testing_connect_cb,
-                                               NULL);
-}
-
-
-static int
-check_blacklist_config (const char *cfg_file,
-                        struct GNUNET_PeerIdentity *peer,
-                        struct GNUNET_PeerIdentity *bl_peer)
-{
-  struct GNUNET_CONFIGURATION_Handle *cfg;
-  char *section;
-  char *peer_str;
-
-  cfg = GNUNET_CONFIGURATION_create ();
-  if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfg_file))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not load configuration `%s'\n",
-                cfg_file);
-    GNUNET_CONFIGURATION_destroy (cfg);
-    return GNUNET_SYSERR;
-  }
-
-  peer_str = GNUNET_strdup (GNUNET_i2s_full (peer));
-  GNUNET_asprintf (&section, "transport-blacklist-%s", peer_str);
-
-  if (GNUNET_NO == GNUNET_CONFIGURATION_have_value (cfg, section,
-                                                    GNUNET_i2s_full (bl_peer)))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Configuration `%s' does not have blacklisting section for 
peer `%s' blacklisting `%s'\n",
-                cfg_file, peer_str, GNUNET_i2s_full (bl_peer));
-    GNUNET_CONFIGURATION_destroy (cfg);
-    GNUNET_free (section);
-    GNUNET_free (peer_str);
-    return GNUNET_SYSERR;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Configuration `%s' does have blacklisting section for peer `%s' 
blacklisting `%s'\n",
-              cfg_file, peer_str, GNUNET_i2s_full (bl_peer));
-
-  GNUNET_CONFIGURATION_destroy (cfg);
-  GNUNET_free (section);
-  GNUNET_free (peer_str);
-  return GNUNET_OK;
-}
-
-
-static void
-run_stage (void *cls)
-{
-  stage_task = NULL;
-  if (NULL != die_task)
-    GNUNET_SCHEDULER_cancel (die_task);
-  die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Running stage %u\n", stage);
-
-  if (0 == stage)
-  {
-    started = GNUNET_NO;
-    connected = GNUNET_NO;
-    if (0 == strcmp (test_name, "test_transport_blacklisting_no_bl"))
-    {
-      /* Try to connect peers successfully */
-      p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                
"test_transport_blacklisting_cfg_peer1.conf",
-                                                1,
-                                                NULL,
-                                                NULL,
-                                                NULL,
-                                                NULL,
-                                                &start_cb,
-                                                NULL);
-
-      p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                
"test_transport_blacklisting_cfg_peer2.conf",
-                                                2,
-                                                NULL,
-                                                NULL,
-                                                NULL,
-                                                NULL,
-                                                &start_cb,
-                                                NULL);
-    }
-    else if (0 == strcmp (test_name,
-                          "test_transport_blacklisting_outbound_bl_full"))
-    {
-      const char *cfg_p1 =
-        "test_transport_blacklisting_cfg_blp_peer1_full.conf";
-      const char *cfg_p2 =
-        "test_transport_blacklisting_cfg_blp_peer2_full.conf";
-
-      p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                cfg_p1,
-                                                1, NULL, NULL, NULL,
-                                                NULL,
-                                                &start_cb, NULL);
-      p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                cfg_p2, 2,
-                                                NULL, NULL, NULL,
-                                                NULL,
-                                                &start_cb, NULL);
-
-      /* check if configuration contain correct blacklist entries */
-      if ((GNUNET_SYSERR ==
-           check_blacklist_config (cfg_p1, &p1->id, &p2->id)) ||
-          (GNUNET_SYSERR ==
-           check_blacklist_config (cfg_p2, &p2->id, &p1->id)))
-      {
-        GNUNET_TRANSPORT_TESTING_stop_peer (p1);
-        p1 = NULL;
-        GNUNET_TRANSPORT_TESTING_stop_peer (p2);
-        p2 = NULL;
-        ok = 1;
-        GNUNET_SCHEDULER_add_now (&end, NULL);
-      }
-    }
-    else if (0
-             == strcmp (test_name,
-                        "test_transport_blacklisting_outbound_bl_plugin"))
-    {
-      const char *cfg_p1 =
-        "test_transport_blacklisting_cfg_blp_peer1_plugin.conf";
-      const char *cfg_p2 =
-        "test_transport_blacklisting_cfg_blp_peer2_plugin.conf";
-
-      p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                cfg_p1,
-                                                1,
-                                                NULL,
-                                                NULL,
-                                                NULL,
-                                                NULL,
-                                                &start_cb,
-                                                NULL);
-
-      p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                cfg_p2, 2,
-                                                NULL,
-                                                NULL,
-                                                NULL,
-                                                NULL,
-                                                &start_cb,
-                                                NULL);
-
-      /* check if configuration contain correct blacklist entries */
-      if ((GNUNET_SYSERR ==
-           check_blacklist_config (cfg_p1, &p1->id, &p2->id)) ||
-          (GNUNET_SYSERR ==
-           check_blacklist_config (cfg_p2, &p2->id, &p1->id)))
-      {
-        GNUNET_TRANSPORT_TESTING_stop_peer (p1);
-        p1 = NULL;
-        GNUNET_TRANSPORT_TESTING_stop_peer (p2);
-        p2 = NULL;
-        ok = 1;
-        GNUNET_SCHEDULER_add_now (&end, NULL);
-      }
-    }
-    else if (0 == strcmp (test_name,
-                          "test_transport_blacklisting_inbound_bl_full"))
-    {
-      const char *cfg_p1 = "test_transport_blacklisting_cfg_peer1.conf";
-      const char *cfg_p2 =
-        "test_transport_blacklisting_cfg_blp_peer2_full.conf";
-
-      p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                cfg_p1, 1,
-                                                NULL,
-                                                NULL, NULL, NULL,
-                                                &start_cb, NULL);
-
-      p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                cfg_p2, 2,
-                                                NULL,
-                                                NULL, NULL, NULL,
-                                                &start_cb, NULL);
-
-      /* check if configuration contain correct blacklist entries */
-      if ((GNUNET_SYSERR ==
-           check_blacklist_config (cfg_p2, &p2->id, &p1->id)))
-      {
-        GNUNET_TRANSPORT_TESTING_stop_peer (p1);
-        p1 = NULL;
-        GNUNET_TRANSPORT_TESTING_stop_peer (p2);
-        p2 = NULL;
-        ok = 1;
-        GNUNET_SCHEDULER_add_now (&end, NULL);
-      }
-    }
-    else if (0 == strcmp (test_name,
-                          "test_transport_blacklisting_inbound_bl_plugin"))
-    {
-      const char *cfg_p1 = "test_transport_blacklisting_cfg_peer1.conf";
-      const char *cfg_p2 =
-        "test_transport_blacklisting_cfg_blp_peer2_plugin.conf";
-
-      p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                cfg_p1, 1,
-                                                NULL,
-                                                NULL, NULL, NULL,
-                                                &start_cb, NULL);
-
-      p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                cfg_p2, 2,
-                                                NULL,
-                                                NULL, NULL,
-                                                NULL,
-                                                &start_cb, NULL);
-
-      /* check if configuration contain correct blacklist entries */
-      if ((GNUNET_SYSERR ==
-           check_blacklist_config (cfg_p2, &p2->id, &p1->id)))
-      {
-        GNUNET_TRANSPORT_TESTING_stop_peer (p1);
-        p1 = NULL;
-        GNUNET_TRANSPORT_TESTING_stop_peer (p2);
-        p2 = NULL;
-        ok = 1;
-        GNUNET_SCHEDULER_add_now (&end, NULL);
-      }
-    }
-    else if (0 == strcmp (test_name,
-                          "test_transport_blacklisting_multiple_plugins"))
-    {
-      const char *cfg_p1 =
-        "test_transport_blacklisting_cfg_blp_peer1_multiple_plugins.conf";
-      const char *cfg_p2 =
-        "test_transport_blacklisting_cfg_blp_peer2_multiple_plugins.conf";
-
-      p1 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                cfg_p1, 1,
-                                                NULL,
-                                                NULL, NULL, NULL,
-                                                &start_cb, NULL);
-
-      p2 = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                                cfg_p2, 2,
-                                                NULL,
-                                                NULL, NULL, NULL,
-                                                &start_cb, NULL);
-
-      /* check if configuration contain correct blacklist entries */
-      if ((GNUNET_SYSERR ==
-           check_blacklist_config (cfg_p1, &p1->id, &p2->id)) ||
-          (GNUNET_SYSERR ==
-           check_blacklist_config (cfg_p2, &p2->id, &p1->id)))
-      {
-        GNUNET_TRANSPORT_TESTING_stop_peer (p1);
-        p1 = NULL;
-        GNUNET_TRANSPORT_TESTING_stop_peer (p2);
-        p2 = NULL;
-        ok = 1;
-        GNUNET_SCHEDULER_add_now (&end, NULL);
-      }
-    }
-    else
-    {
-      GNUNET_break (0);
-      GNUNET_SCHEDULER_add_now (&end, NULL);
-    }
-
-    if ((NULL == p1) || (NULL == p2))
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start peers\n");
-      ok = 1;
-      GNUNET_SCHEDULER_add_now (&end, NULL);
-    }
-
-    timeout_task = GNUNET_SCHEDULER_add_delayed (CONNECT_TIMEOUT,
-                                                 &connect_timeout,
-                                                 NULL);
-    stage++;
-    return;
-  }
-
-  if (cc != NULL)
-  {
-    GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc);
-    cc = NULL;
-  }
-
-  if (p1 != NULL)
-  {
-    GNUNET_TRANSPORT_TESTING_stop_peer (p1);
-    p1 = NULL;
-  }
-  if (p2 != NULL)
-  {
-    GNUNET_TRANSPORT_TESTING_stop_peer (p2);
-    p2 = NULL;
-  }
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Done in stage %u: Peers %s and %s!\n",
-              stage, (GNUNET_NO == started) ? "NOT STARTED" : "STARTED",
-              (GNUNET_YES == connected) ? "CONNECTED" : "NOT CONNECTED");
-
-  if ((0 == strcmp (test_name, "test_transport_blacklisting_no_bl"))
-      || (0 == strcmp (test_name,
-                       "test_transport_blacklisting_multiple_plugins")))
-  {
-    if ((GNUNET_NO != started) && (GNUNET_YES == connected))
-      ok = 0;
-    else
-    {
-      GNUNET_break (0);
-      ok = 1;
-    }
-  }
-  else
-  {
-    if ((GNUNET_NO != started) && (GNUNET_YES != connected))
-      ok = 0;
-    else
-    {
-      ok = 1;
-    }
-  }
-  GNUNET_SCHEDULER_add_now (&end, NULL);
-}
-
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  connected = GNUNET_NO;
-  stage = 0;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Running test `%s'!\n", test_name);
-  stage_task = GNUNET_SCHEDULER_add_now (&run_stage, NULL);
-}
-
-
-int
-main (int argc, char *argv0[])
-{
-  ok = 1;
-
-  test_name = GNUNET_TRANSPORT_TESTING_get_test_name (argv0[0]);
-
-  GNUNET_log_setup ("test-transport-api-blacklisting", "WARNING", NULL);
-
-  static char *const argv[] =
-  { "date", "-c", "test_transport_api_data.conf", NULL };
-  static struct GNUNET_GETOPT_CommandLineOption options[] =
-  { GNUNET_GETOPT_OPTION_END };
-
-  tth = GNUNET_TRANSPORT_TESTING_init ();
-
-  GNUNET_PROGRAM_run ((sizeof(argv) / sizeof(char *)) - 1, argv,
-                      "test-transport-api-blacklisting", "nohelp", options,
-                      &run, NULL);
-
-  GNUNET_TRANSPORT_TESTING_done (tth);
-
-  return ok;
-}
-
-
-/* end of transport_api_blacklisting.c */
diff --git a/src/transport/test_transport_blacklisting_cfg_blp_peer1_full.conf 
b/src/transport/test_transport_blacklisting_cfg_blp_peer1_full.conf
deleted file mode 100644
index 19bff8fcc..000000000
--- a/src/transport/test_transport_blacklisting_cfg_blp_peer1_full.conf
+++ /dev/null
@@ -1,16 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport-tcp]
-PORT = 12000
-TIMEOUT = 5 s
-
-[transport]
-PLUGINS = tcp
-
-#Peer 1: 4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730
-#Peer 2: F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0
-
-[transport-blacklist-4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730]
-F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0 =
diff --git 
a/src/transport/test_transport_blacklisting_cfg_blp_peer1_multiple_plugins.conf 
b/src/transport/test_transport_blacklisting_cfg_blp_peer1_multiple_plugins.conf
deleted file mode 100644
index 79bc90469..000000000
--- 
a/src/transport/test_transport_blacklisting_cfg_blp_peer1_multiple_plugins.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = tcp unix
-
-#Peer 1: 4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730
-#Peer 2: F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0
-
-[transport-blacklist-4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730]
-F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0 = tcp
-
diff --git 
a/src/transport/test_transport_blacklisting_cfg_blp_peer1_plugin.conf 
b/src/transport/test_transport_blacklisting_cfg_blp_peer1_plugin.conf
deleted file mode 100644
index b328dd5cf..000000000
--- a/src/transport/test_transport_blacklisting_cfg_blp_peer1_plugin.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport]
-PLUGINS = tcp
-
-#Peer 1: 4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730
-#Peer 2: F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0
-
-[transport-blacklist-4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730]
-F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0 = tcp
-
diff --git a/src/transport/test_transport_blacklisting_cfg_blp_peer2_full.conf 
b/src/transport/test_transport_blacklisting_cfg_blp_peer2_full.conf
deleted file mode 100644
index 862209d2c..000000000
--- a/src/transport/test_transport_blacklisting_cfg_blp_peer2_full.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = tcp
-
-#Peer 1: 4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730
-#Peer 2: F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0
-
-[transport-blacklist-F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0]
-4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730 =
diff --git 
a/src/transport/test_transport_blacklisting_cfg_blp_peer2_multiple_plugins.conf 
b/src/transport/test_transport_blacklisting_cfg_blp_peer2_multiple_plugins.conf
deleted file mode 100644
index 3134f9d81..000000000
--- 
a/src/transport/test_transport_blacklisting_cfg_blp_peer2_multiple_plugins.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = tcp unix
-
-#Peer 1: 4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730
-#Peer 2: F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0
-
-[transport-blacklist-F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0]
-4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730 = tcp
diff --git 
a/src/transport/test_transport_blacklisting_cfg_blp_peer2_plugin.conf 
b/src/transport/test_transport_blacklisting_cfg_blp_peer2_plugin.conf
deleted file mode 100644
index dd582125d..000000000
--- a/src/transport/test_transport_blacklisting_cfg_blp_peer2_plugin.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport]
-PLUGINS = tcp
-
-#Peer 1: 4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730
-#Peer 2: F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0
-
-[transport-blacklist-F7B5NX6KCPG8SAKYSGV0E94Y5NXR9JE3HCGQ5YGH1H04WFQWMWT0]
-4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730 = tcp
diff --git a/src/transport/test_transport_blacklisting_cfg_peer1.conf 
b/src/transport/test_transport_blacklisting_cfg_peer1.conf
deleted file mode 100644
index 9150c7faf..000000000
--- a/src/transport/test_transport_blacklisting_cfg_peer1.conf
+++ /dev/null
@@ -1,29 +0,0 @@
-@INLINE@ template_cfg_peer1.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
-
-[transport-tcp]
-PORT = 12000
-TIMEOUT = 5 s
-
-[arm]
-PORT = 12005
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock
-
-[statistics]
-PORT = 12004
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-statistics.sock
-
-[resolver]
-PORT = 12003
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-resolver.sock
-
-[peerinfo]
-PORT = 12002
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-peerinfo.sock
-
-[transport]
-PORT = 12001
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-transport.sock
-PLUGINS = tcp
-
diff --git a/src/transport/test_transport_blacklisting_cfg_peer2.conf 
b/src/transport/test_transport_blacklisting_cfg_peer2.conf
deleted file mode 100644
index 43bb4ae37..000000000
--- a/src/transport/test_transport_blacklisting_cfg_peer2.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-@INLINE@ template_cfg_peer2.conf
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
-
-[transport-tcp]
-PORT = 12015
-TIMEOUT = 5 s
-
-[arm]
-PORT = 12014
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-arm.sock
-
-[statistics]
-PORT = 12013
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-statistics.sock
-
-[resolver]
-PORT = 12012
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-resolver.sock
-
-[peerinfo]
-PORT = 12011
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-peerinfo.sock
-
-[transport]
-PORT = 12010
-PLUGINS = tcp
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p2-service-transport.sock
diff --git a/src/transport/test_transport_just_run_topo.conf 
b/src/transport/test_transport_just_run_topo.conf
new file mode 100644
index 000000000..d27a2fc77
--- /dev/null
+++ b/src/transport/test_transport_just_run_topo.conf
@@ -0,0 +1,6 @@
+M:2
+N:1
+X:0
+T:libgnunet_test_transport_plugin_cmd_just_run
+P:1:1|{connect:{P:1:2:tcp}|{P:1:2:udp}}
+P:1:2|{connect:{P:1:1:tcp}|{P:1:1:udp}}
\ No newline at end of file
diff --git a/src/transport/test_transport_plugin_cmd_nat_upnp.c 
b/src/transport/test_transport_plugin_cmd_just_run.c
similarity index 72%
copy from src/transport/test_transport_plugin_cmd_nat_upnp.c
copy to src/transport/test_transport_plugin_cmd_just_run.c
index bb1c2be0a..df7484884 100644
--- a/src/transport/test_transport_plugin_cmd_nat_upnp.c
+++ b/src/transport/test_transport_plugin_cmd_just_run.c
@@ -31,6 +31,7 @@
 #include "transport-testing2.h"
 #include "transport-testing-cmds.h"
 #include "gnunet_testing_barrier.h"
+#include "gnunet_core_service.h"
 
 /**
  * Generic logging shortcut
@@ -43,16 +44,40 @@
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
 
-static struct GNUNET_TESTING_Command block_send;
+#define MAX_RECEIVED 1000
 
-static struct GNUNET_TESTING_Command block_receive;
+#define MESSAGE_SIZE 65000
+
+static struct GNUNET_TESTING_Command block_script;
 
 static struct GNUNET_TESTING_Command connect_peers;
 
 static struct GNUNET_TESTING_Command local_prepared;
 
+static struct GNUNET_TESTING_Command start_peer;
+
 static struct GNUNET_TESTING_Interpreter *is;
 
+static struct GNUNET_CONTAINER_MultiPeerMap *senders;
+
+struct Sender
+{
+  /**
+   * Number of received messages from sender.
+   */
+  unsigned long long num_received;
+
+  /**
+   * Sample mean time the message traveled.
+   */
+  struct GNUNET_TIME_Relative mean_time;
+
+  /**
+   * Time the first message was send.
+   */
+  struct GNUNET_TIME_Absolute time_first;
+};
+
 /**
  * Function called to check a message of type 
GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being
  * received.
@@ -60,33 +85,13 @@ static struct GNUNET_TESTING_Interpreter *is;
  */
 static int
 check_test (void *cls,
-            const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
+            const struct
+            GNUNET_TRANSPORT_TESTING_PerformanceTestMessage *message)
 {
   return GNUNET_OK;
 }
 
 
-/**
- * Function called to handle a message of type 
GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE
- * being received.
- *
- */
-static void
-handle_test (void *cls,
-             const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  const struct GNUNET_TESTING_AsyncContext *ac;
-
-  GNUNET_TESTING_get_trait_async_context (&block_receive,
-                                          &ac);
-  GNUNET_assert  (NULL != ac);
-  if (NULL == ac->cont)
-    GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac);
-  else
-    GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac);
-}
-
-
 struct GNUNET_TESTING_BarrierList*
 get_waiting_for_barriers ()
 {
@@ -118,15 +123,6 @@ get_waiting_for_barriers ()
 static void
 all_peers_started ()
 {
-  const struct GNUNET_TESTING_AsyncContext *ac;
-
-  GNUNET_TESTING_get_trait_async_context (&block_send,
-                                          &ac);
-  GNUNET_assert  (NULL != ac);
-  if (NULL == ac->cont)
-    GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac);
-  else
-    GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac);
 }
 
 
@@ -157,7 +153,7 @@ handle_result (void *cls,
 /**
  * Callback from start peer cmd for signaling a peer got connected.
  *
- */
+ *
 static void *
 notify_connect (struct GNUNET_TESTING_Interpreter *is,
                 const struct GNUNET_PeerIdentity *peer)
@@ -174,7 +170,7 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
   cps->notify_connect (is,
                        peer);
   return ret;
-}
+  }*/
 
 
 /**
@@ -196,6 +192,90 @@ all_local_tests_prepared ()
 }
 
 
+static void
+child_completed_callback (void *cls,
+                          enum GNUNET_OS_ProcessStatusType type,
+                          long unsigned int exit_code)
+{
+  
+}
+
+
+/**
+ * Function called to check a message being
+ * received.
+ *
+ */
+static int
+check_encrypted (void *cls, struct GNUNET_MessageHeader *header)
+{
+  return GNUNET_OK;
+}
+
+
+static void
+core_receive_continue (struct GNUNET_PeerIdentity *peer)
+{
+  const struct GNUNET_TESTING_StartPeerState *sps;
+
+  GNUNET_TRANSPORT_get_trait_state (&start_peer,
+                                    &sps);
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Executing core receive continue\n");
+  
+  GNUNET_TRANSPORT_core_receive_continue (sps->th, peer);
+}
+
+
+/*static void
+handle_core (void *cls, struct GNUNET_MessageHeader *header)
+{
+  struct GNUNET_PeerIdentity *peer = cls;
+
+  core_receive_continue (peer);
+  }*/
+
+
+/**
+ * Function called to handle a message being received.
+ *
+ */
+static void
+handle_encrypted (void *cls, struct GNUNET_MessageHeader *header)
+{
+  struct GNUNET_PeerIdentity *peer = cls;
+
+  core_receive_continue (peer);
+}
+
+
+static void
+handle_ephemeral_key (void *cls, struct GNUNET_MessageHeader *header)
+{
+  struct GNUNET_PeerIdentity *peer = cls;
+
+  core_receive_continue (peer);
+}
+
+
+static void
+handle_ping (void *cls, struct GNUNET_MessageHeader *header)
+{
+  struct GNUNET_PeerIdentity *peer = cls;
+
+  core_receive_continue (peer);
+}
+
+
+static void
+handle_pong (void *cls, struct GNUNET_MessageHeader *header)
+{
+  struct GNUNET_PeerIdentity *peer = cls;
+
+  core_receive_continue (peer);
+}
+
 /**
  * Function to start a local test case.
  *
@@ -232,6 +312,8 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
   struct TestState *ts = GNUNET_new (struct TestState);
   struct GNUNET_TESTING_NetjailTopology *topology;
   unsigned int sscanf_ret = 0;
+  char **argv = NULL;
+  int argc = 0;
 
   ts->finished_cb = finished_cb;
   LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -277,16 +359,15 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
   else
     num = (n_int - 1) * local_m_int + m_int + topology->nodes_x;
 
-  block_send = GNUNET_TESTING_cmd_block_until_external_trigger (
-    "block");
-  block_receive = GNUNET_TESTING_cmd_block_until_external_trigger (
-    "block-receive");
+  block_script = GNUNET_TESTING_cmd_block_until_external_trigger (
+    "block-script");
   connect_peers = GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers",
                                                       "start-peer",
                                                       "system-create",
                                                       num,
                                                       topology,
-                                                      0);
+                                                      0,
+                                                      GNUNET_NO);
   local_prepared = GNUNET_TESTING_cmd_local_test_prepared (
     "local-test-prepared",
     write_message);
@@ -309,25 +390,33 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
                    m,
                    n);
 
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_var_size (test,
-                           GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE,
-                           struct GNUNET_TRANSPORT_TESTING_TestMessage,
-                           ts),
+  /*struct GNUNET_MQ_MessageHandler handlers[] = {
+    GNUNET_MQ_hd_fixed_size (ephemeral_key,
+                             GNUNET_MESSAGE_TYPE_CORE_EPHEMERAL_KEY,
+                             struct EphemeralKeyMessage,
+                             NULL),
+    GNUNET_MQ_hd_fixed_size (ping,
+                             GNUNET_MESSAGE_TYPE_CORE_PING,
+                             struct PingMessage,
+                             NULL),
+    GNUNET_MQ_hd_fixed_size (pong,
+                             GNUNET_MESSAGE_TYPE_CORE_PONG,
+                             struct PongMessage,
+                             NULL),
     GNUNET_MQ_handler_end ()
-  };
+  };*/
+
+  start_peer = GNUNET_TESTING_cmd_start_peer ("start-peer",
+                                                "system-create",
+                                                num,
+                                                node_ip,
+                                                ts->cfgname,
+                                                GNUNET_NO);
 
   struct GNUNET_TESTING_Command commands[] = {
     GNUNET_TESTING_cmd_system_create ("system-create",
                                       ts->testdir),
-    GNUNET_TRANSPORT_cmd_start_peer ("start-peer",
-                                     "system-create",
-                                     num,
-                                     node_ip,
-                                     handlers,
-                                     ts->cfgname,
-                                     notify_connect,
-                                     GNUNET_NO),
+    start_peer,
     GNUNET_TESTING_cmd_barrier_reached ("ready-to-connect-reached",
                                         "ready-to-connect",
                                         GNUNET_NO,
@@ -335,12 +424,12 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
                                         GNUNET_NO,
                                         write_message),
     connect_peers,
-    GNUNET_TRANSPORT_cmd_send_simple ("send-simple",
-                                      "start-peer",
-                                      "system-create",
-                                      num,
-                                      topology),
-    block_receive,
+    GNUNET_TESTING_cmd_exec_bash_script ("script",
+                                         "block.sh",
+                                         argv,
+                                         argc,
+                                         &child_completed_callback),
+    block_script,
     GNUNET_TESTING_cmd_barrier_reached ("test-case-finished-reached",
                                         "test-case-finished",
                                         GNUNET_NO,
@@ -371,7 +460,7 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
  * @return the exported block API
  */
 void *
-libgnunet_test_transport_plugin_cmd_nat_upnp_init (void *cls)
+libgnunet_test_transport_plugin_cmd_just_run_init (void *cls)
 {
   struct GNUNET_TESTING_PluginFunctions *api;
 
@@ -389,11 +478,11 @@ libgnunet_test_transport_plugin_cmd_nat_upnp_init (void 
*cls)
 /**
  * Exit point from the plugin.
  *
- * @param cls the return value from 
#libgnunet_test_transport_plugin_nat_upnp_init
+ * @param cls the return value from 
#libgnunet_test_transport_plugin_just_run_init
  * @return NULL
  */
 void *
-libgnunet_test_transport_plugin_cmd_nat_upnp_done (void *cls)
+libgnunet_test_transport_plugin_cmd_just_run_done (void *cls)
 {
   struct GNUNET_TESTING_PluginFunctions *api = cls;
 
diff --git a/src/transport/test_transport_plugin_cmd_nat_upnp.c 
b/src/transport/test_transport_plugin_cmd_nat_upnp.c
index bb1c2be0a..82623ece7 100644
--- a/src/transport/test_transport_plugin_cmd_nat_upnp.c
+++ b/src/transport/test_transport_plugin_cmd_nat_upnp.c
@@ -75,7 +75,7 @@ static void
 handle_test (void *cls,
              const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
 {
-  const struct GNUNET_TESTING_AsyncContext *ac;
+  struct GNUNET_TESTING_AsyncContext *ac;
 
   GNUNET_TESTING_get_trait_async_context (&block_receive,
                                           &ac);
@@ -111,25 +111,6 @@ get_waiting_for_barriers ()
 }
 
 
-/**
- * Callback to set the flag indicating all peers started. Will be called via 
the plugin api.
- *
- */
-static void
-all_peers_started ()
-{
-  const struct GNUNET_TESTING_AsyncContext *ac;
-
-  GNUNET_TESTING_get_trait_async_context (&block_send,
-                                          &ac);
-  GNUNET_assert  (NULL != ac);
-  if (NULL == ac->cont)
-    GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac);
-  else
-    GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac);
-}
-
-
 /**
  * Function called with the final result of the test.
  *
@@ -286,7 +267,8 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
                                                       "system-create",
                                                       num,
                                                       topology,
-                                                      0);
+                                                      0,
+                                                      GNUNET_YES);
   local_prepared = GNUNET_TESTING_cmd_local_test_prepared (
     "local-test-prepared",
     write_message);
diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c 
b/src/transport/test_transport_plugin_cmd_simple_send.c
index 8a96e19f9..c6d75cce4 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send.c
@@ -75,7 +75,7 @@ static void
 handle_test (void *cls,
              const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
 {
-  const struct GNUNET_TESTING_AsyncContext *ac;
+  struct GNUNET_TESTING_AsyncContext *ac;
 
   GNUNET_TESTING_get_trait_async_context (&block_receive,
                                           &ac);
@@ -102,7 +102,7 @@ get_waiting_for_barriers ()
 static void
 all_peers_started ()
 {
-  const struct GNUNET_TESTING_AsyncContext *ac;
+  struct GNUNET_TESTING_AsyncContext *ac;
 
   GNUNET_TESTING_get_trait_async_context (&block_send,
                                           &ac);
@@ -263,7 +263,8 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
                                                       "system-create",
                                                       num,
                                                       topology,
-                                                      0);
+                                                      0,
+                                                      GNUNET_YES);
   local_prepared = GNUNET_TESTING_cmd_local_test_prepared (
     "local-test-prepared",
     write_message);
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c 
b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c
index 7000851c4..d2870ab34 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c
@@ -75,7 +75,7 @@ static void
 handle_test (void *cls,
              const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
 {
-  const struct GNUNET_TESTING_AsyncContext *ac;
+  struct GNUNET_TESTING_AsyncContext *ac;
 
   GNUNET_TESTING_get_trait_async_context (&block_receive,
                                           &ac);
@@ -102,7 +102,7 @@ get_waiting_for_barriers ()
 static void
 all_peers_started ()
 {
-  const struct GNUNET_TESTING_AsyncContext *ac;
+  struct GNUNET_TESTING_AsyncContext *ac;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received message\n");
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_dv.c 
b/src/transport/test_transport_plugin_cmd_simple_send_dv.c
index 52174e539..d35672cd9 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send_dv.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send_dv.c
@@ -84,12 +84,12 @@ handle_test (void *cls,
              const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
 {
   struct GNUNET_PeerIdentity *peer = cls;
-  const struct GNUNET_TESTING_AsyncContext *ac_block;
+  struct GNUNET_TESTING_AsyncContext *ac_block;
   const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
   unsigned int connected;
   struct GNUNET_TESTING_BlockState *bs;
   struct GNUNET_TRANSPORT_CoreHandle *ch;
-  const struct StartPeerState *sps;
+  const struct GNUNET_TESTING_StartPeerState *sps;
 
 
   GNUNET_TRANSPORT_get_trait_state (&start_peer,
@@ -129,7 +129,7 @@ handle_test (void *cls,
       {
         GNUNET_TESTING_get_trait_block_state (
           &block_receive,
-          (const struct GNUNET_TESTING_BlockState  **) &bs);
+          &bs);
         bs->asynchronous_finish = GNUNET_YES;
       }
 
@@ -154,7 +154,7 @@ get_waiting_for_barriers ()
 static void
 all_peers_started ()
 {
-  const struct GNUNET_TESTING_AsyncContext *ac;
+  struct GNUNET_TESTING_AsyncContext *ac;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received message\n");
@@ -327,7 +327,8 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
     "system-create",
     num,
     topology,
-    topology->additional_connects);
+    topology->additional_connects,
+    GNUNET_YES);
   local_prepared = GNUNET_TESTING_cmd_local_test_prepared (
     "local-test-prepared",
     write_message);
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_performance.c 
b/src/transport/test_transport_plugin_cmd_simple_send_performance.c
index 013a3c2b2..c4158f472 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send_performance.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send_performance.c
@@ -104,14 +104,14 @@ handle_test (void *cls,
              GNUNET_TRANSPORT_TESTING_PerformanceTestMessage *message)
 {
   struct GNUNET_PeerIdentity *peer = cls;
-  const struct GNUNET_TESTING_AsyncContext *ac;
+  struct GNUNET_TESTING_AsyncContext *ac;
   struct Sender *sender;
   struct GNUNET_TIME_Absolute time_send;
   struct GNUNET_TIME_Absolute now;
   struct GNUNET_TIME_Relative time_traveled;
   uint32_t num;
   struct GNUNET_TRANSPORT_CoreHandle *ch;
-  const struct StartPeerState *sps;
+  const struct GNUNET_TESTING_StartPeerState *sps;
 
 
   GNUNET_TRANSPORT_get_trait_state (&start_peer,
@@ -217,25 +217,6 @@ get_waiting_for_barriers ()
 }
 
 
-/**
- * Callback to set the flag indicating all peers started. Will be called via 
the plugin api.
- *
- */
-static void
-all_peers_started ()
-{
-  const struct GNUNET_TESTING_AsyncContext *ac;
-
-  GNUNET_TESTING_get_trait_async_context (&block_send,
-                                          &ac);
-  GNUNET_assert  (NULL != ac);
-  if (NULL == ac->cont)
-    GNUNET_TESTING_async_fail ((struct GNUNET_TESTING_AsyncContext *) ac);
-  else
-    GNUNET_TESTING_async_finish ((struct GNUNET_TESTING_AsyncContext *) ac);
-}
-
-
 /**
  * Function called with the final result of the test.
  *
@@ -393,7 +374,8 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
                                                       "system-create",
                                                       num,
                                                       topology,
-                                                      0);
+                                                      0,
+                                                      GNUNET_YES);
   local_prepared = GNUNET_TESTING_cmd_local_test_prepared (
     "local-test-prepared",
     write_message);
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c 
b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
index 28cbd33ba..378caf7df 100644
--- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c
+++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
@@ -100,7 +100,7 @@ get_waiting_for_barriers ()
 static void
 all_peers_started ()
 {
-  const struct GNUNET_TESTING_AsyncContext *ac;
+  struct GNUNET_TESTING_AsyncContext *ac;
 
   GNUNET_TESTING_get_trait_async_context (&block_send,
                                           &ac);
@@ -257,7 +257,8 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb 
write_message,
                                                       "system-create",
                                                       num,
                                                       topology,
-                                                      0);
+                                                      0,
+                                                      GNUNET_YES);
   local_prepared = GNUNET_TESTING_cmd_local_test_prepared (
     "local-test-prepared",
     write_message);
diff --git a/src/transport/test_transport_simple_send.sh 
b/src/transport/test_transport_start_testcase.sh
similarity index 82%
copy from src/transport/test_transport_simple_send.sh
copy to src/transport/test_transport_start_testcase.sh
index 0250070be..028c8f248 100755
--- a/src/transport/test_transport_simple_send.sh
+++ b/src/transport/test_transport_start_testcase.sh
@@ -1,4 +1,5 @@
 #!/bin/bash
+read -p "Test case configuration to use:" conf
 if ! [ -d "/run/netns" ]; then
     echo You have to create the directory /run/netns.
 fi
@@ -8,4 +9,4 @@ if [ -f /proc/sys/kernel/unprivileged_userns_clone ]; then
     exit 78
   fi
 fi
-exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; 
./test_transport_start_with_config test_transport_simple_send_topo.conf"
+exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; 
./test_transport_start_with_config $conf"
diff --git a/src/transport/test_transport_start_with_config.c 
b/src/transport/test_transport_start_with_config.c
index 9a8b5ee05..349cd65a5 100644
--- a/src/transport/test_transport_start_with_config.c
+++ b/src/transport/test_transport_start_with_config.c
@@ -26,7 +26,6 @@
 #include "platform.h"
 #include "gnunet_testing_ng_lib.h"
 #include "gnunet_testing_netjail_lib.h"
-#include "transport-testing-cmds.h"
 #include "gnunet_util_lib.h"
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
diff --git a/src/transport/test_transport_testing_restart.c 
b/src/transport/test_transport_testing_restart.c
deleted file mode 100644
index f537af5fc..000000000
--- a/src/transport/test_transport_testing_restart.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/test_transport_testing_restart.c
- * @brief test case for transport testing library:
- * start the peer, get the HELLO message, restart and stop the peer
- */
-#include "platform.h"
-#include "gnunet_transport_service.h"
-#include "transport-testing.h"
-
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
-
-
-static struct GNUNET_SCHEDULER_Task *timeout_task;
-
-static struct GNUNET_TRANSPORT_TESTING_PeerContext *p;
-
-static struct GNUNET_TRANSPORT_TESTING_Handle *tth;
-
-static int ret;
-
-
-static void
-end ()
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Stopping peers\n");
-  if (NULL != timeout_task)
-    GNUNET_SCHEDULER_cancel (timeout_task);
-  if (NULL != p)
-    GNUNET_TRANSPORT_TESTING_stop_peer (p);
-  if (NULL != tth)
-    GNUNET_TRANSPORT_TESTING_done (tth);
-}
-
-
-static void
-end_badly ()
-{
-  timeout_task = NULL;
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Timeout!\n");
-  end ();
-  ret = GNUNET_SYSERR;
-}
-
-
-static void
-restart_cb (void *cls)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Peer %u (`%s') successfully restarted\n",
-              p->no,
-              GNUNET_i2s (&p->id));
-  ret = 0;
-  GNUNET_SCHEDULER_add_now (&end,
-                            NULL);
-}
-
-
-static void
-restart_task ()
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Peer %u (`%s') restarting\n",
-              p->no,
-              GNUNET_i2s (&p->id));
-  GNUNET_TRANSPORT_TESTING_restart_peer (p,
-                                         &restart_cb,
-                                         p);
-}
-
-
-static void
-start_cb (void *cls)
-{
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Peer %u (`%s') successfully started\n",
-              p->no,
-              GNUNET_i2s (&p->id));
-  GNUNET_SCHEDULER_add_now (&restart_task,
-                            NULL);
-}
-
-
-static void
-run (void *cls,
-     char *const *args,
-     const char *cfgfile,
-     const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  ret = 1;
-  tth = GNUNET_TRANSPORT_TESTING_init ();
-  GNUNET_assert (NULL != tth);
-
-  timeout_task
-    = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
-                                    &end_badly,
-                                    NULL);
-  p = GNUNET_TRANSPORT_TESTING_start_peer (tth,
-                                           cfgfile,
-                                           1,
-                                           NULL, /* receive cb */
-                                           NULL, /* connect cb */
-                                           NULL, /* disconnect cb */
-                                           NULL, /* nc/nd closure */
-                                           start_cb, /* startup cb */
-                                           NULL); /* closure */
-  if (NULL == p)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to start peer\n");
-    end ();
-    ret = 1;
-  }
-}
-
-
-int
-main (int argc,
-      char *argv[])
-{
-  char *const argv_1[] = { "test_transport_testing_restart",
-                           "-c",
-                           "test_transport_api_data.conf",
-                           NULL };
-  struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_OPTION_END
-  };
-
-  GNUNET_log_setup ("test_transport_testing_restart",
-                    "WARNING",
-                    NULL);
-  GNUNET_PROGRAM_run ((sizeof(argv_1) / sizeof(char *)) - 1,
-                      argv_1,
-                      "test_transport_testing_restart",
-                      "nohelp",
-                      options,
-                      &run,
-                      NULL);
-  return ret;
-}
-
-
-/* end of test_transport_testing_restart.c */
diff --git a/src/transport/transport-testing-cmds.h 
b/src/transport/transport-testing-cmds.h
index 6e3c761f2..6b6fcf4f1 100644
--- a/src/transport/transport-testing-cmds.h
+++ b/src/transport/transport-testing-cmds.h
@@ -33,175 +33,7 @@ typedef void *
 (*GNUNET_TRANSPORT_notify_connect_cb) (struct GNUNET_TESTING_Interpreter *is,
                                        const struct GNUNET_PeerIdentity *peer);
 
-/**
- * Struct to store information needed in callbacks.
- *
- */
-struct ConnectPeersState
-{
-  /**
-   * Context for our asynchronous completion.
-   */
-  struct GNUNET_TESTING_AsyncContext ac;
-
-  GNUNET_TRANSPORT_notify_connect_cb notify_connect;
-
-  /**
-   * The testing system of this node.
-   */
-  const struct GNUNET_TESTING_System *tl_system;
-
-  // Label of the cmd which started the test system.
-  const char *create_label;
-
-  /**
-   * Number globally identifying the node.
-   *
-   */
-  uint32_t num;
-
-  /**
-   * Label of the cmd to start a peer.
-   *
-   */
-  const char *start_peer_label;
-
-  /**
-   * The topology of the test setup.
-   */
-  struct GNUNET_TESTING_NetjailTopology *topology;
-
-  /**
-   * Connections to other peers.
-   */
-  struct GNUNET_TESTING_NodeConnection *node_connections_head;
-
-  struct GNUNET_TESTING_Interpreter *is;
-
-  /**
-   * Number of connections.
-   */
-  unsigned int con_num;
-
-  /**
-   * Number of additional connects this cmd will wait for not triggered by 
this cmd.
-   */
-  unsigned int additional_connects;
-
-  /**
- * Number of connections we already have a notification for.
- */
-  unsigned int con_num_notified;
-
-  /**
-   * Number of additional connects this cmd will wait for not triggered by 
this cmd we already have a notification for.
-   */
-  unsigned int additional_connects_notified;
-};
-
-struct StartPeerState
-{
-  /**
-   * Context for our asynchronous completion.
-   */
-  struct GNUNET_TESTING_AsyncContext ac;
-
-  /**
-   * The ip of a node.
-   */
-  char *node_ip;
-
-  /**
-   * Receive callback
-   */
-  struct GNUNET_MQ_MessageHandler *handlers;
-
-  /**
-   * GNUnet configuration file used to start a peer.
-   */
-  char *cfgname;
-
-  /**
-   * Peer's configuration
-   */
-  struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * struct GNUNET_TESTING_Peer returned by GNUNET_TESTING_peer_configure.
-   */
-  struct GNUNET_TESTING_Peer *peer;
-
-  /**
-   * Peer identity
-   */
-  struct GNUNET_PeerIdentity id;
-
-  /**
-   * Peer's transport service handle
-   */
-  struct GNUNET_TRANSPORT_CoreHandle *th;
 
-  /**
-   * Application handle
-   */
-  struct GNUNET_TRANSPORT_ApplicationHandle *ah;
-
-  /**
-   * Peer's PEERSTORE Handle
-   */
-  struct GNUNET_PEERSTORE_Handle *ph;
-
-  /**
-   * Hello get task
-   */
-  struct GNUNET_SCHEDULER_Task *rh_task;
-
-  /**
-   * Peer's transport get hello handle to retrieve peer's HELLO message
-   */
-  struct GNUNET_PEERSTORE_IterateContext *pic;
-
-  /**
-   * Hello
-   */
-  char *hello;
-
-  /**
-   * Hello size
-   */
-  size_t hello_size;
-
-  /**
-   * The label of the command which was started by calling 
GNUNET_TESTING_cmd_system_create.
-   */
-  char *system_label;
-
-  /**
-   * An unique number to identify the peer
-   */
-  unsigned int no;
-
-  /**
-   * A map with struct GNUNET_MQ_Handle values for each peer this peer
-   * is connected to.
-   */
-  struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
-
-  /**
-   * Test setup for this peer.
-   */
-  const struct GNUNET_TESTING_System *tl_system;
-
-  /**
-   * Callback which is called on neighbour connect events.
-   */
-  GNUNET_TRANSPORT_notify_connect_cb notify_connect;
-
-  /**
-   * Flag indicating, if udp broadcast should be switched on.
-   */
-  enum GNUNET_GenericReturnValue broadcast;
-};
 
 struct TestState
 {
@@ -283,7 +115,8 @@ GNUNET_TRANSPORT_cmd_connect_peers (
   const char *create_label,
   uint32_t num,
   struct GNUNET_TESTING_NetjailTopology *topology,
-  unsigned int additional_connects);
+  unsigned int additional_connects,
+  unsigned int wait_for_connect);
 
 
 /**
@@ -402,7 +235,7 @@ GNUNET_TRANSPORT_cmd_backchannel_check (const char *label,
   op (hello, const char) \
   op (application_handle, const struct GNUNET_TRANSPORT_ApplicationHandle) \
   op (connect_peer_state, const struct ConnectPeersState) \
-  op (state, const struct StartPeerState) \
+  op (state, const struct GNUNET_TESTING_StartPeerState) \
   op (broadcast, const enum GNUNET_GenericReturnValue)
 
 GNUNET_TRANSPORT_SIMPLE_TRAITS (GNUNET_TRANSPORT_MAKE_DECL_SIMPLE_TRAIT)
diff --git a/src/transport/transport-testing-communicator.c 
b/src/transport/transport-testing-communicator.c
index 26895e457..553426b66 100644
--- a/src/transport/transport-testing-communicator.c
+++ b/src/transport/transport-testing-communicator.c
@@ -29,7 +29,6 @@
 #include "gnunet_protocols.h"
 #include "gnunet_constants.h"
 #include "transport-testing-communicator.h"
-#include "gnunet_ats_transport_service.h"
 #include "gnunet_hello_lib.h"
 #include "gnunet_signatures.h"
 #include "transport.h"
@@ -1203,7 +1202,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_send
   if (last_queue != tc_queue)
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Selected sending queue changed to %u with length %lu and MTU 
%u\n",
-                ntohl (tc_queue->qid), tc_queue->q_len, tc_queue->mtu);
+                ntohl (tc_queue->qid), (unsigned long) tc_queue->q_len, 
tc_queue->mtu);
   GNUNET_assert (NULL != tc_queue);
   last_queue = tc_queue;
   // Uncomment this for alternativ 1 of backchannel functionality
@@ -1215,7 +1214,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_send
   if (msg_count % 100 == 0)
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Sending %u-th (%lu-th for queue) message on queue %u\n",
-                msg_count, tc_queue->mid, ntohl (tc_queue->qid));
+                msg_count, (unsigned long) tc_queue->mid, ntohl 
(tc_queue->qid));
   inbox_size = sizeof (struct GNUNET_MessageHeader) + payload_size;
   env = GNUNET_MQ_msg_extra (msg,
                              inbox_size,
diff --git a/src/transport/transport-testing-communicator.h 
b/src/transport/transport-testing-communicator.h
index 122ac3efa..7460aab8e 100644
--- a/src/transport/transport-testing-communicator.h
+++ b/src/transport/transport-testing-communicator.h
@@ -26,7 +26,7 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_ats_transport_service.h"
+#include "gnunet_transport_communication_service.h"
 #include "transport.h"
 
 /**
diff --git a/src/transport/transport-testing-filenames.c 
b/src/transport/transport-testing-filenames.c
deleted file mode 100644
index ee7b0aacf..000000000
--- a/src/transport/transport-testing-filenames.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport-testing-filenames.c
- * @brief convenience string manipulation functions for tests
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "transport-testing.h"
-
-
-/**
- * Removes all directory separators from absolute filename
- *
- * @param file the absolute file name, e.g. as found in argv[0]
- * @return extracted file name, has to be freed by caller
- */
-static char *
-extract_filename (const char *file)
-{
-  char *pch = GNUNET_strdup (file);
-  char *backup = pch;
-  char *filename = NULL;
-  char *res;
-
-  if (NULL != strstr (pch, "/"))
-  {
-    pch = strtok (pch, "/");
-    while (pch != NULL)
-    {
-      pch = strtok (NULL, "/");
-      if (pch != NULL)
-      {
-        filename = pch;
-      }
-    }
-  }
-  else
-    filename = pch;
-
-  res = GNUNET_strdup (filename);
-  GNUNET_free (backup);
-  return res;
-}
-
-
-char *
-GNUNET_TRANSPORT_TESTING_get_test_name (const char *file)
-{
-  char *backup = extract_filename (file);
-  char *filename = backup;
-  char *dotexe;
-  char *ret;
-
-  if (NULL == filename)
-    return NULL;
-
-  /* remove "lt-" */
-  filename = strstr (filename, "test");
-  if (NULL == filename)
-  {
-    GNUNET_free (backup);
-    return NULL;
-  }
-
-  /* remove ".exe" */
-  if (NULL != (dotexe = strstr (filename, ".exe")))
-    dotexe[0] = '\0';
-  ret = GNUNET_strdup (filename);
-  GNUNET_free (backup);
-  return ret;
-}
-
-
-char *
-GNUNET_TRANSPORT_TESTING_get_test_source_name (const char *file)
-{
-  char *src = extract_filename (file);
-  char *split;
-
-  split = strstr (src, ".");
-  if (NULL != split)
-    split[0] = '\0';
-  return src;
-}
-
-
-char *
-GNUNET_TRANSPORT_TESTING_get_test_plugin_name (const char *file,
-                                               const char *test)
-{
-  char *filename;
-  char *dotexe;
-  char *e = extract_filename (file);
-  char *t = extract_filename (test);
-  char *ret;
-
-  if (NULL == e)
-    goto fail;
-  /* remove "lt-" */
-  filename = strstr (e, "tes");
-  if (NULL == filename)
-    goto fail;
-  /* remove ".exe" */
-  if (NULL != (dotexe = strstr (filename, ".exe")))
-    dotexe[0] = '\0';
-
-  /* find last _ */
-  filename = strstr (filename, t);
-  if (NULL == filename)
-    goto fail;
-  /* copy plugin */
-  filename += strlen (t);
-  if ('\0' != *filename)
-    filename++;
-  ret = GNUNET_strdup (filename);
-  goto suc;
-fail:
-  ret = NULL;
-suc:
-  GNUNET_free (t);
-  GNUNET_free (e);
-  return ret;
-}
-
-
-char *
-GNUNET_TRANSPORT_TESTING_get_config_name (const char *file,
-                                          int count)
-{
-  char *filename = extract_filename (file);
-  char *backup = filename;
-  char *dotexe;
-  char *ret;
-
-  if (NULL == filename)
-    return NULL;
-  /* remove "lt-" */
-  filename = strstr (filename, "test");
-  if (NULL == filename)
-    goto fail;
-  /* remove ".exe" */
-  if (NULL != (dotexe = strstr (filename, ".exe")))
-    dotexe[0] = '\0';
-  GNUNET_asprintf (&ret,
-                   "%s_peer%u.conf",
-                   filename,
-                   count);
-  GNUNET_free (backup);
-  return ret;
-fail:
-  GNUNET_free (backup);
-  return NULL;
-}
-
-
-/* end of transport-testing-filenames.c */
diff --git a/src/transport/transport-testing-loggers.c 
b/src/transport/transport-testing-loggers.c
deleted file mode 100644
index 21ed0592a..000000000
--- a/src/transport/transport-testing-loggers.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport-testing-loggers.c
- * @brief convenience functions for logging common events in tests
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "transport-testing.h"
-
-
-/**
- * Log a connect event.
- *
- * @param cls NULL
- * @param me peer that had the event
- * @param other peer that connected.
- */
-void
-GNUNET_TRANSPORT_TESTING_log_connect (void *cls,
-                                      struct
-                                      GNUNET_TRANSPORT_TESTING_PeerContext *me,
-                                      const struct GNUNET_PeerIdentity *other)
-{
-  char *ps;
-
-  ps = GNUNET_strdup (GNUNET_i2s (&me->id));
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Peer %s connected to %u (%s)!\n",
-              GNUNET_i2s (other),
-              me->no,
-              ps);
-  GNUNET_free (ps);
-}
-
-
-/**
- * Log a disconnect event.
- *
- * @param cls NULL
- * @param me peer that had the event
- * @param other peer that disconnected.
- */
-void
-GNUNET_TRANSPORT_TESTING_log_disconnect (void *cls,
-                                         struct
-                                         GNUNET_TRANSPORT_TESTING_PeerContext *
-                                         me,
-                                         const struct
-                                         GNUNET_PeerIdentity *other)
-{
-  char *ps;
-
-  ps = GNUNET_strdup (GNUNET_i2s (&me->id));
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Peer `%s' disconnected from %u (%s)!\n",
-              GNUNET_i2s (other),
-              me->no,
-              ps);
-  GNUNET_free (ps);
-}
-
-
-/* end of transport-testing-loggers.c */
diff --git a/src/transport/transport-testing-main.c 
b/src/transport/transport-testing-main.c
deleted file mode 100644
index 63b91713c..000000000
--- a/src/transport/transport-testing-main.c
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport-testing-main.c
- * @brief convenience main function for tests
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "transport-testing.h"
-
-
-/**
- * Closure for #connect_cb.
- */
-struct GNUNET_TRANSPORT_TESTING_ConnectRequestList
-{
-  /**
-   * Stored in a DLL.
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequestList *next;
-
-  /**
-   * Stored in a DLL.
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequestList *prev;
-
-  /**
-   * Overall context we are in.
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-  /**
-   * Connect request this is about.
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cr;
-
-  /**
-   * Peer being connected.
-   */
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p1;
-
-  /**
-   * Peer being connected.
-   */
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p2;
-};
-
-
-/**
- * Shutdown function for the test. Stops all peers.
- *
- * @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *`
- */
-static void
-do_shutdown (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc = cls;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequestList *crl;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Testcase shutting down\n");
-  if (NULL != ccc->shutdown_task)
-    ccc->shutdown_task (ccc->shutdown_task_cls);
-  if (NULL != ccc->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (ccc->timeout_task);
-    ccc->timeout_task = NULL;
-  }
-  if (NULL != ccc->connect_task)
-  {
-    GNUNET_SCHEDULER_cancel (ccc->connect_task);
-    ccc->connect_task = NULL;
-  }
-  while (NULL != (crl = ccc->crl_head))
-  {
-    GNUNET_CONTAINER_DLL_remove (ccc->crl_head,
-                                 ccc->crl_tail,
-                                 crl);
-    GNUNET_TRANSPORT_TESTING_connect_peers_cancel (crl->cr);
-    GNUNET_free (crl);
-  }
-  for (unsigned int i = 0; i < ccc->num_peers; i++)
-  {
-    if (NULL != ccc->p[i])
-    {
-      GNUNET_TRANSPORT_TESTING_stop_peer (ccc->p[i]);
-      ccc->p[i] = NULL;
-    }
-  }
-}
-
-
-/**
- * Testcase hit timeout, shut it down with error.
- *
- * @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *`
- */
-static void
-do_timeout (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc = cls;
-
-  ccc->timeout_task = NULL;
-  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-              "Testcase timed out\n");
-  ccc->global_ret = GNUNET_SYSERR;
-  GNUNET_SCHEDULER_shutdown ();
-}
-
-
-/**
- * Internal data structure.   Closure for
- * #connect_cb, #disconnect_cb, #my_nc and #start_cb.
- * Allows us to identify which peer this is about.
- */
-struct GNUNET_TRANSPORT_TESTING_InternalPeerContext
-{
-  /**
-   * Overall context of the callback.
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-  /**
-   * Offset of the peer this is about.
-   */
-  unsigned int off;
-};
-
-
-/**
- * Information tracked per connected peer.
- */
-struct ConnectPairInfo
-{
-  /**
-   * Peer this is about.
-   */
-  const struct GNUNET_PeerIdentity *sender;
-
-  /**
-   * Information about the receiving peer.
-   */
-  struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *ipi;
-};
-
-
-/**
- * Function called when we connected two peers.  Once we have gotten
- * to the clique, launch test-specific logic.
- *
- * @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectRequestList *`
- */
-static void
-connect_cb (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequestList *crl = cls;
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc = crl->ccc;
-
-  GNUNET_CONTAINER_DLL_remove (ccc->crl_head,
-                               ccc->crl_tail,
-                               crl);
-  {
-    char *p1_c = GNUNET_strdup (GNUNET_i2s (&crl->p1->id));
-
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Peers connected: %u (%s) <-> %u (%s)\n",
-                crl->p1->no,
-                p1_c,
-                crl->p2->no,
-                GNUNET_i2s (&crl->p2->id));
-    GNUNET_free (p1_c);
-    GNUNET_free (crl);
-  }
-  if (NULL == ccc->crl_head)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "All connections UP, launching custom test logic.\n");
-    GNUNET_SCHEDULER_add_now (ccc->connect_continuation,
-                              ccc->connect_continuation_cls);
-  }
-}
-
-
-/**
- * Find peer by peer ID.
- *
- * @param ccc context to search
- * @param peer peer to look for
- * @return NULL if @a peer was not found
- */
-struct GNUNET_TRANSPORT_TESTING_PeerContext *
-GNUNET_TRANSPORT_TESTING_find_peer (struct
-                                    
GNUNET_TRANSPORT_TESTING_ConnectCheckContext
-                                    *ccc,
-                                    const struct GNUNET_PeerIdentity *peer)
-{
-  for (unsigned int i = 0; i < ccc->num_peers; i++)
-    if ((NULL != ccc->p[i]) &&
-        (0 == memcmp (peer,
-                      &ccc->p[i]->id,
-                      sizeof(*peer))))
-      return ccc->p[i];
-  return NULL;
-}
-
-
-/**
- * Wrapper around peers connecting.  Calls client's nc function.
- *
- * @param cls our `struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *`
- * @param peer peer we got connected to
- * @param mq message queue for transmissions to @a peer
- * @return closure for message handlers
- */
-static void *
-my_nc (void *cls,
-       const struct GNUNET_PeerIdentity *peer,
-       struct GNUNET_MQ_Handle *mq)
-{
-  struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *ipi = cls;
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc = ipi->ccc;
-  struct ConnectPairInfo *cpi;
-
-  if (NULL != ccc->nc)
-    ccc->nc (ccc->cls,
-             ccc->p[ipi->off],
-             peer);
-  cpi = GNUNET_new (struct ConnectPairInfo);
-  cpi->ipi = ipi;
-  cpi->sender = peer; /* valid until disconnect */
-  return cpi;
-}
-
-
-/**
- * Wrapper around peers disconnecting.  Calls client's nd function.
- *
- * @param cls our `struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *`
- * @param peer peer we got disconnected from
- * @param custom_cls return value from @a my_nc
- */
-static void
-my_nd (void *cls,
-       const struct GNUNET_PeerIdentity *peer,
-       void *custom_cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *ipi = cls;
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc = ipi->ccc;
-  struct ConnectPairInfo *cpi = custom_cls;
-
-  if (NULL != ccc->nd)
-    ccc->nd (ccc->cls,
-             ccc->p[ipi->off],
-             peer);
-  GNUNET_free (cpi);
-}
-
-
-/**
- * Wrapper around receiving data.  Calls client's rec function.
- *
- * @param cls our `struct ConnectPairInfo *`
- * @param message message we received
- * @return #GNUNET_OK (all messages are fine)
- */
-static int
-check_test (void *cls,
-            const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  return GNUNET_OK;
-}
-
-
-/**
- * Wrapper around receiving data.  Calls client's rec function.
- *
- * @param cls our `struct ConnectPairInfo *`
- * @param message message we received
- */
-static void
-handle_test (void *cls,
-             const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  struct ConnectPairInfo *cpi = cls;
-  struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *ipi = cpi->ipi;
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc = ipi->ccc;
-
-  if (NULL != ccc->rec)
-    ccc->rec (ccc->cls,
-              ccc->p[ipi->off],
-              cpi->sender,
-              message);
-}
-
-
-/**
- * Wrapper around receiving data.  Calls client's rec function.
- *
- * @param cls our `struct ConnectPairInfo *`
- * @param message message we received
- * @return #GNUNET_OK (all messages are fine)
- */
-static int
-check_test2 (void *cls,
-             const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  return GNUNET_OK;
-}
-
-
-/**
- * Wrapper around receiving data.  Calls client's rec function.
- *
- * @param cls our `struct ConnectPairInfo *`
- * @param message message we received
- */
-static void
-handle_test2 (void *cls,
-              const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
-  struct ConnectPairInfo *cpi = cls;
-  struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *ipi = cpi->ipi;
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc = ipi->ccc;
-
-  if (NULL != ccc->rec)
-    ccc->rec (ccc->cls,
-              ccc->p[ipi->off],
-              cpi->sender,
-              message);
-}
-
-
-/**
- * Connect the peers as a clique.
- *
- * @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext`
- */
-static void
-do_connect (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc = cls;
-
-  ccc->connect_task = NULL;
-  for (unsigned int i = 0; i < ccc->num_peers; i++)
-    for (unsigned int j = (ccc->bi_directional ? 0 : i + 1); j < 
ccc->num_peers;
-         j++)
-    {
-      struct GNUNET_TRANSPORT_TESTING_ConnectRequestList *crl;
-
-      if (i == j)
-        continue;
-      crl = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_ConnectRequestList);
-      GNUNET_CONTAINER_DLL_insert (ccc->crl_head,
-                                   ccc->crl_tail,
-                                   crl);
-      crl->ccc = ccc;
-      crl->p1 = ccc->p[i];
-      crl->p2 = ccc->p[j];
-      {
-        char *sender_c = GNUNET_strdup (GNUNET_i2s (&ccc->p[0]->id));
-
-        GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                    "Test tries to connect peer %u (`%s') -> peer %u (`%s')\n",
-                    ccc->p[0]->no,
-                    sender_c,
-                    ccc->p[1]->no,
-                    GNUNET_i2s (&ccc->p[1]->id));
-        GNUNET_free (sender_c);
-      }
-      crl->cr = GNUNET_TRANSPORT_TESTING_connect_peers (ccc->p[i],
-                                                        ccc->p[j],
-                                                        &connect_cb,
-                                                        crl);
-    }
-}
-
-
-/**
- * Function called once we have successfully launched a peer.
- * Once all peers have been launched, we connect all of them
- * in a clique.
- *
- * @param cls our `struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *`
- */
-static void
-start_cb (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *ipi = cls;
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc = ipi->ccc;
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p = ccc->p[ipi->off];
-
-  ccc->started++;
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Peer %u (`%s') started\n",
-              p->no,
-              GNUNET_i2s (&p->id));
-  if (ccc->started != ccc->num_peers)
-    return;
-  if (NULL != ccc->pre_connect_task)
-  {
-    /* Run the custom per-connect job, then give it a second to
-       go into effect before we continue connecting peers. */
-    ccc->pre_connect_task (ccc->pre_connect_task_cls);
-    ccc->connect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                                      &do_connect,
-                                                      ccc);
-  }
-  else
-  {
-    do_connect (ccc);
-  }
-}
-
-
-/**
- * Function run from #GNUNET_TRANSPORT_TESTING_connect_check
- * once the scheduler is up.  Should launch the peers and
- * then in the continuations try to connect them.
- *
- * @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *`
- * @param args ignored
- * @param cfgfile ignored
- * @param cfg configuration
- */
-static void
-connect_check_run (void *cls,
-                   char *const *args,
-                   const char *cfgfile,
-                   const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc = cls;
-  int ok;
-
-  ccc->cfg = cfg;
-  ccc->timeout_task = GNUNET_SCHEDULER_add_delayed (ccc->timeout,
-                                                    &do_timeout,
-                                                    ccc);
-  GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
-                                 ccc);
-  ok = GNUNET_OK;
-  for (unsigned int i = 0; i < ccc->num_peers; i++)
-  {
-    struct GNUNET_MQ_MessageHandler handlers[] = {
-      GNUNET_MQ_hd_var_size (test,
-                             GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE,
-                             struct GNUNET_TRANSPORT_TESTING_TestMessage,
-                             NULL),
-      GNUNET_MQ_hd_var_size (test2,
-                             GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2,
-                             struct GNUNET_TRANSPORT_TESTING_TestMessage,
-                             NULL),
-      GNUNET_MQ_handler_end ()
-    };
-    ccc->p[i] = GNUNET_TRANSPORT_TESTING_start_peer (ccc->tth,
-                                                     ccc->cfg_files[i],
-                                                     i + 1,
-                                                     handlers,
-                                                     &my_nc,
-                                                     &my_nd,
-                                                     &ccc->ip[i],
-                                                     &start_cb,
-                                                     &ccc->ip[i]);
-    if (NULL == ccc->p[i])
-      ok = GNUNET_SYSERR;
-  }
-  if (GNUNET_OK != ok)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Fail! Could not start peers!\n");
-    GNUNET_SCHEDULER_shutdown ();
-  }
-}
-
-
-/**
- * Common implementation of the #GNUNET_TRANSPORT_TESTING_CheckCallback.
- * Starts and connects the two peers, then invokes the
- * `connect_continuation` from @a cls.  Sets up a timeout to
- * abort the test, and a shutdown handler to clean up properly
- * on exit.
- *
- * @param cls closure of type `struct 
GNUNET_TRANSPORT_TESTING_ConnectCheckContext`
- * @param tth_ initialized testing handle
- * @param test_plugin_ name of the plugin
- * @param test_name_ name of the test
- * @param num_peers number of entries in the @a cfg_file array
- * @param cfg_files array of names of configuration files for the peers
- * @return #GNUNET_SYSERR on error
- */
-int
-GNUNET_TRANSPORT_TESTING_connect_check (void *cls,
-                                        struct GNUNET_TRANSPORT_TESTING_Handle 
*
-                                        tth_,
-                                        const char *test_plugin_,
-                                        const char *test_name_,
-                                        unsigned int num_peers,
-                                        char *cfg_files[])
-{
-  static struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_OPTION_END
-  };
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc = cls;
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p[num_peers];
-  struct GNUNET_TRANSPORT_TESTING_InternalPeerContext ip[num_peers];
-  char *argv[] = {
-    (char *) test_name_,
-    "-c",
-    (char *) ccc->config_file,
-    NULL
-  };
-
-  ccc->num_peers = num_peers;
-  ccc->cfg_files = cfg_files;
-  ccc->test_plugin = test_plugin_;
-  ccc->test_name = test_name_;
-  ccc->tth = tth_;
-  ccc->global_ret = GNUNET_OK;
-  ccc->p = p;
-  ccc->ip = ip;
-  for (unsigned int i = 0; i < num_peers; i++)
-  {
-    ip[i].off = i;
-    ip[i].ccc = ccc;
-  }
-  if (GNUNET_OK !=
-      GNUNET_PROGRAM_run ((sizeof(argv) / sizeof(char *)) - 1,
-                          argv,
-                          test_name_,
-                          "nohelp",
-                          options,
-                          &connect_check_run,
-                          ccc))
-    return GNUNET_SYSERR;
-  return ccc->global_ret;
-}
-
-
-/**
- * Setup testcase.  Calls @a check with the data the test needs.
- *
- * @param argv0 binary name (argv[0])
- * @param filename source file name (__FILE__)
- * @param num_peers number of peers to start
- * @param check main function to run
- * @param check_cls closure for @a check
- * @return #GNUNET_OK on success
- */
-int
-GNUNET_TRANSPORT_TESTING_main_ (const char *argv0,
-                                const char *filename,
-                                unsigned int num_peers,
-                                GNUNET_TRANSPORT_TESTING_CheckCallback check,
-                                void *check_cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth;
-  char *test_name;
-  char *test_source;
-  char *test_plugin;
-  char *cfg_names[num_peers];
-  int ret;
-
-  ret = GNUNET_OK;
-  test_name = GNUNET_TRANSPORT_TESTING_get_test_name (argv0);
-  GNUNET_log_setup (test_name,
-                    "WARNING",
-                    NULL);
-  test_source = GNUNET_TRANSPORT_TESTING_get_test_source_name (filename);
-  test_plugin = GNUNET_TRANSPORT_TESTING_get_test_plugin_name (argv0,
-                                                               test_source);
-  for (unsigned int i = 0; i < num_peers; i++)
-    cfg_names[i] = GNUNET_TRANSPORT_TESTING_get_config_name (argv0,
-                                                             i + 1);
-  tth = GNUNET_TRANSPORT_TESTING_init ();
-  if (NULL == tth)
-  {
-    ret = GNUNET_SYSERR;
-  }
-  else
-  {
-    ret = check (check_cls,
-                 tth,
-                 test_plugin,
-                 test_name,
-                 num_peers,
-                 cfg_names);
-    GNUNET_TRANSPORT_TESTING_done (tth);
-  }
-  for (unsigned int i = 0; i < num_peers; i++)
-    GNUNET_free (cfg_names[i]);
-  GNUNET_free (test_source);
-  GNUNET_free (test_plugin);
-  GNUNET_free (test_name);
-  return ret;
-}
-
-
-/* end of transport-testing-main.c */
diff --git a/src/transport/transport-testing-send.c 
b/src/transport/transport-testing-send.c
deleted file mode 100644
index 9b017c563..000000000
--- a/src/transport/transport-testing-send.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport-testing-send.c
- * @brief convenience transmission function for tests
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "transport-testing.h"
-
-/**
- * Acceptable transmission delay.
- */
-#define TIMEOUT_TRANSMIT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_SECONDS, 30)
-
-
-/**
- * Return @a cx in @a cls.
- */
-static void
-find_cr (void *cls,
-         struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cx)
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest **cr = cls;
-
-  if (GNUNET_NO == cx->connected)
-    return;
-  *cr = cx;
-}
-
-
-/**
- * Send a test message of type @a mtype and size @a msize from
- * peer @a sender to peer @a receiver.  The peers should be
- * connected when this function is called.
- *
- * @param sender the sending peer
- * @param receiver the receiving peer
- * @param mtype message type to use
- * @param msize size of the message, at least `sizeof (struct 
GNUNET_TRANSPORT_TESTING_TestMessage)`
- * @param num unique message number
- * @param cont continuation to call after transmission
- * @param cont_cls closure for @a cont
- * @return #GNUNET_OK if message was queued,
- *         #GNUNET_NO if peers are not connected
- *         #GNUNET_SYSERR if @a msize is illegal
- */
-int
-GNUNET_TRANSPORT_TESTING_send (struct
-                               GNUNET_TRANSPORT_TESTING_PeerContext *sender,
-                               struct GNUNET_TRANSPORT_TESTING_PeerContext *
-                               receiver,
-                               uint16_t mtype,
-                               uint16_t msize,
-                               uint32_t num,
-                               GNUNET_SCHEDULER_TaskCallback cont,
-                               void *cont_cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cr;
-  struct GNUNET_MQ_Envelope *env;
-  struct GNUNET_TRANSPORT_TESTING_TestMessage *test;
-
-  if (msize < sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  cr = NULL;
-  GNUNET_TRANSPORT_TESTING_find_connecting_context (sender,
-                                                    receiver,
-                                                    &find_cr,
-                                                    &cr);
-  if (NULL == cr)
-    GNUNET_TRANSPORT_TESTING_find_connecting_context (receiver,
-                                                      sender,
-                                                      &find_cr,
-                                                      &cr);
-  if (NULL == cr)
-  {
-    GNUNET_break (0);
-    return GNUNET_NO;
-  }
-  if (NULL == cr->mq)
-  {
-    GNUNET_break (0);
-    return GNUNET_NO;
-  }
-  {
-    char *receiver_s = GNUNET_strdup (GNUNET_i2s (&receiver->id));
-
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Sending message from peer %u (`%s') -> peer %u (`%s') !\n",
-                sender->no,
-                GNUNET_i2s (&sender->id),
-                receiver->no,
-                receiver_s);
-    GNUNET_free (receiver_s);
-  }
-  env = GNUNET_MQ_msg_extra (test,
-                             msize - sizeof(*test),
-                             mtype);
-  test->num = htonl (num);
-  memset (&test[1],
-          num,
-          msize - sizeof(*test));
-  GNUNET_MQ_notify_sent (env,
-                         cont,
-                         cont_cls);
-  GNUNET_MQ_send (cr->mq,
-                  env);
-  return GNUNET_OK;
-}
-
-
-/**
- * Task that sends a test message from the
- * first peer to the second peer.
- *
- * @param ccc context which should contain at least two peers, the
- *        first two of which should be currently connected
- * @param size desired message size
- * @param cont continuation to call after transmission
- * @param cont_cls closure for @a cont
- */
-static void
-do_send (struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc,
-         uint16_t size,
-         GNUNET_SCHEDULER_TaskCallback cont,
-         void *cont_cls)
-{
-  int ret;
-
-  ccc->global_ret = GNUNET_SYSERR;
-  ret = GNUNET_TRANSPORT_TESTING_send (ccc->p[0],
-                                       ccc->p[1],
-                                       GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE,
-                                       size,
-                                       ccc->send_num_gen++,
-                                       cont,
-                                       cont_cls);
-  GNUNET_assert (GNUNET_SYSERR != ret);
-  if (GNUNET_NO == ret)
-  {
-    GNUNET_break (0);
-    ccc->global_ret = GNUNET_SYSERR;
-    GNUNET_SCHEDULER_shutdown ();
-  }
-}
-
-
-/**
- * Task that sends a minimalistic test message from the
- * first peer to the second peer.
- *
- * @param cls the `struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext`
- *        which should contain at least two peers, the first two
- *        of which should be currently connected
- */
-void
-GNUNET_TRANSPORT_TESTING_simple_send (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure *sc = cls;
-  int done;
-  size_t msize;
-
-  if (0 < sc->num_messages)
-  {
-    sc->num_messages--;
-    done = (0 == sc->num_messages);
-  }
-  else
-  {
-    done = 0;   /* infinite loop */
-  }
-  msize = sizeof(struct GNUNET_TRANSPORT_TESTING_TestMessage);
-  if (NULL != sc->get_size_cb)
-    msize = sc->get_size_cb (sc->num_messages);
-  /* if this was the last message, call the continuation,
-     otherwise call this function again */
-  do_send (sc->ccc,
-           msize,
-           done ? sc->cont : &GNUNET_TRANSPORT_TESTING_simple_send,
-           done ? sc->cont_cls : sc);
-}
-
-
-/**
- * Task that sends a large test message from the
- * first peer to the second peer.
- *
- * @param cls the `struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext`
- *        which should contain at least two peers, the first two
- *        of which should be currently connected
- */
-void
-GNUNET_TRANSPORT_TESTING_large_send (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_SendClosure *sc = cls;
-  int done;
-  size_t msize;
-
-  if (0 < sc->num_messages)
-  {
-    sc->num_messages--;
-    done = (0 == sc->num_messages);
-  }
-  else
-  {
-    done = 0;   /* infinite loop */
-  }
-  msize = 2600;
-  if (NULL != sc->get_size_cb)
-    msize = sc->get_size_cb (sc->num_messages);
-  /* if this was the last message, call the continuation,
-     otherwise call this function again */
-  do_send (sc->ccc,
-           msize,
-           done ? sc->cont : &GNUNET_TRANSPORT_TESTING_large_send,
-           done ? sc->cont_cls : sc);
-}
-
-
-/* end of transport-testing-send.c */
diff --git a/src/transport/transport-testing.c 
b/src/transport/transport-testing.c
deleted file mode 100644
index baced62e3..000000000
--- a/src/transport/transport-testing.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport-testing.c
- * @brief testing lib for transport service
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "transport-testing.h"
-
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-testing", __VA_ARGS__)
-
-
-static struct GNUNET_TRANSPORT_TESTING_PeerContext *
-find_peer_context (struct GNUNET_TRANSPORT_TESTING_Handle *tth,
-                   const struct GNUNET_PeerIdentity *peer)
-{
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *t;
-
-  for (t = tth->p_head; NULL != t; t = t->next)
-    if (0 == memcmp (&t->id,
-                     peer,
-                     sizeof(struct GNUNET_PeerIdentity)))
-      return t;
-  return NULL;
-}
-
-
-/**
- * Find any connecting context matching the given pair of peers.
- *
- * @param p1 first peer
- * @param p2 second peer
- * @param cb function to call
- * @param cb_cls closure for @a cb
- */
-void
-GNUNET_TRANSPORT_TESTING_find_connecting_context (struct
-                                                  
GNUNET_TRANSPORT_TESTING_PeerContext
-                                                  *p1,
-                                                  struct
-                                                  
GNUNET_TRANSPORT_TESTING_PeerContext
-                                                  *p2,
-                                                  
GNUNET_TRANSPORT_TESTING_ConnectContextCallback
-                                                  cb,
-                                                  void *cb_cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth = p1->tth;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *ccn;
-
-  for (cc = tth->cc_head; NULL != cc; cc = ccn)
-  {
-    ccn = cc->next;
-    if ((cc->p1 == p1) &&
-        (cc->p2 == p2))
-      cb (cb_cls,
-          cc);
-  }
-}
-
-
-static void
-set_p1c (void *cls,
-         struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cx)
-{
-  int *found = cls;
-
-  if (NULL != found)
-    *found = GNUNET_YES;
-  cx->p1_c = GNUNET_YES;
-}
-
-
-static void
-set_mq (void *cls,
-        struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cx)
-{
-  struct GNUNET_MQ_Handle *mq = cls;
-
-  cx->mq = mq;
-}
-
-
-static void
-set_p2c (void *cls,
-         struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cx)
-{
-  int *found = cls;
-
-  if (NULL != found)
-    *found = GNUNET_YES;
-  cx->p2_c = GNUNET_YES;
-}
-
-
-static void
-clear_p1c (void *cls,
-           struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cx)
-{
-  int *found = cls;
-
-  if (NULL != found)
-    *found = GNUNET_YES;
-  cx->p1_c = GNUNET_NO;
-}
-
-
-static void
-clear_p2c (void *cls,
-           struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cx)
-{
-  int *found = cls;
-
-  if (NULL != found)
-    *found = GNUNET_YES;
-  cx->p2_c = GNUNET_NO;
-}
-
-
-static void *
-notify_connect (void *cls,
-                const struct GNUNET_PeerIdentity *peer,
-                struct GNUNET_MQ_Handle *mq)
-{
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cls;
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth = p->tth;
-  char *p2_s;
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p2;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *ccn;
-  int found;
-  void *ret;
-
-  p2 = find_peer_context (p->tth,
-                          peer);
-  if (NULL != p->nc)
-    ret = p->nc (p->cb_cls,
-                 peer,
-                 mq);
-  else
-    ret = NULL;
-
-  if (NULL != p2)
-    GNUNET_asprintf (&p2_s,
-                     "%u (`%s')",
-                     p2->no,
-                     GNUNET_i2s (&p2->id));
-  else
-    GNUNET_asprintf (&p2_s,
-                     "`%s'",
-                     GNUNET_i2s (peer));
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Peers %s connected to peer %u (`%s')\n",
-       p2_s,
-       p->no,
-       GNUNET_i2s (&p->id));
-  GNUNET_free (p2_s);
-  /* update flags in connecting contexts */
-  found = GNUNET_NO;
-  GNUNET_TRANSPORT_TESTING_find_connecting_context (p,
-                                                    p2,
-                                                    &set_p1c,
-                                                    &found);
-  if (GNUNET_NO == found)
-  {
-    cc = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_ConnectRequest);
-    cc->p1 = p;
-    cc->p2 = p2;
-    cc->p1_c = GNUNET_YES;
-    GNUNET_CONTAINER_DLL_insert (tth->cc_head,
-                                 tth->cc_tail,
-                                 cc);
-  }
-  found = GNUNET_NO;
-  GNUNET_TRANSPORT_TESTING_find_connecting_context (p2,
-                                                    p,
-                                                    &set_p2c,
-                                                    &found);
-  if (GNUNET_NO == found)
-  {
-    cc = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_ConnectRequest);
-    cc->p1 = p2;
-    cc->p2 = p;
-    cc->p1_c = GNUNET_YES;
-    GNUNET_CONTAINER_DLL_insert (tth->cc_head,
-                                 tth->cc_tail,
-                                 cc);
-  }
-  GNUNET_TRANSPORT_TESTING_find_connecting_context (p,
-                                                    p2,
-                                                    &set_mq,
-                                                    mq);
-  /* update set connected flag for all requests */
-  for (cc = tth->cc_head; NULL != cc; cc = cc->next)
-  {
-    if (GNUNET_YES == cc->connected)
-      continue;
-    if ((GNUNET_YES == cc->p1_c) &&
-        (GNUNET_YES == cc->p2_c))
-    {
-      cc->connected = GNUNET_YES;
-      /* stop trying to connect */
-      if (NULL != cc->tct)
-      {
-        GNUNET_SCHEDULER_cancel (cc->tct);
-        cc->tct = NULL;
-      }
-      if (NULL != cc->oh)
-      {
-        GNUNET_TRANSPORT_offer_hello_cancel (cc->oh);
-        cc->oh = NULL;
-      }
-      if (NULL != cc->ats_sh)
-      {
-        GNUNET_ATS_connectivity_suggest_cancel (cc->ats_sh);
-        cc->ats_sh = NULL;
-      }
-    }
-  }
-  /* then notify application */
-  for (cc = tth->cc_head; NULL != cc; cc = ccn)
-  {
-    ccn = cc->next;
-    if ((GNUNET_YES == cc->connected) &&
-        (NULL != cc->cb))
-    {
-      cc->cb (cc->cb_cls);
-      cc->cb = NULL;     /* only notify once! */
-    }
-  }
-  return ret;
-}
-
-
-/**
- * Offer the current HELLO of P2 to P1.
- *
- * @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectRequest`
- */
-static void
-offer_hello (void *cls);
-
-
-static void
-notify_disconnect (void *cls,
-                   const struct GNUNET_PeerIdentity *peer,
-                   void *handler_cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cls;
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth = p->tth;
-  char *p2_s;
-  /* Find PeerContext */
-  int no = 0;
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p2 = NULL;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc;
-
-  p2 = find_peer_context (p->tth,
-                          peer);
-  no = p->no;
-  if (NULL != p2)
-    GNUNET_asprintf (&p2_s,
-                     "%u (`%s')",
-                     p2->no,
-                     GNUNET_i2s (&p2->id));
-  else
-    GNUNET_asprintf (&p2_s,
-                     "`%s'",
-                     GNUNET_i2s (peer));
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Peers %s disconnected from peer %u (`%s')\n",
-       p2_s,
-       no,
-       GNUNET_i2s (&p->id));
-  GNUNET_free (p2_s);
-  /* notify about disconnect */
-  if (NULL != p->nd)
-    p->nd (p->cb_cls,
-           peer,
-           handler_cls);
-  if (NULL == p2)
-    return;
-  /* clear MQ, it is now invalid */
-  GNUNET_TRANSPORT_TESTING_find_connecting_context (p,
-                                                    p2,
-                                                    &set_mq,
-                                                    NULL);
-  /* update set connected flags for all requests */
-  GNUNET_TRANSPORT_TESTING_find_connecting_context (p,
-                                                    p2,
-                                                    &clear_p1c,
-                                                    NULL);
-  GNUNET_TRANSPORT_TESTING_find_connecting_context (p2,
-                                                    p,
-                                                    &clear_p2c,
-                                                    NULL);
-  /* resume connectivity requests as necessary */
-  for (cc = tth->cc_head; NULL != cc; cc = cc->next)
-  {
-    if (GNUNET_NO == cc->connected)
-      continue;
-    if ((GNUNET_YES != cc->p1_c) ||
-        (GNUNET_YES != cc->p2_c))
-    {
-      cc->connected = GNUNET_NO;
-      /* start trying to connect */
-      if ((NULL == cc->tct) &&
-          (NULL == cc->oh))
-        cc->tct = GNUNET_SCHEDULER_add_now (&offer_hello,
-                                            cc);
-      if (NULL == cc->ats_sh)
-        cc->ats_sh = GNUNET_ATS_connectivity_suggest (cc->p1->ats,
-                                                      &p2->id,
-                                                      1);
-    }
-  }
-}
-
-
-static void
-get_hello (void *cb_cls,
-           const struct GNUNET_MessageHeader *message)
-{
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cb_cls;
-  struct GNUNET_PeerIdentity hello_id;
-
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_HELLO_get_id ((const struct
-                                       GNUNET_HELLO_Message *) message,
-                                      &hello_id));
-  GNUNET_assert (0 == memcmp (&hello_id,
-                              &p->id,
-                              sizeof(hello_id)));
-  GNUNET_free (p->hello);
-  p->hello = (struct GNUNET_HELLO_Message *) GNUNET_copy_message (message);
-
-  if (NULL != p->start_cb)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Peer %u (`%s') successfully started\n",
-         p->no,
-         GNUNET_i2s (&p->id));
-    p->start_cb (p->start_cb_cls);
-    p->start_cb = NULL;
-  }
-}
-
-
-/**
- * Start a peer with the given configuration
- * @param tth the testing handle
- * @param cfgname configuration file
- * @param peer_id a unique number to identify the peer
- * @param handlers functions for receiving messages
- * @param nc connect callback
- * @param nd disconnect callback
- * @param cb_cls closure for callback
- * @param start_cb start callback
- * @param start_cb_cls closure for callback
- * @return the peer context
- */
-struct GNUNET_TRANSPORT_TESTING_PeerContext *
-GNUNET_TRANSPORT_TESTING_start_peer (struct
-                                     GNUNET_TRANSPORT_TESTING_Handle *tth,
-                                     const char *cfgname,
-                                     int peer_id,
-                                     const struct
-                                     GNUNET_MQ_MessageHandler *handlers,
-                                     GNUNET_TRANSPORT_NotifyConnect nc,
-                                     GNUNET_TRANSPORT_NotifyDisconnect nd,
-                                     void *cb_cls,
-                                     GNUNET_SCHEDULER_TaskCallback start_cb,
-                                     void *start_cb_cls)
-{
-  char *emsg = NULL;
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p;
-  struct GNUNET_PeerIdentity dummy;
-  unsigned int i;
-
-  if (GNUNET_NO == GNUNET_DISK_file_test (cfgname))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "File not found: `%s'\n",
-         cfgname);
-    return NULL;
-  }
-
-  p = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_PeerContext);
-  p->tth = tth;
-  p->nc = nc;
-  p->nd = nd;
-  if (NULL != handlers)
-  {
-    for (i = 0; NULL != handlers[i].cb; i++)
-      ;
-    p->handlers = GNUNET_new_array (i + 1,
-                                    struct GNUNET_MQ_MessageHandler);
-    GNUNET_memcpy (p->handlers,
-                   handlers,
-                   i * sizeof(struct GNUNET_MQ_MessageHandler));
-  }
-  if (NULL != cb_cls)
-    p->cb_cls = cb_cls;
-  else
-    p->cb_cls = p;
-  p->start_cb = start_cb;
-  if (NULL != start_cb_cls)
-    p->start_cb_cls = start_cb_cls;
-  else
-    p->start_cb_cls = p;
-  GNUNET_CONTAINER_DLL_insert (tth->p_head,
-                               tth->p_tail,
-                               p);
-
-  /* Create configuration and call testing lib to modify it */
-  p->cfg = GNUNET_CONFIGURATION_create ();
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONFIGURATION_load (p->cfg, cfgname));
-  if (GNUNET_SYSERR ==
-      GNUNET_TESTING_configuration_create (tth->tl_system,
-                                           p->cfg))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Testing library failed to create unique configuration based on 
`%s'\n",
-         cfgname);
-    GNUNET_CONFIGURATION_destroy (p->cfg);
-    GNUNET_free (p);
-    return NULL;
-  }
-
-  p->no = peer_id;
-  /* Configure peer with configuration */
-  p->peer = GNUNET_TESTING_peer_configure (tth->tl_system,
-                                           p->cfg,
-                                           p->no,
-                                           NULL,
-                                           &emsg);
-  if (NULL == p->peer)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Testing library failed to create unique configuration based on `%s': 
`%s'\n",
-         cfgname,
-         emsg);
-    GNUNET_TRANSPORT_TESTING_stop_peer (p);
-    GNUNET_free (emsg);
-    return NULL;
-  }
-
-  if (GNUNET_OK != GNUNET_TESTING_peer_start (p->peer))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Testing library failed to create unique configuration based on 
`%s'\n",
-         cfgname);
-    GNUNET_TRANSPORT_TESTING_stop_peer (p);
-    return NULL;
-  }
-
-  memset (&dummy,
-          '\0',
-          sizeof(dummy));
-  GNUNET_TESTING_peer_get_identity (p->peer,
-                                    &p->id);
-  if (0 == memcmp (&dummy,
-                   &p->id,
-                   sizeof(struct GNUNET_PeerIdentity)))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Testing library failed to obtain peer identity for peer %u\n",
-         p->no);
-    GNUNET_TRANSPORT_TESTING_stop_peer (p);
-    return NULL;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Peer %u configured with identity `%s'\n",
-       p->no,
-       GNUNET_i2s_full (&p->id));
-  p->tmh = GNUNET_TRANSPORT_manipulation_connect (p->cfg);
-  p->th = GNUNET_TRANSPORT_core_connect (p->cfg,
-                                         NULL,
-                                         handlers,
-                                         p,
-                                         &notify_connect,
-                                         &notify_disconnect,
-                                         NULL);
-  if ((NULL == p->th) ||
-      (NULL == p->tmh))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Failed to connect to transport service for peer `%s': `%s'\n",
-         cfgname,
-         emsg);
-    GNUNET_TRANSPORT_TESTING_stop_peer (p);
-    GNUNET_free (emsg);
-    return NULL;
-  }
-  p->ats = GNUNET_ATS_connectivity_init (p->cfg);
-  if (NULL == p->ats)
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Failed to connect to ATS service for peer `%s': `%s'\n",
-         cfgname,
-         emsg);
-    GNUNET_TRANSPORT_TESTING_stop_peer (p);
-    GNUNET_free (emsg);
-    return NULL;
-  }
-  p->ghh = GNUNET_TRANSPORT_hello_get (p->cfg,
-                                       GNUNET_TRANSPORT_AC_ANY,
-                                       &get_hello,
-                                       p);
-  GNUNET_assert (NULL != p->ghh);
-  return p;
-}
-
-
-/**
- * Stops and restarts the given peer, sleeping (!) for 5s in between.
- *
- * @param p the peer
- * @param restart_cb callback to call when restarted
- * @param restart_cb_cls callback closure
- * @return #GNUNET_OK in success otherwise #GNUNET_SYSERR
- */
-int
-GNUNET_TRANSPORT_TESTING_restart_peer (struct
-                                       GNUNET_TRANSPORT_TESTING_PeerContext *p,
-                                       GNUNET_SCHEDULER_TaskCallback 
restart_cb,
-                                       void *restart_cb_cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *ccn;
-
-  /* shutdown */
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Stopping peer %u (`%s')\n",
-       p->no,
-       GNUNET_i2s (&p->id));
-  if (NULL != p->ghh)
-  {
-    GNUNET_TRANSPORT_hello_get_cancel (p->ghh);
-    p->ghh = NULL;
-  }
-  if (NULL != p->th)
-  {
-    GNUNET_TRANSPORT_core_disconnect (p->th);
-    p->th = NULL;
-  }
-  if (NULL != p->tmh)
-  {
-    GNUNET_TRANSPORT_manipulation_disconnect (p->tmh);
-    p->tmh = NULL;
-  }
-  for (cc = p->tth->cc_head; NULL != cc; cc = ccn)
-  {
-    ccn = cc->next;
-    if ((cc->p1 == p) ||
-        (cc->p2 == p))
-      GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc);
-  }
-  if (NULL != p->ats)
-  {
-    GNUNET_ATS_connectivity_done (p->ats);
-    p->ats = NULL;
-  }
-  if (GNUNET_SYSERR ==
-      GNUNET_TESTING_peer_stop (p->peer))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Failed to stop peer %u (`%s')\n",
-         p->no,
-         GNUNET_i2s (&p->id));
-    return GNUNET_SYSERR;
-  }
-
-  sleep (5);  // YUCK!
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Restarting peer %u (`%s')\n",
-       p->no,
-       GNUNET_i2s (&p->id));
-  /* restart */
-  if (GNUNET_SYSERR == GNUNET_TESTING_peer_start (p->peer))
-  {
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Failed to restart peer %u (`%s')\n",
-         p->no,
-         GNUNET_i2s (&p->id));
-    return GNUNET_SYSERR;
-  }
-
-  GNUNET_assert (NULL == p->start_cb);
-  p->start_cb = restart_cb;
-  p->start_cb_cls = restart_cb_cls;
-
-  p->th = GNUNET_TRANSPORT_core_connect (p->cfg,
-                                         NULL,
-                                         p->handlers,
-                                         p,
-                                         &notify_connect,
-                                         &notify_disconnect,
-                                         NULL);
-  GNUNET_assert (NULL != p->th);
-  p->ats = GNUNET_ATS_connectivity_init (p->cfg);
-  p->ghh = GNUNET_TRANSPORT_hello_get (p->cfg,
-                                       GNUNET_TRANSPORT_AC_ANY,
-                                       &get_hello,
-                                       p);
-  GNUNET_assert (NULL != p->ghh);
-  return GNUNET_OK;
-}
-
-
-/**
- * Shutdown the given peer
- *
- * @param p the peer
- */
-void
-GNUNET_TRANSPORT_TESTING_stop_peer (struct
-                                    GNUNET_TRANSPORT_TESTING_PeerContext *p)
-{
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth = p->tth;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *ccn;
-
-  for (cc = tth->cc_head; NULL != cc; cc = ccn)
-  {
-    ccn = cc->next;
-    if ((cc->p1 == p) ||
-        (cc->p2 == p))
-      GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc);
-  }
-  if (NULL != p->ghh)
-  {
-    GNUNET_TRANSPORT_hello_get_cancel (p->ghh);
-    p->ghh = NULL;
-  }
-  if (NULL != p->tmh)
-  {
-    GNUNET_TRANSPORT_manipulation_disconnect (p->tmh);
-    p->tmh = NULL;
-  }
-  if (NULL != p->th)
-  {
-    GNUNET_TRANSPORT_core_disconnect (p->th);
-    p->th = NULL;
-  }
-  if (NULL != p->peer)
-  {
-    if (GNUNET_OK !=
-        GNUNET_TESTING_peer_stop (p->peer))
-    {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Testing lib failed to stop peer %u (`%s')\n",
-           p->no,
-           GNUNET_i2s (&p->id));
-    }
-    GNUNET_TESTING_peer_destroy (p->peer);
-    p->peer = NULL;
-  }
-  if (NULL != p->ats)
-  {
-    GNUNET_ATS_connectivity_done (p->ats);
-    p->ats = NULL;
-  }
-  if (NULL != p->hello)
-  {
-    GNUNET_free (p->hello);
-    p->hello = NULL;
-  }
-  if (NULL != p->cfg)
-  {
-    GNUNET_CONFIGURATION_destroy (p->cfg);
-    p->cfg = NULL;
-  }
-  if (NULL != p->handlers)
-  {
-    GNUNET_free (p->handlers);
-    p->handlers = NULL;
-  }
-  GNUNET_CONTAINER_DLL_remove (tth->p_head,
-                               tth->p_tail,
-                               p);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Peer %u (`%s') stopped\n",
-       p->no,
-       GNUNET_i2s (&p->id));
-  GNUNET_free (p);
-}
-
-
-/**
- * Function called after the HELLO was passed to the
- * transport service.
- */
-static void
-hello_offered (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = cls;
-
-  cc->oh = NULL;
-  cc->tct = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                          &offer_hello,
-                                          cc);
-}
-
-
-/**
- * Offer the current HELLO of P2 to P1.
- *
- * @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectRequest`
- */
-static void
-offer_hello (void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = cls;
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p1 = cc->p1;
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p2 = cc->p2;
-
-  cc->tct = NULL;
-  {
-    char *p2_s = GNUNET_strdup (GNUNET_i2s (&p2->id));
-
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Asking peer %u (`%s') to connect peer %u (`%s'), providing HELLO 
with %u bytes\n",
-         p1->no,
-         GNUNET_i2s (&p1->id),
-         p2->no,
-         p2_s,
-         GNUNET_HELLO_size (cc->p2->hello));
-    GNUNET_free (p2_s);
-  }
-
-  if (NULL != cc->oh)
-    GNUNET_TRANSPORT_offer_hello_cancel (cc->oh);
-  cc->oh =
-    GNUNET_TRANSPORT_offer_hello (cc->p1->cfg,
-                                  (const struct
-                                   GNUNET_MessageHeader *) cc->p2->hello,
-                                  &hello_offered,
-                                  cc);
-}
-
-
-/**
- * Initiate a connection from p1 to p2 by offering p1 p2's HELLO message
- *
- * Remarks: start_peer's notify_connect callback can be called before.
- *
- * @param tth transport testing handle
- * @param p1 peer 1
- * @param p2 peer 2
- * @param cb the callback to call when both peers notified that they are 
connected
- * @param cls callback cls
- * @return a connect request handle
- */
-struct GNUNET_TRANSPORT_TESTING_ConnectRequest *
-GNUNET_TRANSPORT_TESTING_connect_peers (struct
-                                        GNUNET_TRANSPORT_TESTING_PeerContext 
*p1,
-                                        struct
-                                        GNUNET_TRANSPORT_TESTING_PeerContext 
*p2,
-                                        GNUNET_SCHEDULER_TaskCallback cb,
-                                        void *cls)
-{
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth = p1->tth;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *ccn;
-
-  ccn = NULL;
-  for (cc = tth->cc_head; NULL != cc; cc = cc->next)
-  {
-    if ((cc->p1 == p1) &&
-        (cc->p2 == p2))
-    {
-      ccn = cc;
-      break;
-    }
-  }
-
-  cc = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_ConnectRequest);
-  cc->p1 = p1;
-  cc->p2 = p2;
-  cc->cb = cb;
-  if (NULL != cls)
-    cc->cb_cls = cls;
-  else
-    cc->cb_cls = cc;
-  if (NULL != ccn)
-  {
-    cc->p1_c = ccn->p1_c;
-    cc->p2_c = ccn->p2_c;
-    cc->connected = ccn->connected;
-  }
-  GNUNET_CONTAINER_DLL_insert (tth->cc_head,
-                               tth->cc_tail,
-                               cc);
-  cc->tct = GNUNET_SCHEDULER_add_now (&offer_hello,
-                                      cc);
-  cc->ats_sh = GNUNET_ATS_connectivity_suggest (cc->p1->ats,
-                                                &p2->id,
-                                                1);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "New connect request %p\n",
-       cc);
-  return cc;
-}
-
-
-/**
- * Cancel the request to connect two peers
- * Tou MUST cancel the request if you stop the peers before the peers 
connected successfully
- *
- * @param tth transport testing handle
- * @param cc a connect request handle
- */
-void
-GNUNET_TRANSPORT_TESTING_connect_peers_cancel (struct
-                                               
GNUNET_TRANSPORT_TESTING_ConnectRequest
-                                               *cc)
-{
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth = cc->p1->tth;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Canceling connect request!\n");
-  if (NULL != cc->tct)
-  {
-    GNUNET_SCHEDULER_cancel (cc->tct);
-    cc->tct = NULL;
-  }
-  if (NULL != cc->oh)
-  {
-    GNUNET_TRANSPORT_offer_hello_cancel (cc->oh);
-    cc->oh = NULL;
-  }
-  if (NULL != cc->ats_sh)
-  {
-    GNUNET_ATS_connectivity_suggest_cancel (cc->ats_sh);
-    cc->ats_sh = NULL;
-  }
-  GNUNET_CONTAINER_DLL_remove (tth->cc_head,
-                               tth->cc_tail,
-                               cc);
-  GNUNET_free (cc);
-}
-
-
-/**
- * Clean up the transport testing
- *
- * @param tth transport testing handle
- */
-void
-GNUNET_TRANSPORT_TESTING_done (struct GNUNET_TRANSPORT_TESTING_Handle *tth)
-{
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc;
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *ct;
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p;
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *t;
-
-  if (NULL == tth)
-    return;
-  cc = tth->cc_head;
-  while (NULL != cc)
-  {
-    ct = cc->next;
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Developer forgot to cancel connect request!\n");
-    GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc);
-    cc = ct;
-  }
-  p = tth->p_head;
-  while (NULL != p)
-  {
-    t = p->next;
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Developer forgot to stop peer!\n");
-    GNUNET_TRANSPORT_TESTING_stop_peer (p);
-    p = t;
-  }
-  GNUNET_TESTING_system_destroy (tth->tl_system,
-                                 GNUNET_YES);
-
-  GNUNET_free (tth);
-}
-
-
-/**
- * Initialize the transport testing
- *
- * @return transport testing handle
- */
-struct GNUNET_TRANSPORT_TESTING_Handle *
-GNUNET_TRANSPORT_TESTING_init ()
-{
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth;
-
-  tth = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_Handle);
-  tth->tl_system = GNUNET_TESTING_system_create ("transport-testing",
-                                                 NULL,
-                                                 NULL,
-                                                 NULL);
-  if (NULL == tth->tl_system)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Failed to initialize testing library!\n");
-    GNUNET_free (tth);
-    return NULL;
-  }
-  return tth;
-}
-
-
-/* end of transport-testing.c */
diff --git a/src/transport/transport-testing.h 
b/src/transport/transport-testing.h
deleted file mode 100644
index c548e59c1..000000000
--- a/src/transport/transport-testing.h
+++ /dev/null
@@ -1,914 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport-testing.h
- * @brief testing lib for transport service
- * @author Matthias Wachs
- * @author Christian Grothoff
- */
-#ifndef TRANSPORT_TESTING_H
-#define TRANSPORT_TESTING_H
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_transport_service.h"
-#include "gnunet_transport_hello_service.h"
-#include "gnunet_transport_manipulation_service.h"
-#include "gnunet_testing_lib.h"
-
-
-/* ************* Basic functions for starting/stopping/connecting *********** 
*/
-
-/**
- * Context for a single peer
- */
-struct GNUNET_TRANSPORT_TESTING_PeerContext;
-
-/**
- * Definition for a transport testing handle
- */
-struct GNUNET_TRANSPORT_TESTING_Handle;
-
-
-/**
- * Context for a single peer
- */
-struct GNUNET_TRANSPORT_TESTING_PeerContext
-{
-  /**
-   * Next element in the DLL
-   */
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *next;
-
-  /**
-   * Previous element in the DLL
-   */
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *prev;
-
-  /**
-   * Transport testing handle this peer belongs to
-   */
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth;
-
-  /**
-   * Peer's configuration
-   */
-  struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Peer's transport service handle
-   */
-  struct GNUNET_TRANSPORT_CoreHandle *th;
-
-  /**
-   * Peer's transport service manipulation handle
-   */
-  struct GNUNET_TRANSPORT_ManipulationHandle *tmh;
-
-  /**
-   * Peer's ATS handle.
-   */
-  struct GNUNET_ATS_ConnectivityHandle *ats;
-
-  /**
-   * Peer's transport get hello handle to retrieve peer's HELLO message
-   */
-  struct GNUNET_TRANSPORT_HelloGetHandle *ghh;
-
-  /**
-   * Peer's testing handle
-   */
-  struct GNUNET_TESTING_Peer *peer;
-
-  /**
-   * Peer identity
-   */
-  struct GNUNET_PeerIdentity id;
-
-  /**
-   * Handle for the peer's ARM process
-   */
-  struct GNUNET_OS_Process *arm_proc;
-
-  /**
-   * Receive callback
-   */
-  struct GNUNET_MQ_MessageHandler *handlers;
-
-  /**
-   * Notify connect callback
-   */
-  GNUNET_TRANSPORT_NotifyConnect nc;
-
-  /**
-   * Notify disconnect callback
-   */
-  GNUNET_TRANSPORT_NotifyDisconnect nd;
-
-  /**
-   * Startup completed callback
-   */
-  GNUNET_SCHEDULER_TaskCallback start_cb;
-
-  /**
-   * Peers HELLO Message
-   */
-  struct GNUNET_HELLO_Message *hello;
-
-  /**
-   * Closure for the @a nc and @a nd callbacks
-   */
-  void *cb_cls;
-
-  /**
-   * Closure for @e start_cb.
-   */
-  void *start_cb_cls;
-
-  /**
-   * An unique number to identify the peer
-   */
-  unsigned int no;
-};
-
-
-/**
- * Handle for a request to connect two peers.
- */
-struct GNUNET_TRANSPORT_TESTING_ConnectRequest
-{
-  /**
-   * Kept in a DLL.
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *next;
-
-  /**
-   * Kept in a DLL.
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *prev;
-
-  /**
-   * Peer we want to connect.
-   */
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p1;
-
-  /**
-   * Peer we want to connect.
-   */
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p2;
-
-  /**
-   * Task by which we accomplish the connection.
-   */
-  struct GNUNET_SCHEDULER_Task *tct;
-
-  /**
-   * Handle by which we ask ATS to facilitate the connection.
-   */
-  struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh;
-
-  /**
-   * Handle by which we inform the peer about the HELLO of
-   * the other peer.
-   */
-  struct GNUNET_TRANSPORT_OfferHelloHandle *oh;
-
-  /**
-   * Function to call upon completion.
-   */
-  GNUNET_SCHEDULER_TaskCallback cb;
-
-  /**
-   * Closure for @e cb.
-   */
-  void *cb_cls;
-
-  /**
-   * Message queue for sending from @a p1 to @a p2.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Set if peer1 says the connection is up to peer2.
-   */
-  int p1_c;
-
-  /**
-   * Set if peer2 says the connection is up to peer1.
-   */
-  int p2_c;
-
-  /**
-   * #GNUNET_YES if both @e p1_c and @e p2_c are #GNUNET_YES.
-   */
-  int connected;
-};
-
-
-/**
- * Handle for a test run.
- */
-struct GNUNET_TRANSPORT_TESTING_Handle
-{
-  /**
-   * Testing library system handle
-   */
-  struct GNUNET_TESTING_System *tl_system;
-
-  /**
-   * head DLL of connect contexts
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc_head;
-
-  /**
-   * head DLL of connect contexts
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc_tail;
-
-  /**
-   * head DLL of peers
-   */
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p_head;
-
-  /**
-   * tail DLL of peers
-   */
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p_tail;
-};
-
-
-/**
- * Initialize the transport testing
- *
- * @return transport testing handle
- */
-struct GNUNET_TRANSPORT_TESTING_Handle *
-GNUNET_TRANSPORT_TESTING_init (void);
-
-
-/**
- * Clean up the transport testing
- *
- * @param tth transport testing handle
- */
-void
-GNUNET_TRANSPORT_TESTING_done (struct GNUNET_TRANSPORT_TESTING_Handle *tth);
-
-
-/**
- * Start a peer with the given configuration
- *
- * @param tth the testing handle
- * @param cfgname configuration file
- * @param peer_id the peer_id
- * @param handlers functions for receiving messages
- * @param nc connect callback
- * @param nd disconnect callback
- * @param cb_cls closure for @a nc and @a nd callback
- * @param start_cb start callback
- * @param start_cb_cls closure for @a start_cb
- * @return the peer context
- */
-struct GNUNET_TRANSPORT_TESTING_PeerContext *
-GNUNET_TRANSPORT_TESTING_start_peer (
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth,
-  const char *cfgname,
-  int peer_id,
-  const struct GNUNET_MQ_MessageHandler *handlers,
-  GNUNET_TRANSPORT_NotifyConnect nc,
-  GNUNET_TRANSPORT_NotifyDisconnect nd,
-  void *cb_cls,
-  GNUNET_SCHEDULER_TaskCallback start_cb,
-  void *start_cb_cls);
-
-
-/**
- * Shutdown the given peer
- *
- * @param p the peer
- */
-void
-GNUNET_TRANSPORT_TESTING_stop_peer (
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *pc);
-
-
-/**
- * Stops and restarts the given peer, sleeping (!) for 5s in between.
- *
- * @param p the peer
- * @param restart_cb restart callback
- * @param restart_cb_cls callback closure
- * @return #GNUNET_OK in success otherwise #GNUNET_SYSERR
- */
-int
-GNUNET_TRANSPORT_TESTING_restart_peer (
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p,
-  GNUNET_SCHEDULER_TaskCallback restart_cb,
-  void *restart_cb_cls);
-
-
-/**
- * Connect the given peers and call the callback when both peers
- * report the inbound connection. Remarks: start_peer's notify_connect
- * callback can be called before.
- *
- * @param p1 peer 1
- * @param p2 peer 2
- * @param cb the callback to call when both peers notified that they are
- * connected
- * @param cls callback cls
- * @return a connect request handle
- */
-struct GNUNET_TRANSPORT_TESTING_ConnectRequest *
-GNUNET_TRANSPORT_TESTING_connect_peers (
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p1,
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p2,
-  GNUNET_SCHEDULER_TaskCallback cb,
-  void *cls);
-
-
-/**
- * Cancel the request to connect two peers.  You MUST cancel the
- * request if you stop the peers before the peers connected
- * successfully.
- *
- * @param cc a connect request handle
- */
-void
-GNUNET_TRANSPORT_TESTING_connect_peers_cancel (
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc);
-
-
-/**
- * Function called on matching connect requests.
- *
- * @param cls closure
- * @param cc request matching the query
- */
-typedef void (*GNUNET_TRANSPORT_TESTING_ConnectContextCallback) (
-  void *cls,
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc);
-
-
-/**
- * Find any connecting context matching the given pair of peers.
- *
- * @param p1 first peer
- * @param p2 second peer
- * @param cb function to call
- * @param cb_cls closure for @a cb
- */
-void
-GNUNET_TRANSPORT_TESTING_find_connecting_context (
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p1,
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p2,
-  GNUNET_TRANSPORT_TESTING_ConnectContextCallback cb,
-  void *cb_cls);
-
-
-/* ********************** high-level process functions *************** */
-
-
-/**
- * Function called once the peers have been launched and
- * connected by #GNUNET_TRANSPORT_TESTING_connect_check().
- *
- * @param cls closure
- * @param num_peers size of the @a p array
- * @param p the peers that were launched
- */
-typedef void (*GNUNET_TRANSPORT_TESTING_ConnectContinuation) (
-  void *cls,
-  unsigned int num_peers,
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *p[]);
-
-
-/**
- * Internal data structure.
- */
-struct GNUNET_TRANSPORT_TESTING_ConnectRequestList;
-
-/**
- * Internal data structure.
- */
-struct GNUNET_TRANSPORT_TESTING_InternalPeerContext;
-
-
-GNUNET_NETWORK_STRUCT_BEGIN
-struct GNUNET_TRANSPORT_TESTING_TestMessage
-{
-  /**
-   * Type is (usually) #GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Monotonically increasing counter throughout the test.
-   */
-  uint32_t num GNUNET_PACKED;
-};
-GNUNET_NETWORK_STRUCT_END
-
-
-/**
- * Function called by the transport for each received message.
- *
- * @param cls closure
- * @param receiver receiver of the message
- * @param sender sender of the message
- * @param message the message
- */
-typedef void (*GNUNET_TRANSPORT_TESTING_ReceiveCallback) (
-  void *cls,
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-  const struct GNUNET_PeerIdentity *sender,
-  const struct GNUNET_TRANSPORT_TESTING_TestMessage *message);
-
-
-/**
- * Function called to notify transport users that another
- * peer connected to us.
- *
- * @param cls closure
- * @param me peer experiencing the event
- * @param other peer that connected to @a me
- */
-typedef void (*GNUNET_TRANSPORT_TESTING_NotifyConnect) (
-  void *cls,
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
-  const struct GNUNET_PeerIdentity *other);
-
-
-/**
- * Function called to notify transport users that another
- * peer disconnected from us.
- *
- * @param cls closure
- * @param me peer experiencing the event
- * @param other peer that disconnected from @a me
- */
-typedef void (*GNUNET_TRANSPORT_TESTING_NotifyDisconnect) (
-  void *cls,
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
-  const struct GNUNET_PeerIdentity *other);
-
-
-/**
- * Closure that must be passed to
- * #GNUNET_TRANSPORT_TESTING_connect_check.
- */
-struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext
-{
-  /**
-   * How should we continue after the connect?
-   */
-  GNUNET_SCHEDULER_TaskCallback connect_continuation;
-
-  /**
-   * Closure for @e connect_continuation.
-   */
-  void *connect_continuation_cls;
-
-  /**
-   * Which configuration file should we pass to the
-   * #GNUNET_PROGRAM_run() of the testcase?
-   */
-  const char *config_file;
-
-  /**
-   * Receiver argument to give for peers we start.
-   */
-  GNUNET_TRANSPORT_TESTING_ReceiveCallback rec;
-
-  /**
-   * Notify connect argument to give for peers we start.
-   */
-  GNUNET_TRANSPORT_TESTING_NotifyConnect nc;
-
-  /**
-   * Notify disconnect argument to give for peers we start.
-   */
-  GNUNET_TRANSPORT_TESTING_NotifyDisconnect nd;
-
-  /**
-   * Closure for @e rec, @e nc and @e nd.
-   */
-  void *cls;
-
-  /**
-   * Custom task to run on shutdown.
-   */
-  GNUNET_SCHEDULER_TaskCallback shutdown_task;
-
-  /**
-   * Closure for @e shutdown_task.
-   */
-  void *shutdown_task_cls;
-
-  /**
-   * Custom task to run after peers were started but before we try to
-   * connect them.  If this function is set, we wait ONE second after
-   * running this function until we continue with connecting the
-   * peers.
-   */
-  GNUNET_SCHEDULER_TaskCallback pre_connect_task;
-
-  /**
-   * Closure for @e shutdown_task.
-   */
-  void *pre_connect_task_cls;
-
-  /**
-   * When should the testcase time out?
-   */
-  struct GNUNET_TIME_Relative timeout;
-
-  /**
-   * Should we try to create connections in both directions?
-   */
-  int bi_directional;
-
-  /* ******* fields set by #GNUNET_TRANSPORT_TESTING_connect_check **** */
-
-  /**
-   * Number of peers involved in the test.
-   */
-  unsigned int num_peers;
-
-  /**
-   * Configuration files we have, array with @e num_peers entries.
-   */
-  char **cfg_files;
-
-  /**
-   * Array with @e num_peers entries.
-   */
-  struct GNUNET_TRANSPORT_TESTING_PeerContext **p;
-
-  /**
-   * Name of the plugin.
-   */
-  const char *test_plugin;
-
-  /**
-   * Name of the testcase.
-   */
-  const char *test_name;
-
-  /**
-   * Configuration object for the testcase.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Main testing handle.
-   */
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth;
-
-  /**
-   * Result from the main function, set to #GNUNET_OK on success.
-   * Clients should set to #GNUNET_SYSERR to indicate test failure.
-   */
-  int global_ret;
-
-  /**
-   * Generator for the `num` field in test messages.  Incremented each
-   * time #GNUNET_TRANSPORT_TESTING_simple_send or
-   * #GNUNET_TRANSPORT_TESTING_large_send are used to transmit a
-   * message.
-   */
-  uint32_t send_num_gen;
-
-  /* ******* internal state, clients should not mess with this **** */
-
-  /**
-   * Task run on timeout.
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * Task run to connect peers.
-   */
-  struct GNUNET_SCHEDULER_Task *connect_task;
-
-  /**
-   * Number of peers that have been started.
-   */
-  unsigned int started;
-
-  /**
-   * DLL of active connect requests.
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequestList *crl_head;
-
-  /**
-   * DLL of active connect requests.
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectRequestList *crl_tail;
-
-  /**
-   * Array with @e num_peers entries.
-   */
-  struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *ip;
-};
-
-
-/**
- * Find peer by peer ID.
- *
- * @param ccc context to search
- * @param peer peer to look for
- * @return NULL if @a peer was not found
- */
-struct GNUNET_TRANSPORT_TESTING_PeerContext *
-GNUNET_TRANSPORT_TESTING_find_peer (
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc,
-  const struct GNUNET_PeerIdentity *peer);
-
-
-/**
- * Common implementation of the #GNUNET_TRANSPORT_TESTING_CheckCallback.
- * Starts and connects the two peers, then invokes the
- * `connect_continuation` from @a cls.  Sets up a timeout to
- * abort the test, and a shutdown handler to clean up properly
- * on exit.
- *
- * @param cls closure of type `struct
- * GNUNET_TRANSPORT_TESTING_ConnectCheckContext`
- * @param tth_ initialized testing handle
- * @param test_plugin_ name of the plugin
- * @param test_name_ name of the test
- * @param num_peers number of entries in the @a cfg_file array
- * @param cfg_files array of names of configuration files for the peers
- * @return #GNUNET_SYSERR on error
- */
-int
-GNUNET_TRANSPORT_TESTING_connect_check (
-  void *cls,
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth_,
-  const char *test_plugin_,
-  const char *test_name_,
-  unsigned int num_peers,
-  char *cfg_files[]);
-
-
-/**
- * Main function of a testcase.  Called with the initial setup data
- * for the test as derived from the source name and the binary name.
- *
- * @param cls closure
- * @param tth_ initialized testing handle
- * @param test_plugin_ name of the plugin
- * @param test_name_ name of the test
- * @param num_peers number of entries in the @a cfg_file array
- * @param cfg_files array of names of configuration files for the peers
- * @return #GNUNET_SYSERR on error
- */
-typedef int (*GNUNET_TRANSPORT_TESTING_CheckCallback) (
-  void *cls,
-  struct GNUNET_TRANSPORT_TESTING_Handle *tth_,
-  const char *test_plugin_,
-  const char *test_name_,
-  unsigned int num_peers,
-  char *cfg_files[]);
-
-
-/**
- * Setup testcase.  Calls @a check with the data the test needs.
- *
- * @param argv0 binary name (argv[0])
- * @param filename source file name (__FILE__)
- * @param num_peers number of peers to start
- * @param check main function to run
- * @param check_cls closure for @a check
- * @return #GNUNET_OK on success
- */
-int
-GNUNET_TRANSPORT_TESTING_main_ (const char *argv0,
-                                const char *filename,
-                                unsigned int num_peers,
-                                GNUNET_TRANSPORT_TESTING_CheckCallback check,
-                                void *check_cls);
-
-
-/**
- * Setup testcase.  Calls @a check with the data the test needs.
- *
- * @param num_peers number of peers to start
- * @param check main function to run
- * @param check_cls closure for @a check
- * @return #GNUNET_OK on success
- */
-#define GNUNET_TRANSPORT_TESTING_main(num_peers, check, check_cls) \
-  GNUNET_TRANSPORT_TESTING_main_ (argv[0],                         \
-                                  __FILE__,                        \
-                                  num_peers,                       \
-                                  check,                           \
-                                  check_cls)
-
-/* ***************** Convenience functions for sending ********* */
-
-/**
- * Send a test message of type @a mtype and size @a msize from
- * peer @a sender to peer @a receiver.  The peers should be
- * connected when this function is called.
- *
- * @param sender the sending peer
- * @param receiver the receiving peer
- * @param mtype message type to use
- * @param msize size of the message, at least `sizeof (struct
- * GNUNET_TRANSPORT_TESTING_TestMessage)`
- * @param num unique message number
- * @param cont continuation to call after transmission
- * @param cont_cls closure for @a cont
- * @return #GNUNET_OK if message was queued,
- *         #GNUNET_NO if peers are not connected
- *         #GNUNET_SYSERR if @a msize is illegal
- */
-int
-GNUNET_TRANSPORT_TESTING_send (
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *sender,
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *receiver,
-  uint16_t mtype,
-  uint16_t msize,
-  uint32_t num,
-  GNUNET_SCHEDULER_TaskCallback cont,
-  void *cont_cls);
-
-
-/**
- * Message type used by #GNUNET_TRANSPORT_TESTING_simple_send().
- */
-#define GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE 12345
-
-/**
- * Alternative message type for tests.
- */
-#define GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE2 12346
-
-
-/**
- * Type of the closure argument to pass to
- * #GNUNET_TRANSPORT_TESTING_simple_send() and
- * #GNUNET_TRANSPORT_TESTING_large_send().
- */
-struct GNUNET_TRANSPORT_TESTING_SendClosure
-{
-  /**
-   * Context for the transmission.
-   */
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext *ccc;
-
-  /**
-   * Function that returns the desired message size. Overrides
-   * the message size, can be NULL in which case the message
-   * size is the default.
-   */
-  size_t (*get_size_cb) (unsigned int n);
-
-  /**
-   * Number of messages to be transmitted in a loop.
-   * Use zero for "forever" (until external shutdown).
-   */
-  unsigned int num_messages;
-
-  /**
-   * Function to call after all transmissions, can be NULL.
-   */
-  GNUNET_SCHEDULER_TaskCallback cont;
-
-  /**
-   * Closure for @e cont.
-   */
-  void *cont_cls;
-};
-
-
-/**
- * Task that sends a minimalistic test message from the
- * first peer to the second peer.
- *
- * @param cls the `struct GNUNET_TRANSPORT_TESTING_SendClosure`
- *        which should contain at least two peers, the first two
- *        of which should be currently connected
- */
-void
-GNUNET_TRANSPORT_TESTING_simple_send (void *cls);
-
-/**
- * Size of a message sent with
- * #GNUNET_TRANSPORT_TESTING_large_send().  Big enough
- * to usually force defragmentation.
- */
-#define GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE 2600
-
-/**
- * Task that sends a large test message from the
- * first peer to the second peer.
- *
- * @param cls the `struct GNUNET_TRANSPORT_TESTING_SendClosure`
- *        which should contain at least two peers, the first two
- *        of which should be currently connected
- */
-void
-GNUNET_TRANSPORT_TESTING_large_send (void *cls);
-
-
-/* ********************** log-only convenience functions ************* */
-
-
-/**
- * Log a connect event.
- *
- * @param cls NULL
- * @param me peer that had the event
- * @param other peer that connected.
- */
-void
-GNUNET_TRANSPORT_TESTING_log_connect (
-  void *cls,
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
-  const struct GNUNET_PeerIdentity *other);
-
-
-/**
- * Log a disconnect event.
- *
- * @param cls NULL
- * @param me peer that had the event
- * @param other peer that disconnected.
- */
-void
-GNUNET_TRANSPORT_TESTING_log_disconnect (
-  void *cls,
-  struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
-  const struct GNUNET_PeerIdentity *other);
-
-
-/* ********************** low-level filename functions *************** */
-
-
-/**
- * Extracts the test filename from an absolute file name and removes
- * the extension.
- *
- * @param file absolute file name
- * @return resulting test name
- */
-char *
-GNUNET_TRANSPORT_TESTING_get_test_name (const char *file);
-
-
-/**
- * This function takes the filename (e.g. argv[0), removes a "lt-"-prefix and
- * if existing ".exe"-prefix and adds the peer-number
- *
- * @param file filename of the test, e.g. argv[0]
- * @param count peer number
- * @return configuration name to use
- */
-char *
-GNUNET_TRANSPORT_TESTING_get_config_name (const char *file, int count);
-
-
-/**
- * Extracts the plugin anme from an absolute file name and the test name
- * @param file absolute file name
- * @param test test name
- * @return the plugin name
- */
-char *
-GNUNET_TRANSPORT_TESTING_get_test_plugin_name (const char *executable,
-                                               const char *testname);
-
-
-/**
- * Extracts the filename from an absolute file name and removes the
- * extension
- *
- * @param file absolute file name
- * @return the source name
- */
-char *
-GNUNET_TRANSPORT_TESTING_get_test_source_name (const char *file);
-
-#endif
-/* end of transport_testing.h */
diff --git a/src/transport/transport-testing2.c 
b/src/transport/transport-testing2.c
index ec27ac8ba..11bb6c7d1 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -225,10 +225,10 @@ notify_connect (void *cls,
         GNUNET_SCHEDULER_cancel (cc->tct);
         cc->tct = NULL;
       }
-      if (NULL != cc->ats_sh)
+      if (NULL != cc->ah_sh)
       {
-        GNUNET_ATS_connectivity_suggest_cancel (cc->ats_sh);
-        cc->ats_sh = NULL;
+        GNUNET_TRANSPORT_application_suggest_cancel (cc->ah_sh);
+        cc->ah_sh = NULL;
       }
     }
   }
@@ -268,6 +268,7 @@ notify_disconnect (void *cls,
   int no = 0;
   struct GNUNET_TRANSPORT_TESTING_PeerContext *p2 = NULL;
   struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc;
+  struct GNUNET_BANDWIDTH_Value32NBO bw;
 
   p2 = find_peer_context (p->tth,
                           peer);
@@ -321,10 +322,11 @@ notify_disconnect (void *cls,
       if (NULL == cc->tct)
         cc->tct = GNUNET_SCHEDULER_add_now (&offer_hello,
                                             cc);
-      if (NULL == cc->ats_sh)
-        cc->ats_sh = GNUNET_ATS_connectivity_suggest (cc->p1->ats,
+      if (NULL == cc->ah_sh)
+        cc->ah_sh = GNUNET_TRANSPORT_application_suggest (cc->p1->ah,
                                                       &p2->id,
-                                                      1);
+                                                      
GNUNET_MQ_PRIO_BEST_EFFORT,
+                                                      bw);
     }
   }
 }
@@ -512,11 +514,11 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct
     GNUNET_free (emsg);
     return NULL;
   }
-  p->ats = GNUNET_ATS_connectivity_init (p->cfg);
-  if (NULL == p->ats)
+  p->ah = GNUNET_TRANSPORT_application_init (p->cfg);
+  if (NULL == p->ah)
   {
     LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Failed to connect to ATS service for peer `%s': `%s'\n",
+         "Failed to connect to TNG service for peer `%s': `%s'\n",
          cfgname,
          emsg);
     GNUNET_TRANSPORT_TESTING_stop_peer (p);
@@ -525,9 +527,6 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct
   }
   p->ph = GNUNET_PEERSTORE_connect (p->cfg);
   // FIXME Error handling
-  p->ah = GNUNET_TRANSPORT_application_init (p->cfg);
-  GNUNET_assert (NULL != p->ah);
-  // FIXME Error handling
   p->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, p);
 
   return p;
@@ -565,10 +564,10 @@ GNUNET_TRANSPORT_TESTING_restart_peer (struct
         (cc->p2 == p))
       GNUNET_TRANSPORT_TESTING_connect_peers_cancel (cc);
   }
-  if (NULL != p->ats)
+  if (NULL != p->ah)
   {
-    GNUNET_ATS_connectivity_done (p->ats);
-    p->ats = NULL;
+    GNUNET_TRANSPORT_application_done (p->ah);
+    p->ah = NULL;
   }
   if (GNUNET_SYSERR ==
       GNUNET_TESTING_peer_stop (p->peer))
@@ -607,7 +606,7 @@ GNUNET_TRANSPORT_TESTING_restart_peer (struct
                                          &notify_connect,
                                          &notify_disconnect);
   GNUNET_assert (NULL != p->th);
-  p->ats = GNUNET_ATS_connectivity_init (p->cfg);
+  p->ah = GNUNET_TRANSPORT_application_init (p->cfg);
   p->pic = GNUNET_PEERSTORE_iterate (p->ph,
                                      "transport",
                                      &p->id,
@@ -654,11 +653,6 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct
     GNUNET_TRANSPORT_core_disconnect (p->th);
     p->th = NULL;
   }
-  if (NULL != p->ats)
-  {
-    GNUNET_ATS_connectivity_done (p->ats);
-    p->ats = NULL;
-  }
   if (NULL != p->ah)
   {
     GNUNET_TRANSPORT_application_done (p->ah);
@@ -794,6 +788,7 @@ GNUNET_TRANSPORT_TESTING_connect_peers (struct
   struct GNUNET_TRANSPORT_TESTING_Handle *tth = p1->tth;
   struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc;
   struct GNUNET_TRANSPORT_TESTING_ConnectRequest *ccn;
+  struct GNUNET_BANDWIDTH_Value32NBO bw;
 
   ccn = NULL;
   for (cc = tth->cc_head; NULL != cc; cc = cc->next)
@@ -825,9 +820,10 @@ GNUNET_TRANSPORT_TESTING_connect_peers (struct
                                cc);
   cc->tct = GNUNET_SCHEDULER_add_now (&offer_hello,
                                       cc);
-  cc->ats_sh = GNUNET_ATS_connectivity_suggest (cc->p1->ats,
-                                                &p2->id,
-                                                1);
+  cc->ah_sh = GNUNET_TRANSPORT_application_suggest (cc->p1->ah,
+                                                     &p2->id,
+                                                     
GNUNET_MQ_PRIO_BEST_EFFORT,
+                                                bw);
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "New connect request %p\n",
        cc);
@@ -849,10 +845,10 @@ GNUNET_TRANSPORT_TESTING_connect_peers_cancel (struct
     GNUNET_SCHEDULER_cancel (cc->tct);
     cc->tct = NULL;
   }
-  if (NULL != cc->ats_sh)
+  if (NULL != cc->ah_sh)
   {
-    GNUNET_ATS_connectivity_suggest_cancel (cc->ats_sh);
-    cc->ats_sh = NULL;
+    GNUNET_TRANSPORT_application_suggest_cancel (cc->ah_sh);
+    cc->ah_sh = NULL;
   }
   GNUNET_CONTAINER_DLL_remove (tth->cc_head,
                                tth->cc_tail,
diff --git a/src/transport/transport-testing2.h 
b/src/transport/transport-testing2.h
index b9e492219..8f1071e8f 100644
--- a/src/transport/transport-testing2.h
+++ b/src/transport/transport-testing2.h
@@ -32,7 +32,6 @@
 #include "gnunet_peerstore_service.h"
 #include "gnunet_transport_core_service.h"
 #include "gnunet_transport_application_service.h"
-#include "gnunet_transport_manipulation_service.h"
 #include "gnunet_testing_lib.h"
 
 
@@ -84,11 +83,6 @@ struct GNUNET_TRANSPORT_TESTING_PeerContext
    */
   struct GNUNET_TRANSPORT_CoreHandle *th;
 
-  /**
-   * Peer's ATS handle.
-   */
-  struct GNUNET_ATS_ConnectivityHandle *ats;
-
   /**
    * Peer's PEERSTORE Handle
    */
@@ -197,9 +191,9 @@ struct GNUNET_TRANSPORT_TESTING_ConnectRequest
   struct GNUNET_SCHEDULER_Task *tct;
 
   /**
-   * Handle by which we ask ATS to facilitate the connection.
+   * Handle by which we ask TNG to facilitate the connection.
    */
-  struct GNUNET_ATS_ConnectivitySuggestHandle *ats_sh;
+  struct GNUNET_TRANSPORT_ApplicationSuggestHandle *ah_sh;
 
   /**
    * Function to call upon completion.
@@ -447,7 +441,7 @@ struct GNUNET_TRANSPORT_TESTING_PerformanceTestMessage
    * Time this message was send via transport api.
    */
   struct GNUNET_TIME_AbsoluteNBO time_send;
-  
+
   /**
    * Monotonically increasing counter throughout the test.
    */
diff --git a/src/transport/transport.conf.in b/src/transport/transport.conf.in
index 96b87e266..778b9bb76 100644
--- a/src/transport/transport.conf.in
+++ b/src/transport/transport.conf.in
@@ -2,7 +2,7 @@
 START_ON_DEMAND = @START_ON_DEMAND@
 @JAVAPORT@PORT = 2091
 HOSTNAME = localhost
-BINARY = gnunet-service-transport
+BINARY = gnunet-service-tng
 # PREFIX = valgrind
 
 # Maximum number of neighbours PER PLUGIN (not in total).
@@ -238,4 +238,4 @@ TESTING_IGNORE_KEYS = ACCEPT_FROM;
 
 
 [communicator-quic]
-BINDTO = 127.0.0.1
\ No newline at end of file
+BINDTO = 127.0.0.1
diff --git a/src/transport/transport.h b/src/transport/transport.h
index 38f1b220a..66f17ee5b 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -33,36 +33,6 @@
 #define DEBUG_TRANSPORT GNUNET_EXTRA_LOGGING
 
 
-/**
- * For how long do we allow unused bandwidth
- * from the past to carry over into the future? (in seconds)
- */
-#define MAX_BANDWIDTH_CARRY_S GNUNET_CONSTANTS_MAX_BANDWIDTH_CARRY_S
-
-/**
- * How often do we (at most) do a full quota
- * recalculation? (in ms)
- */
-#define MIN_QUOTA_REFRESH_TIME 2000
-
-/**
- * What's the maximum number of sockets transport uses for validation and
- * neighbors
- */
-#define DEFAULT_MAX_FDS 256
-
-/**
- * Maximum frequency for re-evaluating latencies for all transport addresses.
- */
-#define LATENCY_EVALUATION_MAX_DELAY \
-  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 1)
-
-/**
- * Maximum frequency for re-evaluating latencies for connected addresses.
- */
-#define CONNECTED_LATENCY_EVALUATION_MAX_DELAY \
-  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1)
-
 /**
  * Similar to GNUNET_TRANSPORT_NotifyDisconnect but in and out quotas are
  * included here. These values are not required outside transport_api
@@ -165,32 +135,6 @@ struct DisconnectInfoMessage
 };
 
 
-/**
- * Message used to set a particular bandwidth quota.  Sent TO the
- * service to set an incoming quota, sent FROM the service to update
- * an outgoing quota.
- *
- * NOTE: no longer used in TNG!
- */
-struct QuotaSetMessage
-{
-  /**
-   * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Quota.
-   */
-  struct GNUNET_BANDWIDTH_Value32NBO quota;
-
-  /**
-   * About which peer are we talking here?
-   */
-  struct GNUNET_PeerIdentity peer;
-};
-
-
 /**
  * Message used to notify the transport API about a message
  * received from the network.  The actual message follows.
@@ -309,371 +253,6 @@ struct OutboundMessage
 };
 
 
-#if ! (defined(GNUNET_TRANSPORT_COMMUNICATION_VERSION) || \
-  defined(GNUNET_TRANSPORT_CORE_VERSION))
-
-
-/**
- * Message used to notify the transport API about an address to string
- * conversion. Message is followed by the string with the humand-readable
- * address.  For each lookup, multiple results may be returned.  The
- * last message must have a @e res of #GNUNET_OK and an @e addr_len
- * of zero.
- */
-struct AddressToStringResultMessage
-{
-  /**
-   * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * #GNUNET_OK if the conversion succeeded,
-   * #GNUNET_SYSERR if it failed
-   */
-  uint32_t res GNUNET_PACKED;
-
-  /**
-   * Length of the following string, zero if @e is #GNUNET_SYSERR
-   */
-  uint32_t addr_len GNUNET_PACKED;
-};
-
-
-/**
- * Message from the library to the transport service
- * asking for converting a transport address to a
- * human-readable UTF-8 string.
- */
-struct AddressLookupMessage
-{
-  /**
-   * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Should the conversion use numeric IP addresses (otherwise
-   * a reverse DNS lookup is OK -- if applicable).
-   */
-  int16_t numeric_only GNUNET_PACKED;
-
-  /**
-   * Length of the (binary) address in bytes, in big-endian.
-   */
-  uint16_t addrlen GNUNET_PACKED;
-
-  /**
-   * timeout to give up (for DNS resolution timeout mostly)
-   */
-  struct GNUNET_TIME_RelativeNBO timeout;
-
-  /* followed by @e addrlen bytes of the actual address, then
-   * followed by the 0-terminated name of the transport */
-};
-
-
-/**
- * Message from the transport service to the library containing information
- * about a peer. Information contained are:
- * - current address used to communicate with this peer
- * - state
- * - state timeout
- *
- * Memory layout:
- * [AddressIterateResponseMessage][address[addrlen]][transportname[pluginlen]]
- */
-struct ValidationIterateResponseMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_RESPONSE
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * For alignment.
-   */
-  uint32_t reserved;
-
-  /**
-   * Peer identity
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Local info about the address
-   */
-  uint32_t local_address_info GNUNET_PACKED;
-
-  /**
-   * Address length
-   */
-  uint32_t addrlen GNUNET_PACKED;
-
-  /**
-   * Length of the plugin name
-   */
-  uint32_t pluginlen GNUNET_PACKED;
-
-  /**
-   * State
-   */
-  uint32_t state GNUNET_PACKED;
-
-  /**
-   * At what time did we successfully validate the address last.
-   * Will be NEVER if the address failed validation.
-   */
-  struct GNUNET_TIME_AbsoluteNBO last_validation;
-
-  /**
-   * Until when is the address believed to be valid.
-   * Will be ZERO if the address is not believed to be valid.
-   */
-  struct GNUNET_TIME_AbsoluteNBO valid_until;
-
-  /**
-   * When will we next try to validate the address (typically
-   * done before @e valid_until happens).
-   */
-  struct GNUNET_TIME_AbsoluteNBO next_validation;
-};
-
-
-/**
- * Message from the library to the transport service
- * asking for binary addresses known for a peer.
- */
-struct ValidationMonitorMessage
-{
-  /**
-   * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_REQUEST
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * One shot call or continuous replies?
-   */
-  uint32_t one_shot GNUNET_PACKED;
-
-  /**
-   * The identity of the peer to look up.
-   */
-  struct GNUNET_PeerIdentity peer;
-};
-
-
-/**
- * Message from the library to the transport service
- * asking for binary addresses known for a peer.
- */
-struct PeerMonitorMessage
-{
-  /**
-   * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * One shot call or continuous replies?
-   */
-  uint32_t one_shot GNUNET_PACKED;
-
-  /**
-   * The identity of the peer to look up.
-   */
-  struct GNUNET_PeerIdentity peer;
-};
-
-
-/**
- * Message from the library to the transport service
- * asking for binary addresses known for a peer.
- */
-struct TrafficMetricMessage
-{
-  /**
-   * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Always zero.
-   */
-  uint32_t reserved GNUNET_PACKED;
-
-  /**
-   * The identity of the peer to look up.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Fake properties to generate.
-   */
-  struct GNUNET_ATS_PropertiesNBO properties;
-
-  /**
-   * Fake delay to add on inbound traffic.
-   */
-  struct GNUNET_TIME_RelativeNBO delay_in;
-
-  /**
-   * Fake delay to add on outbound traffic.
-   */
-  struct GNUNET_TIME_RelativeNBO delay_out;
-};
-
-
-/**
- * Message from the transport service to the library containing information
- * about a peer. Information contained are:
- * - current address used to communicate with this peer
- * - state
- * - state timeout
- *
- * Memory layout:
- * [AddressIterateResponseMessage][address[addrlen]][transportname[pluginlen]]
- */
-struct PeerIterateResponseMessage
-{
-  /**
-   * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * For alignment.
-   */
-  uint32_t reserved;
-
-  /**
-   * Peer identity
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Timeout for the state this peer is in
-   */
-  struct GNUNET_TIME_AbsoluteNBO state_timeout;
-
-  /**
-   * Local info about the address
-   */
-  uint32_t local_address_info GNUNET_PACKED;
-
-  /**
-   * State this peer is in as an `enum GNUNET_TRANSPORT_PeerState`
-   */
-  uint32_t state GNUNET_PACKED;
-
-  /**
-   * Address length
-   */
-  uint32_t addrlen GNUNET_PACKED;
-
-  /**
-   * Length of the plugin name
-   */
-  uint32_t pluginlen GNUNET_PACKED;
-};
-
-
-/**
- * Change in blacklisting (either request or notification,
- * depending on which direction it is going).
- */
-struct BlacklistMessage
-{
-  /**
-   * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY or
-   * #GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_REPLY.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * 0 for the query, #GNUNET_OK (allowed) or #GNUNET_SYSERR (disallowed)
-   * for the response.
-   */
-  uint32_t is_allowed GNUNET_PACKED;
-
-  /**
-   * Which peer is being blacklisted or queried?
-   */
-  struct GNUNET_PeerIdentity peer;
-};
-
-
-/**
- * Transport-level connection status update.
- */
-struct TransportPluginMonitorMessage
-{
-  /**
-   * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_EVENT.
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * An `enum GNUNET_TRANSPORT_SessionState` in NBO.
-   */
-  uint16_t session_state GNUNET_PACKED;
-
-  /**
-   * #GNUNET_YES if this is an inbound connection,
-   * #GNUNET_NO if this is an outbound connection,
-   * #GNUNET_SYSERR if connections of this plugin
-   *             are so fundamentally bidirectional
-   *             that they have no 'initiator'
-   * Value given in NBO.
-   */
-  int16_t is_inbound GNUNET_PACKED;
-
-  /**
-   * Number of messages waiting transmission.
-   */
-  uint32_t msgs_pending GNUNET_PACKED;
-
-  /**
-   * Number of bytes waiting for transmission.
-   */
-  uint32_t bytes_pending GNUNET_PACKED;
-
-  /**
-   * When will this transport plugin session time out?
-   */
-  struct GNUNET_TIME_AbsoluteNBO timeout;
-
-  /**
-   * Until how long is this plugin currently blocked from reading?
-   */
-  struct GNUNET_TIME_AbsoluteNBO delay;
-
-  /**
-   * Which peer is this connection for?
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Unique identifier for the session.
-   */
-  uint64_t session_id;
-
-  /**
-   * Length of the plugin name in bytes, including 0-termination.
-   */
-  uint16_t plugin_name_len GNUNET_PACKED;
-
-  /**
-   * Length of the plugin address in bytes.
-   */
-  uint16_t plugin_address_len GNUNET_PACKED;
-
-  /* followed by 0-terminated plugin name and
-     @e plugin_address_len bytes of plugin address */
-};
-
-#else
-
 /* *********************** TNG messages ***************** */
 
 /**
@@ -1243,8 +822,6 @@ struct RequestHelloValidationMessage
   /* followed by 0-terminated address to validate */
 };
 
-#endif
-
 GNUNET_NETWORK_STRUCT_END
 
 /* end of transport.h */
diff --git a/src/transport/transport_api2_communication.c 
b/src/transport/transport_api2_communication.c
index 35ef039da..0a7636843 100644
--- a/src/transport/transport_api2_communication.c
+++ b/src/transport/transport_api2_communication.c
@@ -27,7 +27,6 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_protocols.h"
 #include "gnunet_transport_communication_service.h"
-#include "gnunet_ats_transport_service.h"
 #include "transport.h"
 
 
diff --git a/src/transport/transport_api2_core.c 
b/src/transport/transport_api2_core.c
index 83b965c51..0d2a0ac7f 100644
--- a/src/transport/transport_api2_core.c
+++ b/src/transport/transport_api2_core.c
@@ -402,9 +402,13 @@ mq_cancel_impl (struct GNUNET_MQ_Handle *mq, void 
*impl_state)
 static void
 peer_mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
 {
-  /* struct Neighbour *n = cls; */
+  struct Neighbour *n = cls;
+
+  if (GNUNET_MQ_ERROR_MALFORMED == error)
+    GNUNET_break_op (0);
+  //TODO Look into bug #7887
 
-  GNUNET_break_op (0);
+  GNUNET_TRANSPORT_core_receive_continue (n->h, &n->id);
 }
 
 
diff --git a/src/transport/transport_api_address_to_string.c 
b/src/transport/transport_api_address_to_string.c
deleted file mode 100644
index 5b234f802..000000000
--- a/src/transport/transport_api_address_to_string.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009-2014, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file transport/transport_api_address_to_string.c
- * @author Christian Grothoff
- * @brief enable clients to convert addresses to human readable strings
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_transport_service.h"
-#include "transport.h"
-
-/**
- * Context for the address lookup.
- */
-struct GNUNET_TRANSPORT_AddressToStringContext
-{
-  /**
-   * Function to call with the human-readable address.
-   */
-  GNUNET_TRANSPORT_AddressToStringCallback cb;
-
-  /**
-   * Closure for @e cb.
-   */
-  void *cb_cls;
-
-  /**
-   * Connection to the service.
-   */
-  struct GNUNET_MQ_Handle *mq;
-};
-
-
-/**
- * Function called with responses from the service.
- *
- * @param cls our `struct GNUNET_TRANSPORT_AddressToStringContext *`
- * @param atsm message with the human-readable address
- * @return #GNUNET_OK if message is well-formed
- */
-static int
-check_reply (void *cls,
-             const struct AddressToStringResultMessage *atsm)
-{
-  uint16_t size = ntohs (atsm->header.size) - sizeof(*atsm);
-  const char *address;
-  int result;
-  uint32_t addr_len;
-
-  result = (int) ntohl (atsm->res);
-  addr_len = ntohl (atsm->addr_len);
-  if (GNUNET_SYSERR == result)
-    return GNUNET_OK;
-  if (0 == size)
-  {
-    if (GNUNET_OK != result)
-    {
-      GNUNET_break (0);
-      return GNUNET_SYSERR;
-    }
-    return GNUNET_OK;
-  }
-  address = (const char *) &atsm[1];
-  if ((addr_len > size) ||
-      (address[addr_len - 1] != '\0'))
-  {
-    /* invalid reply */
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Function called with responses from the service.
- *
- * @param cls our `struct GNUNET_TRANSPORT_AddressToStringContext *`
- * @param atsm message with the human-readable address
- */
-static void
-handle_reply (void *cls,
-              const struct AddressToStringResultMessage *atsm)
-{
-  struct GNUNET_TRANSPORT_AddressToStringContext *alucb = cls;
-  uint16_t size = ntohs (atsm->header.size) - sizeof(*atsm);
-  const char *address;
-  int result;
-
-  result = (int) ntohl (atsm->res);
-  if (GNUNET_SYSERR == result)
-  {
-    /* expect more replies; as this is not the last
-       call, we must pass the empty string for the address */
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Address resolution failed\n");
-    alucb->cb (alucb->cb_cls,
-               "",
-               GNUNET_NO);
-    return;
-  }
-  if (0 == size)
-  {
-    /* we are done (successfully, without communication errors) */
-    alucb->cb (alucb->cb_cls,
-               NULL,
-               GNUNET_OK);
-    GNUNET_TRANSPORT_address_to_string_cancel (alucb);
-    return;
-  }
-  address = (const char *) &atsm[1];
-  /* return normal reply to caller, also expect more replies */
-  alucb->cb (alucb->cb_cls,
-             address,
-             GNUNET_OK);
-}
-
-
-/**
- * Generic error handler, called with the appropriate
- * error code and the same closure specified at the creation of
- * the message queue.
- * Not every message queue implementation supports an error handler.
- *
- * @param cls the `struct GNUNET_TRANSPORT_AddressToStringContext *`
- * @param error error code
- */
-static void
-mq_error_handler (void *cls,
-                  enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_TRANSPORT_AddressToStringContext *alucb = cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Disconnected from transport, address resolution failed\n");
-  alucb->cb (alucb->cb_cls,
-             NULL,
-             GNUNET_SYSERR);
-  GNUNET_TRANSPORT_address_to_string_cancel (alucb);
-}
-
-
-/**
- * Convert a binary address into a human readable address.
- *
- * @param cfg configuration to use
- * @param address address to convert (binary format)
- * @param numeric should (IP) addresses be displayed in numeric form
- *                (otherwise do reverse DNS lookup)
- * @param timeout how long is the lookup allowed to take at most
- * @param aluc function to call with the results
- * @param aluc_cls closure for @a aluc
- * @return handle to cancel the operation, NULL on error
- */
-struct GNUNET_TRANSPORT_AddressToStringContext *
-GNUNET_TRANSPORT_address_to_string (const struct
-                                    GNUNET_CONFIGURATION_Handle *cfg,
-                                    const struct GNUNET_HELLO_Address *address,
-                                    int numeric,
-                                    struct GNUNET_TIME_Relative timeout,
-                                    GNUNET_TRANSPORT_AddressToStringCallback
-                                    aluc,
-                                    void *aluc_cls)
-{
-  struct GNUNET_TRANSPORT_AddressToStringContext *alc
-    = GNUNET_new (struct GNUNET_TRANSPORT_AddressToStringContext);
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_var_size (reply,
-                           
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY,
-                           struct AddressToStringResultMessage,
-                           alc),
-    GNUNET_MQ_handler_end ()
-  };
-  size_t alen;
-  size_t slen;
-  struct AddressLookupMessage *msg;
-  struct GNUNET_MQ_Envelope *env;
-  char *addrbuf;
-
-  alen = address->address_length;
-  slen = strlen (address->transport_name) + 1;
-  if ((alen + slen >= GNUNET_MAX_MESSAGE_SIZE
-       - sizeof(struct AddressLookupMessage)) ||
-      (alen >= GNUNET_MAX_MESSAGE_SIZE) ||
-      (slen >= GNUNET_MAX_MESSAGE_SIZE))
-  {
-    GNUNET_break (0);
-    GNUNET_free (alc);
-    return NULL;
-  }
-  alc->cb = aluc;
-  alc->cb_cls = aluc_cls;
-  alc->mq = GNUNET_CLIENT_connect (cfg,
-                                   "transport",
-                                   handlers,
-                                   &mq_error_handler,
-                                   alc);
-  if (NULL == alc->mq)
-  {
-    GNUNET_break (0);
-    GNUNET_free (alc);
-    return NULL;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Client tries to resolve for peer `%s' address plugin %s len 
%u\n",
-              GNUNET_i2s (&address->peer),
-              address->transport_name,
-              (unsigned int) address->address_length);
-  env = GNUNET_MQ_msg_extra (msg,
-                             alen + slen,
-                             GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING);
-  msg->numeric_only = htons ((int16_t) numeric);
-  msg->addrlen = htons ((uint16_t) alen);
-  msg->timeout = GNUNET_TIME_relative_hton (timeout);
-  addrbuf = (char *) &msg[1];
-  GNUNET_memcpy (addrbuf,
-                 address->address,
-                 alen);
-  GNUNET_memcpy (&addrbuf[alen],
-                 address->transport_name,
-                 slen);
-  GNUNET_MQ_send (alc->mq,
-                  env);
-  return alc;
-}
-
-
-/**
- * Cancel request for address conversion.
- *
- * @param alc the context handle
- */
-void
-GNUNET_TRANSPORT_address_to_string_cancel (struct
-                                           
GNUNET_TRANSPORT_AddressToStringContext
-                                           *alc)
-{
-  GNUNET_MQ_destroy (alc->mq);
-  GNUNET_free (alc);
-}
-
-
-/* end of transport_api_address_to_string.c */
diff --git a/src/transport/transport_api_blacklist.c 
b/src/transport/transport_api_blacklist.c
deleted file mode 100644
index b195a7fc7..000000000
--- a/src/transport/transport_api_blacklist.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2010-2014, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/transport_api_blacklist.c
- * @brief library to access the blacklisting functions of the transport service
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_transport_service.h"
-#include "transport.h"
-
-/**
- * Handle for blacklisting requests.
- */
-struct GNUNET_TRANSPORT_Blacklist
-{
-  /**
-   * Connection to transport service.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Configuration to use.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Function to call for determining if a peer is allowed
-   * to communicate with us.
-   */
-  GNUNET_TRANSPORT_BlacklistCallback cb;
-
-  /**
-   * Closure for @e cb.
-   */
-  void *cb_cls;
-};
-
-
-/**
- * Establish blacklist connection to transport service.
- *
- * @param br overall handle
- */
-static void
-reconnect (struct GNUNET_TRANSPORT_Blacklist *br);
-
-
-/**
- * Handle blacklist queries.
- *
- * @param cls our overall handle
- * @param bm query
- */
-static void
-handle_query (void *cls,
-              const struct BlacklistMessage *bm)
-{
-  struct GNUNET_TRANSPORT_Blacklist *br = cls;
-  struct GNUNET_MQ_Envelope *env;
-  struct BlacklistMessage *res;
-
-  GNUNET_break (0 == ntohl (bm->is_allowed));
-  env = GNUNET_MQ_msg (res,
-                       GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_REPLY);
-  res->is_allowed = htonl (br->cb (br->cb_cls,
-                                   &bm->peer));
-  res->peer = bm->peer;
-  GNUNET_MQ_send (br->mq,
-                  env);
-}
-
-
-/**
- * Generic error handler, called with the appropriate error code and
- * the same closure specified at the creation of the message queue.
- * Not every message queue implementation supports an error handler.
- *
- * @param cls closure with the `struct GNUNET_TRANSPORT_Blacklist *`
- * @param error error code
- */
-static void
-mq_error_handler (void *cls,
-                  enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_TRANSPORT_Blacklist *br = cls;
-
-  reconnect (br);
-}
-
-
-/**
- * Establish blacklist connection to transport service.
- *
- * @param br overall handle
- */
-static void
-reconnect (struct GNUNET_TRANSPORT_Blacklist *br)
-{
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_fixed_size (query,
-                             GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY,
-                             struct BlacklistMessage,
-                             br),
-    GNUNET_MQ_handler_end ()
-  };
-  struct GNUNET_MQ_Envelope *env;
-  struct GNUNET_MessageHeader *req;
-
-  if (NULL != br->mq)
-    GNUNET_MQ_destroy (br->mq);
-  br->mq = GNUNET_CLIENT_connect (br->cfg,
-                                  "transport",
-                                  handlers,
-                                  &mq_error_handler,
-                                  br);
-  if (NULL == br->mq)
-    return;
-  env = GNUNET_MQ_msg (req,
-                       GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_INIT);
-  GNUNET_MQ_send (br->mq,
-                  env);
-}
-
-
-/**
- * Install a blacklist callback.  The service will be queried for all
- * existing connections as well as any fresh connections to check if
- * they are permitted.  If the blacklisting callback is unregistered,
- * all hosts that were denied in the past will automatically be
- * whitelisted again.  Cancelling the blacklist handle is also the
- * only way to re-enable connections from peers that were previously
- * blacklisted.
- *
- * @param cfg configuration to use
- * @param cb callback to invoke to check if connections are allowed
- * @param cb_cls closure for @a cb
- * @return NULL on error, otherwise handle for cancellation
- */
-struct GNUNET_TRANSPORT_Blacklist *
-GNUNET_TRANSPORT_blacklist (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                            GNUNET_TRANSPORT_BlacklistCallback cb,
-                            void *cb_cls)
-{
-  struct GNUNET_TRANSPORT_Blacklist *br;
-
-  br = GNUNET_new (struct GNUNET_TRANSPORT_Blacklist);
-  br->cfg = cfg;
-  br->cb = cb;
-  br->cb_cls = cb_cls;
-  reconnect (br);
-  if (NULL == br->mq)
-  {
-    GNUNET_free (br);
-    return NULL;
-  }
-  return br;
-}
-
-
-/**
- * Abort the blacklist.  Note that this function is the only way for
- * removing a peer from the blacklist.
- *
- * @param br handle of the request that is to be cancelled
- */
-void
-GNUNET_TRANSPORT_blacklist_cancel (struct GNUNET_TRANSPORT_Blacklist *br)
-{
-  GNUNET_MQ_destroy (br->mq);
-  GNUNET_free (br);
-}
-
-
-/* end of transport_api_blacklist.c */
diff --git a/src/transport/transport_api_cmd_backchannel_check.c 
b/src/transport/transport_api_cmd_backchannel_check.c
index 1bdb8817f..68bdae69c 100644
--- a/src/transport/transport_api_cmd_backchannel_check.c
+++ b/src/transport/transport_api_cmd_backchannel_check.c
@@ -30,7 +30,6 @@
 #include "gnunet_testing_netjail_lib.h"
 #include "gnunet_transport_application_service.h"
 #include "gnunet_hello_lib.h"
-#include "gnunet_transport_service.h"
 #include "transport-testing-cmds.h"
 
 /**
diff --git a/src/transport/transport_api_cmd_connecting_peers.c 
b/src/transport/transport_api_cmd_connecting_peers.c
index 6bc145880..c59c4b006 100644
--- a/src/transport/transport_api_cmd_connecting_peers.c
+++ b/src/transport/transport_api_cmd_connecting_peers.c
@@ -29,7 +29,6 @@
 #include "gnunet_testing_netjail_lib.h"
 #include "gnunet_transport_application_service.h"
 #include "gnunet_hello_lib.h"
-#include "gnunet_transport_service.h"
 #include "transport-testing-cmds.h"
 
 /**
@@ -65,8 +64,21 @@ connect_peers_run (void *cls,
   cps->is = is;
   peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
                                                          
cps->start_peer_label);
-  GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd,
-                                                 &ah);
+  if (GNUNET_YES == cps->wait_for_connect)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Wait for connect.\n");
+    GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd,
+                                                   &ah);
+  }
+  else
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Not waiting for connect.\n");
+    GNUNET_TESTING_get_trait_application_handle (peer1_cmd,
+                                                   &ah);
+  }
+
   GNUNET_TRANSPORT_get_trait_broadcast (peer1_cmd,
                                         &broadcast);
 
@@ -139,12 +151,13 @@ connect_peers_run (void *cls,
         }
         peer = GNUNET_TESTING_get_peer (num, tl_system);
         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "validating peer number %u with identity %s and address %s 
%u %s\n",
+                    "validating peer number %u with identity %s and address %s 
%u %s and handle %p\n",
                     num,
                     GNUNET_i2s (peer),
                     addr_and_port,
                     *broadcast,
-                    pos_prefix->address_prefix);
+                    pos_prefix->address_prefix,
+                    ah);
         GNUNET_TRANSPORT_application_validate ((struct
                                                 
GNUNET_TRANSPORT_ApplicationHandle
                                                 *) ah,
@@ -255,7 +268,8 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
                                     uint32_t num,
                                     struct GNUNET_TESTING_NetjailTopology *
                                     topology,
-                                    unsigned int additional_connects)
+                                    unsigned int additional_connects,
+                                    unsigned int wait_for_connect)
 {
   struct ConnectPeersState *cps;
   unsigned int node_additional_connects;
@@ -278,11 +292,20 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
   cps->topology = topology;
   cps->notify_connect = notify_connect;
   cps->additional_connects = additional_connects;
-
-  return GNUNET_TESTING_command_new (cps,
-                                     label,
-                                     &connect_peers_run,
-                                     &connect_peers_cleanup,
-                                     &connect_peers_traits,
-                                     &cps->ac);
+  cps->wait_for_connect = wait_for_connect;
+
+  if (GNUNET_YES == wait_for_connect)
+    return GNUNET_TESTING_command_new (cps,
+                                       label,
+                                       &connect_peers_run,
+                                       &connect_peers_cleanup,
+                                       &connect_peers_traits,
+                                       &cps->ac);
+  else
+    return GNUNET_TESTING_command_new (cps,
+                                       label,
+                                       &connect_peers_run,
+                                       &connect_peers_cleanup,
+                                       &connect_peers_traits,
+                                       NULL);
 }
diff --git a/src/transport/transport_api_cmd_start_peer.c 
b/src/transport/transport_api_cmd_start_peer.c
index 244f8d79b..54e204a21 100644
--- a/src/transport/transport_api_cmd_start_peer.c
+++ b/src/transport/transport_api_cmd_start_peer.c
@@ -51,7 +51,7 @@ hello_iter_cb (void *cb_cls,
                const struct GNUNET_PEERSTORE_Record *record,
                const char *emsg)
 {
-  struct StartPeerState *sps = cb_cls;
+  struct GNUNET_TESTING_StartPeerState *sps = cb_cls;
   if (NULL == record)
   {
     sps->pic = NULL;
@@ -81,7 +81,7 @@ hello_iter_cb (void *cb_cls,
 static void
 retrieve_hello (void *cls)
 {
-  struct StartPeerState *sps = cls;
+  struct GNUNET_TESTING_StartPeerState *sps = cls;
   sps->rh_task = NULL;
   sps->pic = GNUNET_PEERSTORE_iterate (sps->ph,
                                        "transport",
@@ -102,7 +102,7 @@ notify_disconnect (void *cls,
                    const struct GNUNET_PeerIdentity *peer,
                    void *handler_cls)
 {
-  struct StartPeerState *sps = cls;
+  struct GNUNET_TESTING_StartPeerState *sps = cls;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Peer %s disconnected from peer %u (`%s')\n",
@@ -122,7 +122,7 @@ notify_connect (void *cls,
                 const struct GNUNET_PeerIdentity *peer,
                 struct GNUNET_MQ_Handle *mq)
 {
-  struct StartPeerState *sps = cls;
+  struct GNUNET_TESTING_StartPeerState *sps = cls;
   struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode);
   struct GNUNET_HashCode hc;
   struct GNUNET_CRYPTO_EddsaPublicKey public_key = peer->public_key;
@@ -168,7 +168,7 @@ static void
 start_peer_run (void *cls,
                 struct GNUNET_TESTING_Interpreter *is)
 {
-  struct StartPeerState *sps = cls;
+  struct GNUNET_TESTING_StartPeerState *sps = cls;
   char *emsg = NULL;
   struct GNUNET_PeerIdentity dummy;
   const struct GNUNET_TESTING_Command *system_cmd;
@@ -339,7 +339,7 @@ start_peer_run (void *cls,
   }
 
   sps->ph = GNUNET_PEERSTORE_connect (sps->cfg);
-  if (NULL == sps->th)
+  if (NULL == sps->ph)
   {
     LOG (GNUNET_ERROR_TYPE_ERROR,
          "Failed to connect to peerstore service for peer `%s': `%s'\n",
@@ -378,7 +378,7 @@ start_peer_run (void *cls,
 static void
 start_peer_cleanup (void *cls)
 {
-  struct StartPeerState *sps = cls;
+  struct GNUNET_TESTING_StartPeerState *sps = cls;
 
   if (NULL != sps->handlers)
   {
@@ -410,7 +410,7 @@ start_peer_traits (void *cls,
                    const char *trait,
                    unsigned int index)
 {
-  struct StartPeerState *sps = cls;
+  struct GNUNET_TESTING_StartPeerState *sps = cls;
   struct GNUNET_TRANSPORT_ApplicationHandle *ah = sps->ah;
   struct GNUNET_PeerIdentity *id = &sps->id;
   struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map =
@@ -450,12 +450,12 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label,
                                  notify_connect,
                                  unsigned int broadcast)
 {
-  struct StartPeerState *sps;
+  struct GNUNET_TESTING_StartPeerState *sps;
   struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map =
     GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
   unsigned int i;
 
-  sps = GNUNET_new (struct StartPeerState);
+  sps = GNUNET_new (struct GNUNET_TESTING_StartPeerState);
   sps->no = no;
   sps->system_label = GNUNET_strdup (system_label);
   sps->connected_peers_map = connected_peers_map;
diff --git a/src/transport/transport_api_cmd_stop_peer.c 
b/src/transport/transport_api_cmd_stop_peer.c
index a80742b5f..60d48c56b 100644
--- a/src/transport/transport_api_cmd_stop_peer.c
+++ b/src/transport/transport_api_cmd_stop_peer.c
@@ -58,7 +58,7 @@ stop_peer_run (void *cls,
                struct GNUNET_TESTING_Interpreter *is)
 {
   struct StopPeerState *stop_ps = cls;
-  const struct StartPeerState *sps;
+  const struct GNUNET_TESTING_StartPeerState *sps;
   const struct GNUNET_TESTING_Command *start_cmd;
 
   start_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
diff --git a/src/transport/transport_api_core.c 
b/src/transport/transport_api_core.c
deleted file mode 100644
index 12612de09..000000000
--- a/src/transport/transport_api_core.c
+++ /dev/null
@@ -1,968 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009-2013, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/transport_api_core.c
- * @brief library to access the transport service for message exchange
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_constants.h"
-#include "gnunet_arm_service.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_transport_service.h"
-#include "transport.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-api-core", 
__VA_ARGS__)
-
-/**
- * If we could not send any payload to a peer for this amount of
- * time, we print a warning.
- */
-#define UNREADY_WARN_TIME GNUNET_TIME_UNIT_MINUTES
-
-/**
- * How large to start with for the hashmap of neighbours.
- */
-#define STARTING_NEIGHBOURS_SIZE 16
-
-
-/**
- * Entry in hash table of all of our current (connected) neighbours.
- */
-struct Neighbour
-{
-  /**
-   * Overall transport handle.
-   */
-  struct GNUNET_TRANSPORT_CoreHandle *h;
-
-  /**
-   * Active message queue for the peer.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Envelope with the message we are currently transmitting (or NULL).
-   */
-  struct GNUNET_MQ_Envelope *env;
-
-  /**
-   * Closure for @e mq handlers.
-   */
-  void *handlers_cls;
-
-  /**
-   * Identity of this neighbour.
-   */
-  struct GNUNET_PeerIdentity id;
-
-  /**
-   * Outbound bandwidh tracker.
-   */
-  struct GNUNET_BANDWIDTH_Tracker out_tracker;
-
-  /**
-   * Entry in our readiness heap (which is sorted by @e next_ready
-   * value).  NULL if there is no pending transmission request for
-   * this neighbour or if we're waiting for @e is_ready to become
-   * true AFTER the @e out_tracker suggested that this peer's quota
-   * has been satisfied (so once @e is_ready goes to #GNUNET_YES,
-   * we should immediately go back into the heap).
-   */
-  struct GNUNET_CONTAINER_HeapNode *hn;
-
-  /**
-   * Task to trigger MQ when we have enough bandwidth for the
-   * next transmission.
-   */
-  struct GNUNET_SCHEDULER_Task *timeout_task;
-
-  /**
-   * Sending consumed more bytes on wire than payload was announced
-   * This overhead is added to the delay of next sending operation
-   */
-  unsigned long long traffic_overhead;
-
-  /**
-   * Is this peer currently ready to receive a message?
-   */
-  int is_ready;
-
-  /**
-   * Size of the message in @e env.
-   */
-  uint16_t env_size;
-};
-
-
-/**
- * Handle for the transport service (includes all of the
- * state for the transport service).
- */
-struct GNUNET_TRANSPORT_CoreHandle
-{
-  /**
-   * Closure for the callbacks.
-   */
-  void *cls;
-
-  /**
-   * Functions to call for received data (template for
-   * new message queues).
-   */
-  struct GNUNET_MQ_MessageHandler *handlers;
-
-  /**
-   * function to call on connect events
-   */
-  GNUNET_TRANSPORT_NotifyConnect nc_cb;
-
-  /**
-   * function to call on disconnect events
-   */
-  GNUNET_TRANSPORT_NotifyDisconnect nd_cb;
-
-  /**
-   * function to call on excess bandwidth events
-   */
-  GNUNET_TRANSPORT_NotifyExcessBandwidth neb_cb;
-
-  /**
-   * My client connection to the transport service.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * My configuration.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Hash map of the current connected neighbours of this peer.
-   * Maps peer identities to `struct Neighbour` entries.
-   */
-  struct GNUNET_CONTAINER_MultiPeerMap *neighbours;
-
-  /**
-   * Peer identity as assumed by this process, or all zeros.
-   */
-  struct GNUNET_PeerIdentity self;
-
-  /**
-   * ID of the task trying to reconnect to the service.
-   */
-  struct GNUNET_SCHEDULER_Task *reconnect_task;
-
-  /**
-   * Delay until we try to reconnect.
-   */
-  struct GNUNET_TIME_Relative reconnect_delay;
-
-  /**
-   * Internal counter to check how many more receive OK messages this
-   * CORE service is allowed to send in total. Just to detect easy
-   * cases of protocol violations by the CORE implementation.
-   * NOTE: we may want to make this stronger by counting per peer
-   * instead of globally.
-   */
-  unsigned int rom_pending;
-
-  /**
-   * Should we check that @e self matches what the service thinks?
-   * (if #GNUNET_NO, then @e self is all zeros!).
-   */
-  int check_self;
-};
-
-
-/**
- * Function that will schedule the job that will try
- * to connect us again to the client.
- *
- * @param h transport service to reconnect
- */
-static void
-disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_CoreHandle *h);
-
-
-/**
- * Get the neighbour list entry for the given peer
- *
- * @param h our context
- * @param peer peer to look up
- * @return NULL if no such peer entry exists
- */
-static struct Neighbour *
-neighbour_find (struct GNUNET_TRANSPORT_CoreHandle *h,
-                const struct GNUNET_PeerIdentity *peer)
-{
-  return GNUNET_CONTAINER_multipeermap_get (h->neighbours, peer);
-}
-
-
-/**
- * Function called by the bandwidth tracker if we have excess
- * bandwidth.
- *
- * @param cls the `struct Neighbour` that has excess bandwidth
- */
-static void
-notify_excess_cb (void *cls)
-{
-  struct Neighbour *n = cls;
-  struct GNUNET_TRANSPORT_CoreHandle *h = n->h;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Notifying CORE that more bandwidth is available for %s\n",
-       GNUNET_i2s (&n->id));
-
-  if (NULL != h->neb_cb)
-    h->neb_cb (h->cls, &n->id, n->handlers_cls);
-}
-
-
-/**
- * Iterator over hash map entries, for deleting state of a neighbour.
- *
- * @param cls the `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param key peer identity
- * @param value value in the hash map, the neighbour entry to delete
- * @return #GNUNET_YES if we should continue to
- *         iterate,
- *         #GNUNET_NO if not.
- */
-static int
-neighbour_delete (void *cls, const struct GNUNET_PeerIdentity *key, void 
*value)
-{
-  struct GNUNET_TRANSPORT_CoreHandle *handle = cls;
-  struct Neighbour *n = value;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Dropping entry for neighbour `%s'.\n",
-       GNUNET_i2s (key));
-  GNUNET_BANDWIDTH_tracker_notification_stop (&n->out_tracker);
-  if (NULL != handle->nd_cb)
-    handle->nd_cb (handle->cls, &n->id, n->handlers_cls);
-  if (NULL != n->timeout_task)
-  {
-    GNUNET_SCHEDULER_cancel (n->timeout_task);
-    n->timeout_task = NULL;
-  }
-  if (NULL != n->env)
-  {
-    GNUNET_MQ_send_cancel (n->env);
-    n->env = NULL;
-  }
-  GNUNET_MQ_destroy (n->mq);
-  GNUNET_assert (NULL == n->mq);
-  GNUNET_assert (
-    GNUNET_YES ==
-    GNUNET_CONTAINER_multipeermap_remove (handle->neighbours, key, n));
-  GNUNET_free (n);
-  return GNUNET_YES;
-}
-
-
-/**
- * Generic error handler, called with the appropriate
- * error code and the same closure specified at the creation of
- * the message queue.
- * Not every message queue implementation supports an error handler.
- *
- * @param cls closure with the `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param error error code
- */
-static void
-mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_TRANSPORT_CoreHandle *h = cls;
-
-  LOG (GNUNET_ERROR_TYPE_ERROR,
-       "Error receiving from transport service (%d), disconnecting 
temporarily.\n",
-       error);
-  disconnect_and_schedule_reconnect (h);
-}
-
-
-/**
- * Function we use for checking incoming HELLO messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param msg message received
- * @return #GNUNET_OK if message is well-formed
- */
-static int
-check_hello (void *cls, const struct GNUNET_MessageHeader *msg)
-{
-  struct GNUNET_PeerIdentity me;
-
-  if (GNUNET_OK !=
-      GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) msg, &me))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Function we use for handling incoming HELLO messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param msg message received
- */
-static void
-handle_hello (void *cls, const struct GNUNET_MessageHeader *msg)
-{
-  /* we do not care => FIXME: signal in options to NEVER send HELLOs! */
-}
-
-
-/**
- * A message from the handler's message queue to a neighbour was
- * transmitted.  Now trigger (possibly delayed) notification of the
- * neighbour's message queue that we are done and thus ready for
- * the next message.
- *
- * @param cls the `struct Neighbour` where the message was sent
- */
-static void
-notify_send_done_fin (void *cls)
-{
-  struct Neighbour *n = cls;
-
-  n->timeout_task = NULL;
-  n->is_ready = GNUNET_YES;
-  GNUNET_MQ_impl_send_continue (n->mq);
-}
-
-
-/**
- * A message from the handler's message queue to a neighbour was
- * transmitted.  Now trigger (possibly delayed) notification of the
- * neighbour's message queue that we are done and thus ready for
- * the next message.
- *
- * @param cls the `struct Neighbour` where the message was sent
- */
-static void
-notify_send_done (void *cls)
-{
-  struct Neighbour *n = cls;
-  struct GNUNET_TIME_Relative delay;
-
-  n->timeout_task = NULL;
-  if (NULL != n->env)
-  {
-    GNUNET_BANDWIDTH_tracker_consume (&n->out_tracker,
-                                      n->env_size + n->traffic_overhead);
-    n->env = NULL;
-    n->traffic_overhead = 0;
-  }
-  delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, 128);
-  if (0 == delay.rel_value_us)
-  {
-    n->is_ready = GNUNET_YES;
-    GNUNET_MQ_impl_send_continue (n->mq);
-    return;
-  }
-  GNUNET_MQ_impl_send_in_flight (n->mq);
-  /* cannot send even a small message without violating
-     quota, wait a before allowing MQ to send next message */
-  n->timeout_task =
-    GNUNET_SCHEDULER_add_delayed (delay, &notify_send_done_fin, n);
-}
-
-
-/**
- * Implement sending functionality of a message queue.
- * Called one message at a time. Should send the @a msg
- * to the transport service and then notify the queue
- * once we are ready for the next one.
- *
- * @param mq the message queue
- * @param msg the message to send
- * @param impl_state state of the implementation
- */
-static void
-mq_send_impl (struct GNUNET_MQ_Handle *mq,
-              const struct GNUNET_MessageHeader *msg,
-              void *impl_state)
-{
-  struct Neighbour *n = impl_state;
-  struct GNUNET_TRANSPORT_CoreHandle *h = n->h;
-  struct OutboundMessage *obm;
-  uint16_t msize;
-
-  GNUNET_assert (GNUNET_YES == n->is_ready);
-  msize = ntohs (msg->size);
-  if (msize >= GNUNET_MAX_MESSAGE_SIZE - sizeof(*obm))
-  {
-    GNUNET_break (0);
-    GNUNET_MQ_impl_send_continue (mq);
-    return;
-  }
-  GNUNET_assert (NULL == n->env);
-  n->env =
-    GNUNET_MQ_msg_nested_mh (obm, GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, msg);
-  {
-    struct GNUNET_MQ_Envelope *env;
-
-    env = GNUNET_MQ_get_current_envelope (mq);
-    obm->priority = htonl ((uint32_t) GNUNET_MQ_env_get_options (env));
-  }
-  obm->timeout = GNUNET_TIME_relative_hton (
-    GNUNET_TIME_UNIT_MINUTES); /* FIXME: to be removed */
-  obm->peer = n->id;
-  GNUNET_assert (NULL == n->timeout_task);
-  n->is_ready = GNUNET_NO;
-  n->env_size = ntohs (msg->size);
-  GNUNET_MQ_notify_sent (n->env, &notify_send_done, n);
-  GNUNET_MQ_send (h->mq, n->env);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Queued message of type %u for neighbour `%s'.\n",
-       ntohs (msg->type),
-       GNUNET_i2s (&n->id));
-}
-
-
-/**
- * Handle destruction of a message queue.  Implementations must not
- * free @a mq, but should take care of @a impl_state.
- *
- * @param mq the message queue to destroy
- * @param impl_state state of the implementation
- */
-static void
-mq_destroy_impl (struct GNUNET_MQ_Handle *mq, void *impl_state)
-{
-  struct Neighbour *n = impl_state;
-
-  GNUNET_assert (mq == n->mq);
-  n->mq = NULL;
-}
-
-
-/**
- * Implementation function that cancels the currently sent message.
- * Should basically undo whatever #mq_send_impl() did.
- *
- * @param mq message queue
- * @param impl_state state specific to the implementation
- */
-static void
-mq_cancel_impl (struct GNUNET_MQ_Handle *mq, void *impl_state)
-{
-  struct Neighbour *n = impl_state;
-
-  GNUNET_assert (GNUNET_NO == n->is_ready);
-  if (NULL != n->env)
-  {
-    GNUNET_MQ_send_cancel (n->env);
-    n->env = NULL;
-  }
-
-  n->is_ready = GNUNET_YES;
-}
-
-
-/**
- * We had an error processing a message we forwarded from a peer to
- * the CORE service.  We should just complain about it but otherwise
- * continue processing.
- *
- * @param cls closure
- * @param error error code
- */
-static void
-peer_mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
-{
-  /* struct Neighbour *n = cls; */
-
-  GNUNET_break_op (0);
-}
-
-
-/**
- * The outbound quota has changed in a way that may require
- * us to reset the timeout.  Update the timeout.
- *
- * @param cls the `struct Neighbour` for which the timeout changed
- */
-static void
-outbound_bw_tracker_update (void *cls)
-{
-  struct Neighbour *n = cls;
-  struct GNUNET_TIME_Relative delay;
-
-  if (NULL == n->timeout_task)
-    return;
-  delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, 128);
-  GNUNET_SCHEDULER_cancel (n->timeout_task);
-  n->timeout_task = GNUNET_SCHEDULER_add_delayed (delay, &notify_send_done, n);
-}
-
-
-/**
- * Function we use for handling incoming connect messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_Handle *`
- * @param cim message received
- */
-static void
-handle_connect (void *cls, const struct ConnectInfoMessage *cim)
-{
-  struct GNUNET_TRANSPORT_CoreHandle *h = cls;
-  struct Neighbour *n;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Receiving CONNECT message for `%s' with quota %u\n",
-       GNUNET_i2s (&cim->id),
-       ntohl (cim->quota_out.value__));
-  n = neighbour_find (h, &cim->id);
-  if (NULL != n)
-  {
-    GNUNET_break (0);  /* FIXME: this assertion seems to fail sometimes!? */
-    disconnect_and_schedule_reconnect (h);
-    return;
-  }
-  n = GNUNET_new (struct Neighbour);
-  n->id = cim->id;
-  n->h = h;
-  n->is_ready = GNUNET_YES;
-  n->traffic_overhead = 0;
-  GNUNET_BANDWIDTH_tracker_init2 (&n->out_tracker,
-                                  &outbound_bw_tracker_update,
-                                  n,
-                                  GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
-                                  MAX_BANDWIDTH_CARRY_S,
-                                  &notify_excess_cb,
-                                  n);
-  GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multipeermap_put (
-                   h->neighbours,
-                   &n->id,
-                   n,
-                   GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-
-  GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, cim->quota_out);
-  n->mq = GNUNET_MQ_queue_for_callbacks (&mq_send_impl,
-                                         &mq_destroy_impl,
-                                         &mq_cancel_impl,
-                                         n,
-                                         h->handlers,
-                                         &peer_mq_error_handler,
-                                         n);
-  if (NULL != h->nc_cb)
-  {
-    n->handlers_cls = h->nc_cb (h->cls, &n->id, n->mq);
-    GNUNET_MQ_set_handlers_closure (n->mq, n->handlers_cls);
-  }
-}
-
-
-/**
- * Function we use for handling incoming disconnect messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param dim message received
- */
-static void
-handle_disconnect (void *cls, const struct DisconnectInfoMessage *dim)
-{
-  struct GNUNET_TRANSPORT_CoreHandle *h = cls;
-  struct Neighbour *n;
-
-  GNUNET_break (ntohl (dim->reserved) == 0);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Receiving DISCONNECT message for `%s'.\n",
-       GNUNET_i2s (&dim->peer));
-  n = neighbour_find (h, &dim->peer);
-  if (NULL == n)
-  {
-    GNUNET_break (0);
-    disconnect_and_schedule_reconnect (h);
-    return;
-  }
-  GNUNET_assert (GNUNET_YES == neighbour_delete (h, &dim->peer, n));
-}
-
-
-/**
- * Function we use for handling incoming send-ok messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param okm message received
- */
-static void
-handle_send_ok (void *cls, const struct SendOkMessage *okm)
-{
-  struct GNUNET_TRANSPORT_CoreHandle *h = cls;
-  struct Neighbour *n;
-  uint32_t bytes_msg;
-  uint32_t bytes_physical;
-  uint16_t success =  ntohs (okm->success);
-
-  bytes_msg = ntohs (okm->bytes_msg);
-  bytes_physical = ntohl (okm->bytes_physical);
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Receiving SEND_OK message, transmission to %s %s.\n",
-       GNUNET_i2s (&okm->peer),
-       success == GNUNET_OK ? "succeeded" : "failed");
-  n = neighbour_find (h, &okm->peer);
-  if (NULL == n)
-  {
-    /* We should never get a 'SEND_OK' for a peer that we are not
-       connected to */
-    GNUNET_break (0);
-    disconnect_and_schedule_reconnect (h);
-    return;
-  }
-  if (bytes_physical > bytes_msg)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Overhead for %u byte message was %u\n",
-         bytes_msg,
-         bytes_physical - bytes_msg);
-    n->traffic_overhead += bytes_physical - bytes_msg;
-  }
-}
-
-
-/**
- * Function we use for checking incoming "inbound" messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param im message received
- */
-static int
-check_recv (void *cls, const struct InboundMessage *im)
-{
-  const struct GNUNET_MessageHeader *imm;
-  uint16_t size;
-
-  size = ntohs (im->header.size) - sizeof(*im);
-  if (size < sizeof(struct GNUNET_MessageHeader))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  imm = (const struct GNUNET_MessageHeader *) &im[1];
-  if (ntohs (imm->size) != size)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Function we use for handling incoming messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param im message received
- */
-static void
-handle_recv (void *cls, const struct InboundMessage *im)
-{
-  struct GNUNET_TRANSPORT_CoreHandle *h = cls;
-  const struct GNUNET_MessageHeader *imm =
-    (const struct GNUNET_MessageHeader *) &im[1];
-  struct Neighbour *n;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Received message of type %u with %u bytes from `%s'.\n",
-       (unsigned int) ntohs (imm->type),
-       (unsigned int) ntohs (imm->size),
-       GNUNET_i2s (&im->peer));
-  n = neighbour_find (h, &im->peer);
-  if (NULL == n)
-  {
-    GNUNET_break (0);
-    disconnect_and_schedule_reconnect (h);
-    return;
-  }
-  h->rom_pending++;
-  GNUNET_MQ_inject_message (n->mq, imm);
-}
-
-
-/**
- * Function we use for handling incoming set quota messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param qm message received
- */
-static void
-handle_set_quota (void *cls, const struct QuotaSetMessage *qm)
-{
-  struct GNUNET_TRANSPORT_CoreHandle *h = cls;
-  struct Neighbour *n;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Receiving SET_QUOTA message for `%s' with quota %u\n",
-       GNUNET_i2s (&qm->peer),
-       ntohl (qm->quota.value__));
-  n = neighbour_find (h, &qm->peer);
-  if (NULL == n)
-  {
-    GNUNET_break (
-      0);   /* FIXME: julius reports this assertion fails sometimes? */
-    disconnect_and_schedule_reconnect (h);
-    return;
-  }
-  GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, qm->quota);
-}
-
-
-/**
- * Try again to connect to transport service.
- *
- * @param cls the handle to the transport service
- */
-static void
-reconnect (void *cls)
-{
-  struct GNUNET_TRANSPORT_CoreHandle *h = cls;
-  struct GNUNET_MQ_MessageHandler handlers[] =
-  { GNUNET_MQ_hd_var_size (hello,
-                           GNUNET_MESSAGE_TYPE_HELLO,
-                           struct GNUNET_MessageHeader,
-                           h),
-    GNUNET_MQ_hd_fixed_size (connect,
-                             GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT,
-                             struct ConnectInfoMessage,
-                             h),
-    GNUNET_MQ_hd_fixed_size (disconnect,
-                             GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT,
-                             struct DisconnectInfoMessage,
-                             h),
-    GNUNET_MQ_hd_fixed_size (send_ok,
-                             GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_OK,
-                             struct SendOkMessage,
-                             h),
-    GNUNET_MQ_hd_var_size (recv,
-                           GNUNET_MESSAGE_TYPE_TRANSPORT_RECV,
-                           struct InboundMessage,
-                           h),
-    GNUNET_MQ_hd_fixed_size (set_quota,
-                             GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA,
-                             struct QuotaSetMessage,
-                             h),
-    GNUNET_MQ_handler_end () };
-  struct GNUNET_MQ_Envelope *env;
-  struct StartMessage *s;
-  uint32_t options;
-
-  h->reconnect_task = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service.\n");
-  GNUNET_assert (NULL == h->mq);
-  h->mq =
-    GNUNET_CLIENT_connect (h->cfg, "transport", handlers, &mq_error_handler, 
h);
-  if (NULL == h->mq)
-    return;
-  env = GNUNET_MQ_msg (s, GNUNET_MESSAGE_TYPE_TRANSPORT_START);
-  options = 0;
-  if (h->check_self)
-    options |= 1;
-  if (NULL != h->handlers)
-    options |= 2;
-  s->options = htonl (options);
-  s->self = h->self;
-  GNUNET_MQ_send (h->mq, env);
-}
-
-
-/**
- * Function that will schedule the job that will try
- * to connect us again to the client.
- *
- * @param h transport service to reconnect
- */
-static void
-disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_CoreHandle *h)
-{
-  GNUNET_assert (NULL == h->reconnect_task);
-  /* Forget about all neighbours that we used to be connected to */
-  GNUNET_CONTAINER_multipeermap_iterate (h->neighbours, &neighbour_delete, h);
-  if (NULL != h->mq)
-  {
-    GNUNET_MQ_destroy (h->mq);
-    h->mq = NULL;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Scheduling task to reconnect to transport service in %s.\n",
-       GNUNET_STRINGS_relative_time_to_string (h->reconnect_delay, 
GNUNET_YES));
-  h->reconnect_task =
-    GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h);
-  h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
-}
-
-
-/**
- * Checks if a given peer is connected to us and get the message queue.
- *
- * @param handle connection to transport service
- * @param peer the peer to check
- * @return NULL if disconnected, otherwise message queue for @a peer
- */
-struct GNUNET_MQ_Handle *
-GNUNET_TRANSPORT_core_get_mq (struct GNUNET_TRANSPORT_CoreHandle *handle,
-                              const struct GNUNET_PeerIdentity *peer)
-{
-  struct Neighbour *n;
-
-  n = neighbour_find (handle, peer);
-  if (NULL == n)
-    return NULL;
-  return n->mq;
-}
-
-
-/**
- * Connect to the transport service.  Note that the connection may
- * complete (or fail) asynchronously.
- *
- * @param cfg configuration to use
- * @param self our own identity (API should check that it matches
- *             the identity found by transport), or NULL (no check)
- * @param cls closure for the callbacks
- * @param rec receive function to call
- * @param nc function to call on connect events
- * @param nd function to call on disconnect events
- * @param neb function to call if we have excess bandwidth to a peer
- * @return NULL on error
- */
-struct GNUNET_TRANSPORT_CoreHandle *
-GNUNET_TRANSPORT_core_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                               const struct GNUNET_PeerIdentity *self,
-                               const struct GNUNET_MQ_MessageHandler *handlers,
-                               void *cls,
-                               GNUNET_TRANSPORT_NotifyConnect nc,
-                               GNUNET_TRANSPORT_NotifyDisconnect nd,
-                               GNUNET_TRANSPORT_NotifyExcessBandwidth neb)
-{
-  struct GNUNET_TRANSPORT_CoreHandle *h;
-  unsigned int i;
-
-  h = GNUNET_new (struct GNUNET_TRANSPORT_CoreHandle);
-  if (NULL != self)
-  {
-    h->self = *self;
-    h->check_self = GNUNET_YES;
-  }
-  h->cfg = cfg;
-  h->cls = cls;
-  h->nc_cb = nc;
-  h->nd_cb = nd;
-  h->neb_cb = neb;
-  h->reconnect_delay = GNUNET_TIME_UNIT_ZERO;
-  if (NULL != handlers)
-  {
-    for (i = 0; NULL != handlers[i].cb; i++)
-      ;
-    h->handlers = GNUNET_new_array (i + 1, struct GNUNET_MQ_MessageHandler);
-    GNUNET_memcpy (h->handlers,
-                   handlers,
-                   i * sizeof(struct GNUNET_MQ_MessageHandler));
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to transport service\n");
-  reconnect (h);
-  if (NULL == h->mq)
-  {
-    GNUNET_free (h->handlers);
-    GNUNET_free (h);
-    return NULL;
-  }
-  h->neighbours =
-    GNUNET_CONTAINER_multipeermap_create (STARTING_NEIGHBOURS_SIZE, 
GNUNET_YES);
-  return h;
-}
-
-
-/**
- * Disconnect from the transport service.
- *
- * @param handle handle to the service as returned from
- * #GNUNET_TRANSPORT_core_connect()
- */
-void
-GNUNET_TRANSPORT_core_disconnect (struct GNUNET_TRANSPORT_CoreHandle *handle)
-{
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Transport disconnect called!\n");
-  /* this disconnects all neighbours... */
-  if (NULL == handle->reconnect_task)
-    disconnect_and_schedule_reconnect (handle);
-  /* and now we stop trying to connect again... */
-  if (NULL != handle->reconnect_task)
-  {
-    GNUNET_SCHEDULER_cancel (handle->reconnect_task);
-    handle->reconnect_task = NULL;
-  }
-  GNUNET_CONTAINER_multipeermap_destroy (handle->neighbours);
-  handle->neighbours = NULL;
-  GNUNET_free (handle->handlers);
-  handle->handlers = NULL;
-  GNUNET_free (handle);
-}
-
-
-/**
- * Notification from the CORE service to the TRANSPORT service
- * that the CORE service has finished processing a message from
- * TRANSPORT (via the @code{handlers} of #GNUNET_TRANSPORT_core_connect())
- * and that it is thus now OK for TRANSPORT to send more messages
- * for @a pid.
- *
- * Used to provide flow control, this is our equivalent to
- * #GNUNET_SERVICE_client_continue() of an ordinary service.
- *
- * Note that due to the use of a window, TRANSPORT may send multiple
- * messages destined for the same peer even without an intermediate
- * call to this function. However, CORE must still call this function
- * once per message received, as otherwise eventually the window will
- * be full and TRANSPORT will stop providing messages to CORE for @a
- * pid.
- *
- * @param ch core handle
- * @param pid which peer was the message from that was fully processed by CORE
- */
-void
-GNUNET_TRANSPORT_core_receive_continue (struct GNUNET_TRANSPORT_CoreHandle *ch,
-                                        const struct GNUNET_PeerIdentity *pid)
-{
-  struct RecvOkMessage *rom;
-  struct GNUNET_MQ_Envelope *env;
-
-  GNUNET_assert (ch->rom_pending > 0);
-  ch->rom_pending--;
-  env = GNUNET_MQ_msg (rom, GNUNET_MESSAGE_TYPE_TRANSPORT_RECV_OK);
-  rom->increase_window_delta = htonl (1);
-  rom->peer = *pid;
-  GNUNET_MQ_send (ch->mq, env);
-}
-
-
-/* end of transport_api_core.c */
diff --git a/src/transport/transport_api_hello_get.c 
b/src/transport/transport_api_hello_get.c
deleted file mode 100644
index f8bcc5f07..000000000
--- a/src/transport/transport_api_hello_get.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009-2013, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/transport_api_hello_get.c
- * @brief library to obtain our HELLO from our transport service
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_constants.h"
-#include "gnunet_arm_service.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_transport_hello_service.h"
-#include "transport.h"
-
-
-/**
- * Functions to call with this peer's HELLO.
- */
-struct GNUNET_TRANSPORT_HelloGetHandle
-{
-  /**
-   * Our configuration.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Transport handle.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Callback to call once we got our HELLO.
-   */
-  GNUNET_TRANSPORT_HelloUpdateCallback rec;
-
-  /**
-   * Closure for @e rec.
-   */
-  void *rec_cls;
-
-  /**
-   * Task for calling the HelloUpdateCallback when we already have a HELLO
-   */
-  struct GNUNET_SCHEDULER_Task *notify_task;
-
-  /**
-   * ID of the task trying to reconnect to the service.
-   */
-  struct GNUNET_SCHEDULER_Task *reconnect_task;
-
-  /**
-   * Delay until we try to reconnect.
-   */
-  struct GNUNET_TIME_Relative reconnect_delay;
-
-  /**
-   * Type of HELLOs client cares about.
-   */
-  enum GNUNET_TRANSPORT_AddressClass ac;
-};
-
-
-/**
- * Function we use for checking incoming HELLO messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_Handle *`
- * @param msg message received
- * @return #GNUNET_OK if message is well-formed
- */
-static int
-check_hello (void *cls,
-             const struct GNUNET_MessageHeader *msg)
-{
-  struct GNUNET_PeerIdentity me;
-
-  if (GNUNET_OK !=
-      GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) msg,
-                           &me))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Receiving (my own) HELLO message (%u bytes), I am `%s'.\n",
-              (unsigned int) ntohs (msg->size),
-              GNUNET_i2s (&me));
-  return GNUNET_OK;
-}
-
-
-/**
- * Function we use for handling incoming HELLO messages.
- *
- * @param cls closure, a `struct GNUNET_TRANSPORT_HelloGetHandle *`
- * @param msg message received
- */
-static void
-handle_hello (void *cls,
-              const struct GNUNET_MessageHeader *msg)
-{
-  struct GNUNET_TRANSPORT_HelloGetHandle *ghh = cls;
-
-  ghh->rec (ghh->rec_cls,
-            msg);
-}
-
-
-/**
- * Function that will schedule the job that will try
- * to connect us again to the client.
- *
- * @param ghh transport service to reconnect
- */
-static void
-schedule_reconnect (struct GNUNET_TRANSPORT_HelloGetHandle *ghh);
-
-
-/**
- * Generic error handler, called with the appropriate
- * error code and the same closure specified at the creation of
- * the message queue.
- * Not every message queue implementation supports an error handler.
- *
- * @param cls closure with the `struct GNUNET_TRANSPORT_Handle *`
- * @param error error code
- */
-static void
-mq_error_handler (void *cls,
-                  enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_TRANSPORT_HelloGetHandle *ghh = cls;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Error receiving from transport service, disconnecting 
temporarily.\n");
-  GNUNET_MQ_destroy (ghh->mq);
-  ghh->mq = NULL;
-  schedule_reconnect (ghh);
-}
-
-
-/**
- * Try again to connect to transport service.
- *
- * @param cls the handle to the transport service
- */
-static void
-reconnect (void *cls)
-{
-  struct GNUNET_TRANSPORT_HelloGetHandle *ghh = cls;
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_var_size (hello,
-                           GNUNET_MESSAGE_TYPE_HELLO,
-                           struct GNUNET_MessageHeader,
-                           ghh),
-    GNUNET_MQ_handler_end ()
-  };
-  struct GNUNET_MQ_Envelope *env;
-  struct StartMessage *s;
-
-  ghh->reconnect_task = NULL;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Connecting to transport service.\n");
-  GNUNET_assert (NULL == ghh->mq);
-  ghh->mq = GNUNET_CLIENT_connect (ghh->cfg,
-                                   "transport",
-                                   handlers,
-                                   &mq_error_handler,
-                                   ghh);
-  if (NULL == ghh->mq)
-    return;
-  env = GNUNET_MQ_msg (s,
-                       GNUNET_MESSAGE_TYPE_TRANSPORT_START);
-  s->options = htonl (0);
-  GNUNET_MQ_send (ghh->mq,
-                  env);
-}
-
-
-/**
- * Function that will schedule the job that will try
- * to connect us again to the client.
- *
- * @param ghh transport service to reconnect
- */
-static void
-schedule_reconnect (struct GNUNET_TRANSPORT_HelloGetHandle *ghh)
-{
-  ghh->reconnect_task =
-    GNUNET_SCHEDULER_add_delayed (ghh->reconnect_delay,
-                                  &reconnect,
-                                  ghh);
-  ghh->reconnect_delay = GNUNET_TIME_STD_BACKOFF (ghh->reconnect_delay);
-}
-
-
-/**
- * Obtain the HELLO message for this peer.  The callback given in this function
- * is never called synchronously.
- *
- * @param cfg configuration
- * @param ac which network type should the addresses from the HELLO belong to?
- * @param rec function to call with the HELLO, sender will be our peer
- *            identity; message and sender will be NULL on timeout
- *            (handshake with transport service pending/failed).
- *             cost estimate will be 0.
- * @param rec_cls closure for @a rec
- * @return handle to cancel the operation
- */
-struct GNUNET_TRANSPORT_HelloGetHandle *
-GNUNET_TRANSPORT_hello_get (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                            enum GNUNET_TRANSPORT_AddressClass ac,
-                            GNUNET_TRANSPORT_HelloUpdateCallback rec,
-                            void *rec_cls)
-{
-  struct GNUNET_TRANSPORT_HelloGetHandle *ghh;
-
-  ghh = GNUNET_new (struct GNUNET_TRANSPORT_HelloGetHandle);
-  ghh->rec = rec;
-  ghh->rec_cls = rec_cls;
-  ghh->cfg = cfg;
-  ghh->ac = ac;
-  reconnect (ghh);
-  if (NULL == ghh->mq)
-  {
-    GNUNET_free (ghh);
-    return NULL;
-  }
-  return ghh;
-}
-
-
-/**
- * Stop receiving updates about changes to our HELLO message.
- *
- * @param ghh handle to cancel
- */
-void
-GNUNET_TRANSPORT_hello_get_cancel (struct GNUNET_TRANSPORT_HelloGetHandle *ghh)
-{
-  if (NULL != ghh->reconnect_task)
-  {
-    GNUNET_SCHEDULER_cancel (ghh->reconnect_task);
-    ghh->reconnect_task = NULL;
-  }
-  if (NULL != ghh->mq)
-  {
-    GNUNET_MQ_destroy (ghh->mq);
-    ghh->mq = NULL;
-  }
-  GNUNET_free (ghh);
-}
-
-
-/* end of transport_api_hello_get.c */
diff --git a/src/transport/transport_api_manipulation.c 
b/src/transport/transport_api_manipulation.c
deleted file mode 100644
index 4f4ccc4a0..000000000
--- a/src/transport/transport_api_manipulation.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009-2013, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/transport_api_manipulation.c
- * @brief library to access the low-level P2P IO service
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_constants.h"
-#include "gnunet_arm_service.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_transport_service.h"
-#include "transport.h"
-
-#define LOG(kind, ...) GNUNET_log_from (kind, "transport-api", __VA_ARGS__)
-
-
-/**
- * Handle for the transport service (includes all of the
- * state for the transport service).
- */
-struct GNUNET_TRANSPORT_ManipulationHandle
-{
-  /**
-   * My client connection to the transport service.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * My configuration.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * ID of the task trying to reconnect to the service.
-   */
-  struct GNUNET_SCHEDULER_Task *reconnect_task;
-
-  /**
-   * Delay until we try to reconnect.
-   */
-  struct GNUNET_TIME_Relative reconnect_delay;
-
-  /**
-   * Reconnect in progress
-   */
-  int reconnecting;
-};
-
-
-/**
- * Function that will schedule the job that will try
- * to connect us again to the client.
- *
- * @param h transport service to reconnect
- */
-static void
-disconnect_and_schedule_reconnect (struct
-                                   GNUNET_TRANSPORT_ManipulationHandle *h);
-
-
-/**
- * Generic error handler, called with the appropriate
- * error code and the same closure specified at the creation of
- * the message queue.
- * Not every message queue implementation supports an error handler.
- *
- * @param cls closure with the `struct GNUNET_TRANSPORT_ManipulationHandle *`
- * @param error error code
- */
-static void
-mq_error_handler (void *cls,
-                  enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_TRANSPORT_ManipulationHandle *h = cls;
-
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Error receiving from transport service, disconnecting temporarily.\n");
-  h->reconnecting = GNUNET_YES;
-  disconnect_and_schedule_reconnect (h);
-}
-
-
-/**
- * Try again to connect to transport service.
- *
- * @param cls the handle to the transport service
- */
-static void
-reconnect (void *cls)
-{
-  struct GNUNET_TRANSPORT_ManipulationHandle *h = cls;
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_handler_end ()
-  };
-  struct GNUNET_MQ_Envelope *env;
-  struct StartMessage *s;
-
-  h->reconnect_task = NULL;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Connecting to transport service.\n");
-  GNUNET_assert (NULL == h->mq);
-  h->reconnecting = GNUNET_NO;
-  h->mq = GNUNET_CLIENT_connect (h->cfg,
-                                 "transport",
-                                 handlers,
-                                 &mq_error_handler,
-                                 h);
-  if (NULL == h->mq)
-    return;
-  env = GNUNET_MQ_msg (s,
-                       GNUNET_MESSAGE_TYPE_TRANSPORT_START);
-  GNUNET_MQ_send (h->mq,
-                  env);
-}
-
-
-/**
- * Function that will schedule the job that will try
- * to connect us again to the client.
- *
- * @param h transport service to reconnect
- */
-static void
-disconnect_and_schedule_reconnect (struct
-                                   GNUNET_TRANSPORT_ManipulationHandle *h)
-{
-  GNUNET_assert (NULL == h->reconnect_task);
-  if (NULL != h->mq)
-  {
-    GNUNET_MQ_destroy (h->mq);
-    h->mq = NULL;
-  }
-  h->reconnect_task =
-    GNUNET_SCHEDULER_add_delayed (h->reconnect_delay,
-                                  &reconnect,
-                                  h);
-  h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
-}
-
-
-/**
- * Set transport metrics for a peer and a direction.
- *
- * @param handle transport handle
- * @param peer the peer to set the metric for
- * @param prop the performance metrics to set
- * @param delay_in inbound delay to introduce
- * @param delay_out outbound delay to introduce
- *
- * Note: Delay restrictions in receiving direction will be enforced
- * with one message delay.
- */
-void
-GNUNET_TRANSPORT_manipulation_set (struct
-                                   GNUNET_TRANSPORT_ManipulationHandle *handle,
-                                   const struct GNUNET_PeerIdentity *peer,
-                                   const struct GNUNET_ATS_Properties *prop,
-                                   struct GNUNET_TIME_Relative delay_in,
-                                   struct GNUNET_TIME_Relative delay_out)
-{
-  struct GNUNET_MQ_Envelope *env;
-  struct TrafficMetricMessage *msg;
-
-  if (NULL == handle->mq)
-    return;
-  env = GNUNET_MQ_msg (msg,
-                       GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC);
-  msg->reserved = htonl (0);
-  msg->peer = *peer;
-  GNUNET_ATS_properties_hton (&msg->properties,
-                              prop);
-  msg->delay_in = GNUNET_TIME_relative_hton (delay_in);
-  msg->delay_out = GNUNET_TIME_relative_hton (delay_out);
-  GNUNET_MQ_send (handle->mq,
-                  env);
-}
-
-
-/**
- * Connect to the transport service.  Note that the connection may
- * complete (or fail) asynchronously.
- *
- * @param cfg configuration to use
- * @return NULL on error
- */
-struct GNUNET_TRANSPORT_ManipulationHandle *
-GNUNET_TRANSPORT_manipulation_connect (const struct
-                                       GNUNET_CONFIGURATION_Handle *cfg)
-{
-  struct GNUNET_TRANSPORT_ManipulationHandle *h;
-
-  h = GNUNET_new (struct GNUNET_TRANSPORT_ManipulationHandle);
-  h->cfg = cfg;
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Connecting to transport service.\n");
-  reconnect (h);
-  if (NULL == h->mq)
-  {
-    GNUNET_free (h);
-    return NULL;
-  }
-  return h;
-}
-
-
-/**
- * Disconnect from the transport service.
- *
- * @param handle handle to the service as returned from 
#GNUNET_TRANSPORT_manipulation_connect()
- */
-void
-GNUNET_TRANSPORT_manipulation_disconnect (struct
-                                          GNUNET_TRANSPORT_ManipulationHandle *
-                                          handle)
-{
-  if (NULL == handle->reconnect_task)
-    disconnect_and_schedule_reconnect (handle);
-  /* and now we stop trying to connect again... */
-  if (NULL != handle->reconnect_task)
-  {
-    GNUNET_SCHEDULER_cancel (handle->reconnect_task);
-    handle->reconnect_task = NULL;
-  }
-  GNUNET_free (handle);
-}
-
-
-/* end of transport_api_manipulation.c */
diff --git a/src/transport/transport_api_monitor_peers.c 
b/src/transport/transport_api_monitor_peers.c
deleted file mode 100644
index ef1dc6087..000000000
--- a/src/transport/transport_api_monitor_peers.c
+++ /dev/null
@@ -1,443 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009-2014, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/transport_api_monitor_peers.c
- * @brief montoring api for transport peer status
- *
- * This api provides the ability to query the transport service about
- * the connection status of a specific or all peers.
- *
- * Calls back with information about peer(s) including address used, state and
- * state timeout for peer requests.
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_transport_service.h"
-#include "transport.h"
-
-/**
- * Context for iterating validation entries.
- */
-struct GNUNET_TRANSPORT_PeerMonitoringContext
-{
-  /**
-   * Function to call with the binary address.
-   */
-  GNUNET_TRANSPORT_PeerIterateCallback cb;
-
-  /**
-   * Closure for @e cb.
-   */
-  void *cb_cls;
-
-  /**
-   * Connection to the service.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Configuration we use.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Backoff for reconnect.
-   */
-  struct GNUNET_TIME_Relative backoff;
-
-  /**
-   * Task ID for reconnect.
-   */
-  struct GNUNET_SCHEDULER_Task *reconnect_task;
-
-  /**
-   * Identity of the peer to monitor.
-   */
-  struct GNUNET_PeerIdentity peer;
-
-  /**
-   * Was this a one-shot request?
-   */
-  int one_shot;
-};
-
-
-/**
- * Check if a state is defined as connected
- *
- * @param state the state value
- * @return #GNUNET_YES or #GNUNET_NO
- */
-int
-GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state)
-{
-  switch (state)
-  {
-  case GNUNET_TRANSPORT_PS_NOT_CONNECTED:
-  case GNUNET_TRANSPORT_PS_INIT_ATS:
-  case GNUNET_TRANSPORT_PS_SYN_SENT:
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ATS:
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ACK:
-    return GNUNET_NO;
-
-  case GNUNET_TRANSPORT_PS_CONNECTED:
-  case GNUNET_TRANSPORT_PS_RECONNECT_ATS:
-  case GNUNET_TRANSPORT_PS_RECONNECT_SENT:
-  case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT:
-    return GNUNET_YES;
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT:
-  case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED:
-    return GNUNET_NO;
-
-  default:
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Unhandled state `%s'\n",
-                GNUNET_TRANSPORT_ps2s (state));
-    GNUNET_break (0);
-    break;
-  }
-  return GNUNET_SYSERR;
-}
-
-
-/**
- * Convert peer state to human-readable string.
- *
- * @param state the state value
- * @return corresponding string
- */
-const char *
-GNUNET_TRANSPORT_ps2s (enum GNUNET_TRANSPORT_PeerState state)
-{
-  switch (state)
-  {
-  case GNUNET_TRANSPORT_PS_NOT_CONNECTED:
-    return "S_NOT_CONNECTED";
-
-  case GNUNET_TRANSPORT_PS_INIT_ATS:
-    return "S_INIT_ATS";
-
-  case GNUNET_TRANSPORT_PS_SYN_SENT:
-    return "S_SYN_SENT";
-
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ATS:
-    return "S_SYN_RECV_ATS";
-
-  case GNUNET_TRANSPORT_PS_SYN_RECV_ACK:
-    return "S_SYN_RECV_ACK";
-
-  case GNUNET_TRANSPORT_PS_CONNECTED:
-    return "S_CONNECTED";
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_ATS:
-    return "S_RECONNECT_ATS";
-
-  case GNUNET_TRANSPORT_PS_RECONNECT_SENT:
-    return "S_RECONNECT_SENT";
-
-  case GNUNET_TRANSPORT_PS_SWITCH_SYN_SENT:
-    return "S_SWITCH_SYN_SENT";
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT:
-    return "S_DISCONNECT";
-
-  case GNUNET_TRANSPORT_PS_DISCONNECT_FINISHED:
-    return "S_DISCONNECT_FINISHED";
-
-  default:
-    GNUNET_break (0);
-    return "UNDEFINED";
-  }
-}
-
-
-/**
- * Task run to re-establish the connection.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PeerMonitoringContext *`
- */
-static void
-do_peer_connect (void *cls);
-
-
-/**
- * Cut the existing connection and reconnect.
- *
- * @param pal_ctx our context
- */
-static void
-reconnect_peer_ctx (struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx)
-{
-  GNUNET_assert (GNUNET_NO == pal_ctx->one_shot);
-  GNUNET_MQ_destroy (pal_ctx->mq);
-  pal_ctx->mq = NULL;
-  pal_ctx->cb (pal_ctx->cb_cls,
-               NULL,
-               NULL,
-               GNUNET_TRANSPORT_PS_NOT_CONNECTED,
-               GNUNET_TIME_UNIT_ZERO_ABS);
-  pal_ctx->backoff = GNUNET_TIME_STD_BACKOFF (pal_ctx->backoff);
-  pal_ctx->reconnect_task = GNUNET_SCHEDULER_add_delayed (pal_ctx->backoff,
-                                                          &do_peer_connect,
-                                                          pal_ctx);
-}
-
-
-/**
- * Function called with responses from the service.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PeerMonitoringContext *`
- * @param msg message from service
- */
-static void
-handle_response_end (void *cls,
-                     const struct GNUNET_MessageHeader *msg)
-{
-  struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls;
-
-  if (pal_ctx->one_shot)
-  {
-    /* iteration finished */
-    pal_ctx->cb (pal_ctx->cb_cls,
-                 NULL,
-                 NULL,
-                 GNUNET_TRANSPORT_PS_NOT_CONNECTED,
-                 GNUNET_TIME_UNIT_ZERO_ABS);
-    GNUNET_TRANSPORT_monitor_peers_cancel (pal_ctx);
-    return;
-  }
-  /* not quite what we expected, reconnect */
-  GNUNET_break (0);
-  reconnect_peer_ctx (pal_ctx);
-}
-
-
-/**
- * Function called to check responses from the service.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PeerMonitoringContext *`
- * @param pir_msg  message with the human-readable address
- * @return #GNUNET_OK if @a pir_msg is well-formed
- */
-static int
-check_response (void *cls,
-                const struct PeerIterateResponseMessage *pir_msg)
-{
-  uint16_t size = ntohs (pir_msg->header.size) - sizeof(*pir_msg);
-  size_t alen = ntohl (pir_msg->addrlen);
-  size_t tlen = ntohl (pir_msg->pluginlen);
-  const char *addr;
-  const char *transport_name;
-
-  if (size != tlen + alen)
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  if ((0 == tlen) && (0 == alen))
-    return GNUNET_OK;
-  if (0 == tlen)
-  {
-    GNUNET_break (0);  /* This must not happen: address without plugin */
-    return GNUNET_SYSERR;
-  }
-  addr = (const char *) &pir_msg[1];
-  transport_name = &addr[alen];
-  if (transport_name[tlen - 1] != '\0')
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Function called with responses from the service.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PeerMonitoringContext *`
- * @param msg  message with the human-readable address
- */
-static void
-handle_response (void *cls,
-                 const struct PeerIterateResponseMessage *pir_msg)
-{
-  struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls;
-  struct GNUNET_HELLO_Address *address;
-  size_t alen = ntohl (pir_msg->addrlen);
-  size_t tlen = ntohl (pir_msg->pluginlen);
-  const char *addr;
-  const char *transport_name;
-
-  if ((0 == tlen) &&
-      (0 == alen))
-  {
-    /* No address available */
-    pal_ctx->cb (pal_ctx->cb_cls,
-                 &pir_msg->peer,
-                 NULL,
-                 ntohl (pir_msg->state),
-                 GNUNET_TIME_absolute_ntoh (pir_msg->state_timeout));
-    return;
-  }
-  addr = (const char *) &pir_msg[1];
-  transport_name = &addr[alen];
-
-  /* notify client */
-  address = GNUNET_HELLO_address_allocate (&pir_msg->peer,
-                                           transport_name,
-                                           addr,
-                                           alen,
-                                           ntohl 
(pir_msg->local_address_info));
-  pal_ctx->cb (pal_ctx->cb_cls,
-               &pir_msg->peer,
-               address,
-               ntohl (pir_msg->state),
-               GNUNET_TIME_absolute_ntoh (pir_msg->state_timeout));
-  GNUNET_HELLO_address_free (address);
-}
-
-
-/**
- * Generic error handler, called with the appropriate error code and
- * the same closure specified at the creation of the message queue.
- * Not every message queue implementation supports an error handler.
- *
- * @param cls closure with the `struct GNUNET_TRANSPORT_PeerMonitoringContext 
*`
- * @param error error code
- */
-static void
-mq_error_handler (void *cls,
-                  enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls;
-
-  if (pal_ctx->one_shot)
-  {
-    /* Disconnect */
-    pal_ctx->cb (pal_ctx->cb_cls,
-                 NULL,
-                 NULL,
-                 GNUNET_TRANSPORT_PS_NOT_CONNECTED,
-                 GNUNET_TIME_UNIT_ZERO_ABS);
-    GNUNET_TRANSPORT_monitor_peers_cancel (pal_ctx);
-    return;
-  }
-  reconnect_peer_ctx (pal_ctx);
-}
-
-
-/**
- * Task run to re-establish the connection.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PeerMonitoringContext *`
- */
-static void
-do_peer_connect (void *cls)
-{
-  struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls;
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_var_size (response,
-                           GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE,
-                           struct PeerIterateResponseMessage,
-                           pal_ctx),
-    GNUNET_MQ_hd_fixed_size (response_end,
-                             
GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE_END,
-                             struct GNUNET_MessageHeader,
-                             pal_ctx),
-    GNUNET_MQ_handler_end ()
-  };
-  struct PeerMonitorMessage *msg;
-  struct GNUNET_MQ_Envelope *env;
-
-  pal_ctx->reconnect_task = NULL;
-  pal_ctx->mq = GNUNET_CLIENT_connect (pal_ctx->cfg,
-                                       "transport",
-                                       handlers,
-                                       &mq_error_handler,
-                                       pal_ctx);
-  if (NULL == pal_ctx->mq)
-    return;
-  env = GNUNET_MQ_msg (msg,
-                       GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST);
-  msg->one_shot = htonl (pal_ctx->one_shot);
-  msg->peer = pal_ctx->peer;
-  GNUNET_MQ_send (pal_ctx->mq,
-                  env);
-}
-
-
-struct GNUNET_TRANSPORT_PeerMonitoringContext *
-GNUNET_TRANSPORT_monitor_peers (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                                const struct GNUNET_PeerIdentity *peer,
-                                int one_shot,
-                                GNUNET_TRANSPORT_PeerIterateCallback
-                                peer_callback,
-                                void *peer_callback_cls)
-{
-  struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx
-    = GNUNET_new (struct GNUNET_TRANSPORT_PeerMonitoringContext);
-
-  pal_ctx->cb = peer_callback;
-  pal_ctx->cb_cls = peer_callback_cls;
-  pal_ctx->cfg = cfg;
-  if (NULL != peer)
-    pal_ctx->peer = *peer;
-  pal_ctx->one_shot = one_shot;
-  do_peer_connect (pal_ctx);
-  if (NULL == pal_ctx->mq)
-  {
-    GNUNET_free (pal_ctx);
-    return NULL;
-  }
-  return pal_ctx;
-}
-
-
-/**
- * Cancel request to monitor peers
- *
- * @param pic handle for the request to cancel
- */
-void
-GNUNET_TRANSPORT_monitor_peers_cancel (struct
-                                       GNUNET_TRANSPORT_PeerMonitoringContext *
-                                       pic)
-{
-  if (NULL != pic->mq)
-  {
-    GNUNET_MQ_destroy (pic->mq);
-    pic->mq = NULL;
-  }
-  if (NULL != pic->reconnect_task)
-  {
-    GNUNET_SCHEDULER_cancel (pic->reconnect_task);
-    pic->reconnect_task = NULL;
-  }
-  GNUNET_free (pic);
-}
-
-
-/* end of transport_api_monitor_peers.c */
diff --git a/src/transport/transport_api_monitor_plugins.c 
b/src/transport/transport_api_monitor_plugins.c
deleted file mode 100644
index 43a11442b..000000000
--- a/src/transport/transport_api_monitor_plugins.c
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2014, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/transport_api_monitor_plugins.c
- * @brief montoring api for transport plugin session status
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_transport_service.h"
-#include "transport.h"
-
-
-/**
- * Handle for a plugin session state monitor.
- */
-struct GNUNET_TRANSPORT_PluginMonitor
-{
-  /**
-   * Connection to the service.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Our configuration.
-   */
-  const struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * Callback to call.
-   */
-  GNUNET_TRANSPORT_SessionMonitorCallback cb;
-
-  /**
-   * Closure for @e cb
-   */
-  void *cb_cls;
-
-  /**
-   * Map of session_ids (reduced to 32-bits) to
-   * `struct GNUNET_TRANSPORT_PluginSession` objects.
-   */
-  struct GNUNET_CONTAINER_MultiHashMap32 *sessions;
-
-  /**
-   * Backoff for reconnect.
-   */
-  struct GNUNET_TIME_Relative backoff;
-
-  /**
-   * Task ID for reconnect.
-   */
-  struct GNUNET_SCHEDULER_Task *reconnect_task;
-};
-
-
-/**
- * Abstract representation of a plugin's session.
- * Corresponds to the `struct GNUNET_ATS_Session` within the TRANSPORT service.
- */
-struct GNUNET_TRANSPORT_PluginSession
-{
-  /**
-   * Unique session identifier.
-   */
-  uint64_t session_id;
-
-  /**
-   * Location for the client to store "data".
-   */
-  void *client_ctx;
-};
-
-
-/**
- * Task run to re-establish the connection.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *`
- */
-static void
-do_plugin_connect (void *cls);
-
-
-/**
- * Free the session entry and notify the callback about its demise.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PluginMonitor`
- * @param key key of the session in the map
- * @param value the session to free
- * @return #GNUNET_OK (continue to iterate)
- */
-static int
-free_entry (void *cls,
-            uint32_t key,
-            void *value)
-{
-  struct GNUNET_TRANSPORT_PluginMonitor *pm = cls;
-  struct GNUNET_TRANSPORT_PluginSession *ps = value;
-
-  pm->cb (pm->cb_cls,
-          ps,
-          &ps->client_ctx,
-          NULL);
-  GNUNET_break (GNUNET_YES ==
-                GNUNET_CONTAINER_multihashmap32_remove (pm->sessions,
-                                                        key,
-                                                        ps));
-  GNUNET_break (NULL == ps->client_ctx);
-  GNUNET_free (ps);
-  return GNUNET_OK;
-}
-
-
-/**
- * Cut the existing connection and reconnect.
- *
- * @param pm our context
- */
-static void
-reconnect_plugin_ctx (struct GNUNET_TRANSPORT_PluginMonitor *pm)
-{
-  GNUNET_MQ_destroy (pm->mq);
-  pm->mq = NULL;
-  GNUNET_CONTAINER_multihashmap32_iterate (pm->sessions,
-                                           &free_entry,
-                                           pm);
-  pm->backoff = GNUNET_TIME_STD_BACKOFF (pm->backoff);
-  pm->reconnect_task = GNUNET_SCHEDULER_add_delayed (pm->backoff,
-                                                     &do_plugin_connect,
-                                                     pm);
-}
-
-
-/**
- * Convert 64-bit session ID to 32-bit index for hash map.
- *
- * @param id 64-bit session ID
- * @return 32-bit hash map index
- */
-static uint32_t
-wrap_id (uint64_t id)
-{
-  return ((uint32_t) id) ^ ((uint32_t) (id >> 32));
-}
-
-
-/**
- * Context for #locate_by_id().
- */
-struct SearchContext
-{
-  /**
-   * Result.
-   */
-  struct GNUNET_TRANSPORT_PluginSession *ps;
-
-  /**
-   * ID to locate.
-   */
-  uint64_t session_id;
-};
-
-
-/**
- * Locate a session entry.
- *
- * @param cls our `struct SearchContext`
- * @param key key of the session in the map
- * @param value a session
- * @return #GNUNET_OK (continue to iterate), or #GNUNET_SYSERR (match found)
- */
-static int
-locate_by_id (void *cls,
-              uint32_t key,
-              void *value)
-{
-  struct SearchContext *sc = cls;
-  struct GNUNET_TRANSPORT_PluginSession *ps = value;
-
-  if (sc->session_id == ps->session_id)
-  {
-    sc->ps = ps;
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Function called with responses from the service.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *`
- * @param tpmm message with event data
- * @return #GNUNET_Ok if message is well-formed
- */
-static int
-check_event (void *cls,
-             const struct TransportPluginMonitorMessage *tpmm)
-{
-  const char *pname;
-  size_t pname_len;
-  size_t paddr_len;
-
-  pname = (const char *) &tpmm[1];
-  pname_len = ntohs (tpmm->plugin_name_len);
-  paddr_len = ntohs (tpmm->plugin_address_len);
-  if ((pname_len
-       + paddr_len
-       + sizeof(struct TransportPluginMonitorMessage) != ntohs (
-         tpmm->header.size)) ||
-      ((0 != pname_len) &&
-       ('\0' != pname[pname_len - 1])))
-  {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
-  }
-  return GNUNET_OK;
-}
-
-
-/**
- * Function called with responses from the service.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *`
- * @param tpmm message with event data
- */
-static void
-handle_event (void *cls,
-              const struct TransportPluginMonitorMessage *tpmm)
-{
-  struct GNUNET_TRANSPORT_PluginMonitor *pm = cls;
-  struct GNUNET_TRANSPORT_PluginSession *ps;
-  const char *pname;
-  const void *paddr;
-  enum GNUNET_TRANSPORT_SessionState ss;
-  size_t pname_len;
-  size_t paddr_len;
-  struct GNUNET_TRANSPORT_SessionInfo info;
-  struct GNUNET_HELLO_Address addr;
-  struct SearchContext rv;
-
-  pname = (const char *) &tpmm[1];
-  pname_len = ntohs (tpmm->plugin_name_len);
-  paddr_len = ntohs (tpmm->plugin_address_len);
-  paddr = &pname[pname_len];
-  ps = NULL;
-  ss = (enum GNUNET_TRANSPORT_SessionState) ntohs (tpmm->session_state);
-  if (GNUNET_TRANSPORT_SS_INIT == ss)
-  {
-    ps = GNUNET_new (struct GNUNET_TRANSPORT_PluginSession);
-    ps->session_id = tpmm->session_id;
-    (void) GNUNET_CONTAINER_multihashmap32_put (pm->sessions,
-                                                wrap_id (tpmm->session_id),
-                                                ps,
-                                                
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  }
-  else
-  {
-    rv.session_id = tpmm->session_id;
-    rv.ps = NULL;
-    (void) GNUNET_CONTAINER_multihashmap32_get_multiple (pm->sessions,
-                                                         wrap_id (
-                                                           tpmm->session_id),
-                                                         &locate_by_id,
-                                                         &rv);
-    ps = rv.ps;
-    if (NULL == ps)
-    {
-      GNUNET_break (0);
-      reconnect_plugin_ctx (pm);
-      return;
-    }
-  }
-  info.state = ss;
-  info.is_inbound = (int16_t) ntohs (tpmm->is_inbound);
-  info.num_msg_pending = ntohl (tpmm->msgs_pending);
-  info.num_bytes_pending = ntohl (tpmm->bytes_pending);
-  info.receive_delay = GNUNET_TIME_absolute_ntoh (tpmm->delay);
-  info.session_timeout = GNUNET_TIME_absolute_ntoh (tpmm->timeout);
-  info.address = &addr;
-  addr.peer = tpmm->peer;
-  addr.address = (0 == paddr_len) ? NULL : paddr;
-  addr.address_length = paddr_len;
-  addr.transport_name = (0 == pname_len) ? NULL : pname;
-  addr.local_info = GNUNET_HELLO_ADDRESS_INFO_NONE;
-  pm->cb (pm->cb_cls,
-          ps,
-          &ps->client_ctx,
-          &info);
-
-  if (GNUNET_TRANSPORT_SS_DONE == ss)
-  {
-    GNUNET_break (NULL == ps->client_ctx);
-    GNUNET_assert (GNUNET_YES ==
-                   GNUNET_CONTAINER_multihashmap32_remove (pm->sessions,
-                                                           wrap_id (
-                                                             tpmm->session_id),
-                                                           ps));
-    GNUNET_free (ps);
-  }
-}
-
-
-/**
- * Function called with sync responses from the service.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *`
- * @param msg message from the service
- */
-static void
-handle_sync (void *cls,
-             const struct GNUNET_MessageHeader *msg)
-{
-  struct GNUNET_TRANSPORT_PluginMonitor *pm = cls;
-
-  /* we are in sync, notify callback */
-  pm->cb (pm->cb_cls,
-          NULL,
-          NULL,
-          NULL);
-}
-
-
-/**
- * Generic error handler, called with the appropriate
- * error code and the same closure specified at the creation of
- * the message queue.
- * Not every message queue implementation supports an error handler.
- *
- * @param cls closure with the `struct GNUNET_NSE_Handle *`
- * @param error error code
- */
-static void
-mq_error_handler (void *cls,
-                  enum GNUNET_MQ_Error error)
-{
-  struct GNUNET_TRANSPORT_PluginMonitor *pm = cls;
-
-  reconnect_plugin_ctx (pm);
-}
-
-
-/**
- * Task run to re-establish the connection.
- *
- * @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *`
- */
-static void
-do_plugin_connect (void *cls)
-{
-  struct GNUNET_TRANSPORT_PluginMonitor *pm = cls;
-  struct GNUNET_MQ_MessageHandler handlers[] = {
-    GNUNET_MQ_hd_var_size (event,
-                           GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_EVENT,
-                           struct TransportPluginMonitorMessage,
-                           pm),
-    GNUNET_MQ_hd_fixed_size (sync,
-                             GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_SYNC,
-                             struct GNUNET_MessageHeader,
-                             pm),
-    GNUNET_MQ_handler_end ()
-  };
-  struct GNUNET_MessageHeader *msg;
-  struct GNUNET_MQ_Envelope *env;
-
-  pm->reconnect_task = NULL;
-  pm->mq = GNUNET_CLIENT_connect (pm->cfg,
-                                  "transport",
-                                  handlers,
-                                  &mq_error_handler,
-                                  pm);
-  if (NULL == pm->mq)
-    return;
-  env = GNUNET_MQ_msg (msg,
-                       GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_START);
-  GNUNET_MQ_send (pm->mq,
-                  env);
-}
-
-
-/**
- * Install a plugin session state monitor callback.  The callback
- * will be notified whenever the session changes.
- *
- * @param cfg configuration to use
- * @param cb callback to invoke on events
- * @param cb_cls closure for @a cb
- * @return NULL on error, otherwise handle for cancellation
- */
-struct GNUNET_TRANSPORT_PluginMonitor *
-GNUNET_TRANSPORT_monitor_plugins (const struct GNUNET_CONFIGURATION_Handle 
*cfg,
-                                  GNUNET_TRANSPORT_SessionMonitorCallback cb,
-                                  void *cb_cls)
-{
-  struct GNUNET_TRANSPORT_PluginMonitor *pm;
-
-  pm = GNUNET_new (struct GNUNET_TRANSPORT_PluginMonitor);
-  pm->cb = cb;
-  pm->cb_cls = cb_cls;
-  pm->cfg = cfg;
-  do_plugin_connect (pm);
-  if (NULL == pm->mq)
-  {
-    GNUNET_free (pm);
-    return NULL;
-  }
-  pm->sessions = GNUNET_CONTAINER_multihashmap32_create (128);
-  return pm;
-}
-
-
-/**
- * Cancel monitoring the plugin session state.  The callback will
- * be called once for each session that is up with the information
- * #GNUNET_TRANSPORT_SS_FINI (even though the session may stay up;
- * this is just to enable client-side cleanup).
- *
- * @param pm handle of the request that is to be cancelled
- */
-void
-GNUNET_TRANSPORT_monitor_plugins_cancel (struct
-                                         GNUNET_TRANSPORT_PluginMonitor *pm)
-{
-  if (NULL != pm->mq)
-  {
-    GNUNET_MQ_destroy (pm->mq);
-    pm->mq = NULL;
-  }
-  if (NULL != pm->reconnect_task)
-  {
-    GNUNET_SCHEDULER_cancel (pm->reconnect_task);
-    pm->reconnect_task = NULL;
-  }
-  GNUNET_CONTAINER_multihashmap32_iterate (pm->sessions,
-                                           &free_entry,
-                                           pm);
-  GNUNET_CONTAINER_multihashmap32_destroy (pm->sessions);
-  GNUNET_free (pm);
-}
-
-
-/* end of transport_api_monitor_plugins.c */
diff --git a/src/transport/transport_api_offer_hello.c 
b/src/transport/transport_api_offer_hello.c
deleted file mode 100644
index 1b611aa6b..000000000
--- a/src/transport/transport_api_offer_hello.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-     This file is part of GNUnet.
-     Copyright (C) 2009-2013, 2016 GNUnet e.V.
-
-     GNUnet is free software: you can redistribute it and/or modify it
-     under the terms of the GNU Affero General Public License as published
-     by the Free Software Foundation, either version 3 of the License,
-     or (at your option) any later version.
-
-     GNUnet is distributed in the hope that it will be useful, but
-     WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     Affero General Public License for more details.
-
-     You should have received a copy of the GNU Affero General Public License
-     along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-     SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @file transport/transport_api_offer_hello.c
- * @brief library to offer HELLOs to transport service
- * @author Christian Grothoff
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_hello_lib.h"
-#include "gnunet_protocols.h"
-#include "gnunet_transport_service.h"
-
-
-/**
- * Entry in linked list for all offer-HELLO requests.
- */
-struct GNUNET_TRANSPORT_OfferHelloHandle
-{
-  /**
-   * Transport service handle we use for transmission.
-   */
-  struct GNUNET_MQ_Handle *mq;
-
-  /**
-   * Function to call once we are done.
-   */
-  GNUNET_SCHEDULER_TaskCallback cont;
-
-  /**
-   * Closure for @e cont
-   */
-  void *cls;
-};
-
-
-/**
- * Done sending HELLO message to the service, notify application.
- *
- * @param cls the handle for the operation
- */
-static void
-finished_hello (void *cls)
-{
-  struct GNUNET_TRANSPORT_OfferHelloHandle *ohh = cls;
-
-  if (NULL != ohh->cont)
-    ohh->cont (ohh->cls);
-  GNUNET_TRANSPORT_offer_hello_cancel (ohh);
-}
-
-
-/**
- * Offer the transport service the HELLO of another peer.  Note that
- * the transport service may just ignore this message if the HELLO is
- * malformed or useless due to our local configuration.
- *
- * @param cfg configuration
- * @param hello the hello message
- * @param cont continuation to call when HELLO has been sent,
- *      tc reason #GNUNET_SCHEDULER_REASON_TIMEOUT for fail
- *      tc reasong #GNUNET_SCHEDULER_REASON_READ_READY for success
- * @param cont_cls closure for @a cont
- * @return a `struct GNUNET_TRANSPORT_OfferHelloHandle` handle or NULL on 
failure,
- *      in case of failure @a cont will not be called
- *
- */
-struct GNUNET_TRANSPORT_OfferHelloHandle *
-GNUNET_TRANSPORT_offer_hello (const struct GNUNET_CONFIGURATION_Handle *cfg,
-                              const struct GNUNET_MessageHeader *hello,
-                              GNUNET_SCHEDULER_TaskCallback cont,
-                              void *cont_cls)
-{
-  struct GNUNET_TRANSPORT_OfferHelloHandle *ohh
-    = GNUNET_new (struct GNUNET_TRANSPORT_OfferHelloHandle);
-  struct GNUNET_MQ_Envelope *env;
-  struct GNUNET_PeerIdentity peer;
-
-  if (GNUNET_OK !=
-      GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hello,
-                           &peer))
-  {
-    GNUNET_break (0);
-    GNUNET_free (ohh);
-    return NULL;
-  }
-  ohh->mq = GNUNET_CLIENT_connect (cfg,
-                                   "transport",
-                                   NULL,
-                                   NULL,
-                                   ohh);
-  if (NULL == ohh->mq)
-  {
-    GNUNET_free (ohh);
-    return NULL;
-  }
-  ohh->cont = cont;
-  ohh->cls = cont_cls;
-  GNUNET_break (ntohs (hello->type) == GNUNET_MESSAGE_TYPE_HELLO);
-  env = GNUNET_MQ_msg_copy (hello);
-  GNUNET_MQ_notify_sent (env,
-                         &finished_hello,
-                         ohh);
-  GNUNET_MQ_send (ohh->mq,
-                  env);
-  return ohh;
-}
-
-
-void
-GNUNET_TRANSPORT_offer_hello_cancel (struct
-                                     GNUNET_TRANSPORT_OfferHelloHandle *ohh)
-{
-  GNUNET_MQ_destroy (ohh->mq);
-  GNUNET_free (ohh);
-}
-
-
-/* end of transport_api_offer_hello.c */
diff --git a/src/util/bio.c b/src/util/bio.c
index 3a463bcd1..caf533108 100644
--- a/src/util/bio.c
+++ b/src/util/bio.c
@@ -23,7 +23,6 @@
  * @author Christian Grothoff
  */
 
-#include "gnunet_common.h"
 #include "platform.h"
 #include "gnunet_util_lib.h"
 
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 45aec7981..17ba253ff 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -23,7 +23,6 @@
  * @author Christian Grothoff
  */
 
-#include "gnunet_common.h"
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_configuration_lib.h"
diff --git a/src/util/container_heap.c b/src/util/container_heap.c
index 56a002f8c..232e66bf9 100644
--- a/src/util/container_heap.c
+++ b/src/util/container_heap.c
@@ -26,7 +26,6 @@
  */
 
 
-#include "gnunet_common.h"
 #include "platform.h"
 #include "gnunet_util_lib.h"
 
diff --git a/src/util/container_multihashmap.c 
b/src/util/container_multihashmap.c
index 65d7f33c0..73333d22a 100644
--- a/src/util/container_multihashmap.c
+++ b/src/util/container_multihashmap.c
@@ -24,7 +24,6 @@
  */
 
 
-#include "gnunet_common.h"
 #include "platform.h"
 #include "gnunet_util_lib.h"
 
diff --git a/src/util/container_multihashmap32.c 
b/src/util/container_multihashmap32.c
index 698e08e3a..3b4c92426 100644
--- a/src/util/container_multihashmap32.c
+++ b/src/util/container_multihashmap32.c
@@ -26,7 +26,6 @@
  */
 
 
-#include "gnunet_common.h"
 #include "platform.h"
 #include "gnunet_util_lib.h"
 
diff --git a/src/util/container_multishortmap.c 
b/src/util/container_multishortmap.c
index 327616048..c626b55e5 100644
--- a/src/util/container_multishortmap.c
+++ b/src/util/container_multishortmap.c
@@ -24,7 +24,6 @@
  */
 
 
-#include "gnunet_common.h"
 #include "platform.h"
 #include "gnunet_util_lib.h"
 
diff --git a/src/util/container_multiuuidmap.c 
b/src/util/container_multiuuidmap.c
index 53975b3f7..3e957d47b 100644
--- a/src/util/container_multiuuidmap.c
+++ b/src/util/container_multiuuidmap.c
@@ -24,7 +24,6 @@
  */
 
 
-#include "gnunet_common.h"
 #include "platform.h"
 #include "gnunet_util_lib.h"
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]