Browse Source

Merge branch 'master' of git+ssh://gnunet.org/gnunet

Schanzenbach, Martin 5 years ago
parent
commit
94f9368aa1

+ 3 - 0
ChangeLog

@@ -1,3 +1,6 @@
+Thu 04 Apr 2019 12:39:44 PM CEST
+  Hotfix for build issue. Releasing GNUnet 0.11.2. -CG/MS
+
 Wed 03 Apr 2019 03:18:43 PM CEST
   Releasing GNUnet 0.11.1. -CG
 

+ 1 - 1
configure.ac

@@ -21,7 +21,7 @@
 #
 AC_PREREQ(2.61)
 # Checks for programs.
-AC_INIT([gnunet], [0.11.1], [bug-gnunet@gnu.org])
+AC_INIT([gnunet], [0.11.2], [bug-gnunet@gnu.org])
 AC_CONFIG_AUX_DIR([build-aux])
 
 AC_CANONICAL_TARGET

+ 2 - 1
po/POTFILES.in

@@ -262,9 +262,9 @@ src/nt/nt.c
 src/peerinfo/gnunet-service-peerinfo.c
 src/peerinfo/peerinfo_api.c
 src/peerinfo/peerinfo_api_notify.c
-src/peerinfo/plugin_rest_peerinfo.c
 src/peerinfo-tool/gnunet-peerinfo.c
 src/peerinfo-tool/gnunet-peerinfo_plugins.c
+src/peerinfo-tool/plugin_rest_peerinfo.c
 src/peerstore/gnunet-peerstore.c
 src/peerstore/gnunet-service-peerstore.c
 src/peerstore/peerstore_api.c
@@ -423,6 +423,7 @@ src/transport/tcp_server_legacy.c
 src/transport/tcp_server_mst_legacy.c
 src/transport/tcp_service_legacy.c
 src/transport/transport_api2_address.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

+ 13 - 13
po/de.po

@@ -10,7 +10,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gnunet 0.10.1\n"
 "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
-"POT-Creation-Date: 2019-04-03 16:13+0200\n"
+"POT-Creation-Date: 2019-04-04 12:39+0200\n"
 "PO-Revision-Date: 2015-03-08 16:16+0100\n"
 "Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n"
 "Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
@@ -5646,17 +5646,6 @@ msgstr ""
 msgid "Failed to receive response from `PEERINFO' service."
 msgstr "Fehler beim Empfangen der Antwort von gnunetd auf die `%s' Nachricht\n"
 
-#: src/peerinfo/plugin_rest_peerinfo.c:501
-#: src/peerinfo-tool/gnunet-peerinfo.c:299
-#, fuzzy, c-format
-msgid "Failure: Cannot convert address to string for peer `%s'\n"
-msgstr "Adresse des Knotens `%s' konnte nicht ermittelt werden.\n"
-
-#: src/peerinfo/plugin_rest_peerinfo.c:796
-#, fuzzy
-msgid "Peerinfo REST API initialized\n"
-msgstr " Verbindung fehlgeschlagen\n"
-
 #: src/peerinfo-tool/gnunet-peerinfo.c:239
 #, fuzzy, c-format
 msgid "%sPeer `%s'\n"
@@ -5667,6 +5656,12 @@ msgstr "Ich bin Peer `%s'.\n"
 msgid "\tExpires: %s \t %s\n"
 msgstr ""
 
+#: src/peerinfo-tool/gnunet-peerinfo.c:299
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:501
+#, fuzzy, c-format
+msgid "Failure: Cannot convert address to string for peer `%s'\n"
+msgstr "Adresse des Knotens `%s' konnte nicht ermittelt werden.\n"
+
 #: src/peerinfo-tool/gnunet-peerinfo.c:466
 #, fuzzy, c-format
 msgid "Failure: Received invalid %s\n"
@@ -5742,6 +5737,11 @@ msgstr "Teste Transport(e) %s\n"
 msgid "Failed to load transport plugin for `%s'\n"
 msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n"
 
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:796
+#, fuzzy
+msgid "Peerinfo REST API initialized\n"
+msgstr " Verbindung fehlgeschlagen\n"
+
 #: src/peerstore/gnunet-peerstore.c:91
 msgid "peerstore"
 msgstr ""
@@ -6897,7 +6897,7 @@ msgstr ""
 
 #: src/transport/gnunet-communicator-tcp.c:2328
 #: src/transport/gnunet-communicator-udp.c:2882
-#: src/transport/gnunet-service-tng.c:4747
+#: src/transport/gnunet-service-tng.c:4888
 #: src/transport/gnunet-service-transport.c:2795
 msgid "Transport service is lacking key configuration settings. Exiting.\n"
 msgstr ""

+ 13 - 13
po/es.po

@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gnunet 0.9.5a\n"
 "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
-"POT-Creation-Date: 2019-04-03 16:13+0200\n"
+"POT-Creation-Date: 2019-04-04 12:39+0200\n"
 "PO-Revision-Date: 2013-02-23 17:50+0100\n"
 "Last-Translator: Miguel Ángel Arruga Vivas <rosen644835@gmail.com>\n"
 "Language-Team: Spanish <es@li.org>\n"
@@ -5842,17 +5842,6 @@ msgid "Failed to receive response from `PEERINFO' service."
 msgstr ""
 "No se obtuvo respuesta del servicio de información de pares (PEERINFO)."
 
-#: src/peerinfo/plugin_rest_peerinfo.c:501
-#: src/peerinfo-tool/gnunet-peerinfo.c:299
-#, fuzzy, c-format
-msgid "Failure: Cannot convert address to string for peer `%s'\n"
-msgstr "Se produjo un fallo al resolver la dirección para el par «%s»\n"
-
-#: src/peerinfo/plugin_rest_peerinfo.c:796
-#, fuzzy
-msgid "Peerinfo REST API initialized\n"
-msgstr "Conexión fallida\n"
-
 #: src/peerinfo-tool/gnunet-peerinfo.c:239
 #, fuzzy, c-format
 msgid "%sPeer `%s'\n"
@@ -5863,6 +5852,12 @@ msgstr "Par «%s»\n"
 msgid "\tExpires: %s \t %s\n"
 msgstr ""
 
+#: src/peerinfo-tool/gnunet-peerinfo.c:299
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:501
+#, fuzzy, c-format
+msgid "Failure: Cannot convert address to string for peer `%s'\n"
+msgstr "Se produjo un fallo al resolver la dirección para el par «%s»\n"
+
 #: src/peerinfo-tool/gnunet-peerinfo.c:466
 #, fuzzy, c-format
 msgid "Failure: Received invalid %s\n"
@@ -5937,6 +5932,11 @@ msgstr "Cargando el módulo de transporte «%s»\n"
 msgid "Failed to load transport plugin for `%s'\n"
 msgstr "Se produjo un fallo al cargar el módulo del transporte para «%s»\n"
 
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:796
+#, fuzzy
+msgid "Peerinfo REST API initialized\n"
+msgstr "Conexión fallida\n"
+
 #: src/peerstore/gnunet-peerstore.c:91
 msgid "peerstore"
 msgstr ""
@@ -7140,7 +7140,7 @@ msgstr ""
 
 #: src/transport/gnunet-communicator-tcp.c:2328
 #: src/transport/gnunet-communicator-udp.c:2882
-#: src/transport/gnunet-service-tng.c:4747
+#: src/transport/gnunet-service-tng.c:4888
 #: src/transport/gnunet-service-transport.c:2795
 #, fuzzy
 msgid "Transport service is lacking key configuration settings. Exiting.\n"

+ 12 - 12
po/fr.po

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gnunet 0.10.1\n"
 "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
-"POT-Creation-Date: 2019-04-03 16:13+0200\n"
+"POT-Creation-Date: 2019-04-04 12:39+0200\n"
 "PO-Revision-Date: 2015-12-24 01:20+0100\n"
 "Last-Translator: Stéphane  Aulery <lkppo@free.fr>\n"
 "Language-Team: French <traduc@traduc.org>\n"
@@ -5413,16 +5413,6 @@ msgstr ""
 msgid "Failed to receive response from `PEERINFO' service."
 msgstr ""
 
-#: src/peerinfo/plugin_rest_peerinfo.c:501
-#: src/peerinfo-tool/gnunet-peerinfo.c:299
-#, c-format
-msgid "Failure: Cannot convert address to string for peer `%s'\n"
-msgstr ""
-
-#: src/peerinfo/plugin_rest_peerinfo.c:796
-msgid "Peerinfo REST API initialized\n"
-msgstr ""
-
 #: src/peerinfo-tool/gnunet-peerinfo.c:239
 #, c-format
 msgid "%sPeer `%s'\n"
@@ -5433,6 +5423,12 @@ msgstr ""
 msgid "\tExpires: %s \t %s\n"
 msgstr ""
 
+#: src/peerinfo-tool/gnunet-peerinfo.c:299
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:501
+#, c-format
+msgid "Failure: Cannot convert address to string for peer `%s'\n"
+msgstr ""
+
 #: src/peerinfo-tool/gnunet-peerinfo.c:466
 #, c-format
 msgid "Failure: Received invalid %s\n"
@@ -5507,6 +5503,10 @@ msgstr ""
 msgid "Failed to load transport plugin for `%s'\n"
 msgstr ""
 
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:796
+msgid "Peerinfo REST API initialized\n"
+msgstr ""
+
 #: src/peerstore/gnunet-peerstore.c:91
 msgid "peerstore"
 msgstr ""
@@ -6630,7 +6630,7 @@ msgstr ""
 
 #: src/transport/gnunet-communicator-tcp.c:2328
 #: src/transport/gnunet-communicator-udp.c:2882
-#: src/transport/gnunet-service-tng.c:4747
+#: src/transport/gnunet-service-tng.c:4888
 #: src/transport/gnunet-service-transport.c:2795
 msgid "Transport service is lacking key configuration settings. Exiting.\n"
 msgstr ""

+ 12 - 12
po/it.po

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gnunet 0.10.1\n"
 "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
-"POT-Creation-Date: 2019-04-03 16:13+0200\n"
+"POT-Creation-Date: 2019-04-04 12:39+0200\n"
 "PO-Revision-Date: 2018-08-29 13:48+0200\n"
 "Last-Translator: Sebastiano Pistore <SebastianoPistore.info@protonmail.ch>\n"
 "Language-Team: Italian <tp@lists.linux.it>\n"
@@ -5407,16 +5407,6 @@ msgstr ""
 msgid "Failed to receive response from `PEERINFO' service."
 msgstr ""
 
-#: src/peerinfo/plugin_rest_peerinfo.c:501
-#: src/peerinfo-tool/gnunet-peerinfo.c:299
-#, c-format
-msgid "Failure: Cannot convert address to string for peer `%s'\n"
-msgstr ""
-
-#: src/peerinfo/plugin_rest_peerinfo.c:796
-msgid "Peerinfo REST API initialized\n"
-msgstr ""
-
 #: src/peerinfo-tool/gnunet-peerinfo.c:239
 #, c-format
 msgid "%sPeer `%s'\n"
@@ -5427,6 +5417,12 @@ msgstr ""
 msgid "\tExpires: %s \t %s\n"
 msgstr ""
 
+#: src/peerinfo-tool/gnunet-peerinfo.c:299
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:501
+#, c-format
+msgid "Failure: Cannot convert address to string for peer `%s'\n"
+msgstr ""
+
 #: src/peerinfo-tool/gnunet-peerinfo.c:466
 #, c-format
 msgid "Failure: Received invalid %s\n"
@@ -5501,6 +5497,10 @@ msgstr ""
 msgid "Failed to load transport plugin for `%s'\n"
 msgstr ""
 
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:796
+msgid "Peerinfo REST API initialized\n"
+msgstr ""
+
 #: src/peerstore/gnunet-peerstore.c:91
 msgid "peerstore"
 msgstr ""
@@ -6621,7 +6621,7 @@ msgstr ""
 
 #: src/transport/gnunet-communicator-tcp.c:2328
 #: src/transport/gnunet-communicator-udp.c:2882
-#: src/transport/gnunet-service-tng.c:4747
+#: src/transport/gnunet-service-tng.c:4888
 #: src/transport/gnunet-service-transport.c:2795
 msgid "Transport service is lacking key configuration settings. Exiting.\n"
 msgstr ""

+ 13 - 13
po/sv.po

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: GNUnet 0.7.0b\n"
 "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
-"POT-Creation-Date: 2019-04-03 16:13+0200\n"
+"POT-Creation-Date: 2019-04-04 12:39+0200\n"
 "PO-Revision-Date: 2006-01-21 17:16+0100\n"
 "Last-Translator: Daniel Nylander <po@danielnylander.se>\n"
 "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
@@ -5687,17 +5687,6 @@ msgstr ""
 msgid "Failed to receive response from `PEERINFO' service."
 msgstr "Misslyckades att ta emot svar till \"%s\" meddelande från gnunetd\n"
 
-#: src/peerinfo/plugin_rest_peerinfo.c:501
-#: src/peerinfo-tool/gnunet-peerinfo.c:299
-#, fuzzy, c-format
-msgid "Failure: Cannot convert address to string for peer `%s'\n"
-msgstr "Misslyckades att binda till UDP-port %d.\n"
-
-#: src/peerinfo/plugin_rest_peerinfo.c:796
-#, fuzzy
-msgid "Peerinfo REST API initialized\n"
-msgstr " Anslutning misslyckades\n"
-
 #: src/peerinfo-tool/gnunet-peerinfo.c:239
 #, fuzzy, c-format
 msgid "%sPeer `%s'\n"
@@ -5708,6 +5697,12 @@ msgstr "Jag är ändpunkt \"%s\".\n"
 msgid "\tExpires: %s \t %s\n"
 msgstr ""
 
+#: src/peerinfo-tool/gnunet-peerinfo.c:299
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:501
+#, fuzzy, c-format
+msgid "Failure: Cannot convert address to string for peer `%s'\n"
+msgstr "Misslyckades att binda till UDP-port %d.\n"
+
 #: src/peerinfo-tool/gnunet-peerinfo.c:466
 #, c-format
 msgid "Failure: Received invalid %s\n"
@@ -5783,6 +5778,11 @@ msgstr "Testar transport(er) %s\n"
 msgid "Failed to load transport plugin for `%s'\n"
 msgstr "Kunde inte slå upp \"%s\": %s\n"
 
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:796
+#, fuzzy
+msgid "Peerinfo REST API initialized\n"
+msgstr " Anslutning misslyckades\n"
+
 #: src/peerstore/gnunet-peerstore.c:91
 msgid "peerstore"
 msgstr ""
@@ -6954,7 +6954,7 @@ msgstr ""
 
 #: src/transport/gnunet-communicator-tcp.c:2328
 #: src/transport/gnunet-communicator-udp.c:2882
-#: src/transport/gnunet-service-tng.c:4747
+#: src/transport/gnunet-service-tng.c:4888
 #: src/transport/gnunet-service-transport.c:2795
 #, fuzzy
 msgid "Transport service is lacking key configuration settings. Exiting.\n"

+ 13 - 13
po/vi.po

@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gnunet 0.8.0a\n"
 "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
-"POT-Creation-Date: 2019-04-03 16:13+0200\n"
+"POT-Creation-Date: 2019-04-04 12:39+0200\n"
 "PO-Revision-Date: 2008-09-10 22:05+0930\n"
 "Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n"
 "Language-Team: Vietnamese <vi-VN@googlegroups.com>\n"
@@ -5743,17 +5743,6 @@ msgstr ""
 "\n"
 "Không nhận được đáp ứng từ gnunetd.\n"
 
-#: src/peerinfo/plugin_rest_peerinfo.c:501
-#: src/peerinfo-tool/gnunet-peerinfo.c:299
-#, fuzzy, c-format
-msgid "Failure: Cannot convert address to string for peer `%s'\n"
-msgstr "Lỗi đóng kết đến cổng %s %d.\n"
-
-#: src/peerinfo/plugin_rest_peerinfo.c:796
-#, fuzzy
-msgid "Peerinfo REST API initialized\n"
-msgstr "Lỗi sơ khởi lõi.\n"
-
 #: src/peerinfo-tool/gnunet-peerinfo.c:239
 #, fuzzy, c-format
 msgid "%sPeer `%s'\n"
@@ -5764,6 +5753,12 @@ msgstr "Tôi là đồng đẳng « %s ».\n"
 msgid "\tExpires: %s \t %s\n"
 msgstr ""
 
+#: src/peerinfo-tool/gnunet-peerinfo.c:299
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:501
+#, fuzzy, c-format
+msgid "Failure: Cannot convert address to string for peer `%s'\n"
+msgstr "Lỗi đóng kết đến cổng %s %d.\n"
+
 #: src/peerinfo-tool/gnunet-peerinfo.c:466
 #, c-format
 msgid "Failure: Received invalid %s\n"
@@ -5840,6 +5835,11 @@ msgstr "Đang nạp các truyền tải « %s »\n"
 msgid "Failed to load transport plugin for `%s'\n"
 msgstr "Không thể nạp phần bổ sung truyền tải « %s »\n"
 
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:796
+#, fuzzy
+msgid "Peerinfo REST API initialized\n"
+msgstr "Lỗi sơ khởi lõi.\n"
+
 #: src/peerstore/gnunet-peerstore.c:91
 msgid "peerstore"
 msgstr ""
@@ -7015,7 +7015,7 @@ msgstr ""
 
 #: src/transport/gnunet-communicator-tcp.c:2328
 #: src/transport/gnunet-communicator-udp.c:2882
-#: src/transport/gnunet-service-tng.c:4747
+#: src/transport/gnunet-service-tng.c:4888
 #: src/transport/gnunet-service-transport.c:2795
 #, fuzzy
 msgid "Transport service is lacking key configuration settings. Exiting.\n"

+ 12 - 12
po/zh_CN.po

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: gnunet-0.8.1\n"
 "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
-"POT-Creation-Date: 2019-04-03 16:13+0200\n"
+"POT-Creation-Date: 2019-04-04 12:39+0200\n"
 "PO-Revision-Date: 2011-07-09 12:12+0800\n"
 "Last-Translator: Wylmer Wang <wantinghard@gmail.com>\n"
 "Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
@@ -5514,16 +5514,6 @@ msgstr ""
 msgid "Failed to receive response from `PEERINFO' service."
 msgstr ""
 
-#: src/peerinfo/plugin_rest_peerinfo.c:501
-#: src/peerinfo-tool/gnunet-peerinfo.c:299
-#, fuzzy, c-format
-msgid "Failure: Cannot convert address to string for peer `%s'\n"
-msgstr "找不到接口“%s”的一个 IP 地址。\n"
-
-#: src/peerinfo/plugin_rest_peerinfo.c:796
-msgid "Peerinfo REST API initialized\n"
-msgstr ""
-
 #: src/peerinfo-tool/gnunet-peerinfo.c:239
 #, fuzzy, c-format
 msgid "%sPeer `%s'\n"
@@ -5534,6 +5524,12 @@ msgstr "运行 %s失败:%s %d\n"
 msgid "\tExpires: %s \t %s\n"
 msgstr ""
 
+#: src/peerinfo-tool/gnunet-peerinfo.c:299
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:501
+#, fuzzy, c-format
+msgid "Failure: Cannot convert address to string for peer `%s'\n"
+msgstr "找不到接口“%s”的一个 IP 地址。\n"
+
 #: src/peerinfo-tool/gnunet-peerinfo.c:466
 #, c-format
 msgid "Failure: Received invalid %s\n"
@@ -5610,6 +5606,10 @@ msgstr ""
 msgid "Failed to load transport plugin for `%s'\n"
 msgstr "解析配置文件“%s”失败\n"
 
+#: src/peerinfo-tool/plugin_rest_peerinfo.c:796
+msgid "Peerinfo REST API initialized\n"
+msgstr ""
+
 #: src/peerstore/gnunet-peerstore.c:91
 msgid "peerstore"
 msgstr ""
@@ -6764,7 +6764,7 @@ msgstr ""
 
 #: src/transport/gnunet-communicator-tcp.c:2328
 #: src/transport/gnunet-communicator-udp.c:2882
-#: src/transport/gnunet-service-tng.c:4747
+#: src/transport/gnunet-service-tng.c:4888
 #: src/transport/gnunet-service-transport.c:2795
 #, fuzzy
 msgid "Transport service is lacking key configuration settings. Exiting.\n"

+ 8 - 8
src/ats/gnunet-service-ats-new.c

@@ -304,7 +304,7 @@ prop_ntoh (const struct PropertiesNBO *properties,
  */
 static void
 handle_suggest (void *cls,
-		const struct ExpressPreferenceMessage *msg)
+                const struct ExpressPreferenceMessage *msg)
 {
   struct Client *c = cls;
   struct ClientPreference *cp;
@@ -344,7 +344,7 @@ handle_suggest (void *cls,
  */
 static void
 handle_suggest_cancel (void *cls,
-		       const struct ExpressPreferenceMessage *msg)
+                       const struct ExpressPreferenceMessage *msg)
 {
   struct Client *c = cls;
   struct ClientPreference *cp;
@@ -772,13 +772,13 @@ GNUNET_SERVICE_MAIN
  &client_disconnect_cb,
  NULL,
  GNUNET_MQ_hd_fixed_size (suggest,
-			  GNUNET_MESSAGE_TYPE_ATS_SUGGEST,
-			  struct ExpressPreferenceMessage,
-			  NULL),
+                          GNUNET_MESSAGE_TYPE_ATS_SUGGEST,
+                          struct ExpressPreferenceMessage,
+                          NULL),
  GNUNET_MQ_hd_fixed_size (suggest_cancel,
-			  GNUNET_MESSAGE_TYPE_ATS_SUGGEST_CANCEL,
-			  struct ExpressPreferenceMessage,
-			  NULL),
+                          GNUNET_MESSAGE_TYPE_ATS_SUGGEST_CANCEL,
+                          struct ExpressPreferenceMessage,
+                          NULL),
  GNUNET_MQ_hd_fixed_size (start,
 			  GNUNET_MESSAGE_TYPE_ATS_START,
 			  struct GNUNET_MessageHeader,

+ 3 - 3
src/include/gnunet_ats_application_service.h

@@ -83,9 +83,9 @@ struct GNUNET_ATS_ApplicationSuggestHandle;
  */
 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);
+                                const struct GNUNET_PeerIdentity *peer,
+                                enum GNUNET_MQ_PreferenceKind pk,
+                                struct GNUNET_BANDWIDTH_Value32NBO bw);
 
 
 /**

+ 2 - 2
src/include/gnunet_peerstore_service.h

@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      Copyright (C)
+      Copyright (C) GNUnet e.V. 2004--2019
 
       GNUnet is free software: you can redistribute it and/or modify it
       under the terms of the GNU Affero General Public License as published
@@ -11,7 +11,7 @@
       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/>.
 

+ 12 - 0
src/include/gnunet_protocols.h

@@ -3177,6 +3177,18 @@ extern "C"
  */
 #define GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_FC_LIMITS 1276
 
+/**
+ * Type of the 'struct ExpressPreferenceMessage' send by clients to TRANSPORT
+ * to establish bandwidth preference.
+ */
+#define GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST 1300
+
+/**
+ * Type of the 'struct ExpressPreferenceMessage' send by clients to TRANSPORT
+ * to abandon bandwidth preference.
+ */
+#define GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL 1301
+
 
 /* ************** NEW (NG) ATS Messages ************* */
 

+ 100 - 0
src/include/gnunet_transport_application_service.h

@@ -0,0 +1,100 @@
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2010-2015, 2018, 2019 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 applications to interact with
+ *
+ * @author Christian Grothoff
+ * @author Matthias Wachs
+ *
+ * @defgroup TRANSPORT service
+ * Bandwidth allocation
+ *
+ * @{
+ */
+#ifndef GNUNET_TRANSPORT_APPLICATION_SERVICE_H
+#define GNUNET_TRANSPORT_APPLICATION_SERVICE_H
+
+#include "gnunet_constants.h"
+#include "gnunet_util_lib.h"
+
+/**
+ * Handle to the TRANSPORT subsystem for making suggestions about
+ * connections the peer would like to have.
+ */
+struct GNUNET_TRANSPORT_ApplicationHandle;
+
+
+/**
+ * Initialize the TRANSPORT application client handle.
+ *
+ * @param cfg configuration to use
+ * @return ats application handle, NULL on error
+ */
+struct GNUNET_TRANSPORT_ApplicationHandle *
+GNUNET_TRANSPORT_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg);
+
+
+/**
+ * Shutdown TRANSPORT application client.
+ *
+ * @param ch handle to destroy
+ */
+void
+GNUNET_TRANSPORT_application_done (struct GNUNET_TRANSPORT_ApplicationHandle *ch);
+
+
+/**
+ * Handle for suggestion requests.
+ */
+struct GNUNET_TRANSPORT_ApplicationSuggestHandle;
+
+
+/**
+ * An application would like to communicate with a peer.  TRANSPORT should
+ * allocate bandwith 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 bandwith, can be zero (we will still try to connect)
+ * @return suggestion handle, NULL if request is already pending
+ */
+struct GNUNET_TRANSPORT_ApplicationSuggestHandle *
+GNUNET_TRANSPORT_application_suggest (struct GNUNET_TRANSPORT_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_TRANSPORT_application_suggest_cancel (struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh);
+
+/** @} */  /* end of group */
+
+#endif
+/* end of file gnunet_ats_application_service.h */

+ 1 - 0
src/rps/Makefile.am

@@ -36,6 +36,7 @@ libgnunetrps_la_SOURCES = \
   rps-sampler_client.h rps-sampler_client.c \
   rps_api.c rps.h
 libgnunetrps_la_LIBADD = \
+  $(top_builddir)/src/nse/libgnunetnse.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(GN_LIBINTL) $(XLIB)
 libgnunetrps_la_LDFLAGS = \

+ 3 - 22
src/rps/gnunet-rps-profiler.c

@@ -1041,7 +1041,9 @@ cancel_request (struct PendingReply *pending_rep)
               "Cancelling rps get reply\n");
   GNUNET_assert (NULL != pending_rep->req_handle);
   GNUNET_RPS_request_cancel (pending_rep->req_handle);
+  pending_rep->req_handle = NULL;
   GNUNET_free (pending_rep);
+  pending_rep = NULL;
 }
 
 void
@@ -2061,29 +2063,8 @@ profiler_eval (void)
   return evaluate ();
 }
 
-static uint32_t fac (uint32_t x)
-{
-  if (1 >= x)
-  {
-    return x;
-  }
-  return x * fac (x - 1);
-}
 
-static uint32_t binom (uint32_t n, uint32_t k)
-{
-  //GNUNET_assert (n >= k);
-  if (k > n) return 0;
-  /* if (0 > n) return 0;  - always false */
-  /* if (0 > k) return 0;  - always false */
-  if (0 == k) return 1;
-  return fac (n)
-    /
-    fac(k) * fac(n - k);
-}
-
-/**
- * @brief is b in view of a?
+/** @brief is b in view of a?
  *
  * @param a
  * @param b

+ 1 - 1
src/rps/gnunet-service-rps_sampler.h

@@ -70,7 +70,7 @@ RPS_sampler_resize (struct RPS_Sampler *sampler, unsigned int new_size);
  */
 struct RPS_Sampler *
 RPS_sampler_init (size_t init_size,
-    struct GNUNET_TIME_Relative max_round_interval);
+                  struct GNUNET_TIME_Relative max_round_interval);
 
 
 /**

+ 3 - 0
src/rps/profiler_rps.conf

@@ -22,6 +22,9 @@ FILENAME_VALID_PEERS = $GNUNET_DATA_HOME/rps/valid_peers.txt
 # So, 50 is enough for a network of size 50^3 = 125000
 MINSIZE = 4
 
+DESIRED_PROBABILITY = 0.75
+
+DEFICIENCY_FACTOR = 0.4
 
 
 [testbed]

+ 54 - 0
src/rps/rps-sampler_client.c

@@ -218,6 +218,41 @@ RPS_sampler_mod_init (size_t init_size,
 }
 
 
+/**
+ * @brief Compute the probability that we already observed all peers from a
+ * biased stream of peer ids.
+ *
+ * Deficiency factor:
+ * As introduced by Brahms: Factor between the number of unique ids in a
+ * truly random stream and number of unique ids in the gossip stream.
+ *
+ * @param num_peers_estim The estimated number of peers in the network
+ * @param num_peers_observed The number of peers the given element has observed
+ * @param deficiency_factor A factor that catches the 'bias' of a random stream
+ * of peer ids
+ *
+ * @return The estimated probability
+ */
+static double
+prob_observed_n_peers (uint32_t num_peers_estim,
+                       uint32_t num_peers_observed,
+                       double deficiency_factor)
+{
+  uint32_t num_peers = num_peers_estim * (1/deficiency_factor);
+  uint64_t sum = 0;
+
+  for (uint32_t i = 0; i < num_peers; i++)
+  {
+    uint64_t a = pow (-1, num_peers-i);
+    uint64_t b = binom (num_peers, i);
+    uint64_t c = pow (i, num_peers_observed);
+    sum += a * b * c;
+  }
+
+  return sum / (double) pow (num_peers, num_peers_observed);
+}
+
+
 /**
  * Get one random peer out of the sampled peers.
  *
@@ -230,6 +265,7 @@ sampler_mod_get_rand_peer (void *cls)
   struct RPS_SamplerElement *s_elem;
   struct GNUNET_TIME_Relative last_request_diff;
   struct RPS_Sampler *sampler;
+  double prob_observed_n;
 
   gpc->get_peer_task = NULL;
   gpc->notify_ctx = NULL;
@@ -294,6 +330,24 @@ sampler_mod_get_rand_peer (void *cls)
                                 gpc);
     return;
   }
+  /* compute probability */
+  prob_observed_n = prob_observed_n_peers (sampler->num_peers_estim,
+                                           s_elem->num_peers,
+                                           sampler->deficiency_factor);
+  /* check if probability is above desired */
+  if (prob_observed_n >= sampler->desired_probability)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+        "Probability of having observed all peers (%d) too small ( < %d).\n",
+        prob_observed_n,
+        sampler->desired_probability);
+    GNUNET_assert (NULL == gpc->notify_ctx);
+    gpc->notify_ctx =
+      sampler_notify_on_update (sampler,
+                                &sampler_mod_get_rand_peer,
+                                gpc);
+    return;
+  }
   /* More reasons to wait could be added here */
 
 //  GNUNET_STATISTICS_set (stats,

+ 54 - 0
src/rps/rps-sampler_common.c

@@ -115,6 +115,60 @@ struct RPS_SamplerRequestHandle
 };
 
 
+/**
+ * @brief Update the current estimate of the network size stored at the sampler
+ *
+ * Used for computing the condition when to return elements to the client
+ *
+ * Only used/useful with the client sampler
+ * (Maybe move to rps-sampler_client.{h|c} ?)
+ *
+ * @param sampler The sampler to update
+ * @param num_peers The estimated value
+ */
+void
+RPS_sampler_update_with_nw_size (struct RPS_Sampler *sampler,
+                                 uint32_t num_peers)
+{
+  sampler->num_peers_estim = num_peers;
+}
+
+
+/**
+ * @brief Set the probability that is needed at least with what a sampler
+ * element has to have observed all elements from the network.
+ *
+ * Only used/useful with the client sampler
+ * (Maybe move to rps-sampler_client.{h|c} ?)
+ *
+ * @param sampler
+ * @param desired_probability
+ */
+void
+RPS_sampler_set_desired_probability (struct RPS_Sampler *sampler,
+                                     double desired_probability)
+{
+  sampler->desired_probability = desired_probability;
+}
+
+
+/**
+ * @brief Set the deficiency factor.
+ *
+ * Only used/useful with the client sampler
+ * (Maybe move to rps-sampler_client.{h|c} ?)
+ *
+ * @param sampler
+ * @param desired_probability
+ */
+void
+RPS_sampler_set_deficiency_factor (struct RPS_Sampler *sampler,
+                                   double deficiency_factor)
+{
+  sampler->deficiency_factor = deficiency_factor;
+}
+
+
 /**
  * @brief Add a callback that will be called when the next peer is inserted
  * into the sampler

+ 61 - 0
src/rps/rps-sampler_common.h

@@ -146,6 +146,25 @@ struct RPS_Sampler
    */
   struct GNUNET_TIME_Relative max_round_interval;
 
+  /**
+   * @brief The estimated total number of peers in the network
+   */
+  uint32_t num_peers_estim;
+
+  /**
+   * @brief The desired probability with which we want to have observed all
+   * peers.
+   */
+  double desired_probability;
+
+  /**
+   * @brief A factor that catches the 'bias' of a random stream of peer ids.
+   *
+   * As introduced by Brahms: Factor between the number of unique ids in a
+   * truly random stream and number of unique ids in the gossip stream.
+   */
+  double deficiency_factor;
+
   /**
    * Stores the function to return peers. Which one it is depends on whether
    * the Sampler is the modified one or not.
@@ -163,6 +182,48 @@ struct RPS_Sampler
 };
 
 
+/**
+ * @brief Update the current estimate of the network size stored at the sampler
+ *
+ * Used for computing the condition when to return elements to the client
+ *
+ * @param sampler The sampler to update
+ * @param num_peers The estimated value
+ */
+void
+RPS_sampler_update_with_nw_size (struct RPS_Sampler *sampler,
+                                 uint32_t num_peers);
+
+
+/**
+ * @brief Set the probability that is needed at least with what a sampler
+ * element has to have observed all elements from the network.
+ *
+ * Only used/useful with the client sampler
+ * (Maybe move to rps-sampler_client.{h|c} ?)
+ *
+ * @param sampler
+ * @param desired_probability
+ */
+void
+RPS_sampler_set_desired_probability (struct RPS_Sampler *sampler,
+                                     double desired_probability);
+
+
+/**
+ * @brief Set the deficiency factor.
+ *
+ * Only used/useful with the client sampler
+ * (Maybe move to rps-sampler_client.{h|c} ?)
+ *
+ * @param sampler
+ * @param desired_probability
+ */
+void
+RPS_sampler_set_deficiency_factor (struct RPS_Sampler *sampler,
+                                   double deficiency_factor);
+
+
 /**
  * @brief Add a callback that will be called when the next peer is inserted
  * into the sampler

+ 38 - 0
src/rps/rps-test_util.c

@@ -487,4 +487,42 @@ store_prefix_file_name (const struct GNUNET_PeerIdentity *peer,
   return file_name;
 }
 
+
+/**
+ * @brief Factorial
+ *
+ * @param x Number of which to compute the factorial
+ *
+ * @return Factorial of @a x
+ */
+uint32_t fac (uint32_t x)
+{
+  if (1 >= x)
+  {
+    return x;
+  }
+  return x * fac (x - 1);
+}
+
+/**
+ * @brief Binomial coefficient (n choose k)
+ *
+ * @param n
+ * @param k
+ *
+ * @return Binomial coefficient of @a n and @a k
+ */
+uint32_t binom (uint32_t n, uint32_t k)
+{
+  //GNUNET_assert (n >= k);
+  if (k > n) return 0;
+  /* if (0 > n) return 0;  - always false */
+  /* if (0 > k) return 0;  - always false */
+  if (0 == k) return 1;
+  return fac (n)
+    /
+    fac(k) * fac(n - k);
+}
+
+
 /* end of gnunet-service-rps.c */

+ 21 - 0
src/rps/rps-test_util.h

@@ -107,5 +107,26 @@ to_file_raw_unaligned (const char *file_name,
                        size_t size_buf,
                        unsigned bits_needed);
 
+
+/**
+ * @brief Factorial
+ *
+ * @param x Number of which to compute the factorial
+ *
+ * @return Factorial of @a x
+ */
+uint32_t fac (uint32_t x);
+
+
+/**
+ * @brief Binomial coefficient (n choose k)
+ *
+ * @param n
+ * @param k
+ *
+ * @return Binomial coefficient of @a n and @a k
+ */
+uint32_t binom (uint32_t n, uint32_t k);
+
 #endif /* RPS_TEST_UTIL_H */
 /* end of gnunet-service-rps.c */

+ 10 - 0
src/rps/rps.conf.in

@@ -26,3 +26,13 @@ FILENAME_VALID_PEERS = $GNUNET_DATA_HOME/rps/valid_peers.txt
 # Keep in mind, that (networksize)^(1/3) should be enough.
 # So, 50 is enough for a network of size 50^3 = 125000
 MINSIZE = 10
+
+# The probability whith which we want a sampler element to have observed all
+# peer ids in the network at least
+DESIRED_PROBABILITY = 0.9
+
+# A factor that catches the 'bias' of a random stream of peer ids.
+#
+# As introduced by Brahms: Factor between the number of unique ids in a
+# truly random stream and number of unique ids in the gossip stream.
+DEFICIENCY_FACTOR = 0.4

+ 142 - 7
src/rps/rps_api.c

@@ -29,6 +29,8 @@
 #include "gnunet_rps_service.h"
 #include "rps-sampler_client.h"
 
+#include "gnunet_nse_service.h"
+
 #include <inttypes.h>
 
 #define LOG(kind,...) GNUNET_log_from (kind, "rps-api",__VA_ARGS__)
@@ -109,6 +111,35 @@ struct GNUNET_RPS_Handle
    * @brief Tail of the DLL of stream requests
    */
   struct GNUNET_RPS_StreamRequestHandle *stream_requests_tail;
+
+  /**
+   * @brief Handle to nse service
+   */
+  struct GNUNET_NSE_Handle *nse;
+
+  /**
+   * @brief Pointer to the head element in DLL of request handles
+   */
+  struct GNUNET_RPS_Request_Handle *rh_head;
+
+  /**
+   * @brief Pointer to the tail element in DLL of request handles
+   */
+  struct GNUNET_RPS_Request_Handle *rh_tail;
+
+  /**
+   * @brief The desired probability with which we want to have observed all
+   * peers.
+   */
+  float desired_probability;
+
+  /**
+   * @brief A factor that catches the 'bias' of a random stream of peer ids.
+   *
+   * As introduced by Brahms: Factor between the number of unique ids in a
+   * truly random stream and number of unique ids in the gossip stream.
+   */
+  float deficiency_factor;
 };
 
 
@@ -152,6 +183,16 @@ struct GNUNET_RPS_Request_Handle
    * The closure for the callback.
    */
   void *ready_cb_cls;
+
+  /**
+   * @brief Pointer to next element in DLL
+   */
+  struct GNUNET_RPS_Request_Handle *next;
+
+  /**
+   * @brief Pointer to previous element in DLL
+   */
+  struct GNUNET_RPS_Request_Handle *prev;
 };
 
 
@@ -263,10 +304,7 @@ peers_ready_cb (const struct GNUNET_PeerIdentity *peers,
   rh->ready_cb (rh->ready_cb_cls,
                 num_peers,
                 peers);
-  GNUNET_RPS_stream_cancel (rh->srh);
-  rh->srh = NULL;
-  RPS_sampler_destroy (rh->sampler);
-  rh->sampler = NULL;
+  GNUNET_RPS_request_cancel (rh);
 }
 
 
@@ -606,6 +644,37 @@ hash_from_share_val (const char *share_val,
 }
 
 
+/**
+ * @brief Callback for network size estimate - called with new estimates about
+ * the network size, updates all samplers with the new estimate
+ *
+ * Implements #GNUNET_NSE_Callback
+ *
+ * @param cls the rps handle
+ * @param timestamp unused
+ * @param logestimate the estimate
+ * @param std_dev the standard distribution
+ */
+static void
+nse_cb (void *cls,
+        struct GNUNET_TIME_Absolute timestamp,
+        double logestimate,
+        double std_dev)
+{
+  struct GNUNET_RPS_Handle *h = cls;
+  (void) timestamp;
+  (void) std_dev;
+
+  for (struct GNUNET_RPS_Request_Handle *rh_iter = h->rh_head;
+       NULL != rh_iter && NULL != rh_iter->next;
+       rh_iter = rh_iter->next)
+  {
+    RPS_sampler_update_with_nw_size (rh_iter->sampler,
+                                     GNUNET_NSE_log_estimate_to_n (logestimate));
+  }
+}
+
+
 /**
  * Reconnect to the service
  */
@@ -631,6 +700,9 @@ reconnect (struct GNUNET_RPS_Handle *h)
                                  mq_handlers,
                                  &mq_error_handler,
                                  h);
+  if (NULL != h->nse)
+    GNUNET_NSE_disconnect (h->nse);
+  h->nse = GNUNET_NSE_connect (h->cfg, &nse_cb, h);
 }
 
 
@@ -638,7 +710,7 @@ reconnect (struct GNUNET_RPS_Handle *h)
  * Connect to the rps service
  *
  * @param cfg configuration to use
- * @return a handle to the service
+ * @return a handle to the service, NULL on error
  */
 struct GNUNET_RPS_Handle *
 GNUNET_RPS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -647,6 +719,44 @@ GNUNET_RPS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
 
   h = GNUNET_new (struct GNUNET_RPS_Handle);
   h->cfg = cfg;
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_float (cfg,
+                                           "RPS",
+                                           "DESIRED_PROBABILITY",
+                                           &h->desired_probability))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "RPS", "DESIRED_PROBABILITY");
+    GNUNET_free (h);
+    return NULL;
+  }
+  if (0 > h->desired_probability ||
+      1 < h->desired_probability)
+  {
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+        "The desired probability must be in the interval [0;1]\n");
+    GNUNET_free (h);
+    return NULL;
+  }
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_float (cfg,
+                                           "RPS",
+                                           "DEFICIENCY_FACTOR",
+                                           &h->deficiency_factor))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "RPS", "DEFICIENCY_FACTOR");
+    GNUNET_free (h);
+    return NULL;
+  }
+  if (0 > h->desired_probability ||
+      1 < h->desired_probability)
+  {
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+        "The deficiency factor must be in the interval [0;1]\n");
+    GNUNET_free (h);
+    return NULL;
+  }
   reconnect (h);
   if (NULL == h->mq)
   {
@@ -725,6 +835,10 @@ GNUNET_RPS_request_peers (struct GNUNET_RPS_Handle *rps_handle,
   rh->num_requests = num_req_peers;
   rh->sampler = RPS_sampler_mod_init (num_req_peers,
                                       GNUNET_TIME_UNIT_SECONDS); // TODO remove this time-stuff
+  RPS_sampler_set_desired_probability (rh->sampler,
+                                       rps_handle->desired_probability);
+  RPS_sampler_set_deficiency_factor (rh->sampler,
+                                     rps_handle->deficiency_factor);
   rh->sampler_rh = RPS_sampler_get_n_rand_peers (rh->sampler,
                                                  num_req_peers,
                                                  peers_ready_cb,
@@ -734,6 +848,9 @@ GNUNET_RPS_request_peers (struct GNUNET_RPS_Handle *rps_handle,
                                        rh); /* cls */
   rh->ready_cb = ready_cb;
   rh->ready_cb_cls = cls;
+  GNUNET_CONTAINER_DLL_insert (rps_handle->rh_head,
+                               rps_handle->rh_tail,
+                               rh);
 
   return rh;
 }
@@ -911,6 +1028,7 @@ GNUNET_RPS_request_cancel (struct GNUNET_RPS_Request_Handle *rh)
 
   h = rh->rps_handle;
   GNUNET_assert (NULL != rh);
+  GNUNET_assert (NULL != rh->srh);
   GNUNET_assert (h == rh->srh->rps_handle);
   GNUNET_RPS_stream_cancel (rh->srh);
   rh->srh = NULL;
@@ -920,6 +1038,10 @@ GNUNET_RPS_request_cancel (struct GNUNET_RPS_Request_Handle *rh)
     RPS_sampler_request_cancel (rh->sampler_rh);
   }
   RPS_sampler_destroy (rh->sampler);
+  rh->sampler = NULL;
+  GNUNET_CONTAINER_DLL_remove (h->rh_head,
+                               h->rh_tail,
+                               rh);
   GNUNET_free (rh);
 }
 
@@ -939,13 +1061,24 @@ GNUNET_RPS_disconnect (struct GNUNET_RPS_Handle *h)
     LOG (GNUNET_ERROR_TYPE_WARNING,
         "Still waiting for replies\n");
     for (struct GNUNET_RPS_StreamRequestHandle *srh_iter = h->stream_requests_head;
-	 NULL != srh_iter;
-	 srh_iter = srh_next)
+         NULL != srh_iter;
+         srh_iter = srh_next)
     {
       srh_next = srh_iter->next;
       GNUNET_RPS_stream_cancel (srh_iter);
     }
   }
+  if (NULL != h->rh_head)
+  {
+    LOG (GNUNET_ERROR_TYPE_WARNING,
+         "Not all requests were cancelled!\n");
+    for (struct GNUNET_RPS_Request_Handle *rh_iter = h->rh_head;
+         h->rh_head != NULL;
+         rh_iter = h->rh_head)
+    {
+      GNUNET_RPS_request_cancel (rh_iter);
+    }
+  }
   if (NULL != srh_callback_peers)
   {
     GNUNET_free (srh_callback_peers);
@@ -957,6 +1090,8 @@ GNUNET_RPS_disconnect (struct GNUNET_RPS_Handle *h)
         "Still waiting for view updates\n");
     GNUNET_RPS_view_request_cancel (h);
   }
+  if (NULL != h->nse)
+    GNUNET_NSE_disconnect (h->nse);
   GNUNET_MQ_destroy (h->mq);
   GNUNET_free (h);
 }

+ 0 - 20
src/rps/test_rps.c

@@ -1964,26 +1964,6 @@ profiler_eval (void)
   return evaluate ();
 }
 
-static uint32_t fac (uint32_t x)
-{
-  if (1 >= x)
-  {
-    return x;
-  }
-  return x * fac (x - 1);
-}
-
-static uint32_t binom (uint32_t n, uint32_t k)
-{
-  //GNUNET_assert (n >= k);
-  if (k > n) return 0;
-  if (0 > n) return 0;
-  if (0 > k) return 0;
-  if (0 == k) return 1;
-  return fac (n)
-    /
-    fac(k) * fac(n - k);
-}
 
 /**
  * @brief is b in view of a?

+ 4 - 0
src/rps/test_rps.conf

@@ -22,6 +22,10 @@ FILENAME_VALID_PEERS = $GNUNET_DATA_HOME/rps/valid_peers.txt
 # So, 50 is enough for a network of size 50^3 = 125000
 MINSIZE = 4
 
+DESIRED_PROBABILITY = 0.75
+
+DEFICIENCY_FACTOR = 0.4
+
 
 
 [testbed]

+ 9 - 1
src/transport/Makefile.am

@@ -155,6 +155,7 @@ endif
 lib_LTLIBRARIES = \
   libgnunettransport.la \
   libgnunettransportaddress.la \
+  libgnunettransportapplication.la \
   libgnunettransportcore.la \
   libgnunettransportcommunicator.la \
   libgnunettransportmonitor.la \
@@ -196,6 +197,14 @@ libgnunettransport_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS) $(WINFLAGS) \
   -version-info 4:0:2
 
+libgnunettransportapplication_la_SOURCES = \
+  transport_api2_application.c
+libgnunettransportapplication_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(LTLIBINTL)
+libgnunettransportapplication_la_LDFLAGS = \
+  $(GN_LIB_LDFLAGS) $(WINFLAGS) \
+  -version-info 0:0:0
 
 
 libgnunettransportaddress_la_SOURCES = \
@@ -360,7 +369,6 @@ gnunet_service_transport_CFLAGS = \
 gnunet_service_tng_SOURCES = \
  gnunet-service-tng.c
 gnunet_service_tng_LDADD = \
-  $(top_builddir)/src/ats/libgnunetatstransport.la \
   $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
   $(top_builddir)/src/hello/libgnunethello.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \

File diff suppressed because it is too large
+ 230 - 221
src/transport/gnunet-service-tng.c


+ 32 - 0
src/transport/transport.h

@@ -1107,6 +1107,38 @@ struct GNUNET_TRANSPORT_AddressToVerify
 };
 
 
+/**
+ * Application client to TRANSPORT service: we would like to have
+ * address suggestions for this peer.
+ */
+struct ExpressPreferenceMessage
+{
+  /**
+   * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST or
+   * #GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL to stop
+   * suggestions.
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * What type of performance preference does the client have?
+   * A `enum GNUNET_MQ_PreferenceKind` in NBO.
+   */
+  uint32_t pk GNUNET_PACKED;
+
+  /**
+   * Peer to get address suggestions for.
+   */
+  struct GNUNET_PeerIdentity peer;
+
+  /**
+   * How much bandwidth in bytes/second does the application expect?
+   */
+  struct GNUNET_BANDWIDTH_Value32NBO bw;
+
+};
+
+
 #endif
 
 GNUNET_NETWORK_STRUCT_END

+ 366 - 0
src/transport/transport_api2_application.c

@@ -0,0 +1,366 @@
+/*
+     This file is part of GNUnet.
+     Copyright (C) 2010--2019 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_api2_application.c
+ * @brief enable clients to ask TRANSPORT about establishing connections to peers
+ * @author Christian Grothoff
+ * @author Matthias Wachs
+ */
+#include "platform.h"
+#include "gnunet_transport_application_service.h"
+#include "gnunet_transport_core_service.h"
+#include "transport.h"
+
+
+#define LOG(kind,...) GNUNET_log_from(kind, "transport-application-api", __VA_ARGS__)
+
+
+/**
+ * Handle for TRANSPORT address suggestion requests.
+ */
+struct GNUNET_TRANSPORT_ApplicationSuggestHandle
+{
+  /**
+   * ID of the peer for which address suggestion was requested.
+   */
+  struct GNUNET_PeerIdentity id;
+
+  /**
+   * Connecitivity handle this suggestion handle belongs to.
+   */
+  struct GNUNET_TRANSPORT_ApplicationHandle *ch;
+
+  /**
+   * What preference is being expressed?
+   */
+  enum GNUNET_MQ_PreferenceKind pk;
+
+  /**
+   * How much bandwidth does the client expect?
+   */
+  struct GNUNET_BANDWIDTH_Value32NBO bw;
+};
+
+
+/**
+ * Handle to the TRANSPORT subsystem for application management.
+ */
+struct GNUNET_TRANSPORT_ApplicationHandle
+{
+
+  /**
+   * 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_TRANSPORT_ApplicationSuggestHandle`
+   */
+  struct GNUNET_CONTAINER_MultiPeerMap *sug_requests;
+
+  /**
+   * Message queue for sending requests to the TRANSPORT 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 TRANSPORT service.
+ *
+ * @param ch handle to use to re-connect.
+ */
+static void
+reconnect (struct GNUNET_TRANSPORT_ApplicationHandle *ch);
+
+
+/**
+ * Re-establish the connection to the TRANSPORT service.
+ *
+ * @param cls handle to use to re-connect.
+ */
+static void
+reconnect_task (void *cls)
+{
+  struct GNUNET_TRANSPORT_ApplicationHandle *ch = cls;
+
+  ch->task = NULL;
+  reconnect (ch);
+}
+
+
+/**
+ * Disconnect from TRANSPORT and then reconnect.
+ *
+ * @param ch our handle
+ */
+static void
+force_reconnect (struct GNUNET_TRANSPORT_ApplicationHandle *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
+ * TRANSPORT service.  Reconnect.
+ *
+ * @param cls the `struct GNUNET_TRANSPORT_ApplicationHandle`
+ * @param error details about the error
+ */
+static void
+error_handler (void *cls,
+               enum GNUNET_MQ_Error error)
+{
+  struct GNUNET_TRANSPORT_ApplicationHandle *ch = cls;
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "TRANSPORT connection died (code %d), reconnecting\n",
+       (int) error);
+  force_reconnect (ch);
+}
+
+
+/**
+ * Transmit request for an address suggestion.
+ *
+ * @param cls the `struct GNUNET_TRANSPORT_ApplicationHandle`
+ * @param peer peer to ask for an address suggestion for
+ * @param value the `struct GNUNET_TRANSPORT_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_TRANSPORT_ApplicationHandle *ch = cls;
+  struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh = value;
+  struct GNUNET_MQ_Envelope *ev;
+  struct ExpressPreferenceMessage *m;
+
+  if (NULL == ch->mq)
+    return GNUNET_SYSERR;
+  ev = GNUNET_MQ_msg (m,
+                      GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST);
+  m->pk = htonl ((uint32_t) sh->pk);
+  m->bw = sh->bw;
+  m->peer = *peer;
+  GNUNET_MQ_send (ch->mq, ev);
+  return GNUNET_OK;
+}
+
+
+/**
+ * Re-establish the connection to the TRANSPORT service.
+ *
+ * @param ch handle to use to re-connect.
+ */
+static void
+reconnect (struct GNUNET_TRANSPORT_ApplicationHandle *ch)
+{
+  static const struct GNUNET_MQ_MessageHandler handlers[] = {
+    { NULL, 0, 0 }
+  };
+
+  GNUNET_assert (NULL == ch->mq);
+  ch->mq = GNUNET_CLIENT_connect (ch->cfg,
+                                  "transport",
+                                  handlers,
+                                  &error_handler,
+                                  ch);
+  if (NULL == ch->mq)
+  {
+    force_reconnect (ch);
+    return;
+  }
+  GNUNET_CONTAINER_multipeermap_iterate (ch->sug_requests,
+                                         &transmit_suggestion,
+                                         ch);
+}
+
+
+/**
+ * Initialize the TRANSPORT application suggestion client handle.
+ *
+ * @param cfg configuration to use
+ * @return transport application handle, NULL on error
+ */
+struct GNUNET_TRANSPORT_ApplicationHandle *
+GNUNET_TRANSPORT_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  struct GNUNET_TRANSPORT_ApplicationHandle *ch;
+
+  ch = GNUNET_new (struct GNUNET_TRANSPORT_ApplicationHandle);
+  ch->cfg = cfg;
+  ch->sug_requests = GNUNET_CONTAINER_multipeermap_create (32,
+                                                           GNUNET_YES);
+  reconnect (ch);
+  return ch;
+}
+
+
+/**
+ * Function called to free all `struct GNUNET_TRANSPORT_ApplicationSuggestHandle`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_TRANSPORT_ApplicationSuggestHandle *cur = value;
+
+  GNUNET_free (cur);
+  return GNUNET_OK;
+}
+
+
+/**
+ * Client is done with TRANSPORT application management, release resources.
+ *
+ * @param ch handle to release
+ */
+void
+GNUNET_TRANSPORT_application_done (struct GNUNET_TRANSPORT_ApplicationHandle *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. TRANSPORT will
+ * respond with a call to the continuation immediately containing an address or
+ * no address if none is available. TRANSPORT can suggest more addresses until we call
+ * #GNUNET_TRANSPORT_application_suggest_cancel().
+ *
+ * @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 bandwith, can be zero (we will still try to connect)
+ * @return suggest handle, NULL if a request is already pending
+ */
+struct GNUNET_TRANSPORT_ApplicationSuggestHandle *
+GNUNET_TRANSPORT_application_suggest (struct GNUNET_TRANSPORT_ApplicationHandle *ch,
+                                      const struct GNUNET_PeerIdentity *peer,
+                                      enum GNUNET_MQ_PreferenceKind pk,
+                                      struct GNUNET_BANDWIDTH_Value32NBO bw)
+{
+  struct GNUNET_TRANSPORT_ApplicationSuggestHandle *s;
+
+  s = GNUNET_new (struct GNUNET_TRANSPORT_ApplicationSuggestHandle);
+  s->ch = ch;
+  s->id = *peer;
+  s->pk = pk;
+  s->bw = bw;
+  (void) GNUNET_CONTAINER_multipeermap_put (ch->sug_requests,
+                                            &s->id,
+                                            s,
+                                            GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Requesting TRANSPORT to suggest address for `%s'\n",
+       GNUNET_i2s (peer));
+  if (NULL == ch->mq)
+    return s;
+  GNUNET_assert (GNUNET_OK ==
+                 transmit_suggestion (ch,
+                                      &s->id,
+                                      s));
+  return s;
+}
+
+
+/**
+ * We no longer care about being connected to a peer.
+ *
+ * @param sh handle to stop
+ */
+void
+GNUNET_TRANSPORT_application_suggest_cancel (struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh)
+{
+  struct GNUNET_TRANSPORT_ApplicationHandle *ch = sh->ch;
+  struct GNUNET_MQ_Envelope *ev;
+  struct ExpressPreferenceMessage *m;
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Telling TRANSPORT 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_TRANSPORT_SUGGEST_CANCEL);
+  m->pk = htonl ((uint32_t) sh->pk);
+  m->bw = sh->bw;
+  m->peer = sh->id;
+  GNUNET_MQ_send (ch->mq,
+                  ev);
+  GNUNET_free (sh);
+}
+
+
+/* end of transport_api2_application.c */

Some files were not shown because too many files changed in this diff