diff options
Diffstat (limited to 'src/transport')
224 files changed, 7839 insertions, 1017 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index e8c1f5d4a..d0db6b141 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -289,13 +289,19 @@ plugin_LTLIBRARIES = \ | |||
289 | $(WLAN_PLUGIN_LA) \ | 289 | $(WLAN_PLUGIN_LA) \ |
290 | $(BT_PLUGIN_LA) | 290 | $(BT_PLUGIN_LA) |
291 | 291 | ||
292 | if HAVE_EXPERIMENTAL | ||
293 | plugin_LTLIBRARIES += \ | ||
294 | libgnunet_plugin_transport_xt.la \ | ||
295 | libgnunet_plugin_transport_xu.la | ||
296 | endif | ||
297 | |||
292 | # Note: real plugins of course need to be added | 298 | # Note: real plugins of course need to be added |
293 | # to the plugin_LTLIBRARIES above | 299 | # to the plugin_LTLIBRARIES above |
294 | noinst_LTLIBRARIES = \ | 300 | noinst_LTLIBRARIES = \ |
295 | libgnunet_plugin_transport_template.la | 301 | libgnunet_plugin_transport_template.la |
296 | 302 | ||
297 | libgnunet_plugin_transport_tcp_la_SOURCES = \ | 303 | libgnunet_plugin_transport_tcp_la_SOURCES = \ |
298 | plugin_transport_tcp.c | 304 | plugin_transport_tcp.c |
299 | libgnunet_plugin_transport_tcp_la_LIBADD = \ | 305 | libgnunet_plugin_transport_tcp_la_LIBADD = \ |
300 | $(top_builddir)/src/hello/libgnunethello.la \ | 306 | $(top_builddir)/src/hello/libgnunethello.la \ |
301 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 307 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
@@ -306,6 +312,18 @@ libgnunet_plugin_transport_tcp_la_LIBADD = \ | |||
306 | libgnunet_plugin_transport_tcp_la_LDFLAGS = \ | 312 | libgnunet_plugin_transport_tcp_la_LDFLAGS = \ |
307 | $(GN_PLUGIN_LDFLAGS) | 313 | $(GN_PLUGIN_LDFLAGS) |
308 | 314 | ||
315 | libgnunet_plugin_transport_xt_la_SOURCES = \ | ||
316 | plugin_transport_xt.c | ||
317 | libgnunet_plugin_transport_xt_la_LIBADD = \ | ||
318 | $(top_builddir)/src/hello/libgnunethello.la \ | ||
319 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | ||
320 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | ||
321 | $(top_builddir)/src/nat/libgnunetnatnew.la \ | ||
322 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
323 | $(LTLIBINTL) | ||
324 | libgnunet_plugin_transport_xt_la_LDFLAGS = \ | ||
325 | $(GN_PLUGIN_LDFLAGS) | ||
326 | |||
309 | libgnunet_plugin_transport_template_la_SOURCES = \ | 327 | libgnunet_plugin_transport_template_la_SOURCES = \ |
310 | plugin_transport_template.c | 328 | plugin_transport_template.c |
311 | libgnunet_plugin_transport_template_la_LIBADD = \ | 329 | libgnunet_plugin_transport_template_la_LIBADD = \ |
@@ -354,6 +372,19 @@ libgnunet_plugin_transport_udp_la_LIBADD = \ | |||
354 | libgnunet_plugin_transport_udp_la_LDFLAGS = \ | 372 | libgnunet_plugin_transport_udp_la_LDFLAGS = \ |
355 | $(GN_PLUGIN_LDFLAGS) | 373 | $(GN_PLUGIN_LDFLAGS) |
356 | 374 | ||
375 | libgnunet_plugin_transport_xu_la_SOURCES = \ | ||
376 | plugin_transport_xu.c plugin_transport_xu.h | ||
377 | libgnunet_plugin_transport_xu_la_LIBADD = \ | ||
378 | $(top_builddir)/src/hello/libgnunethello.la \ | ||
379 | $(top_builddir)/src/fragmentation/libgnunetfragmentation.la \ | ||
380 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | ||
381 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | ||
382 | $(top_builddir)/src/nat/libgnunetnatnew.la \ | ||
383 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
384 | $(LTLIBINTL) | ||
385 | libgnunet_plugin_transport_xu_la_LDFLAGS = \ | ||
386 | $(GN_PLUGIN_LDFLAGS) | ||
387 | |||
357 | libgnunet_plugin_transport_unix_la_SOURCES = \ | 388 | libgnunet_plugin_transport_unix_la_SOURCES = \ |
358 | plugin_transport_unix.c | 389 | plugin_transport_unix.c |
359 | libgnunet_plugin_transport_unix_la_LIBADD = \ | 390 | libgnunet_plugin_transport_unix_la_LIBADD = \ |
diff --git a/src/transport/gnunet-helper-transport-bluetooth.c b/src/transport/gnunet-helper-transport-bluetooth.c index 28855c31e..27d862f22 100644 --- a/src/transport/gnunet-helper-transport-bluetooth.c +++ b/src/transport/gnunet-helper-transport-bluetooth.c | |||
@@ -4,20 +4,18 @@ | |||
4 | Copyright (c) 2007, 2008, Andy Green <andy@warmcat.com> | 4 | Copyright (c) 2007, 2008, Andy Green <andy@warmcat.com> |
5 | Copyright Copyright (C) 2009 Thomas d'Otreppe | 5 | Copyright Copyright (C) 2009 Thomas d'Otreppe |
6 | 6 | ||
7 | GNUnet is free software; you can redistribute it and/or modify | 7 | GNUnet is free software: you can redistribute it and/or modify it |
8 | it under the terms of the GNU General Public License as published | 8 | under the terms of the GNU Affero General Public License as published |
9 | by the Free Software Foundation; either version 3, or (at your | 9 | by the Free Software Foundation, either version 3 of the License, |
10 | option) any later version. | 10 | or (at your option) any later version. |
11 | 11 | ||
12 | GNUnet is distributed in the hope that it will be useful, but | 12 | GNUnet is distributed in the hope that it will be useful, but |
13 | WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | General Public License for more details. | 15 | Affero General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU Affero General Public License |
18 | along with GNUnet; see the file COPYING. If not, write to the | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
20 | Boston, MA 02110-1301, USA. | ||
21 | */ | 19 | */ |
22 | #include "gnunet_config.h" | 20 | #include "gnunet_config.h" |
23 | 21 | ||
diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c b/src/transport/gnunet-helper-transport-wlan-dummy.c index f02d8bdd7..7b24caf4e 100644 --- a/src/transport/gnunet-helper-transport-wlan-dummy.c +++ b/src/transport/gnunet-helper-transport-wlan-dummy.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010, 2012 GNUnet e.V. | 3 | Copyright (C) 2010, 2012 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/gnunet-helper-transport-wlan-dummy.c | 19 | * @file transport/gnunet-helper-transport-wlan-dummy.c |
diff --git a/src/transport/gnunet-helper-transport-wlan.c b/src/transport/gnunet-helper-transport-wlan.c index 0ce387013..59a2d8b56 100644 --- a/src/transport/gnunet-helper-transport-wlan.c +++ b/src/transport/gnunet-helper-transport-wlan.c | |||
@@ -4,20 +4,18 @@ | |||
4 | Copyright (c) 2007, 2008, Andy Green <andy@warmcat.com> | 4 | Copyright (c) 2007, 2008, Andy Green <andy@warmcat.com> |
5 | Copyright Copyright (C) 2009 Thomas d'Otreppe | 5 | Copyright Copyright (C) 2009 Thomas d'Otreppe |
6 | 6 | ||
7 | GNUnet is free software; you can redistribute it and/or modify | 7 | GNUnet is free software: you can redistribute it and/or modify it |
8 | it under the terms of the GNU General Public License as published | 8 | under the terms of the GNU Affero General Public License as published |
9 | by the Free Software Foundation; either version 3, or (at your | 9 | by the Free Software Foundation, either version 3 of the License, |
10 | option) any later version. | 10 | or (at your option) any later version. |
11 | 11 | ||
12 | GNUnet is distributed in the hope that it will be useful, but | 12 | GNUnet is distributed in the hope that it will be useful, but |
13 | WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | General Public License for more details. | 15 | Affero General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU Affero General Public License |
18 | along with GNUnet; see the file COPYING. If not, write to the | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
20 | Boston, MA 02110-1301, USA. | ||
21 | */ | 19 | */ |
22 | /** | 20 | /** |
23 | * @file src/transport/gnunet-helper-transport-wlan.c | 21 | * @file src/transport/gnunet-helper-transport-wlan.c |
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 124260c41..8c4f33fd0 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010-2016 GNUnet e.V. | 3 | Copyright (C) 2010-2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/gnunet-service-transport.c | 19 | * @file transport/gnunet-service-transport.c |
@@ -614,7 +612,7 @@ notify_client_about_neighbour (void *cls, | |||
614 | 612 | ||
615 | /** | 613 | /** |
616 | * Initialize a normal client. We got a start message from this | 614 | * Initialize a normal client. We got a start message from this |
617 | * client, add him to the list of clients for broadcasting of inbound | 615 | * client, add it to the list of clients for broadcasting of inbound |
618 | * messages. | 616 | * messages. |
619 | * | 617 | * |
620 | * @param cls the client | 618 | * @param cls the client |
@@ -2175,7 +2173,7 @@ test_connection_ok (void *cls, | |||
2175 | 2173 | ||
2176 | /** | 2174 | /** |
2177 | * Initialize a blacklisting client. We got a blacklist-init | 2175 | * Initialize a blacklisting client. We got a blacklist-init |
2178 | * message from this client, add him to the list of clients | 2176 | * message from this client, add it to the list of clients |
2179 | * to query for blacklisting. | 2177 | * to query for blacklisting. |
2180 | * | 2178 | * |
2181 | * @param cls the client | 2179 | * @param cls the client |
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h index 2807afd79..fd852f027 100644 --- a/src/transport/gnunet-service-transport.h +++ b/src/transport/gnunet-service-transport.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010,2011 GNUnet e.V. | 3 | Copyright (C) 2010,2011 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c index 01e115bfc..8b3b998c8 100644 --- a/src/transport/gnunet-service-transport_ats.c +++ b/src/transport/gnunet-service-transport_ats.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2015 GNUnet e.V. | 3 | Copyright (C) 2015 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/gnunet-service-transport_ats.c | 19 | * @file transport/gnunet-service-transport_ats.c |
diff --git a/src/transport/gnunet-service-transport_ats.h b/src/transport/gnunet-service-transport_ats.h index d9d7b555b..139c04c3b 100644 --- a/src/transport/gnunet-service-transport_ats.h +++ b/src/transport/gnunet-service-transport_ats.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2015 GNUnet e.V. | 3 | Copyright (C) 2015 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/gnunet-service-transport_ats.h | 19 | * @file transport/gnunet-service-transport_ats.h |
diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c index 1a3c2c32e..cfd8c0f66 100644 --- a/src/transport/gnunet-service-transport_hello.c +++ b/src/transport/gnunet-service-transport_hello.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010,2011 GNUnet e.V. | 3 | Copyright (C) 2010,2011 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-service-transport_hello.h b/src/transport/gnunet-service-transport_hello.h index f04008630..e4e35167f 100644 --- a/src/transport/gnunet-service-transport_hello.h +++ b/src/transport/gnunet-service-transport_hello.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010,2011 GNUnet e.V. | 3 | Copyright (C) 2010,2011 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/gnunet-service-transport_hello.h | 19 | * @file transport/gnunet-service-transport_hello.h |
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c index e68753583..013b14cce 100644 --- a/src/transport/gnunet-service-transport_manipulation.c +++ b/src/transport/gnunet-service-transport_manipulation.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010-2013 GNUnet e.V. | 3 | Copyright (C) 2010-2013 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-service-transport_manipulation.h b/src/transport/gnunet-service-transport_manipulation.h index 312dd1168..ee72478b6 100644 --- a/src/transport/gnunet-service-transport_manipulation.h +++ b/src/transport/gnunet-service-transport_manipulation.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010-2015 GNUnet e.V. | 3 | Copyright (C) 2010-2015 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index e124f1667..3965bc13e 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010-2015 GNUnet e.V. | 3 | Copyright (C) 2010-2015 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
@@ -181,7 +179,7 @@ struct GNUNET_ATS_SessionQuotaMessage | |||
181 | 179 | ||
182 | 180 | ||
183 | /** | 181 | /** |
184 | * Message we send to the other peer to notify him that we intentionally | 182 | * Message we send to the other peer to notify it that we intentionally |
185 | * are disconnecting (to reduce timeouts). This is just a friendly | 183 | * are disconnecting (to reduce timeouts). This is just a friendly |
186 | * notification, peers must not rely on always receiving disconnect | 184 | * notification, peers must not rely on always receiving disconnect |
187 | * messages. | 185 | * messages. |
@@ -3083,7 +3081,7 @@ master_task (void *cls) | |||
3083 | 3081 | ||
3084 | /** | 3082 | /** |
3085 | * Send a ACK message to the neighbour to confirm that we | 3083 | * Send a ACK message to the neighbour to confirm that we |
3086 | * got his SYN_ACK. | 3084 | * got its SYN_ACK. |
3087 | * | 3085 | * |
3088 | * @param n neighbour to send the ACK to | 3086 | * @param n neighbour to send the ACK to |
3089 | */ | 3087 | */ |
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h index 1a4de7294..c8da98423 100644 --- a/src/transport/gnunet-service-transport_neighbours.h +++ b/src/transport/gnunet-service-transport_neighbours.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010-2015 GNUnet e.V. | 3 | Copyright (C) 2010-2015 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-service-transport_plugins.c b/src/transport/gnunet-service-transport_plugins.c index e68538c77..9c3044450 100644 --- a/src/transport/gnunet-service-transport_plugins.c +++ b/src/transport/gnunet-service-transport_plugins.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010-2014 GNUnet e.V. | 3 | Copyright (C) 2010-2014 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-service-transport_plugins.h b/src/transport/gnunet-service-transport_plugins.h index dc9d841ca..3cc3bb901 100644 --- a/src/transport/gnunet-service-transport_plugins.h +++ b/src/transport/gnunet-service-transport_plugins.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010,2011 GNUnet e.V. | 3 | Copyright (C) 2010,2011 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index cd5aeb5e2..eecc54efa 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010-2015 GNUnet e.V. | 3 | Copyright (C) 2010-2015 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
@@ -1623,15 +1621,20 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
1623 | GNUNET_TRANSPORT_VS_UPDATE); | 1621 | GNUNET_TRANSPORT_VS_UPDATE); |
1624 | 1622 | ||
1625 | /* build HELLO to store in PEERINFO */ | 1623 | /* build HELLO to store in PEERINFO */ |
1624 | GNUNET_STATISTICS_update (GST_stats, | ||
1625 | gettext_noop ("# HELLOs given to peerinfo"), | ||
1626 | 1, | ||
1627 | GNUNET_NO); | ||
1626 | ve->copied = GNUNET_NO; | 1628 | ve->copied = GNUNET_NO; |
1627 | hello = GNUNET_HELLO_create (&ve->address->peer.public_key, | 1629 | hello = GNUNET_HELLO_create (&ve->address->peer.public_key, |
1628 | &add_valid_peer_address, | 1630 | &add_valid_peer_address, |
1629 | ve, | 1631 | ve, |
1630 | GNUNET_NO); | 1632 | GNUNET_NO); |
1631 | GNUNET_PEERINFO_add_peer (GST_peerinfo, | 1633 | GNUNET_break (NULL != |
1632 | hello, | 1634 | GNUNET_PEERINFO_add_peer (GST_peerinfo, |
1633 | NULL, | 1635 | hello, |
1634 | NULL); | 1636 | NULL, |
1637 | NULL)); | ||
1635 | GNUNET_free (hello); | 1638 | GNUNET_free (hello); |
1636 | return GNUNET_OK; | 1639 | return GNUNET_OK; |
1637 | } | 1640 | } |
diff --git a/src/transport/gnunet-service-transport_validation.h b/src/transport/gnunet-service-transport_validation.h index 53528437a..8d11413db 100644 --- a/src/transport/gnunet-service-transport_validation.h +++ b/src/transport/gnunet-service-transport_validation.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010,2011 GNUnet e.V. | 3 | Copyright (C) 2010,2011 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-transport-certificate-creation.c b/src/transport/gnunet-transport-certificate-creation.c index edaf4773a..8b536ba49 100644 --- a/src/transport/gnunet-transport-certificate-creation.c +++ b/src/transport/gnunet-transport-certificate-creation.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2011, 2013 GNUnet e.V. | 3 | Copyright (C) 2011, 2013 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-transport-profiler.c b/src/transport/gnunet-transport-profiler.c index d580fce08..951975f03 100644 --- a/src/transport/gnunet-transport-profiler.c +++ b/src/transport/gnunet-transport-profiler.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2011-2016 GNUnet e.V. | 3 | Copyright (C) 2011-2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-transport-wlan-receiver.c b/src/transport/gnunet-transport-wlan-receiver.c index 595210c42..930d29e9e 100644 --- a/src/transport/gnunet-transport-wlan-receiver.c +++ b/src/transport/gnunet-transport-wlan-receiver.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2012 GNUnet e.V. | 3 | Copyright (C) 2012 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-transport-wlan-sender.c b/src/transport/gnunet-transport-wlan-sender.c index bc5f6c321..0c0326b8f 100644 --- a/src/transport/gnunet-transport-wlan-sender.c +++ b/src/transport/gnunet-transport-wlan-sender.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2011 GNUnet e.V. | 3 | Copyright (C) 2011 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index 96d0a6a3a..fed509fe1 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2011-2014, 2016, 2017 GNUnet e.V. | 3 | Copyright (C) 2011-2014, 2016, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/perf_http_peer1.conf b/src/transport/perf_http_peer1.conf index e683a8145..e97e16289 100644 --- a/src/transport/perf_http_peer1.conf +++ b/src/transport/perf_http_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = http_client | 6 | PLUGINS = http_client |
diff --git a/src/transport/perf_http_peer2.conf b/src/transport/perf_http_peer2.conf index ab093d0ff..a1c83bde5 100644 --- a/src/transport/perf_http_peer2.conf +++ b/src/transport/perf_http_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = http_server | 6 | PLUGINS = http_server |
diff --git a/src/transport/perf_https_peer1.conf b/src/transport/perf_https_peer1.conf index bad98c532..e943671c2 100644 --- a/src/transport/perf_https_peer1.conf +++ b/src/transport/perf_https_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = https_client | 6 | PLUGINS = https_client |
diff --git a/src/transport/perf_https_peer2.conf b/src/transport/perf_https_peer2.conf index 923426dc3..6e30f9e60 100644 --- a/src/transport/perf_https_peer2.conf +++ b/src/transport/perf_https_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = https_server | 6 | PLUGINS = https_server |
diff --git a/src/transport/perf_tcp_peer1.conf b/src/transport/perf_tcp_peer1.conf index 2471633fc..e56c47ada 100644 --- a/src/transport/perf_tcp_peer1.conf +++ b/src/transport/perf_tcp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/perf_tcp_peer2.conf b/src/transport/perf_tcp_peer2.conf index e1517ff75..3264161f5 100644 --- a/src/transport/perf_tcp_peer2.conf +++ b/src/transport/perf_tcp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/perf_udp_peer1.conf b/src/transport/perf_udp_peer1.conf index 10e44c178..68bf43908 100644 --- a/src/transport/perf_udp_peer1.conf +++ b/src/transport/perf_udp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = udp | 6 | PLUGINS = udp |
diff --git a/src/transport/perf_udp_peer2.conf b/src/transport/perf_udp_peer2.conf index 4f27b2d71..efed935f8 100644 --- a/src/transport/perf_udp_peer2.conf +++ b/src/transport/perf_udp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = udp | 6 | PLUGINS = udp |
diff --git a/src/transport/perf_unix_peer1.conf b/src/transport/perf_unix_peer1.conf index 96cda0748..06cd63fc6 100644 --- a/src/transport/perf_unix_peer1.conf +++ b/src/transport/perf_unix_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PORT = 12001 | 6 | PORT = 12001 |
diff --git a/src/transport/perf_unix_peer2.conf b/src/transport/perf_unix_peer2.conf index a9178ed8f..feadb6fec 100644 --- a/src/transport/perf_unix_peer2.conf +++ b/src/transport/perf_unix_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PORT = 12010 | 6 | PORT = 12010 |
diff --git a/src/transport/plugin_transport_http.h b/src/transport/plugin_transport_http.h index cbd780a58..a21904edd 100644 --- a/src/transport/plugin_transport_http.h +++ b/src/transport/plugin_transport_http.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 GNUnet e.V. | 3 | Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index e20948c5a..0afb54943 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2002-2014 GNUnet e.V. | 3 | Copyright (C) 2002-2014 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c index eb8320c8e..e9576d72b 100644 --- a/src/transport/plugin_transport_http_common.c +++ b/src/transport/plugin_transport_http_common.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2002-2013 GNUnet e.V. | 3 | Copyright (C) 2002-2013 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_http_common.h b/src/transport/plugin_transport_http_common.h index 8a32e17e4..ac62f6ee4 100644 --- a/src/transport/plugin_transport_http_common.h +++ b/src/transport/plugin_transport_http_common.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2002-2014 GNUnet e.V. | 3 | Copyright (C) 2002-2014 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/plugin_transport_http_common.c | 19 | * @file transport/plugin_transport_http_common.c |
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 6a9c1b0ba..abf60280a 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2002-2014, 2017 GNUnet e.V. | 3 | Copyright (C) 2002-2014, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_smtp.c b/src/transport/plugin_transport_smtp.c index 876f81ce3..8898bd827 100644 --- a/src/transport/plugin_transport_smtp.c +++ b/src/transport/plugin_transport_smtp.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2003-2013 GNUnet e.V. | 3 | Copyright (C) 2003-2013 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 8b00543c3..75a885535 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2002--2015 GNUnet e.V. | 3 | Copyright (C) 2002--2015 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/plugin_transport_tcp.c | 19 | * @file transport/plugin_transport_tcp.c |
diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c index 1df06d792..679d83daa 100644 --- a/src/transport/plugin_transport_template.c +++ b/src/transport/plugin_transport_template.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2002-2014 GNUnet e.V. | 3 | Copyright (C) 2002-2014 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 0daac4443..abbcca2ae 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2010-2017 GNUnet e.V. | 3 | Copyright (C) 2010-2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_udp.h b/src/transport/plugin_transport_udp.h index 48c7365c7..5a2fa6f05 100644 --- a/src/transport/plugin_transport_udp.h +++ b/src/transport/plugin_transport_udp.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2010-2014 GNUnet e.V. | 3 | Copyright (C) 2010-2014 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c index c6ddbce9b..bcb622a46 100644 --- a/src/transport/plugin_transport_udp_broadcasting.c +++ b/src/transport/plugin_transport_udp_broadcasting.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2010, 2011 GNUnet e.V. | 3 | Copyright (C) 2010, 2011 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 6bcb7290f..3d177e703 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2010-2014 GNUnet e.V. | 3 | Copyright (C) 2010-2014 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index b23739d3c..13d2ca466 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2010-2014 GNUnet e.V. | 3 | Copyright (C) 2010-2014 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_wlan.h b/src/transport/plugin_transport_wlan.h index bcbaa6371..ad16a267e 100644 --- a/src/transport/plugin_transport_wlan.h +++ b/src/transport/plugin_transport_wlan.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2010, 2011 GNUnet e.V. | 3 | Copyright (C) 2010, 2011 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/plugin_transport_xt.c b/src/transport/plugin_transport_xt.c new file mode 100644 index 000000000..0f517dd0c --- /dev/null +++ b/src/transport/plugin_transport_xt.c | |||
@@ -0,0 +1,4105 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2002--2015 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | /** | ||
19 | * @file transport/plugin_transport_xt.c | ||
20 | * @brief Implementation of the TCP transport service | ||
21 | * @author Christian Grothoff | ||
22 | */ | ||
23 | #include "platform.h" | ||
24 | #include "gnunet_hello_lib.h" | ||
25 | #include "gnunet_constants.h" | ||
26 | #include "gnunet_util_lib.h" | ||
27 | #include "gnunet_nat_service.h" | ||
28 | #include "gnunet_protocols.h" | ||
29 | #include "gnunet_resolver_service.h" | ||
30 | #include "gnunet_signatures.h" | ||
31 | #include "gnunet_statistics_service.h" | ||
32 | #include "gnunet_transport_service.h" | ||
33 | #include "gnunet_transport_plugin.h" | ||
34 | #include "transport.h" | ||
35 | |||
36 | #define LOG(kind,...) GNUNET_log_from (kind, "transport-xt",__VA_ARGS__) | ||
37 | |||
38 | #define PLUGIN_NAME "xt" | ||
39 | |||
40 | /** | ||
41 | * How long until we give up on establishing an NAT connection? | ||
42 | * Must be > 4 RTT | ||
43 | */ | ||
44 | #define NAT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | ||
45 | |||
46 | /** | ||
47 | * Opaque handle that can be used to cancel | ||
48 | * a transmit-ready notification. | ||
49 | */ | ||
50 | struct GNUNET_CONNECTION_TransmitHandle; | ||
51 | |||
52 | /** | ||
53 | * @brief handle for a server | ||
54 | */ | ||
55 | struct GNUNET_SERVER_Handle; | ||
56 | |||
57 | /** | ||
58 | * @brief opaque handle for a client of the server | ||
59 | */ | ||
60 | struct GNUNET_SERVER_Client; | ||
61 | |||
62 | /** | ||
63 | * @brief opaque handle server returns for aborting transmission to a client. | ||
64 | */ | ||
65 | struct GNUNET_SERVER_TransmitHandle; | ||
66 | |||
67 | /** | ||
68 | * @brief handle for a network connection | ||
69 | */ | ||
70 | struct GNUNET_CONNECTION_Handle; | ||
71 | |||
72 | /** | ||
73 | * @brief handle for a network service | ||
74 | */ | ||
75 | struct LEGACY_SERVICE_Context; | ||
76 | |||
77 | |||
78 | /** | ||
79 | * Stops a service that was started with #GNUNET_SERVICE_start(). | ||
80 | * | ||
81 | * @param srv service to stop | ||
82 | */ | ||
83 | void | ||
84 | LEGACY_SERVICE_stop (struct LEGACY_SERVICE_Context *srv); | ||
85 | |||
86 | |||
87 | |||
88 | /** | ||
89 | * Function called to notify a client about the connection begin ready | ||
90 | * to queue more data. @a buf will be NULL and @a size zero if the | ||
91 | * connection was closed for writing in the meantime. | ||
92 | * | ||
93 | * @param cls closure | ||
94 | * @param size number of bytes available in @a buf | ||
95 | * @param buf where the callee should write the message | ||
96 | * @return number of bytes written to @a buf | ||
97 | */ | ||
98 | typedef size_t | ||
99 | (*GNUNET_CONNECTION_TransmitReadyNotify) (void *cls, | ||
100 | size_t size, | ||
101 | void *buf); | ||
102 | |||
103 | /** | ||
104 | * Credentials for UNIX domain sockets. | ||
105 | */ | ||
106 | struct GNUNET_CONNECTION_Credentials | ||
107 | { | ||
108 | /** | ||
109 | * UID of the other end of the connection. | ||
110 | */ | ||
111 | uid_t uid; | ||
112 | |||
113 | /** | ||
114 | * GID of the other end of the connection. | ||
115 | */ | ||
116 | gid_t gid; | ||
117 | }; | ||
118 | |||
119 | |||
120 | /** | ||
121 | * Functions with this signature are called whenever a client | ||
122 | * is disconnected on the network level. | ||
123 | * | ||
124 | * @param cls closure | ||
125 | * @param client identification of the client; NULL | ||
126 | * for the last call when the server is destroyed | ||
127 | */ | ||
128 | typedef void | ||
129 | (*GNUNET_SERVER_DisconnectCallback) (void *cls, | ||
130 | struct GNUNET_SERVER_Client *client); | ||
131 | |||
132 | |||
133 | /** | ||
134 | * Functions with this signature are called whenever a client | ||
135 | * is connected on the network level. | ||
136 | * | ||
137 | * @param cls closure | ||
138 | * @param client identification of the client | ||
139 | */ | ||
140 | typedef void | ||
141 | (*GNUNET_SERVER_ConnectCallback) (void *cls, | ||
142 | struct GNUNET_SERVER_Client *client); | ||
143 | |||
144 | |||
145 | |||
146 | |||
147 | /** | ||
148 | * Function to call for access control checks. | ||
149 | * | ||
150 | * @param cls closure | ||
151 | * @param ucred credentials, if available, otherwise NULL | ||
152 | * @param addr address | ||
153 | * @param addrlen length of address | ||
154 | * @return GNUNET_YES to allow, GNUNET_NO to deny, GNUNET_SYSERR | ||
155 | * for unknown address family (will be denied). | ||
156 | */ | ||
157 | typedef int | ||
158 | (*GNUNET_CONNECTION_AccessCheck) (void *cls, | ||
159 | const struct | ||
160 | GNUNET_CONNECTION_Credentials * | ||
161 | ucred, | ||
162 | const struct sockaddr * addr, | ||
163 | socklen_t addrlen); | ||
164 | |||
165 | /** | ||
166 | * Callback function for data received from the network. Note that | ||
167 | * both "available" and "err" would be 0 if the read simply timed out. | ||
168 | * | ||
169 | * @param cls closure | ||
170 | * @param buf pointer to received data | ||
171 | * @param available number of bytes availabe in "buf", | ||
172 | * possibly 0 (on errors) | ||
173 | * @param addr address of the sender | ||
174 | * @param addrlen size of addr | ||
175 | * @param errCode value of errno (on errors receiving) | ||
176 | */ | ||
177 | typedef void | ||
178 | (*GNUNET_CONNECTION_Receiver) (void *cls, const void *buf, | ||
179 | size_t available, | ||
180 | const struct sockaddr * addr, | ||
181 | socklen_t addrlen, int errCode); | ||
182 | |||
183 | |||
184 | |||
185 | /** | ||
186 | * Close the connection and free associated resources. There must | ||
187 | * not be any pending requests for reading or writing to the | ||
188 | * connection at this time. | ||
189 | * | ||
190 | * @param connection connection to destroy | ||
191 | */ | ||
192 | void | ||
193 | GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *connection); | ||
194 | |||
195 | |||
196 | /** | ||
197 | * Signature of a function to create a custom tokenizer. | ||
198 | * | ||
199 | * @param cls closure from #GNUNET_SERVER_set_callbacks | ||
200 | * @param client handle to client the tokenzier will be used for | ||
201 | * @return handle to custom tokenizer ('mst') | ||
202 | */ | ||
203 | typedef void* | ||
204 | (*GNUNET_SERVER_MstCreateCallback) (void *cls, | ||
205 | struct GNUNET_SERVER_Client *client); | ||
206 | |||
207 | |||
208 | /** | ||
209 | * Signature of a function to destroy a custom tokenizer. | ||
210 | * | ||
211 | * @param cls closure from #GNUNET_SERVER_set_callbacks | ||
212 | * @param mst custom tokenizer handle | ||
213 | */ | ||
214 | typedef void | ||
215 | (*GNUNET_SERVER_MstDestroyCallback) (void *cls, | ||
216 | void *mst); | ||
217 | |||
218 | /** | ||
219 | * Signature of a function to receive data for a custom tokenizer. | ||
220 | * | ||
221 | * @param cls closure from #GNUNET_SERVER_set_callbacks | ||
222 | * @param mst custom tokenizer handle | ||
223 | * @param client_identity ID of client for which this is a buffer, | ||
224 | * can be NULL (will be passed back to 'cb') | ||
225 | * @param buf input data to add | ||
226 | * @param size number of bytes in @a buf | ||
227 | * @param purge should any excess bytes in the buffer be discarded | ||
228 | * (i.e. for packet-based services like UDP) | ||
229 | * @param one_shot only call callback once, keep rest of message in buffer | ||
230 | * @return #GNUNET_OK if we are done processing (need more data) | ||
231 | * #GNUNET_NO if one_shot was set and we have another message ready | ||
232 | * #GNUNET_SYSERR if the data stream is corrupt | ||
233 | */ | ||
234 | typedef int | ||
235 | (*GNUNET_SERVER_MstReceiveCallback) (void *cls, void *mst, | ||
236 | struct GNUNET_SERVER_Client *client, | ||
237 | const char *buf, | ||
238 | size_t size, | ||
239 | int purge, | ||
240 | int one_shot); | ||
241 | /** | ||
242 | * Functions with this signature are called whenever a message is | ||
243 | * received. | ||
244 | * | ||
245 | * @param cls closure | ||
246 | * @param client identification of the client | ||
247 | * @param message the actual message | ||
248 | */ | ||
249 | typedef void | ||
250 | (*GNUNET_SERVER_MessageCallback) (void *cls, | ||
251 | struct GNUNET_SERVER_Client *client, | ||
252 | const struct GNUNET_MessageHeader *message); | ||
253 | |||
254 | /** | ||
255 | * Message handler. Each struct specifies how to handle on particular | ||
256 | * type of message received. | ||
257 | */ | ||
258 | struct GNUNET_SERVER_MessageHandler | ||
259 | { | ||
260 | /** | ||
261 | * Function to call for messages of "type". | ||
262 | */ | ||
263 | GNUNET_SERVER_MessageCallback callback; | ||
264 | |||
265 | /** | ||
266 | * Closure argument for @e callback. | ||
267 | */ | ||
268 | void *callback_cls; | ||
269 | |||
270 | /** | ||
271 | * Type of the message this handler covers. | ||
272 | */ | ||
273 | uint16_t type; | ||
274 | |||
275 | /** | ||
276 | * Expected size of messages of this type. Use 0 for | ||
277 | * variable-size. If non-zero, messages of the given | ||
278 | * type will be discarded (and the connection closed) | ||
279 | * if they do not have the right size. | ||
280 | */ | ||
281 | uint16_t expected_size; | ||
282 | |||
283 | }; | ||
284 | |||
285 | |||
286 | /** | ||
287 | * Options for the service (bitmask). | ||
288 | */ | ||
289 | enum LEGACY_SERVICE_Options | ||
290 | { | ||
291 | /** | ||
292 | * Use defaults. Terminates all client connections and the listen | ||
293 | * sockets immediately upon receiving the shutdown signal. | ||
294 | */ | ||
295 | LEGACY_SERVICE_OPTION_NONE = 0, | ||
296 | |||
297 | /** | ||
298 | * Do not trigger server shutdown on signal at all; instead, allow | ||
299 | * for the user to terminate the server explicitly when needed | ||
300 | * by calling #LEGACY_SERVICE_shutdown(). | ||
301 | */ | ||
302 | LEGACY_SERVICE_OPTION_MANUAL_SHUTDOWN = 1, | ||
303 | |||
304 | /** | ||
305 | * Trigger a SOFT server shutdown on signals, allowing active | ||
306 | * non-monitor clients to complete their transactions. | ||
307 | */ | ||
308 | LEGACY_SERVICE_OPTION_SOFT_SHUTDOWN = 2 | ||
309 | }; | ||
310 | |||
311 | |||
312 | |||
313 | /** | ||
314 | * Ask the server to disconnect from the given client. This is the | ||
315 | * same as passing #GNUNET_SYSERR to #GNUNET_SERVER_receive_done, | ||
316 | * except that it allows dropping of a client even when not handling a | ||
317 | * message from that client. | ||
318 | * | ||
319 | * @param client the client to disconnect from | ||
320 | */ | ||
321 | void | ||
322 | GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client); | ||
323 | |||
324 | /** | ||
325 | * Return user context associated with the given client. | ||
326 | * Note: you should probably use the macro (call without the underscore). | ||
327 | * | ||
328 | * @param client client to query | ||
329 | * @param size number of bytes in user context struct (for verification only) | ||
330 | * @return pointer to user context | ||
331 | */ | ||
332 | void * | ||
333 | GNUNET_SERVER_client_get_user_context_ (struct GNUNET_SERVER_Client *client, | ||
334 | size_t size); | ||
335 | |||
336 | |||
337 | /** | ||
338 | * Functions with this signature are called whenever a | ||
339 | * complete message is received by the tokenizer. | ||
340 | * | ||
341 | * Do not call #GNUNET_SERVER_mst_destroy from within | ||
342 | * the scope of this callback. | ||
343 | * | ||
344 | * @param cls closure | ||
345 | * @param client identification of the client | ||
346 | * @param message the actual message | ||
347 | * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing | ||
348 | */ | ||
349 | typedef int | ||
350 | (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls, | ||
351 | void *client, | ||
352 | const struct GNUNET_MessageHeader *message); | ||
353 | |||
354 | |||
355 | /** | ||
356 | * Create a message stream tokenizer. | ||
357 | * | ||
358 | * @param cb function to call on completed messages | ||
359 | * @param cb_cls closure for @a cb | ||
360 | * @return handle to tokenizer | ||
361 | */ | ||
362 | struct GNUNET_SERVER_MessageStreamTokenizer * | ||
363 | GNUNET_SERVER_mst_create (GNUNET_SERVER_MessageTokenizerCallback cb, | ||
364 | void *cb_cls); | ||
365 | |||
366 | /** | ||
367 | * Add incoming data to the receive buffer and call the | ||
368 | * callback for all complete messages. | ||
369 | * | ||
370 | * @param mst tokenizer to use | ||
371 | * @param client_identity ID of client for which this is a buffer, | ||
372 | * can be NULL (will be passed back to 'cb') | ||
373 | * @param buf input data to add | ||
374 | * @param size number of bytes in @a buf | ||
375 | * @param purge should any excess bytes in the buffer be discarded | ||
376 | * (i.e. for packet-based services like UDP) | ||
377 | * @param one_shot only call callback once, keep rest of message in buffer | ||
378 | * @return #GNUNET_OK if we are done processing (need more data) | ||
379 | * #GNUNET_NO if one_shot was set and we have another message ready | ||
380 | * #GNUNET_SYSERR if the data stream is corrupt | ||
381 | */ | ||
382 | int | ||
383 | GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst, | ||
384 | void *client_identity, | ||
385 | const char *buf, size_t size, | ||
386 | int purge, int one_shot); | ||
387 | |||
388 | |||
389 | |||
390 | /** | ||
391 | * Destroys a tokenizer. | ||
392 | * | ||
393 | * @param mst tokenizer to destroy | ||
394 | */ | ||
395 | void | ||
396 | GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer *mst); | ||
397 | |||
398 | |||
399 | /** | ||
400 | * Set user context to be associated with the given client. | ||
401 | * Note: you should probably use the macro (call without the underscore). | ||
402 | * | ||
403 | * @param client client to query | ||
404 | * @param ptr pointer to user context | ||
405 | * @param size number of bytes in user context struct (for verification only) | ||
406 | */ | ||
407 | void | ||
408 | GNUNET_SERVER_client_set_user_context_ (struct GNUNET_SERVER_Client *client, | ||
409 | void *ptr, | ||
410 | size_t size); | ||
411 | /** | ||
412 | * Return user context associated with the given client. | ||
413 | * | ||
414 | * @param client client to query | ||
415 | * @param type expected return type (i.e. 'struct Foo') | ||
416 | * @return pointer to user context of type 'type *'. | ||
417 | */ | ||
418 | #define GNUNET_SERVER_client_get_user_context(client,type) \ | ||
419 | (type *) GNUNET_SERVER_client_get_user_context_ (client, sizeof (type)) | ||
420 | |||
421 | /** | ||
422 | * Set user context to be associated with the given client. | ||
423 | * | ||
424 | * @param client client to query | ||
425 | * @param value pointer to user context | ||
426 | */ | ||
427 | #define GNUNET_SERVER_client_set_user_context(client,value) \ | ||
428 | GNUNET_SERVER_client_set_user_context_ (client, value, sizeof (*value)) | ||
429 | |||
430 | |||
431 | |||
432 | /** | ||
433 | * Notify us when the server has enough space to transmit | ||
434 | * a message of the given size to the given client. | ||
435 | * | ||
436 | * @param client client to transmit message to | ||
437 | * @param size requested amount of buffer space | ||
438 | * @param timeout after how long should we give up (and call | ||
439 | * notify with buf NULL and size 0)? | ||
440 | * @param callback function to call when space is available | ||
441 | * @param callback_cls closure for @a callback | ||
442 | * @return non-NULL if the notify callback was queued; can be used | ||
443 | * to cancel the request using | ||
444 | * #GNUNET_SERVER_notify_transmit_ready_cancel. | ||
445 | * NULL if we are already going to notify someone else (busy) | ||
446 | */ | ||
447 | struct GNUNET_SERVER_TransmitHandle * | ||
448 | GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client, | ||
449 | size_t size, | ||
450 | struct GNUNET_TIME_Relative timeout, | ||
451 | GNUNET_CONNECTION_TransmitReadyNotify callback, | ||
452 | void *callback_cls); | ||
453 | |||
454 | /** | ||
455 | * Abort transmission request. | ||
456 | * | ||
457 | * @param th request to abort | ||
458 | */ | ||
459 | void | ||
460 | GNUNET_SERVER_notify_transmit_ready_cancel (struct GNUNET_SERVER_TransmitHandle *th); | ||
461 | |||
462 | |||
463 | |||
464 | |||
465 | /** | ||
466 | * Notify the server that the given client handle should | ||
467 | * be kept (keeps the connection up if possible, increments | ||
468 | * the internal reference counter). | ||
469 | * | ||
470 | * @param client the client to keep | ||
471 | */ | ||
472 | void | ||
473 | GNUNET_SERVER_client_keep (struct GNUNET_SERVER_Client *client); | ||
474 | |||
475 | |||
476 | /** | ||
477 | * Notify the server that the given client handle is no | ||
478 | * longer required. Decrements the reference counter. If | ||
479 | * that counter reaches zero an inactive connection maybe | ||
480 | * closed. | ||
481 | * | ||
482 | * @param client the client to drop | ||
483 | */ | ||
484 | void | ||
485 | GNUNET_SERVER_client_drop (struct GNUNET_SERVER_Client *client); | ||
486 | |||
487 | |||
488 | /** | ||
489 | * Function called by the service's run | ||
490 | * method to run service-specific setup code. | ||
491 | * | ||
492 | * @param cls closure | ||
493 | * @param server the initialized server | ||
494 | * @param cfg configuration to use | ||
495 | */ | ||
496 | typedef void | ||
497 | (*LEGACY_SERVICE_Main) (void *cls, | ||
498 | struct GNUNET_SERVER_Handle *server, | ||
499 | const struct GNUNET_CONFIGURATION_Handle *cfg); | ||
500 | |||
501 | |||
502 | |||
503 | /** | ||
504 | * Suspend accepting connections from the listen socket temporarily. | ||
505 | * Resume activity using #GNUNET_SERVER_resume. | ||
506 | * | ||
507 | * @param server server to stop accepting connections. | ||
508 | */ | ||
509 | void | ||
510 | GNUNET_SERVER_suspend (struct GNUNET_SERVER_Handle *server); | ||
511 | |||
512 | /** | ||
513 | * Notify us when the server has enough space to transmit | ||
514 | * a message of the given size to the given client. | ||
515 | * | ||
516 | * @param client client to transmit message to | ||
517 | * @param size requested amount of buffer space | ||
518 | * @param timeout after how long should we give up (and call | ||
519 | * notify with buf NULL and size 0)? | ||
520 | * @param callback function to call when space is available | ||
521 | * @param callback_cls closure for @a callback | ||
522 | * @return non-NULL if the notify callback was queued; can be used | ||
523 | * to cancel the request using | ||
524 | * #GNUNET_SERVER_notify_transmit_ready_cancel. | ||
525 | * NULL if we are already going to notify someone else (busy) | ||
526 | */ | ||
527 | struct GNUNET_SERVER_TransmitHandle * | ||
528 | GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client, | ||
529 | size_t size, | ||
530 | struct GNUNET_TIME_Relative timeout, | ||
531 | GNUNET_CONNECTION_TransmitReadyNotify callback, | ||
532 | void *callback_cls); | ||
533 | |||
534 | |||
535 | /** | ||
536 | * Add a TCP socket-based connection to the set of handles managed by | ||
537 | * this server. Use this function for outgoing (P2P) connections that | ||
538 | * we initiated (and where this server should process incoming | ||
539 | * messages). | ||
540 | * | ||
541 | * @param server the server to use | ||
542 | * @param connection the connection to manage (client must | ||
543 | * stop using this connection from now on) | ||
544 | * @return the client handle | ||
545 | */ | ||
546 | struct GNUNET_SERVER_Client * | ||
547 | GNUNET_SERVER_connect_socket (struct GNUNET_SERVER_Handle *server, | ||
548 | struct GNUNET_CONNECTION_Handle *connection); | ||
549 | |||
550 | |||
551 | /** | ||
552 | * Resume accepting connections from the listen socket. | ||
553 | * | ||
554 | * @param server server to resume accepting connections. | ||
555 | */ | ||
556 | void | ||
557 | GNUNET_SERVER_resume (struct GNUNET_SERVER_Handle *server); | ||
558 | |||
559 | /** | ||
560 | * Free resources held by this server. | ||
561 | * | ||
562 | * @param server server to destroy | ||
563 | */ | ||
564 | void | ||
565 | GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *server); | ||
566 | |||
567 | |||
568 | |||
569 | |||
570 | #include "tcp_connection_legacy.c" | ||
571 | #include "tcp_server_mst_legacy.c" | ||
572 | #include "tcp_server_legacy.c" | ||
573 | #include "tcp_service_legacy.c" | ||
574 | |||
575 | GNUNET_NETWORK_STRUCT_BEGIN | ||
576 | |||
577 | /** | ||
578 | * Initial handshake message for a session. | ||
579 | */ | ||
580 | struct WelcomeMessage | ||
581 | { | ||
582 | /** | ||
583 | * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME. | ||
584 | */ | ||
585 | struct GNUNET_MessageHeader header; | ||
586 | |||
587 | /** | ||
588 | * Identity of the node connecting (TCP client) | ||
589 | */ | ||
590 | struct GNUNET_PeerIdentity clientIdentity; | ||
591 | |||
592 | }; | ||
593 | |||
594 | /** | ||
595 | * Basically a WELCOME message, but with the purpose | ||
596 | * of giving the waiting peer a client handle to use | ||
597 | */ | ||
598 | struct TCP_NAT_ProbeMessage | ||
599 | { | ||
600 | /** | ||
601 | * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE. | ||
602 | */ | ||
603 | struct GNUNET_MessageHeader header; | ||
604 | |||
605 | /** | ||
606 | * Identity of the sender of the message. | ||
607 | */ | ||
608 | struct GNUNET_PeerIdentity clientIdentity; | ||
609 | |||
610 | }; | ||
611 | GNUNET_NETWORK_STRUCT_END | ||
612 | |||
613 | /** | ||
614 | * Context for sending a NAT probe via TCP. | ||
615 | */ | ||
616 | struct TCPProbeContext | ||
617 | { | ||
618 | |||
619 | /** | ||
620 | * Active probes are kept in a DLL. | ||
621 | */ | ||
622 | struct TCPProbeContext *next; | ||
623 | |||
624 | /** | ||
625 | * Active probes are kept in a DLL. | ||
626 | */ | ||
627 | struct TCPProbeContext *prev; | ||
628 | |||
629 | /** | ||
630 | * Probe connection. | ||
631 | */ | ||
632 | struct GNUNET_CONNECTION_Handle *sock; | ||
633 | |||
634 | /** | ||
635 | * Message to be sent. | ||
636 | */ | ||
637 | struct TCP_NAT_ProbeMessage message; | ||
638 | |||
639 | /** | ||
640 | * Handle to the transmission. | ||
641 | */ | ||
642 | struct GNUNET_CONNECTION_TransmitHandle *transmit_handle; | ||
643 | |||
644 | /** | ||
645 | * Transport plugin handle. | ||
646 | */ | ||
647 | struct Plugin *plugin; | ||
648 | }; | ||
649 | |||
650 | /** | ||
651 | * Bits in the `options` field of TCP addresses. | ||
652 | */ | ||
653 | enum TcpAddressOptions | ||
654 | { | ||
655 | |||
656 | /** | ||
657 | * No bits set. | ||
658 | */ | ||
659 | TCP_OPTIONS_NONE = 0, | ||
660 | |||
661 | /** | ||
662 | * See #HTTP_OPTIONS_VERIFY_CERTIFICATE. | ||
663 | */ | ||
664 | TCP_OPTIONS_RESERVED = 1, | ||
665 | |||
666 | /** | ||
667 | * Enable TCP Stealth-style port knocking. | ||
668 | */ | ||
669 | TCP_OPTIONS_TCP_STEALTH = 2 | ||
670 | }; | ||
671 | |||
672 | GNUNET_NETWORK_STRUCT_BEGIN | ||
673 | |||
674 | /** | ||
675 | * Network format for IPv4 addresses. | ||
676 | */ | ||
677 | struct IPv4TcpAddress | ||
678 | { | ||
679 | /** | ||
680 | * Optional options and flags for this address, | ||
681 | * see `enum TcpAddressOptions` | ||
682 | */ | ||
683 | uint32_t options GNUNET_PACKED; | ||
684 | |||
685 | /** | ||
686 | * IPv4 address, in network byte order. | ||
687 | */ | ||
688 | uint32_t ipv4_addr GNUNET_PACKED; | ||
689 | |||
690 | /** | ||
691 | * Port number, in network byte order. | ||
692 | */ | ||
693 | uint16_t t4_port GNUNET_PACKED; | ||
694 | |||
695 | }; | ||
696 | |||
697 | /** | ||
698 | * Network format for IPv6 addresses. | ||
699 | */ | ||
700 | struct IPv6TcpAddress | ||
701 | { | ||
702 | /** | ||
703 | * Optional flags for this address | ||
704 | * see `enum TcpAddressOptions` | ||
705 | */ | ||
706 | uint32_t options GNUNET_PACKED; | ||
707 | |||
708 | /** | ||
709 | * IPv6 address. | ||
710 | */ | ||
711 | struct in6_addr ipv6_addr GNUNET_PACKED; | ||
712 | |||
713 | /** | ||
714 | * Port number, in network byte order. | ||
715 | */ | ||
716 | uint16_t t6_port GNUNET_PACKED; | ||
717 | |||
718 | }; | ||
719 | GNUNET_NETWORK_STRUCT_END | ||
720 | |||
721 | /** | ||
722 | * Encapsulation of all of the state of the plugin. | ||
723 | */ | ||
724 | struct Plugin; | ||
725 | |||
726 | /** | ||
727 | * Information kept for each message that is yet to | ||
728 | * be transmitted. | ||
729 | */ | ||
730 | struct PendingMessage | ||
731 | { | ||
732 | |||
733 | /** | ||
734 | * This is a doubly-linked list. | ||
735 | */ | ||
736 | struct PendingMessage *next; | ||
737 | |||
738 | /** | ||
739 | * This is a doubly-linked list. | ||
740 | */ | ||
741 | struct PendingMessage *prev; | ||
742 | |||
743 | /** | ||
744 | * The pending message | ||
745 | */ | ||
746 | const char *msg; | ||
747 | |||
748 | /** | ||
749 | * Continuation function to call once the message | ||
750 | * has been sent. Can be NULL if there is no | ||
751 | * continuation to call. | ||
752 | */ | ||
753 | GNUNET_TRANSPORT_TransmitContinuation transmit_cont; | ||
754 | |||
755 | /** | ||
756 | * Closure for @e transmit_cont. | ||
757 | */ | ||
758 | void *transmit_cont_cls; | ||
759 | |||
760 | /** | ||
761 | * Timeout value for the pending message. | ||
762 | */ | ||
763 | struct GNUNET_TIME_Absolute timeout; | ||
764 | |||
765 | /** | ||
766 | * So that the gnunet-service-transport can group messages together, | ||
767 | * these pending messages need to accept a message buffer and size | ||
768 | * instead of just a `struct GNUNET_MessageHeader`. | ||
769 | */ | ||
770 | size_t message_size; | ||
771 | |||
772 | }; | ||
773 | |||
774 | /** | ||
775 | * Session handle for TCP connections. | ||
776 | */ | ||
777 | struct GNUNET_ATS_Session | ||
778 | { | ||
779 | /** | ||
780 | * To whom are we talking to (set to our identity | ||
781 | * if we are still waiting for the welcome message) | ||
782 | */ | ||
783 | struct GNUNET_PeerIdentity target; | ||
784 | |||
785 | /** | ||
786 | * Pointer to the global plugin struct. | ||
787 | */ | ||
788 | struct Plugin *plugin; | ||
789 | |||
790 | /** | ||
791 | * The client (used to identify this connection) | ||
792 | */ | ||
793 | struct GNUNET_SERVER_Client *client; | ||
794 | |||
795 | /** | ||
796 | * Task cleaning up a NAT client connection establishment attempt; | ||
797 | */ | ||
798 | struct GNUNET_SCHEDULER_Task *nat_connection_timeout; | ||
799 | |||
800 | /** | ||
801 | * Messages currently pending for transmission | ||
802 | * to this peer, if any. | ||
803 | */ | ||
804 | struct PendingMessage *pending_messages_head; | ||
805 | |||
806 | /** | ||
807 | * Messages currently pending for transmission | ||
808 | * to this peer, if any. | ||
809 | */ | ||
810 | struct PendingMessage *pending_messages_tail; | ||
811 | |||
812 | /** | ||
813 | * Handle for pending transmission request. | ||
814 | */ | ||
815 | struct GNUNET_SERVER_TransmitHandle *transmit_handle; | ||
816 | |||
817 | /** | ||
818 | * Address of the other peer. | ||
819 | */ | ||
820 | struct GNUNET_HELLO_Address *address; | ||
821 | |||
822 | /** | ||
823 | * ID of task used to delay receiving more to throttle sender. | ||
824 | */ | ||
825 | struct GNUNET_SCHEDULER_Task *receive_delay_task; | ||
826 | |||
827 | /** | ||
828 | * Session timeout task | ||
829 | */ | ||
830 | struct GNUNET_SCHEDULER_Task *timeout_task; | ||
831 | |||
832 | /** | ||
833 | * When will this session time out? | ||
834 | */ | ||
835 | struct GNUNET_TIME_Absolute timeout; | ||
836 | |||
837 | /** | ||
838 | * When will we continue to read from the socket? | ||
839 | * (used to enforce inbound quota). | ||
840 | */ | ||
841 | struct GNUNET_TIME_Absolute receive_delay; | ||
842 | |||
843 | /** | ||
844 | * Last activity on this connection. Used to select preferred | ||
845 | * connection. | ||
846 | */ | ||
847 | struct GNUNET_TIME_Absolute last_activity; | ||
848 | |||
849 | /** | ||
850 | * Number of bytes waiting for transmission to this peer. | ||
851 | */ | ||
852 | unsigned long long bytes_in_queue; | ||
853 | |||
854 | /** | ||
855 | * Number of messages waiting for transmission to this peer. | ||
856 | */ | ||
857 | unsigned int msgs_in_queue; | ||
858 | |||
859 | /** | ||
860 | * Network type of the address. | ||
861 | */ | ||
862 | enum GNUNET_ATS_Network_Type scope; | ||
863 | |||
864 | /** | ||
865 | * Are we still expecting the welcome message? (#GNUNET_YES/#GNUNET_NO) | ||
866 | */ | ||
867 | int expecting_welcome; | ||
868 | |||
869 | /** | ||
870 | * Was this session created using NAT traversal? | ||
871 | */ | ||
872 | int is_nat; | ||
873 | |||
874 | }; | ||
875 | |||
876 | |||
877 | /** | ||
878 | * Context for address to string conversion, closure | ||
879 | * for #append_port(). | ||
880 | */ | ||
881 | struct PrettyPrinterContext | ||
882 | { | ||
883 | /** | ||
884 | * DLL | ||
885 | */ | ||
886 | struct PrettyPrinterContext *next; | ||
887 | |||
888 | /** | ||
889 | * DLL | ||
890 | */ | ||
891 | struct PrettyPrinterContext *prev; | ||
892 | |||
893 | /** | ||
894 | * Our plugin. | ||
895 | */ | ||
896 | struct Plugin *plugin; | ||
897 | |||
898 | /** | ||
899 | * Timeout task | ||
900 | */ | ||
901 | struct GNUNET_SCHEDULER_Task *timeout_task; | ||
902 | |||
903 | /** | ||
904 | * Resolver handle | ||
905 | */ | ||
906 | struct GNUNET_RESOLVER_RequestHandle *resolver_handle; | ||
907 | |||
908 | /** | ||
909 | * Function to call with the result. | ||
910 | */ | ||
911 | GNUNET_TRANSPORT_AddressStringCallback asc; | ||
912 | |||
913 | /** | ||
914 | * Clsoure for @e asc. | ||
915 | */ | ||
916 | void *asc_cls; | ||
917 | |||
918 | /** | ||
919 | * IPv6 address | ||
920 | */ | ||
921 | int ipv6; | ||
922 | |||
923 | /** | ||
924 | * Options | ||
925 | */ | ||
926 | uint32_t options; | ||
927 | |||
928 | /** | ||
929 | * Port to add after the IP address. | ||
930 | */ | ||
931 | uint16_t port; | ||
932 | }; | ||
933 | |||
934 | |||
935 | /** | ||
936 | * Encapsulation of all of the state of the plugin. | ||
937 | */ | ||
938 | struct Plugin | ||
939 | { | ||
940 | /** | ||
941 | * Our environment. | ||
942 | */ | ||
943 | struct GNUNET_TRANSPORT_PluginEnvironment *env; | ||
944 | |||
945 | /** | ||
946 | * The listen socket. | ||
947 | */ | ||
948 | struct GNUNET_CONNECTION_Handle *lsock; | ||
949 | |||
950 | /** | ||
951 | * Our handle to the NAT module. | ||
952 | */ | ||
953 | struct GNUNET_NAT_Handle *nat; | ||
954 | |||
955 | /** | ||
956 | * Map from peer identities to sessions for the given peer. | ||
957 | */ | ||
958 | struct GNUNET_CONTAINER_MultiPeerMap *sessionmap; | ||
959 | |||
960 | /** | ||
961 | * Handle to the network service. | ||
962 | */ | ||
963 | struct LEGACY_SERVICE_Context *service; | ||
964 | |||
965 | /** | ||
966 | * Handle to the server for this service. | ||
967 | */ | ||
968 | struct GNUNET_SERVER_Handle *server; | ||
969 | |||
970 | /** | ||
971 | * Copy of the handler array where the closures are | ||
972 | * set to this struct's instance. | ||
973 | */ | ||
974 | struct GNUNET_SERVER_MessageHandler *handlers; | ||
975 | |||
976 | /** | ||
977 | * Map of peers we have tried to contact behind a NAT | ||
978 | */ | ||
979 | struct GNUNET_CONTAINER_MultiPeerMap *nat_wait_conns; | ||
980 | |||
981 | /** | ||
982 | * List of active TCP probes. | ||
983 | */ | ||
984 | struct TCPProbeContext *probe_head; | ||
985 | |||
986 | /** | ||
987 | * List of active TCP probes. | ||
988 | */ | ||
989 | struct TCPProbeContext *probe_tail; | ||
990 | |||
991 | /** | ||
992 | * Function to call about session status changes. | ||
993 | */ | ||
994 | GNUNET_TRANSPORT_SessionInfoCallback sic; | ||
995 | |||
996 | /** | ||
997 | * Closure for @e sic. | ||
998 | */ | ||
999 | void *sic_cls; | ||
1000 | |||
1001 | /** | ||
1002 | * ID of task used to update our addresses when one expires. | ||
1003 | */ | ||
1004 | struct GNUNET_SCHEDULER_Task *address_update_task; | ||
1005 | |||
1006 | /** | ||
1007 | * Running pretty printers: head | ||
1008 | */ | ||
1009 | struct PrettyPrinterContext *ppc_dll_head; | ||
1010 | |||
1011 | /** | ||
1012 | * Running pretty printers: tail | ||
1013 | */ | ||
1014 | struct PrettyPrinterContext *ppc_dll_tail; | ||
1015 | |||
1016 | /** | ||
1017 | * Welcome message used by this peer. | ||
1018 | */ | ||
1019 | struct WelcomeMessage my_welcome; | ||
1020 | |||
1021 | /** | ||
1022 | * How many more TCP sessions are we allowed to open right now? | ||
1023 | */ | ||
1024 | unsigned long long max_connections; | ||
1025 | |||
1026 | /** | ||
1027 | * How many more TCP sessions do we have right now? | ||
1028 | */ | ||
1029 | unsigned long long cur_connections; | ||
1030 | |||
1031 | /** | ||
1032 | * Address options | ||
1033 | */ | ||
1034 | uint32_t myoptions; | ||
1035 | |||
1036 | /** | ||
1037 | * Port that we are actually listening on. | ||
1038 | */ | ||
1039 | uint16_t open_port; | ||
1040 | |||
1041 | /** | ||
1042 | * Port that the user said we would have visible to the | ||
1043 | * rest of the world. | ||
1044 | */ | ||
1045 | uint16_t adv_port; | ||
1046 | |||
1047 | }; | ||
1048 | |||
1049 | |||
1050 | /** | ||
1051 | * Get the list of addresses that a server for the given service | ||
1052 | * should bind to. | ||
1053 | * | ||
1054 | * @param service_name name of the service | ||
1055 | * @param cfg configuration (which specifies the addresses) | ||
1056 | * @param addrs set (call by reference) to an array of pointers to the | ||
1057 | * addresses the server should bind to and listen on; the | ||
1058 | * array will be NULL-terminated (on success) | ||
1059 | * @param addr_lens set (call by reference) to an array of the lengths | ||
1060 | * of the respective `struct sockaddr` struct in the @a addrs | ||
1061 | * array (on success) | ||
1062 | * @return number of addresses found on success, | ||
1063 | * #GNUNET_SYSERR if the configuration | ||
1064 | * did not specify reasonable finding information or | ||
1065 | * if it specified a hostname that could not be resolved; | ||
1066 | * #GNUNET_NO if the number of addresses configured is | ||
1067 | * zero (in this case, `*addrs` and `*addr_lens` will be | ||
1068 | * set to NULL). | ||
1069 | */ | ||
1070 | static int | ||
1071 | get_server_addresses (const char *service_name, | ||
1072 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
1073 | struct sockaddr ***addrs, | ||
1074 | socklen_t ** addr_lens) | ||
1075 | { | ||
1076 | int disablev6; | ||
1077 | struct GNUNET_NETWORK_Handle *desc; | ||
1078 | unsigned long long port; | ||
1079 | char *unixpath; | ||
1080 | struct addrinfo hints; | ||
1081 | struct addrinfo *res; | ||
1082 | struct addrinfo *pos; | ||
1083 | struct addrinfo *next; | ||
1084 | unsigned int i; | ||
1085 | int resi; | ||
1086 | int ret; | ||
1087 | int abstract; | ||
1088 | struct sockaddr **saddrs; | ||
1089 | socklen_t *saddrlens; | ||
1090 | char *hostname; | ||
1091 | |||
1092 | *addrs = NULL; | ||
1093 | *addr_lens = NULL; | ||
1094 | desc = NULL; | ||
1095 | if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "DISABLEV6")) | ||
1096 | { | ||
1097 | if (GNUNET_SYSERR == | ||
1098 | (disablev6 = | ||
1099 | GNUNET_CONFIGURATION_get_value_yesno (cfg, service_name, "DISABLEV6"))) | ||
1100 | return GNUNET_SYSERR; | ||
1101 | } | ||
1102 | else | ||
1103 | disablev6 = GNUNET_NO; | ||
1104 | |||
1105 | if (! disablev6) | ||
1106 | { | ||
1107 | /* probe IPv6 support */ | ||
1108 | desc = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0); | ||
1109 | if (NULL == desc) | ||
1110 | { | ||
1111 | if ((ENOBUFS == errno) || (ENOMEM == errno) || (ENFILE == errno) || | ||
1112 | (EACCES == errno)) | ||
1113 | { | ||
1114 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); | ||
1115 | return GNUNET_SYSERR; | ||
1116 | } | ||
1117 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1118 | _("Disabling IPv6 support for service `%s', failed to create IPv6 socket: %s\n"), | ||
1119 | service_name, STRERROR (errno)); | ||
1120 | disablev6 = GNUNET_YES; | ||
1121 | } | ||
1122 | else | ||
1123 | { | ||
1124 | GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (desc)); | ||
1125 | desc = NULL; | ||
1126 | } | ||
1127 | } | ||
1128 | |||
1129 | port = 0; | ||
1130 | if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT")) | ||
1131 | { | ||
1132 | if (GNUNET_OK != | ||
1133 | GNUNET_CONFIGURATION_get_value_number (cfg, service_name, | ||
1134 | "PORT", &port)) | ||
1135 | { | ||
1136 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1137 | _("Require valid port number for service `%s' in configuration!\n"), | ||
1138 | service_name); | ||
1139 | } | ||
1140 | if (port > 65535) | ||
1141 | { | ||
1142 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1143 | _("Require valid port number for service `%s' in configuration!\n"), | ||
1144 | service_name); | ||
1145 | return GNUNET_SYSERR; | ||
1146 | } | ||
1147 | } | ||
1148 | |||
1149 | if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "BINDTO")) | ||
1150 | { | ||
1151 | GNUNET_break (GNUNET_OK == | ||
1152 | GNUNET_CONFIGURATION_get_value_string (cfg, service_name, | ||
1153 | "BINDTO", &hostname)); | ||
1154 | } | ||
1155 | else | ||
1156 | hostname = NULL; | ||
1157 | |||
1158 | unixpath = NULL; | ||
1159 | abstract = GNUNET_NO; | ||
1160 | #ifdef AF_UNIX | ||
1161 | if ((GNUNET_YES == | ||
1162 | GNUNET_CONFIGURATION_have_value (cfg, service_name, "UNIXPATH")) && | ||
1163 | (GNUNET_OK == | ||
1164 | GNUNET_CONFIGURATION_get_value_filename (cfg, service_name, "UNIXPATH", | ||
1165 | &unixpath)) && | ||
1166 | (0 < strlen (unixpath))) | ||
1167 | { | ||
1168 | /* probe UNIX support */ | ||
1169 | struct sockaddr_un s_un; | ||
1170 | |||
1171 | if (strlen (unixpath) >= sizeof (s_un.sun_path)) | ||
1172 | { | ||
1173 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1174 | _("UNIXPATH `%s' too long, maximum length is %llu\n"), unixpath, | ||
1175 | (unsigned long long) sizeof (s_un.sun_path)); | ||
1176 | unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath); | ||
1177 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1178 | _("Using `%s' instead\n"), | ||
1179 | unixpath); | ||
1180 | } | ||
1181 | #ifdef LINUX | ||
1182 | abstract = GNUNET_CONFIGURATION_get_value_yesno (cfg, | ||
1183 | "TESTING", | ||
1184 | "USE_ABSTRACT_SOCKETS"); | ||
1185 | if (GNUNET_SYSERR == abstract) | ||
1186 | abstract = GNUNET_NO; | ||
1187 | #endif | ||
1188 | if ((GNUNET_YES != abstract) | ||
1189 | && (GNUNET_OK != | ||
1190 | GNUNET_DISK_directory_create_for_file (unixpath))) | ||
1191 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, | ||
1192 | "mkdir", | ||
1193 | unixpath); | ||
1194 | } | ||
1195 | if (NULL != unixpath) | ||
1196 | { | ||
1197 | desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0); | ||
1198 | if (NULL == desc) | ||
1199 | { | ||
1200 | if ((ENOBUFS == errno) || (ENOMEM == errno) || (ENFILE == errno) || | ||
1201 | (EACCES == errno)) | ||
1202 | { | ||
1203 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); | ||
1204 | GNUNET_free_non_null (hostname); | ||
1205 | GNUNET_free (unixpath); | ||
1206 | return GNUNET_SYSERR; | ||
1207 | } | ||
1208 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1209 | _("Disabling UNIX domain socket support for service `%s', failed to create UNIX domain socket: %s\n"), | ||
1210 | service_name, | ||
1211 | STRERROR (errno)); | ||
1212 | GNUNET_free (unixpath); | ||
1213 | unixpath = NULL; | ||
1214 | } | ||
1215 | else | ||
1216 | { | ||
1217 | GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (desc)); | ||
1218 | desc = NULL; | ||
1219 | } | ||
1220 | } | ||
1221 | #endif | ||
1222 | |||
1223 | if ((0 == port) && (NULL == unixpath)) | ||
1224 | { | ||
1225 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1226 | _("Have neither PORT nor UNIXPATH for service `%s', but one is required\n"), | ||
1227 | service_name); | ||
1228 | GNUNET_free_non_null (hostname); | ||
1229 | return GNUNET_SYSERR; | ||
1230 | } | ||
1231 | if (0 == port) | ||
1232 | { | ||
1233 | saddrs = GNUNET_malloc (2 * sizeof (struct sockaddr *)); | ||
1234 | saddrlens = GNUNET_malloc (2 * sizeof (socklen_t)); | ||
1235 | add_unixpath (saddrs, saddrlens, unixpath, abstract); | ||
1236 | GNUNET_free_non_null (unixpath); | ||
1237 | GNUNET_free_non_null (hostname); | ||
1238 | *addrs = saddrs; | ||
1239 | *addr_lens = saddrlens; | ||
1240 | return 1; | ||
1241 | } | ||
1242 | |||
1243 | if (NULL != hostname) | ||
1244 | { | ||
1245 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1246 | "Resolving `%s' since that is where `%s' will bind to.\n", | ||
1247 | hostname, | ||
1248 | service_name); | ||
1249 | memset (&hints, 0, sizeof (struct addrinfo)); | ||
1250 | if (disablev6) | ||
1251 | hints.ai_family = AF_INET; | ||
1252 | hints.ai_protocol = IPPROTO_TCP; | ||
1253 | if ((0 != (ret = getaddrinfo (hostname, NULL, &hints, &res))) || | ||
1254 | (NULL == res)) | ||
1255 | { | ||
1256 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1257 | _("Failed to resolve `%s': %s\n"), | ||
1258 | hostname, | ||
1259 | gai_strerror (ret)); | ||
1260 | GNUNET_free (hostname); | ||
1261 | GNUNET_free_non_null (unixpath); | ||
1262 | return GNUNET_SYSERR; | ||
1263 | } | ||
1264 | next = res; | ||
1265 | i = 0; | ||
1266 | while (NULL != (pos = next)) | ||
1267 | { | ||
1268 | next = pos->ai_next; | ||
1269 | if ((disablev6) && (pos->ai_family == AF_INET6)) | ||
1270 | continue; | ||
1271 | i++; | ||
1272 | } | ||
1273 | if (0 == i) | ||
1274 | { | ||
1275 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1276 | _("Failed to find %saddress for `%s'.\n"), | ||
1277 | disablev6 ? "IPv4 " : "", | ||
1278 | hostname); | ||
1279 | freeaddrinfo (res); | ||
1280 | GNUNET_free (hostname); | ||
1281 | GNUNET_free_non_null (unixpath); | ||
1282 | return GNUNET_SYSERR; | ||
1283 | } | ||
1284 | resi = i; | ||
1285 | if (NULL != unixpath) | ||
1286 | resi++; | ||
1287 | saddrs = GNUNET_malloc ((resi + 1) * sizeof (struct sockaddr *)); | ||
1288 | saddrlens = GNUNET_malloc ((resi + 1) * sizeof (socklen_t)); | ||
1289 | i = 0; | ||
1290 | if (NULL != unixpath) | ||
1291 | { | ||
1292 | add_unixpath (saddrs, saddrlens, unixpath, abstract); | ||
1293 | i++; | ||
1294 | } | ||
1295 | next = res; | ||
1296 | while (NULL != (pos = next)) | ||
1297 | { | ||
1298 | next = pos->ai_next; | ||
1299 | if ((disablev6) && (AF_INET6 == pos->ai_family)) | ||
1300 | continue; | ||
1301 | if ((IPPROTO_TCP != pos->ai_protocol) && (0 != pos->ai_protocol)) | ||
1302 | continue; /* not TCP */ | ||
1303 | if ((SOCK_STREAM != pos->ai_socktype) && (0 != pos->ai_socktype)) | ||
1304 | continue; /* huh? */ | ||
1305 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Service `%s' will bind to `%s'\n", | ||
1306 | service_name, GNUNET_a2s (pos->ai_addr, pos->ai_addrlen)); | ||
1307 | if (AF_INET == pos->ai_family) | ||
1308 | { | ||
1309 | GNUNET_assert (sizeof (struct sockaddr_in) == pos->ai_addrlen); | ||
1310 | saddrlens[i] = pos->ai_addrlen; | ||
1311 | saddrs[i] = GNUNET_malloc (saddrlens[i]); | ||
1312 | GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); | ||
1313 | ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port); | ||
1314 | } | ||
1315 | else | ||
1316 | { | ||
1317 | GNUNET_assert (AF_INET6 == pos->ai_family); | ||
1318 | GNUNET_assert (sizeof (struct sockaddr_in6) == pos->ai_addrlen); | ||
1319 | saddrlens[i] = pos->ai_addrlen; | ||
1320 | saddrs[i] = GNUNET_malloc (saddrlens[i]); | ||
1321 | GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]); | ||
1322 | ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port); | ||
1323 | } | ||
1324 | i++; | ||
1325 | } | ||
1326 | GNUNET_free (hostname); | ||
1327 | freeaddrinfo (res); | ||
1328 | resi = i; | ||
1329 | } | ||
1330 | else | ||
1331 | { | ||
1332 | /* will bind against everything, just set port */ | ||
1333 | if (disablev6) | ||
1334 | { | ||
1335 | /* V4-only */ | ||
1336 | resi = 1; | ||
1337 | if (NULL != unixpath) | ||
1338 | resi++; | ||
1339 | i = 0; | ||
1340 | saddrs = GNUNET_malloc ((resi + 1) * sizeof (struct sockaddr *)); | ||
1341 | saddrlens = GNUNET_malloc ((resi + 1) * sizeof (socklen_t)); | ||
1342 | if (NULL != unixpath) | ||
1343 | { | ||
1344 | add_unixpath (saddrs, saddrlens, unixpath, abstract); | ||
1345 | i++; | ||
1346 | } | ||
1347 | saddrlens[i] = sizeof (struct sockaddr_in); | ||
1348 | saddrs[i] = GNUNET_malloc (saddrlens[i]); | ||
1349 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
1350 | ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[i]; | ||
1351 | #endif | ||
1352 | ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET; | ||
1353 | ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port); | ||
1354 | } | ||
1355 | else | ||
1356 | { | ||
1357 | /* dual stack */ | ||
1358 | resi = 2; | ||
1359 | if (NULL != unixpath) | ||
1360 | resi++; | ||
1361 | saddrs = GNUNET_malloc ((resi + 1) * sizeof (struct sockaddr *)); | ||
1362 | saddrlens = GNUNET_malloc ((resi + 1) * sizeof (socklen_t)); | ||
1363 | i = 0; | ||
1364 | if (NULL != unixpath) | ||
1365 | { | ||
1366 | add_unixpath (saddrs, saddrlens, unixpath, abstract); | ||
1367 | i++; | ||
1368 | } | ||
1369 | saddrlens[i] = sizeof (struct sockaddr_in6); | ||
1370 | saddrs[i] = GNUNET_malloc (saddrlens[i]); | ||
1371 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
1372 | ((struct sockaddr_in6 *) saddrs[i])->sin6_len = saddrlens[0]; | ||
1373 | #endif | ||
1374 | ((struct sockaddr_in6 *) saddrs[i])->sin6_family = AF_INET6; | ||
1375 | ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port); | ||
1376 | i++; | ||
1377 | saddrlens[i] = sizeof (struct sockaddr_in); | ||
1378 | saddrs[i] = GNUNET_malloc (saddrlens[i]); | ||
1379 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
1380 | ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[1]; | ||
1381 | #endif | ||
1382 | ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET; | ||
1383 | ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port); | ||
1384 | } | ||
1385 | } | ||
1386 | GNUNET_free_non_null (unixpath); | ||
1387 | *addrs = saddrs; | ||
1388 | *addr_lens = saddrlens; | ||
1389 | return resi; | ||
1390 | } | ||
1391 | /* end ancient copy-and-paste */ | ||
1392 | |||
1393 | |||
1394 | /** | ||
1395 | * If a session monitor is attached, notify it about the new | ||
1396 | * session state. | ||
1397 | * | ||
1398 | * @param plugin our plugin | ||
1399 | * @param session session that changed state | ||
1400 | * @param state new state of the session | ||
1401 | */ | ||
1402 | static void | ||
1403 | notify_session_monitor (struct Plugin *plugin, | ||
1404 | struct GNUNET_ATS_Session *session, | ||
1405 | enum GNUNET_TRANSPORT_SessionState state) | ||
1406 | { | ||
1407 | struct GNUNET_TRANSPORT_SessionInfo info; | ||
1408 | |||
1409 | if (NULL == plugin->sic) | ||
1410 | return; | ||
1411 | memset (&info, 0, sizeof (info)); | ||
1412 | info.state = state; | ||
1413 | info.is_inbound = GNUNET_HELLO_address_check_option (session->address, | ||
1414 | GNUNET_HELLO_ADDRESS_INFO_INBOUND); | ||
1415 | info.num_msg_pending = session->msgs_in_queue; | ||
1416 | info.num_bytes_pending = session->bytes_in_queue; | ||
1417 | if (NULL != session->receive_delay_task) | ||
1418 | info.receive_delay = session->receive_delay; | ||
1419 | info.session_timeout = session->timeout; | ||
1420 | info.address = session->address; | ||
1421 | plugin->sic (plugin->sic_cls, | ||
1422 | session, | ||
1423 | &info); | ||
1424 | } | ||
1425 | |||
1426 | |||
1427 | /** | ||
1428 | * Our external IP address/port mapping has changed. | ||
1429 | * | ||
1430 | * @param cls closure, the `struct Plugin` | ||
1431 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean | ||
1432 | * the previous (now invalid) one | ||
1433 | * @param ac address class the address belongs to | ||
1434 | * @param addr either the previous or the new public IP address | ||
1435 | * @param addrlen actual length of @a addr | ||
1436 | */ | ||
1437 | static void | ||
1438 | tcp_nat_port_map_callback (void *cls, | ||
1439 | int add_remove, | ||
1440 | enum GNUNET_NAT_AddressClass ac, | ||
1441 | const struct sockaddr *addr, | ||
1442 | socklen_t addrlen) | ||
1443 | { | ||
1444 | struct Plugin *plugin = cls; | ||
1445 | struct GNUNET_HELLO_Address *address; | ||
1446 | struct IPv4TcpAddress t4; | ||
1447 | struct IPv6TcpAddress t6; | ||
1448 | void *arg; | ||
1449 | size_t args; | ||
1450 | |||
1451 | if (GNUNET_NAT_AC_LOOPBACK == ac) | ||
1452 | return; | ||
1453 | if (GNUNET_NAT_AC_LAN == ac) | ||
1454 | return; | ||
1455 | if (GNUNET_NAT_AC_LAN_PRIVATE == ac) | ||
1456 | return; | ||
1457 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1458 | "NAT notification to %s address `%s'\n", | ||
1459 | (GNUNET_YES == add_remove) ? "add" : "remove", | ||
1460 | GNUNET_a2s (addr, addrlen)); | ||
1461 | /* convert 'addr' to our internal format */ | ||
1462 | switch (addr->sa_family) | ||
1463 | { | ||
1464 | case AF_INET: | ||
1465 | GNUNET_assert(addrlen == sizeof(struct sockaddr_in)); | ||
1466 | memset (&t4, 0, sizeof(t4)); | ||
1467 | t4.options = htonl (plugin->myoptions); | ||
1468 | t4.ipv4_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr; | ||
1469 | t4.t4_port = ((struct sockaddr_in *) addr)->sin_port; | ||
1470 | arg = &t4; | ||
1471 | args = sizeof (t4); | ||
1472 | break; | ||
1473 | case AF_INET6: | ||
1474 | GNUNET_assert(addrlen == sizeof(struct sockaddr_in6)); | ||
1475 | memset (&t6, 0, sizeof(t6)); | ||
1476 | GNUNET_memcpy (&t6.ipv6_addr, | ||
1477 | &((struct sockaddr_in6 *) addr)->sin6_addr, | ||
1478 | sizeof(struct in6_addr)); | ||
1479 | t6.options = htonl (plugin->myoptions); | ||
1480 | t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port; | ||
1481 | arg = &t6; | ||
1482 | args = sizeof (t6); | ||
1483 | break; | ||
1484 | default: | ||
1485 | GNUNET_break(0); | ||
1486 | return; | ||
1487 | } | ||
1488 | /* modify our published address list */ | ||
1489 | GNUNET_assert ((args == sizeof (struct IPv4TcpAddress)) || | ||
1490 | (args == sizeof (struct IPv6TcpAddress))); | ||
1491 | /* TODO: use 'ac' here in the future... */ | ||
1492 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, | ||
1493 | PLUGIN_NAME, | ||
1494 | arg, | ||
1495 | args, | ||
1496 | GNUNET_HELLO_ADDRESS_INFO_NONE); | ||
1497 | plugin->env->notify_address (plugin->env->cls, | ||
1498 | add_remove, | ||
1499 | address); | ||
1500 | GNUNET_HELLO_address_free (address); | ||
1501 | } | ||
1502 | |||
1503 | |||
1504 | /** | ||
1505 | * Function called for a quick conversion of the binary address to | ||
1506 | * a numeric address. Note that the caller must not free the | ||
1507 | * address and that the next call to this function is allowed | ||
1508 | * to override the address again. | ||
1509 | * | ||
1510 | * @param cls closure (`struct Plugin*`) | ||
1511 | * @param addr binary address | ||
1512 | * @param addrlen length of @a addr | ||
1513 | * @return string representing the same address | ||
1514 | */ | ||
1515 | static const char * | ||
1516 | tcp_plugin_address_to_string (void *cls, | ||
1517 | const void *addr, | ||
1518 | size_t addrlen) | ||
1519 | { | ||
1520 | static char rbuf[INET6_ADDRSTRLEN + 12]; | ||
1521 | char buf[INET6_ADDRSTRLEN]; | ||
1522 | const void *sb; | ||
1523 | struct in_addr a4; | ||
1524 | struct in6_addr a6; | ||
1525 | const struct IPv4TcpAddress *t4; | ||
1526 | const struct IPv6TcpAddress *t6; | ||
1527 | int af; | ||
1528 | uint16_t port; | ||
1529 | uint32_t options; | ||
1530 | |||
1531 | switch (addrlen) | ||
1532 | { | ||
1533 | case sizeof(struct IPv6TcpAddress): | ||
1534 | t6 = addr; | ||
1535 | af = AF_INET6; | ||
1536 | port = ntohs (t6->t6_port); | ||
1537 | options = ntohl (t6->options); | ||
1538 | GNUNET_memcpy (&a6, &t6->ipv6_addr, sizeof(a6)); | ||
1539 | sb = &a6; | ||
1540 | break; | ||
1541 | case sizeof(struct IPv4TcpAddress): | ||
1542 | t4 = addr; | ||
1543 | af = AF_INET; | ||
1544 | port = ntohs (t4->t4_port); | ||
1545 | options = ntohl (t4->options); | ||
1546 | GNUNET_memcpy (&a4, &t4->ipv4_addr, sizeof(a4)); | ||
1547 | sb = &a4; | ||
1548 | break; | ||
1549 | default: | ||
1550 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1551 | _("Unexpected address length: %u bytes\n"), | ||
1552 | (unsigned int) addrlen); | ||
1553 | return NULL ; | ||
1554 | } | ||
1555 | if (NULL == inet_ntop (af, sb, buf, INET6_ADDRSTRLEN)) | ||
1556 | { | ||
1557 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, | ||
1558 | "inet_ntop"); | ||
1559 | return NULL ; | ||
1560 | } | ||
1561 | GNUNET_snprintf (rbuf, sizeof(rbuf), | ||
1562 | (af == AF_INET6) ? "%s.%u.[%s]:%u" : "%s.%u.%s:%u", | ||
1563 | PLUGIN_NAME, | ||
1564 | options, | ||
1565 | buf, | ||
1566 | port); | ||
1567 | return rbuf; | ||
1568 | } | ||
1569 | |||
1570 | |||
1571 | /** | ||
1572 | * Function called to convert a string address to | ||
1573 | * a binary address. | ||
1574 | * | ||
1575 | * @param cls closure (`struct Plugin*`) | ||
1576 | * @param addr string address | ||
1577 | * @param addrlen length of the address | ||
1578 | * @param buf location to store the buffer | ||
1579 | * @param added location to store the number of bytes in the buffer. | ||
1580 | * If the function returns #GNUNET_SYSERR, its contents are undefined. | ||
1581 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
1582 | */ | ||
1583 | static int | ||
1584 | tcp_plugin_string_to_address (void *cls, | ||
1585 | const char *addr, | ||
1586 | uint16_t addrlen, | ||
1587 | void **buf, | ||
1588 | size_t *added) | ||
1589 | { | ||
1590 | struct sockaddr_storage socket_address; | ||
1591 | char *address; | ||
1592 | char *plugin; | ||
1593 | char *optionstr; | ||
1594 | uint32_t options; | ||
1595 | |||
1596 | /* Format tcp.options.address:port */ | ||
1597 | address = NULL; | ||
1598 | plugin = NULL; | ||
1599 | optionstr = NULL; | ||
1600 | if ((NULL == addr) || (0 == addrlen)) | ||
1601 | { | ||
1602 | GNUNET_break(0); | ||
1603 | return GNUNET_SYSERR; | ||
1604 | } | ||
1605 | if ('\0' != addr[addrlen - 1]) | ||
1606 | { | ||
1607 | GNUNET_break(0); | ||
1608 | return GNUNET_SYSERR; | ||
1609 | } | ||
1610 | if (strlen (addr) != addrlen - 1) | ||
1611 | { | ||
1612 | GNUNET_break(0); | ||
1613 | return GNUNET_SYSERR; | ||
1614 | } | ||
1615 | plugin = GNUNET_strdup (addr); | ||
1616 | optionstr = strchr (plugin, '.'); | ||
1617 | if (NULL == optionstr) | ||
1618 | { | ||
1619 | GNUNET_break(0); | ||
1620 | GNUNET_free(plugin); | ||
1621 | return GNUNET_SYSERR; | ||
1622 | } | ||
1623 | optionstr[0] = '\0'; | ||
1624 | optionstr++; | ||
1625 | options = atol (optionstr); | ||
1626 | address = strchr (optionstr, '.'); | ||
1627 | if (NULL == address) | ||
1628 | { | ||
1629 | GNUNET_break(0); | ||
1630 | GNUNET_free(plugin); | ||
1631 | return GNUNET_SYSERR; | ||
1632 | } | ||
1633 | address[0] = '\0'; | ||
1634 | address++; | ||
1635 | |||
1636 | if (GNUNET_OK != | ||
1637 | GNUNET_STRINGS_to_address_ip (address, | ||
1638 | strlen (address), | ||
1639 | &socket_address)) | ||
1640 | { | ||
1641 | GNUNET_break(0); | ||
1642 | GNUNET_free(plugin); | ||
1643 | return GNUNET_SYSERR; | ||
1644 | } | ||
1645 | |||
1646 | GNUNET_free(plugin); | ||
1647 | switch (socket_address.ss_family) | ||
1648 | { | ||
1649 | case AF_INET: | ||
1650 | { | ||
1651 | struct IPv4TcpAddress *t4; | ||
1652 | struct sockaddr_in *in4 = (struct sockaddr_in *) &socket_address; | ||
1653 | t4 = GNUNET_new (struct IPv4TcpAddress); | ||
1654 | t4->options = htonl (options); | ||
1655 | t4->ipv4_addr = in4->sin_addr.s_addr; | ||
1656 | t4->t4_port = in4->sin_port; | ||
1657 | *buf = t4; | ||
1658 | *added = sizeof(struct IPv4TcpAddress); | ||
1659 | return GNUNET_OK; | ||
1660 | } | ||
1661 | case AF_INET6: | ||
1662 | { | ||
1663 | struct IPv6TcpAddress *t6; | ||
1664 | struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) &socket_address; | ||
1665 | t6 = GNUNET_new (struct IPv6TcpAddress); | ||
1666 | t6->options = htonl (options); | ||
1667 | t6->ipv6_addr = in6->sin6_addr; | ||
1668 | t6->t6_port = in6->sin6_port; | ||
1669 | *buf = t6; | ||
1670 | *added = sizeof(struct IPv6TcpAddress); | ||
1671 | return GNUNET_OK; | ||
1672 | } | ||
1673 | default: | ||
1674 | return GNUNET_SYSERR; | ||
1675 | } | ||
1676 | } | ||
1677 | |||
1678 | |||
1679 | /** | ||
1680 | * Find the session handle for the given client. | ||
1681 | * Currently uses both the hashmap and the client | ||
1682 | * context, as the client context is new and the | ||
1683 | * logic still needs to be tested. | ||
1684 | * | ||
1685 | * @param plugin the plugin | ||
1686 | * @param client which client to find the session handle for | ||
1687 | * @return NULL if no matching session exists | ||
1688 | */ | ||
1689 | static struct GNUNET_ATS_Session * | ||
1690 | lookup_session_by_client (struct Plugin *plugin, | ||
1691 | struct GNUNET_SERVER_Client *client) | ||
1692 | { | ||
1693 | return GNUNET_SERVER_client_get_user_context (client, | ||
1694 | struct GNUNET_ATS_Session); | ||
1695 | } | ||
1696 | |||
1697 | |||
1698 | /** | ||
1699 | * Functions with this signature are called whenever we need | ||
1700 | * to close a session due to a disconnect or failure to | ||
1701 | * establish a connection. | ||
1702 | * | ||
1703 | * @param cls the `struct Plugin` | ||
1704 | * @param session session to close down | ||
1705 | * @return #GNUNET_OK on success | ||
1706 | */ | ||
1707 | static int | ||
1708 | tcp_plugin_disconnect_session (void *cls, | ||
1709 | struct GNUNET_ATS_Session *session) | ||
1710 | { | ||
1711 | struct Plugin *plugin = cls; | ||
1712 | struct PendingMessage *pm; | ||
1713 | |||
1714 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1715 | "Disconnecting session of peer `%s' address `%s'\n", | ||
1716 | GNUNET_i2s (&session->target), | ||
1717 | tcp_plugin_address_to_string (session->plugin, | ||
1718 | session->address->address, | ||
1719 | session->address->address_length)); | ||
1720 | |||
1721 | if (NULL != session->timeout_task) | ||
1722 | { | ||
1723 | GNUNET_SCHEDULER_cancel (session->timeout_task); | ||
1724 | session->timeout_task = NULL; | ||
1725 | session->timeout = GNUNET_TIME_UNIT_ZERO_ABS; | ||
1726 | } | ||
1727 | |||
1728 | if (GNUNET_YES == | ||
1729 | GNUNET_CONTAINER_multipeermap_remove (plugin->sessionmap, | ||
1730 | &session->target, | ||
1731 | session)) | ||
1732 | { | ||
1733 | GNUNET_STATISTICS_update (session->plugin->env->stats, | ||
1734 | gettext_noop ("# TCP sessions active"), | ||
1735 | -1, | ||
1736 | GNUNET_NO); | ||
1737 | } | ||
1738 | else | ||
1739 | { | ||
1740 | GNUNET_assert (GNUNET_YES == | ||
1741 | GNUNET_CONTAINER_multipeermap_remove (plugin->nat_wait_conns, | ||
1742 | &session->target, | ||
1743 | session)); | ||
1744 | } | ||
1745 | if (NULL != session->client) | ||
1746 | GNUNET_SERVER_client_set_user_context (session->client, | ||
1747 | NULL); | ||
1748 | |||
1749 | /* clean up state */ | ||
1750 | if (NULL != session->transmit_handle) | ||
1751 | { | ||
1752 | GNUNET_SERVER_notify_transmit_ready_cancel (session->transmit_handle); | ||
1753 | session->transmit_handle = NULL; | ||
1754 | } | ||
1755 | session->plugin->env->session_end (session->plugin->env->cls, | ||
1756 | session->address, | ||
1757 | session); | ||
1758 | |||
1759 | if (NULL != session->nat_connection_timeout) | ||
1760 | { | ||
1761 | GNUNET_SCHEDULER_cancel (session->nat_connection_timeout); | ||
1762 | session->nat_connection_timeout = NULL; | ||
1763 | } | ||
1764 | |||
1765 | while (NULL != (pm = session->pending_messages_head)) | ||
1766 | { | ||
1767 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1768 | (NULL != pm->transmit_cont) | ||
1769 | ? "Could not deliver message to `%s' at %s.\n" | ||
1770 | : "Could not deliver message to `%s' at %s, notifying.\n", | ||
1771 | GNUNET_i2s (&session->target), | ||
1772 | tcp_plugin_address_to_string (session->plugin, | ||
1773 | session->address->address, | ||
1774 | session->address->address_length)); | ||
1775 | GNUNET_STATISTICS_update (session->plugin->env->stats, | ||
1776 | gettext_noop ("# bytes currently in TCP buffers"), | ||
1777 | -(int64_t) pm->message_size, GNUNET_NO); | ||
1778 | GNUNET_STATISTICS_update (session->plugin->env->stats, | ||
1779 | gettext_noop ("# bytes discarded by TCP (disconnect)"), | ||
1780 | pm->message_size, | ||
1781 | GNUNET_NO); | ||
1782 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, | ||
1783 | session->pending_messages_tail, | ||
1784 | pm); | ||
1785 | GNUNET_assert (0 < session->msgs_in_queue); | ||
1786 | session->msgs_in_queue--; | ||
1787 | GNUNET_assert (pm->message_size <= session->bytes_in_queue); | ||
1788 | session->bytes_in_queue -= pm->message_size; | ||
1789 | if (NULL != pm->transmit_cont) | ||
1790 | pm->transmit_cont (pm->transmit_cont_cls, | ||
1791 | &session->target, | ||
1792 | GNUNET_SYSERR, | ||
1793 | pm->message_size, | ||
1794 | 0); | ||
1795 | GNUNET_free (pm); | ||
1796 | } | ||
1797 | GNUNET_assert (0 == session->msgs_in_queue); | ||
1798 | GNUNET_assert (0 == session->bytes_in_queue); | ||
1799 | notify_session_monitor (session->plugin, | ||
1800 | session, | ||
1801 | GNUNET_TRANSPORT_SS_DONE); | ||
1802 | |||
1803 | if (NULL != session->receive_delay_task) | ||
1804 | { | ||
1805 | GNUNET_SCHEDULER_cancel (session->receive_delay_task); | ||
1806 | session->receive_delay_task = NULL; | ||
1807 | } | ||
1808 | if (NULL != session->client) | ||
1809 | { | ||
1810 | GNUNET_SERVER_client_disconnect (session->client); | ||
1811 | session->client = NULL; | ||
1812 | } | ||
1813 | GNUNET_HELLO_address_free (session->address); | ||
1814 | GNUNET_assert (NULL == session->transmit_handle); | ||
1815 | GNUNET_free (session); | ||
1816 | return GNUNET_OK; | ||
1817 | } | ||
1818 | |||
1819 | |||
1820 | /** | ||
1821 | * Function that is called to get the keepalive factor. | ||
1822 | * #GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to | ||
1823 | * calculate the interval between keepalive packets. | ||
1824 | * | ||
1825 | * @param cls closure with the `struct Plugin` | ||
1826 | * @return keepalive factor | ||
1827 | */ | ||
1828 | static unsigned int | ||
1829 | tcp_plugin_query_keepalive_factor (void *cls) | ||
1830 | { | ||
1831 | return 3; | ||
1832 | } | ||
1833 | |||
1834 | |||
1835 | /** | ||
1836 | * Session was idle for too long, so disconnect it | ||
1837 | * | ||
1838 | * @param cls the `struct GNUNET_ATS_Session` of the idle session | ||
1839 | */ | ||
1840 | static void | ||
1841 | session_timeout (void *cls) | ||
1842 | { | ||
1843 | struct GNUNET_ATS_Session *s = cls; | ||
1844 | struct GNUNET_TIME_Relative left; | ||
1845 | |||
1846 | s->timeout_task = NULL; | ||
1847 | left = GNUNET_TIME_absolute_get_remaining (s->timeout); | ||
1848 | if (0 != left.rel_value_us) | ||
1849 | { | ||
1850 | /* not actually our turn yet, but let's at least update | ||
1851 | the monitor, it may think we're about to die ... */ | ||
1852 | notify_session_monitor (s->plugin, | ||
1853 | s, | ||
1854 | GNUNET_TRANSPORT_SS_UPDATE); | ||
1855 | s->timeout_task = GNUNET_SCHEDULER_add_delayed (left, | ||
1856 | &session_timeout, | ||
1857 | s); | ||
1858 | return; | ||
1859 | } | ||
1860 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1861 | "Session %p was idle for %s, disconnecting\n", | ||
1862 | s, | ||
1863 | GNUNET_STRINGS_relative_time_to_string (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
1864 | GNUNET_YES)); | ||
1865 | /* call session destroy function */ | ||
1866 | tcp_plugin_disconnect_session (s->plugin, | ||
1867 | s); | ||
1868 | } | ||
1869 | |||
1870 | |||
1871 | /** | ||
1872 | * Increment session timeout due to activity. | ||
1873 | * | ||
1874 | * @param s session to increment timeout for | ||
1875 | */ | ||
1876 | static void | ||
1877 | reschedule_session_timeout (struct GNUNET_ATS_Session *s) | ||
1878 | { | ||
1879 | GNUNET_assert (NULL != s->timeout_task); | ||
1880 | s->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | ||
1881 | } | ||
1882 | |||
1883 | |||
1884 | /** | ||
1885 | * Create a new session. Also queues a welcome message. | ||
1886 | * | ||
1887 | * @param plugin the plugin | ||
1888 | * @param address the address to create the session for | ||
1889 | * @param scope network scope the address is from | ||
1890 | * @param client client to use, reference counter must have already been increased | ||
1891 | * @param is_nat this a NAT session, we should wait for a client to | ||
1892 | * connect to us from an address, then assign that to | ||
1893 | * the session | ||
1894 | * @return new session object | ||
1895 | */ | ||
1896 | static struct GNUNET_ATS_Session * | ||
1897 | create_session (struct Plugin *plugin, | ||
1898 | const struct GNUNET_HELLO_Address *address, | ||
1899 | enum GNUNET_ATS_Network_Type scope, | ||
1900 | struct GNUNET_SERVER_Client *client, | ||
1901 | int is_nat) | ||
1902 | { | ||
1903 | struct GNUNET_ATS_Session *session; | ||
1904 | struct PendingMessage *pm; | ||
1905 | |||
1906 | if (GNUNET_YES != is_nat) | ||
1907 | GNUNET_assert (NULL != client); | ||
1908 | else | ||
1909 | GNUNET_assert (NULL == client); | ||
1910 | |||
1911 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1912 | "Creating new session for peer `%s' at address %s\n", | ||
1913 | GNUNET_i2s (&address->peer), | ||
1914 | tcp_plugin_address_to_string (plugin, | ||
1915 | address->address, | ||
1916 | address->address_length)); | ||
1917 | session = GNUNET_new (struct GNUNET_ATS_Session); | ||
1918 | session->last_activity = GNUNET_TIME_absolute_get (); | ||
1919 | session->plugin = plugin; | ||
1920 | session->is_nat = is_nat; | ||
1921 | if (NULL != client) | ||
1922 | { | ||
1923 | session->client = client; | ||
1924 | GNUNET_SERVER_client_set_user_context (client, | ||
1925 | session); | ||
1926 | } | ||
1927 | session->address = GNUNET_HELLO_address_copy (address); | ||
1928 | session->target = address->peer; | ||
1929 | session->expecting_welcome = GNUNET_YES; | ||
1930 | session->scope = scope; | ||
1931 | pm = GNUNET_malloc (sizeof (struct PendingMessage) + | ||
1932 | sizeof (struct WelcomeMessage)); | ||
1933 | pm->msg = (const char *) &pm[1]; | ||
1934 | pm->message_size = sizeof(struct WelcomeMessage); | ||
1935 | GNUNET_memcpy (&pm[1], | ||
1936 | &plugin->my_welcome, | ||
1937 | sizeof(struct WelcomeMessage)); | ||
1938 | pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; | ||
1939 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1940 | gettext_noop ("# bytes currently in TCP buffers"), | ||
1941 | pm->message_size, | ||
1942 | GNUNET_NO); | ||
1943 | GNUNET_CONTAINER_DLL_insert (session->pending_messages_head, | ||
1944 | session->pending_messages_tail, | ||
1945 | pm); | ||
1946 | session->msgs_in_queue++; | ||
1947 | session->bytes_in_queue += pm->message_size; | ||
1948 | session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | ||
1949 | session->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
1950 | &session_timeout, | ||
1951 | session); | ||
1952 | notify_session_monitor (session->plugin, | ||
1953 | session, | ||
1954 | GNUNET_TRANSPORT_SS_INIT); | ||
1955 | if (GNUNET_YES != is_nat) | ||
1956 | { | ||
1957 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1958 | gettext_noop ("# TCP sessions active"), | ||
1959 | 1, | ||
1960 | GNUNET_NO); | ||
1961 | notify_session_monitor (session->plugin, | ||
1962 | session, | ||
1963 | GNUNET_TRANSPORT_SS_UP); | ||
1964 | } | ||
1965 | else | ||
1966 | { | ||
1967 | notify_session_monitor (session->plugin, | ||
1968 | session, | ||
1969 | GNUNET_TRANSPORT_SS_HANDSHAKE); | ||
1970 | } | ||
1971 | return session; | ||
1972 | } | ||
1973 | |||
1974 | |||
1975 | /** | ||
1976 | * If we have pending messages, ask the server to | ||
1977 | * transmit them (schedule the respective tasks, etc.) | ||
1978 | * | ||
1979 | * @param session for which session should we do this | ||
1980 | */ | ||
1981 | static void | ||
1982 | process_pending_messages (struct GNUNET_ATS_Session *session); | ||
1983 | |||
1984 | |||
1985 | /** | ||
1986 | * Function called to notify a client about the socket | ||
1987 | * being ready to queue more data. "buf" will be | ||
1988 | * NULL and "size" zero if the socket was closed for | ||
1989 | * writing in the meantime. | ||
1990 | * | ||
1991 | * @param cls closure | ||
1992 | * @param size number of bytes available in @a buf | ||
1993 | * @param buf where the callee should write the message | ||
1994 | * @return number of bytes written to @a buf | ||
1995 | */ | ||
1996 | static size_t | ||
1997 | do_transmit (void *cls, | ||
1998 | size_t size, | ||
1999 | void *buf) | ||
2000 | { | ||
2001 | struct GNUNET_ATS_Session *session = cls; | ||
2002 | struct GNUNET_PeerIdentity pid; | ||
2003 | struct Plugin *plugin; | ||
2004 | struct PendingMessage *pos; | ||
2005 | struct PendingMessage *hd; | ||
2006 | struct PendingMessage *tl; | ||
2007 | struct GNUNET_TIME_Absolute now; | ||
2008 | char *cbuf; | ||
2009 | size_t ret; | ||
2010 | |||
2011 | session->transmit_handle = NULL; | ||
2012 | plugin = session->plugin; | ||
2013 | if (NULL == buf) | ||
2014 | { | ||
2015 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2016 | "Timeout trying to transmit to peer `%s', discarding message queue.\n", | ||
2017 | GNUNET_i2s (&session->target)); | ||
2018 | /* timeout; cancel all messages that have already expired */ | ||
2019 | hd = NULL; | ||
2020 | tl = NULL; | ||
2021 | ret = 0; | ||
2022 | now = GNUNET_TIME_absolute_get (); | ||
2023 | while ( (NULL != (pos = session->pending_messages_head)) && | ||
2024 | (pos->timeout.abs_value_us <= now.abs_value_us) ) | ||
2025 | { | ||
2026 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, | ||
2027 | session->pending_messages_tail, | ||
2028 | pos); | ||
2029 | GNUNET_assert (0 < session->msgs_in_queue); | ||
2030 | session->msgs_in_queue--; | ||
2031 | GNUNET_assert (pos->message_size <= session->bytes_in_queue); | ||
2032 | session->bytes_in_queue -= pos->message_size; | ||
2033 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2034 | "Failed to transmit %u byte message to `%s'.\n", | ||
2035 | pos->message_size, | ||
2036 | GNUNET_i2s (&session->target)); | ||
2037 | ret += pos->message_size; | ||
2038 | GNUNET_CONTAINER_DLL_insert_after (hd, | ||
2039 | tl, | ||
2040 | tl, | ||
2041 | pos); | ||
2042 | } | ||
2043 | /* do this call before callbacks (so that if callbacks destroy | ||
2044 | * session, they have a chance to cancel actions done by this | ||
2045 | * call) */ | ||
2046 | process_pending_messages (session); | ||
2047 | pid = session->target; | ||
2048 | /* no do callbacks and do not use session again since | ||
2049 | * the callbacks may abort the session */ | ||
2050 | while (NULL != (pos = hd)) | ||
2051 | { | ||
2052 | GNUNET_CONTAINER_DLL_remove (hd, | ||
2053 | tl, | ||
2054 | pos); | ||
2055 | if (NULL != pos->transmit_cont) | ||
2056 | pos->transmit_cont (pos->transmit_cont_cls, | ||
2057 | &pid, | ||
2058 | GNUNET_SYSERR, | ||
2059 | pos->message_size, | ||
2060 | 0); | ||
2061 | GNUNET_free (pos); | ||
2062 | } | ||
2063 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
2064 | gettext_noop ("# bytes currently in TCP buffers"), -(int64_t) ret, | ||
2065 | GNUNET_NO); | ||
2066 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
2067 | gettext_noop ("# bytes discarded by TCP (timeout)"), | ||
2068 | ret, | ||
2069 | GNUNET_NO); | ||
2070 | if (0 < ret) | ||
2071 | notify_session_monitor (session->plugin, | ||
2072 | session, | ||
2073 | GNUNET_TRANSPORT_SS_UPDATE); | ||
2074 | return 0; | ||
2075 | } | ||
2076 | /* copy all pending messages that would fit */ | ||
2077 | ret = 0; | ||
2078 | cbuf = buf; | ||
2079 | hd = NULL; | ||
2080 | tl = NULL; | ||
2081 | while (NULL != (pos = session->pending_messages_head)) | ||
2082 | { | ||
2083 | if (ret + pos->message_size > size) | ||
2084 | break; | ||
2085 | GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, | ||
2086 | session->pending_messages_tail, | ||
2087 | pos); | ||
2088 | GNUNET_assert (0 < session->msgs_in_queue); | ||
2089 | session->msgs_in_queue--; | ||
2090 | GNUNET_assert (pos->message_size <= session->bytes_in_queue); | ||
2091 | session->bytes_in_queue -= pos->message_size; | ||
2092 | GNUNET_assert(size >= pos->message_size); | ||
2093 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2094 | "Transmitting message of type %u size %u to peer %s at %s\n", | ||
2095 | ntohs (((struct GNUNET_MessageHeader *) pos->msg)->type), | ||
2096 | pos->message_size, | ||
2097 | GNUNET_i2s (&session->target), | ||
2098 | tcp_plugin_address_to_string (session->plugin, | ||
2099 | session->address->address, | ||
2100 | session->address->address_length)); | ||
2101 | /* FIXME: this GNUNET_memcpy can be up to 7% of our total runtime */ | ||
2102 | GNUNET_memcpy (cbuf, | ||
2103 | pos->msg, | ||
2104 | pos->message_size); | ||
2105 | cbuf += pos->message_size; | ||
2106 | ret += pos->message_size; | ||
2107 | size -= pos->message_size; | ||
2108 | GNUNET_CONTAINER_DLL_insert_tail (hd, | ||
2109 | tl, | ||
2110 | pos); | ||
2111 | } | ||
2112 | notify_session_monitor (session->plugin, | ||
2113 | session, | ||
2114 | GNUNET_TRANSPORT_SS_UPDATE); | ||
2115 | /* schedule 'continuation' before callbacks so that callbacks that | ||
2116 | * cancel everything don't cause us to use a session that no longer | ||
2117 | * exists... */ | ||
2118 | process_pending_messages (session); | ||
2119 | session->last_activity = GNUNET_TIME_absolute_get (); | ||
2120 | pid = session->target; | ||
2121 | /* we'll now call callbacks that may cancel the session; hence | ||
2122 | * we should not use 'session' after this point */ | ||
2123 | while (NULL != (pos = hd)) | ||
2124 | { | ||
2125 | GNUNET_CONTAINER_DLL_remove (hd, tl, pos); | ||
2126 | if (NULL != pos->transmit_cont) | ||
2127 | pos->transmit_cont (pos->transmit_cont_cls, | ||
2128 | &pid, | ||
2129 | GNUNET_OK, | ||
2130 | pos->message_size, | ||
2131 | pos->message_size); /* FIXME: include TCP overhead */ | ||
2132 | GNUNET_free (pos); | ||
2133 | } | ||
2134 | GNUNET_assert (NULL == hd); | ||
2135 | GNUNET_assert (NULL == tl); | ||
2136 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
2137 | gettext_noop ("# bytes currently in TCP buffers"), | ||
2138 | - (int64_t) ret, | ||
2139 | GNUNET_NO); | ||
2140 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
2141 | gettext_noop ("# bytes transmitted via TCP"), | ||
2142 | ret, | ||
2143 | GNUNET_NO); | ||
2144 | return ret; | ||
2145 | } | ||
2146 | |||
2147 | |||
2148 | /** | ||
2149 | * If we have pending messages, ask the server to | ||
2150 | * transmit them (schedule the respective tasks, etc.) | ||
2151 | * | ||
2152 | * @param session for which session should we do this | ||
2153 | */ | ||
2154 | static void | ||
2155 | process_pending_messages (struct GNUNET_ATS_Session *session) | ||
2156 | { | ||
2157 | struct PendingMessage *pm; | ||
2158 | |||
2159 | GNUNET_assert (NULL != session->client); | ||
2160 | if (NULL != session->transmit_handle) | ||
2161 | return; | ||
2162 | if (NULL == (pm = session->pending_messages_head)) | ||
2163 | return; | ||
2164 | |||
2165 | session->transmit_handle | ||
2166 | = GNUNET_SERVER_notify_transmit_ready (session->client, | ||
2167 | pm->message_size, | ||
2168 | GNUNET_TIME_absolute_get_remaining (pm->timeout), | ||
2169 | &do_transmit, | ||
2170 | session); | ||
2171 | } | ||
2172 | |||
2173 | |||
2174 | /** | ||
2175 | * Function that can be used by the transport service to transmit | ||
2176 | * a message using the plugin. Note that in the case of a | ||
2177 | * peer disconnecting, the continuation MUST be called | ||
2178 | * prior to the disconnect notification itself. This function | ||
2179 | * will be called with this peer's HELLO message to initiate | ||
2180 | * a fresh connection to another peer. | ||
2181 | * | ||
2182 | * @param cls closure | ||
2183 | * @param session which session must be used | ||
2184 | * @param msgbuf the message to transmit | ||
2185 | * @param msgbuf_size number of bytes in @a msgbuf | ||
2186 | * @param priority how important is the message (most plugins will | ||
2187 | * ignore message priority and just FIFO) | ||
2188 | * @param to how long to wait at most for the transmission (does not | ||
2189 | * require plugins to discard the message after the timeout, | ||
2190 | * just advisory for the desired delay; most plugins will ignore | ||
2191 | * this as well) | ||
2192 | * @param cont continuation to call once the message has | ||
2193 | * been transmitted (or if the transport is ready | ||
2194 | * for the next transmission call; or if the | ||
2195 | * peer disconnected...); can be NULL | ||
2196 | * @param cont_cls closure for @a cont | ||
2197 | * @return number of bytes used (on the physical network, with overheads); | ||
2198 | * -1 on hard errors (i.e. address invalid); 0 is a legal value | ||
2199 | * and does NOT mean that the message was not transmitted (DV) | ||
2200 | */ | ||
2201 | static ssize_t | ||
2202 | tcp_plugin_send (void *cls, | ||
2203 | struct GNUNET_ATS_Session *session, | ||
2204 | const char *msgbuf, | ||
2205 | size_t msgbuf_size, | ||
2206 | unsigned int priority, | ||
2207 | struct GNUNET_TIME_Relative to, | ||
2208 | GNUNET_TRANSPORT_TransmitContinuation cont, | ||
2209 | void *cont_cls) | ||
2210 | { | ||
2211 | struct Plugin * plugin = cls; | ||
2212 | struct PendingMessage *pm; | ||
2213 | |||
2214 | /* create new message entry */ | ||
2215 | pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); | ||
2216 | pm->msg = (const char *) &pm[1]; | ||
2217 | GNUNET_memcpy (&pm[1], msgbuf, msgbuf_size); | ||
2218 | pm->message_size = msgbuf_size; | ||
2219 | pm->timeout = GNUNET_TIME_relative_to_absolute (to); | ||
2220 | pm->transmit_cont = cont; | ||
2221 | pm->transmit_cont_cls = cont_cls; | ||
2222 | |||
2223 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2224 | "Asked to transmit %u bytes to `%s', added message to list.\n", | ||
2225 | msgbuf_size, | ||
2226 | GNUNET_i2s (&session->target)); | ||
2227 | |||
2228 | if (GNUNET_YES == | ||
2229 | GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap, | ||
2230 | &session->target, | ||
2231 | session)) | ||
2232 | { | ||
2233 | GNUNET_assert (NULL != session->client); | ||
2234 | GNUNET_SERVER_client_set_timeout (session->client, | ||
2235 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | ||
2236 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
2237 | gettext_noop ("# bytes currently in TCP buffers"), | ||
2238 | msgbuf_size, | ||
2239 | GNUNET_NO); | ||
2240 | |||
2241 | /* append pm to pending_messages list */ | ||
2242 | GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head, | ||
2243 | session->pending_messages_tail, | ||
2244 | pm); | ||
2245 | notify_session_monitor (session->plugin, | ||
2246 | session, | ||
2247 | GNUNET_TRANSPORT_SS_UPDATE); | ||
2248 | session->msgs_in_queue++; | ||
2249 | session->bytes_in_queue += pm->message_size; | ||
2250 | process_pending_messages (session); | ||
2251 | return msgbuf_size; | ||
2252 | } | ||
2253 | if (GNUNET_YES == | ||
2254 | GNUNET_CONTAINER_multipeermap_contains_value (plugin->nat_wait_conns, | ||
2255 | &session->target, | ||
2256 | session)) | ||
2257 | { | ||
2258 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2259 | "This NAT WAIT session for peer `%s' is not yet ready!\n", | ||
2260 | GNUNET_i2s (&session->target)); | ||
2261 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
2262 | gettext_noop ("# bytes currently in TCP buffers"), msgbuf_size, | ||
2263 | GNUNET_NO); | ||
2264 | /* append pm to pending_messages list */ | ||
2265 | GNUNET_CONTAINER_DLL_insert_tail (session->pending_messages_head, | ||
2266 | session->pending_messages_tail, | ||
2267 | pm); | ||
2268 | session->msgs_in_queue++; | ||
2269 | session->bytes_in_queue += pm->message_size; | ||
2270 | notify_session_monitor (session->plugin, | ||
2271 | session, | ||
2272 | GNUNET_TRANSPORT_SS_HANDSHAKE); | ||
2273 | return msgbuf_size; | ||
2274 | } | ||
2275 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
2276 | "Invalid session %p\n", | ||
2277 | session); | ||
2278 | if (NULL != cont) | ||
2279 | cont (cont_cls, | ||
2280 | &session->target, | ||
2281 | GNUNET_SYSERR, | ||
2282 | pm->message_size, | ||
2283 | 0); | ||
2284 | GNUNET_break (0); | ||
2285 | GNUNET_free (pm); | ||
2286 | return GNUNET_SYSERR; /* session does not exist here */ | ||
2287 | } | ||
2288 | |||
2289 | |||
2290 | /** | ||
2291 | * Closure for #session_lookup_it(). | ||
2292 | */ | ||
2293 | struct GNUNET_ATS_SessionItCtx | ||
2294 | { | ||
2295 | /** | ||
2296 | * Address we are looking for. | ||
2297 | */ | ||
2298 | const struct GNUNET_HELLO_Address *address; | ||
2299 | |||
2300 | /** | ||
2301 | * Where to store the session (if we found it). | ||
2302 | */ | ||
2303 | struct GNUNET_ATS_Session *result; | ||
2304 | |||
2305 | }; | ||
2306 | |||
2307 | |||
2308 | /** | ||
2309 | * Look for a session by address. | ||
2310 | * | ||
2311 | * @param cls the `struct GNUNET_ATS_SessionItCtx` | ||
2312 | * @param key unused | ||
2313 | * @param value a `struct GNUNET_ATS_Session` | ||
2314 | * @return #GNUNET_YES to continue looking, #GNUNET_NO if we found the session | ||
2315 | */ | ||
2316 | static int | ||
2317 | session_lookup_it (void *cls, | ||
2318 | const struct GNUNET_PeerIdentity *key, | ||
2319 | void *value) | ||
2320 | { | ||
2321 | struct GNUNET_ATS_SessionItCtx *si_ctx = cls; | ||
2322 | struct GNUNET_ATS_Session *session = value; | ||
2323 | |||
2324 | if (0 != | ||
2325 | GNUNET_HELLO_address_cmp (si_ctx->address, | ||
2326 | session->address)) | ||
2327 | return GNUNET_YES; | ||
2328 | si_ctx->result = session; | ||
2329 | return GNUNET_NO; | ||
2330 | } | ||
2331 | |||
2332 | |||
2333 | /** | ||
2334 | * Task cleaning up a NAT connection attempt after timeout | ||
2335 | * | ||
2336 | * @param cls the `struct GNUNET_ATS_Session` | ||
2337 | */ | ||
2338 | static void | ||
2339 | nat_connect_timeout (void *cls) | ||
2340 | { | ||
2341 | struct GNUNET_ATS_Session *session = cls; | ||
2342 | |||
2343 | session->nat_connection_timeout = NULL; | ||
2344 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2345 | "NAT WAIT connection to `%4s' at `%s' could not be established, removing session\n", | ||
2346 | GNUNET_i2s (&session->target), | ||
2347 | tcp_plugin_address_to_string (session->plugin, | ||
2348 | session->address->address, | ||
2349 | session->address->address_length)); | ||
2350 | tcp_plugin_disconnect_session (session->plugin, | ||
2351 | session); | ||
2352 | } | ||
2353 | |||
2354 | |||
2355 | /** | ||
2356 | * Function that will be called whenever the transport service wants to | ||
2357 | * notify the plugin that a session is still active and in use and | ||
2358 | * therefore the session timeout for this session has to be updated | ||
2359 | * | ||
2360 | * @param cls closure | ||
2361 | * @param peer which peer was the session for | ||
2362 | * @param session which session is being updated | ||
2363 | */ | ||
2364 | static void | ||
2365 | tcp_plugin_update_session_timeout (void *cls, | ||
2366 | const struct GNUNET_PeerIdentity *peer, | ||
2367 | struct GNUNET_ATS_Session *session) | ||
2368 | { | ||
2369 | reschedule_session_timeout (session); | ||
2370 | } | ||
2371 | |||
2372 | |||
2373 | /** | ||
2374 | * Task to signal the server that we can continue | ||
2375 | * receiving from the TCP client now. | ||
2376 | * | ||
2377 | * @param cls the `struct GNUNET_ATS_Session *` | ||
2378 | */ | ||
2379 | static void | ||
2380 | delayed_done (void *cls) | ||
2381 | { | ||
2382 | struct GNUNET_ATS_Session *session = cls; | ||
2383 | |||
2384 | session->receive_delay_task = NULL; | ||
2385 | reschedule_session_timeout (session); | ||
2386 | GNUNET_SERVER_receive_done (session->client, | ||
2387 | GNUNET_OK); | ||
2388 | } | ||
2389 | |||
2390 | |||
2391 | /** | ||
2392 | * Function that will be called whenever the transport service wants to | ||
2393 | * notify the plugin that the inbound quota changed and that the plugin | ||
2394 | * should update it's delay for the next receive value | ||
2395 | * | ||
2396 | * @param cls closure | ||
2397 | * @param peer which peer was the session for | ||
2398 | * @param session which session is being updated | ||
2399 | * @param delay new delay to use for receiving | ||
2400 | */ | ||
2401 | static void | ||
2402 | tcp_plugin_update_inbound_delay (void *cls, | ||
2403 | const struct GNUNET_PeerIdentity *peer, | ||
2404 | struct GNUNET_ATS_Session *session, | ||
2405 | struct GNUNET_TIME_Relative delay) | ||
2406 | { | ||
2407 | if (NULL == session->receive_delay_task) | ||
2408 | return; | ||
2409 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2410 | "New inbound delay %s\n", | ||
2411 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
2412 | GNUNET_NO)); | ||
2413 | session->receive_delay = GNUNET_TIME_relative_to_absolute (delay); | ||
2414 | GNUNET_SCHEDULER_cancel (session->receive_delay_task); | ||
2415 | session->receive_delay_task = GNUNET_SCHEDULER_add_delayed (delay, | ||
2416 | &delayed_done, | ||
2417 | session); | ||
2418 | } | ||
2419 | |||
2420 | |||
2421 | /** | ||
2422 | * Create a new session to transmit data to the target | ||
2423 | * This session will used to send data to this peer and the plugin will | ||
2424 | * notify us by calling the env->session_end function | ||
2425 | * | ||
2426 | * @param cls closure | ||
2427 | * @param address the address to use | ||
2428 | * @return the session if the address is valid, NULL otherwise | ||
2429 | */ | ||
2430 | static struct GNUNET_ATS_Session * | ||
2431 | tcp_plugin_get_session (void *cls, | ||
2432 | const struct GNUNET_HELLO_Address *address) | ||
2433 | { | ||
2434 | struct Plugin *plugin = cls; | ||
2435 | struct GNUNET_ATS_Session *session = NULL; | ||
2436 | int af; | ||
2437 | const void *sb; | ||
2438 | size_t sbs; | ||
2439 | struct GNUNET_CONNECTION_Handle *sa; | ||
2440 | struct sockaddr_in a4; | ||
2441 | struct sockaddr_in6 a6; | ||
2442 | const struct IPv4TcpAddress *t4; | ||
2443 | const struct IPv6TcpAddress *t6; | ||
2444 | unsigned int options; | ||
2445 | enum GNUNET_ATS_Network_Type net_type; | ||
2446 | unsigned int is_natd = GNUNET_NO; | ||
2447 | size_t addrlen; | ||
2448 | #ifdef TCP_STEALTH | ||
2449 | struct GNUNET_NETWORK_Handle *s; | ||
2450 | #endif | ||
2451 | |||
2452 | addrlen = address->address_length; | ||
2453 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2454 | "Trying to get session for `%s' address of peer `%s'\n", | ||
2455 | tcp_plugin_address_to_string (plugin, | ||
2456 | address->address, | ||
2457 | address->address_length), | ||
2458 | GNUNET_i2s (&address->peer)); | ||
2459 | |||
2460 | if (GNUNET_HELLO_address_check_option (address, | ||
2461 | GNUNET_HELLO_ADDRESS_INFO_INBOUND)) | ||
2462 | { | ||
2463 | GNUNET_break (0); | ||
2464 | return NULL; | ||
2465 | } | ||
2466 | |||
2467 | /* look for existing session */ | ||
2468 | if (GNUNET_YES == | ||
2469 | GNUNET_CONTAINER_multipeermap_contains (plugin->sessionmap, | ||
2470 | &address->peer)) | ||
2471 | { | ||
2472 | struct GNUNET_ATS_SessionItCtx si_ctx; | ||
2473 | |||
2474 | si_ctx.address = address; | ||
2475 | si_ctx.result = NULL; | ||
2476 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, | ||
2477 | &address->peer, | ||
2478 | &session_lookup_it, | ||
2479 | &si_ctx); | ||
2480 | if (NULL != si_ctx.result) | ||
2481 | { | ||
2482 | session = si_ctx.result; | ||
2483 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2484 | "Found existing session for `%s' address `%s'\n", | ||
2485 | GNUNET_i2s (&address->peer), | ||
2486 | tcp_plugin_address_to_string (plugin, | ||
2487 | address->address, | ||
2488 | address->address_length)); | ||
2489 | return session; | ||
2490 | } | ||
2491 | /* This is a bit of a hack, limiting TCP to never allow more than | ||
2492 | one TCP connection to any given peer at the same time. | ||
2493 | Without this, peers sometimes disagree about which of the TCP | ||
2494 | connections they should use, causing one side to believe that | ||
2495 | they transmit successfully, while the other receives nothing. */ | ||
2496 | return NULL; /* Refuse to have more than one TCP connection per | ||
2497 | peer pair at the same time. */ | ||
2498 | } | ||
2499 | |||
2500 | if (addrlen == sizeof(struct IPv6TcpAddress)) | ||
2501 | { | ||
2502 | GNUNET_assert (NULL != address->address); /* make static analysis happy */ | ||
2503 | t6 = address->address; | ||
2504 | options = t6->options; | ||
2505 | af = AF_INET6; | ||
2506 | memset (&a6, 0, sizeof(a6)); | ||
2507 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
2508 | a6.sin6_len = sizeof (a6); | ||
2509 | #endif | ||
2510 | a6.sin6_family = AF_INET6; | ||
2511 | a6.sin6_port = t6->t6_port; | ||
2512 | if (t6->t6_port == 0) | ||
2513 | is_natd = GNUNET_YES; | ||
2514 | GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); | ||
2515 | sb = &a6; | ||
2516 | sbs = sizeof(a6); | ||
2517 | } | ||
2518 | else if (addrlen == sizeof(struct IPv4TcpAddress)) | ||
2519 | { | ||
2520 | GNUNET_assert(NULL != address->address); /* make static analysis happy */ | ||
2521 | t4 = address->address; | ||
2522 | options = t4->options; | ||
2523 | af = AF_INET; | ||
2524 | memset (&a4, 0, sizeof(a4)); | ||
2525 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
2526 | a4.sin_len = sizeof (a4); | ||
2527 | #endif | ||
2528 | a4.sin_family = AF_INET; | ||
2529 | a4.sin_port = t4->t4_port; | ||
2530 | if (t4->t4_port == 0) | ||
2531 | is_natd = GNUNET_YES; | ||
2532 | a4.sin_addr.s_addr = t4->ipv4_addr; | ||
2533 | sb = &a4; | ||
2534 | sbs = sizeof(a4); | ||
2535 | } | ||
2536 | else | ||
2537 | { | ||
2538 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
2539 | gettext_noop ("# requests to create session with invalid address"), | ||
2540 | 1, | ||
2541 | GNUNET_NO); | ||
2542 | return NULL; | ||
2543 | } | ||
2544 | |||
2545 | net_type = plugin->env->get_address_type (plugin->env->cls, | ||
2546 | sb, | ||
2547 | sbs); | ||
2548 | GNUNET_break (net_type != GNUNET_ATS_NET_UNSPECIFIED); | ||
2549 | |||
2550 | if ( (is_natd == GNUNET_YES) && | ||
2551 | (addrlen == sizeof(struct IPv6TcpAddress)) ) | ||
2552 | { | ||
2553 | /* NAT client only works with IPv4 addresses */ | ||
2554 | return NULL; | ||
2555 | } | ||
2556 | |||
2557 | if (plugin->cur_connections >= plugin->max_connections) | ||
2558 | { | ||
2559 | /* saturated */ | ||
2560 | return NULL; | ||
2561 | } | ||
2562 | |||
2563 | if ( (is_natd == GNUNET_YES) && | ||
2564 | (GNUNET_YES == | ||
2565 | GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns, | ||
2566 | &address->peer))) | ||
2567 | { | ||
2568 | /* Only do one NAT punch attempt per peer identity */ | ||
2569 | return NULL; | ||
2570 | } | ||
2571 | |||
2572 | if ( (is_natd == GNUNET_YES) && | ||
2573 | (NULL != plugin->nat) && | ||
2574 | (GNUNET_NO == | ||
2575 | GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns, | ||
2576 | &address->peer))) | ||
2577 | { | ||
2578 | struct sockaddr_in local_sa; | ||
2579 | |||
2580 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2581 | "Found valid IPv4 NAT address (creating session)!\n"); | ||
2582 | session = create_session (plugin, | ||
2583 | address, | ||
2584 | net_type, | ||
2585 | NULL, | ||
2586 | GNUNET_YES); | ||
2587 | session->nat_connection_timeout = GNUNET_SCHEDULER_add_delayed (NAT_TIMEOUT, | ||
2588 | &nat_connect_timeout, | ||
2589 | session); | ||
2590 | GNUNET_assert (GNUNET_OK == | ||
2591 | GNUNET_CONTAINER_multipeermap_put (plugin->nat_wait_conns, | ||
2592 | &session->target, | ||
2593 | session, | ||
2594 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
2595 | |||
2596 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2597 | "Created NAT WAIT connection to `%s' at `%s'\n", | ||
2598 | GNUNET_i2s (&session->target), | ||
2599 | GNUNET_a2s (sb, sbs)); | ||
2600 | memset (&local_sa, | ||
2601 | 0, | ||
2602 | sizeof (local_sa)); | ||
2603 | local_sa.sin_family = AF_INET; | ||
2604 | local_sa.sin_port = htons (plugin->open_port); | ||
2605 | /* We leave sin_address at 0, let the kernel figure it out, | ||
2606 | even if our bind() is more specific. (May want to reconsider | ||
2607 | later.) */ | ||
2608 | if (GNUNET_OK == | ||
2609 | GNUNET_NAT_request_reversal (plugin->nat, | ||
2610 | &local_sa, | ||
2611 | &a4)) | ||
2612 | return session; | ||
2613 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2614 | "Running NAT client for `%s' at `%s' failed\n", | ||
2615 | GNUNET_i2s (&session->target), | ||
2616 | GNUNET_a2s (sb, sbs)); | ||
2617 | tcp_plugin_disconnect_session (plugin, | ||
2618 | session); | ||
2619 | return NULL; | ||
2620 | } | ||
2621 | |||
2622 | /* create new outbound session */ | ||
2623 | if (0 != (options & TCP_OPTIONS_TCP_STEALTH)) | ||
2624 | { | ||
2625 | #ifdef TCP_STEALTH | ||
2626 | s = GNUNET_NETWORK_socket_create (af, SOCK_STREAM, 0); | ||
2627 | if (NULL == s) | ||
2628 | { | ||
2629 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, | ||
2630 | "socket"); | ||
2631 | sa = NULL; | ||
2632 | } | ||
2633 | else | ||
2634 | { | ||
2635 | if ( (GNUNET_OK != | ||
2636 | GNUNET_NETWORK_socket_setsockopt (s, | ||
2637 | IPPROTO_TCP, | ||
2638 | TCP_STEALTH, | ||
2639 | &session->target, | ||
2640 | sizeof (struct GNUNET_PeerIdentity))) || | ||
2641 | (GNUNET_OK != | ||
2642 | GNUNET_NETWORK_socket_setsockopt (s, | ||
2643 | IPPROTO_TCP, | ||
2644 | TCP_STEALTH_INTEGRITY, | ||
2645 | &plugin->my_welcome, | ||
2646 | sizeof (struct WelcomeMessage))) ) | ||
2647 | { | ||
2648 | /* TCP STEALTH not supported by kernel */ | ||
2649 | GNUNET_break (GNUNET_OK == | ||
2650 | GNUNET_NETWORK_socket_close (s)); | ||
2651 | sa = NULL; | ||
2652 | } | ||
2653 | else | ||
2654 | { | ||
2655 | sa = GNUNET_CONNECTION_connect_socket (s, sb, sbs); | ||
2656 | } | ||
2657 | } | ||
2658 | #else | ||
2659 | sa = NULL; | ||
2660 | #endif | ||
2661 | } | ||
2662 | else | ||
2663 | { | ||
2664 | sa = GNUNET_CONNECTION_create_from_sockaddr (af, sb, sbs); | ||
2665 | } | ||
2666 | if (NULL == sa) | ||
2667 | { | ||
2668 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2669 | "Failed to create connection to `%s' at `%s'\n", | ||
2670 | GNUNET_i2s (&address->peer), | ||
2671 | GNUNET_a2s (sb, sbs)); | ||
2672 | return NULL; | ||
2673 | } | ||
2674 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2675 | "Asked to transmit to `%s', creating fresh session using address `%s'.\n", | ||
2676 | GNUNET_i2s (&address->peer), | ||
2677 | GNUNET_a2s (sb, sbs)); | ||
2678 | |||
2679 | session = create_session (plugin, | ||
2680 | address, | ||
2681 | net_type, | ||
2682 | GNUNET_SERVER_connect_socket (plugin->server, | ||
2683 | sa), | ||
2684 | GNUNET_NO); | ||
2685 | (void) GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, | ||
2686 | &session->target, | ||
2687 | session, | ||
2688 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
2689 | /* Send TCP Welcome */ | ||
2690 | process_pending_messages (session); | ||
2691 | |||
2692 | return session; | ||
2693 | } | ||
2694 | |||
2695 | |||
2696 | /** | ||
2697 | * We have been asked to destroy all connections to a particular peer. | ||
2698 | * This function is called on each applicable session and must tear it | ||
2699 | * down. | ||
2700 | * | ||
2701 | * @param cls the `struct Plugin *` | ||
2702 | * @param key the peer which the session belongs to (unused) | ||
2703 | * @param value the `struct GNUNET_ATS_Session` | ||
2704 | * @return #GNUNET_YES (continue to iterate) | ||
2705 | */ | ||
2706 | static int | ||
2707 | session_disconnect_it (void *cls, | ||
2708 | const struct GNUNET_PeerIdentity *key, | ||
2709 | void *value) | ||
2710 | { | ||
2711 | struct Plugin *plugin = cls; | ||
2712 | struct GNUNET_ATS_Session *session = value; | ||
2713 | |||
2714 | GNUNET_STATISTICS_update (session->plugin->env->stats, | ||
2715 | gettext_noop ("# transport-service disconnect requests for TCP"), | ||
2716 | 1, | ||
2717 | GNUNET_NO); | ||
2718 | tcp_plugin_disconnect_session (plugin, | ||
2719 | session); | ||
2720 | return GNUNET_YES; | ||
2721 | } | ||
2722 | |||
2723 | |||
2724 | /** | ||
2725 | * Function that can be called to force a disconnect from the | ||
2726 | * specified neighbour. This should also cancel all previously | ||
2727 | * scheduled transmissions. Obviously the transmission may have been | ||
2728 | * partially completed already, which is OK. The plugin is supposed | ||
2729 | * to close the connection (if applicable) and no longer call the | ||
2730 | * transmit continuation(s). | ||
2731 | * | ||
2732 | * Finally, plugin MUST NOT call the services's receive function to | ||
2733 | * notify the service that the connection to the specified target was | ||
2734 | * closed after a getting this call. | ||
2735 | * | ||
2736 | * @param cls closure | ||
2737 | * @param target peer for which the last transmission is | ||
2738 | * to be cancelled | ||
2739 | */ | ||
2740 | static void | ||
2741 | tcp_plugin_disconnect (void *cls, | ||
2742 | const struct GNUNET_PeerIdentity *target) | ||
2743 | { | ||
2744 | struct Plugin *plugin = cls; | ||
2745 | |||
2746 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2747 | "Disconnecting peer `%s'\n", | ||
2748 | GNUNET_i2s (target)); | ||
2749 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessionmap, | ||
2750 | target, | ||
2751 | &session_disconnect_it, | ||
2752 | plugin); | ||
2753 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->nat_wait_conns, | ||
2754 | target, | ||
2755 | &session_disconnect_it, | ||
2756 | plugin); | ||
2757 | } | ||
2758 | |||
2759 | |||
2760 | /** | ||
2761 | * We are processing an address pretty printing request and finished | ||
2762 | * the IP resolution (if applicable). Append our port and forward the | ||
2763 | * result. If called with @a hostname NULL, we are done and should | ||
2764 | * clean up the pretty printer (otherwise, there might be multiple | ||
2765 | * hostnames for the IP address and we might receive more). | ||
2766 | * | ||
2767 | * @param cls the `struct PrettyPrinterContext *` | ||
2768 | * @param hostname hostname part of the address | ||
2769 | */ | ||
2770 | static void | ||
2771 | append_port (void *cls, | ||
2772 | const char *hostname) | ||
2773 | { | ||
2774 | struct PrettyPrinterContext *ppc = cls; | ||
2775 | struct Plugin *plugin = ppc->plugin; | ||
2776 | char *ret; | ||
2777 | |||
2778 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2779 | "append_port called with hostname `%s'\n", | ||
2780 | hostname); | ||
2781 | if (NULL == hostname) | ||
2782 | { | ||
2783 | /* Final call, done */ | ||
2784 | ppc->resolver_handle = NULL; | ||
2785 | GNUNET_CONTAINER_DLL_remove (plugin->ppc_dll_head, | ||
2786 | plugin->ppc_dll_tail, | ||
2787 | ppc); | ||
2788 | ppc->asc (ppc->asc_cls, | ||
2789 | NULL, | ||
2790 | GNUNET_OK); | ||
2791 | GNUNET_free (ppc); | ||
2792 | return; | ||
2793 | } | ||
2794 | if (GNUNET_YES == ppc->ipv6) | ||
2795 | GNUNET_asprintf (&ret, | ||
2796 | "%s.%u.[%s]:%d", | ||
2797 | PLUGIN_NAME, | ||
2798 | ppc->options, | ||
2799 | hostname, | ||
2800 | ppc->port); | ||
2801 | else | ||
2802 | GNUNET_asprintf (&ret, | ||
2803 | "%s.%u.%s:%d", | ||
2804 | PLUGIN_NAME, | ||
2805 | ppc->options, | ||
2806 | hostname, | ||
2807 | ppc->port); | ||
2808 | ppc->asc (ppc->asc_cls, | ||
2809 | ret, | ||
2810 | GNUNET_OK); | ||
2811 | GNUNET_free (ret); | ||
2812 | } | ||
2813 | |||
2814 | |||
2815 | /** | ||
2816 | * Convert the transports address to a nice, human-readable format. | ||
2817 | * | ||
2818 | * @param cls closure with the `struct Plugin` | ||
2819 | * @param type name of the transport that generated the address | ||
2820 | * @param addr one of the addresses of the host, NULL for the last address | ||
2821 | * the specific address format depends on the transport | ||
2822 | * @param addrlen length of the @a addr | ||
2823 | * @param numeric should (IP) addresses be displayed in numeric form? | ||
2824 | * @param timeout after how long should we give up? | ||
2825 | * @param asc function to call on each string | ||
2826 | * @param asc_cls closure for @a asc | ||
2827 | */ | ||
2828 | static void | ||
2829 | tcp_plugin_address_pretty_printer (void *cls, | ||
2830 | const char *type, | ||
2831 | const void *addr, | ||
2832 | size_t addrlen, | ||
2833 | int numeric, | ||
2834 | struct GNUNET_TIME_Relative timeout, | ||
2835 | GNUNET_TRANSPORT_AddressStringCallback asc, | ||
2836 | void *asc_cls) | ||
2837 | { | ||
2838 | struct Plugin *plugin = cls; | ||
2839 | struct PrettyPrinterContext *ppc; | ||
2840 | const void *sb; | ||
2841 | size_t sbs; | ||
2842 | struct sockaddr_in a4; | ||
2843 | struct sockaddr_in6 a6; | ||
2844 | const struct IPv4TcpAddress *t4; | ||
2845 | const struct IPv6TcpAddress *t6; | ||
2846 | uint16_t port; | ||
2847 | uint32_t options; | ||
2848 | |||
2849 | if (sizeof(struct IPv6TcpAddress) == addrlen) | ||
2850 | { | ||
2851 | t6 = addr; | ||
2852 | memset (&a6, 0, sizeof(a6)); | ||
2853 | a6.sin6_family = AF_INET6; | ||
2854 | a6.sin6_port = t6->t6_port; | ||
2855 | GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); | ||
2856 | port = ntohs (t6->t6_port); | ||
2857 | options = ntohl (t6->options); | ||
2858 | sb = &a6; | ||
2859 | sbs = sizeof(a6); | ||
2860 | } | ||
2861 | else if (sizeof(struct IPv4TcpAddress) == addrlen) | ||
2862 | { | ||
2863 | t4 = addr; | ||
2864 | memset (&a4, 0, sizeof(a4)); | ||
2865 | a4.sin_family = AF_INET; | ||
2866 | a4.sin_port = t4->t4_port; | ||
2867 | a4.sin_addr.s_addr = t4->ipv4_addr; | ||
2868 | port = ntohs (t4->t4_port); | ||
2869 | options = ntohl (t4->options); | ||
2870 | sb = &a4; | ||
2871 | sbs = sizeof(a4); | ||
2872 | } | ||
2873 | else | ||
2874 | { | ||
2875 | /* invalid address */ | ||
2876 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
2877 | _("Unexpected address length: %u bytes\n"), | ||
2878 | (unsigned int) addrlen); | ||
2879 | asc (asc_cls, NULL, GNUNET_SYSERR); | ||
2880 | asc (asc_cls, NULL, GNUNET_OK); | ||
2881 | return; | ||
2882 | } | ||
2883 | ppc = GNUNET_new (struct PrettyPrinterContext); | ||
2884 | ppc->plugin = plugin; | ||
2885 | if (addrlen == sizeof(struct IPv6TcpAddress)) | ||
2886 | ppc->ipv6 = GNUNET_YES; | ||
2887 | else | ||
2888 | ppc->ipv6 = GNUNET_NO; | ||
2889 | ppc->asc = asc; | ||
2890 | ppc->asc_cls = asc_cls; | ||
2891 | ppc->port = port; | ||
2892 | ppc->options = options; | ||
2893 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2894 | "Starting DNS reverse lookup\n"); | ||
2895 | ppc->resolver_handle = GNUNET_RESOLVER_hostname_get (sb, | ||
2896 | sbs, | ||
2897 | ! numeric, | ||
2898 | timeout, | ||
2899 | &append_port, | ||
2900 | ppc); | ||
2901 | if (NULL == ppc->resolver_handle) | ||
2902 | { | ||
2903 | GNUNET_break (0); | ||
2904 | GNUNET_free (ppc); | ||
2905 | return; | ||
2906 | } | ||
2907 | GNUNET_CONTAINER_DLL_insert (plugin->ppc_dll_head, | ||
2908 | plugin->ppc_dll_tail, | ||
2909 | ppc); | ||
2910 | } | ||
2911 | |||
2912 | |||
2913 | /** | ||
2914 | * Function that will be called to check if a binary address for this | ||
2915 | * plugin is well-formed and corresponds to an address for THIS peer | ||
2916 | * (as per our configuration). Naturally, if absolutely necessary, | ||
2917 | * plugins can be a bit conservative in their answer, but in general | ||
2918 | * plugins should make sure that the address does not redirect | ||
2919 | * traffic to a 3rd party that might try to man-in-the-middle our | ||
2920 | * traffic. | ||
2921 | * | ||
2922 | * @param cls closure, our `struct Plugin *` | ||
2923 | * @param addr pointer to the address | ||
2924 | * @param addrlen length of @a addr | ||
2925 | * @return #GNUNET_OK if this is a plausible address for this peer | ||
2926 | * and transport, #GNUNET_SYSERR if not | ||
2927 | */ | ||
2928 | static int | ||
2929 | tcp_plugin_check_address (void *cls, | ||
2930 | const void *addr, | ||
2931 | size_t addrlen) | ||
2932 | { | ||
2933 | struct Plugin *plugin = cls; | ||
2934 | const struct IPv4TcpAddress *v4; | ||
2935 | const struct IPv6TcpAddress *v6; | ||
2936 | |||
2937 | if ( (addrlen != sizeof(struct IPv4TcpAddress)) && | ||
2938 | (addrlen != sizeof(struct IPv6TcpAddress)) ) | ||
2939 | { | ||
2940 | GNUNET_break_op (0); | ||
2941 | return GNUNET_SYSERR; | ||
2942 | } | ||
2943 | |||
2944 | if (addrlen == sizeof(struct IPv4TcpAddress)) | ||
2945 | { | ||
2946 | struct sockaddr_in s4; | ||
2947 | |||
2948 | v4 = (const struct IPv4TcpAddress *) addr; | ||
2949 | if (0 != memcmp (&v4->options, | ||
2950 | &plugin->myoptions, | ||
2951 | sizeof(uint32_t))) | ||
2952 | { | ||
2953 | GNUNET_break (0); | ||
2954 | return GNUNET_SYSERR; | ||
2955 | } | ||
2956 | memset (&s4, 0, sizeof (s4)); | ||
2957 | s4.sin_family = AF_INET; | ||
2958 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
2959 | s4.sin_len = sizeof (s4); | ||
2960 | #endif | ||
2961 | s4.sin_port = v4->t4_port; | ||
2962 | s4.sin_addr.s_addr = v4->ipv4_addr; | ||
2963 | |||
2964 | if (GNUNET_OK != | ||
2965 | GNUNET_NAT_test_address (plugin->nat, | ||
2966 | &s4, | ||
2967 | sizeof (struct sockaddr_in))) | ||
2968 | return GNUNET_SYSERR; | ||
2969 | } | ||
2970 | else | ||
2971 | { | ||
2972 | struct sockaddr_in6 s6; | ||
2973 | |||
2974 | v6 = (const struct IPv6TcpAddress *) addr; | ||
2975 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) | ||
2976 | { | ||
2977 | GNUNET_break_op (0); | ||
2978 | return GNUNET_SYSERR; | ||
2979 | } | ||
2980 | if (0 != memcmp (&v6->options, | ||
2981 | &plugin->myoptions, | ||
2982 | sizeof (uint32_t))) | ||
2983 | { | ||
2984 | GNUNET_break (0); | ||
2985 | return GNUNET_SYSERR; | ||
2986 | } | ||
2987 | memset (&s6, 0, sizeof (s6)); | ||
2988 | s6.sin6_family = AF_INET6; | ||
2989 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
2990 | s6.sin6_len = sizeof (s6); | ||
2991 | #endif | ||
2992 | s6.sin6_port = v6->t6_port; | ||
2993 | s6.sin6_addr = v6->ipv6_addr; | ||
2994 | |||
2995 | if (GNUNET_OK != | ||
2996 | GNUNET_NAT_test_address (plugin->nat, | ||
2997 | &s6, | ||
2998 | sizeof(struct sockaddr_in6))) | ||
2999 | return GNUNET_SYSERR; | ||
3000 | } | ||
3001 | return GNUNET_OK; | ||
3002 | } | ||
3003 | |||
3004 | |||
3005 | /** | ||
3006 | * We've received a nat probe from this peer via TCP. Finish | ||
3007 | * creating the client session and resume sending of queued | ||
3008 | * messages. | ||
3009 | * | ||
3010 | * @param cls closure | ||
3011 | * @param client identification of the client | ||
3012 | * @param message the actual message | ||
3013 | */ | ||
3014 | static void | ||
3015 | handle_tcp_nat_probe (void *cls, | ||
3016 | struct GNUNET_SERVER_Client *client, | ||
3017 | const struct GNUNET_MessageHeader *message) | ||
3018 | { | ||
3019 | struct Plugin *plugin = cls; | ||
3020 | struct GNUNET_ATS_Session *session; | ||
3021 | const struct TCP_NAT_ProbeMessage *tcp_nat_probe; | ||
3022 | size_t alen; | ||
3023 | void *vaddr; | ||
3024 | struct IPv4TcpAddress *t4; | ||
3025 | struct IPv6TcpAddress *t6; | ||
3026 | const struct sockaddr_in *s4; | ||
3027 | const struct sockaddr_in6 *s6; | ||
3028 | |||
3029 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
3030 | "Received NAT probe\n"); | ||
3031 | /* We have received a TCP NAT probe, meaning we (hopefully) initiated | ||
3032 | * a connection to this peer by running gnunet-nat-client. This peer | ||
3033 | * received the punch message and now wants us to use the new connection | ||
3034 | * as the default for that peer. Do so and then send a WELCOME message | ||
3035 | * so we can really be connected! | ||
3036 | */ | ||
3037 | if (ntohs (message->size) != sizeof(struct TCP_NAT_ProbeMessage)) | ||
3038 | { | ||
3039 | GNUNET_break_op(0); | ||
3040 | GNUNET_SERVER_receive_done (client, | ||
3041 | GNUNET_SYSERR); | ||
3042 | return; | ||
3043 | } | ||
3044 | |||
3045 | tcp_nat_probe = (const struct TCP_NAT_ProbeMessage *) message; | ||
3046 | if (0 == memcmp (&tcp_nat_probe->clientIdentity, plugin->env->my_identity, | ||
3047 | sizeof(struct GNUNET_PeerIdentity))) | ||
3048 | { | ||
3049 | /* refuse connections from ourselves */ | ||
3050 | GNUNET_SERVER_receive_done (client, | ||
3051 | GNUNET_SYSERR); | ||
3052 | return; | ||
3053 | } | ||
3054 | |||
3055 | session = GNUNET_CONTAINER_multipeermap_get (plugin->nat_wait_conns, | ||
3056 | &tcp_nat_probe->clientIdentity); | ||
3057 | if (NULL == session) | ||
3058 | { | ||
3059 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
3060 | "Did NOT find session for NAT probe!\n"); | ||
3061 | GNUNET_SERVER_receive_done (client, | ||
3062 | GNUNET_OK); | ||
3063 | return; | ||
3064 | } | ||
3065 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
3066 | "Found session for NAT probe!\n"); | ||
3067 | |||
3068 | if (NULL != session->nat_connection_timeout) | ||
3069 | { | ||
3070 | GNUNET_SCHEDULER_cancel (session->nat_connection_timeout); | ||
3071 | session->nat_connection_timeout = NULL; | ||
3072 | } | ||
3073 | |||
3074 | if (GNUNET_OK != | ||
3075 | GNUNET_SERVER_client_get_address (client, | ||
3076 | &vaddr, | ||
3077 | &alen)) | ||
3078 | { | ||
3079 | GNUNET_break(0); | ||
3080 | GNUNET_SERVER_receive_done (client, | ||
3081 | GNUNET_SYSERR); | ||
3082 | tcp_plugin_disconnect_session (plugin, | ||
3083 | session); | ||
3084 | return; | ||
3085 | } | ||
3086 | GNUNET_assert (GNUNET_YES == | ||
3087 | GNUNET_CONTAINER_multipeermap_remove (plugin->nat_wait_conns, | ||
3088 | &tcp_nat_probe->clientIdentity, | ||
3089 | session)); | ||
3090 | GNUNET_SERVER_client_set_user_context (client, | ||
3091 | session); | ||
3092 | (void) GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, | ||
3093 | &session->target, | ||
3094 | session, | ||
3095 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
3096 | session->last_activity = GNUNET_TIME_absolute_get (); | ||
3097 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
3098 | "Found address `%s' for incoming connection\n", | ||
3099 | GNUNET_a2s (vaddr, alen)); | ||
3100 | switch (((const struct sockaddr *) vaddr)->sa_family) | ||
3101 | { | ||
3102 | case AF_INET: | ||
3103 | s4 = vaddr; | ||
3104 | t4 = GNUNET_new (struct IPv4TcpAddress); | ||
3105 | t4->options = htonl (TCP_OPTIONS_NONE); | ||
3106 | t4->t4_port = s4->sin_port; | ||
3107 | t4->ipv4_addr = s4->sin_addr.s_addr; | ||
3108 | session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity, | ||
3109 | PLUGIN_NAME, | ||
3110 | &t4, | ||
3111 | sizeof(struct IPv4TcpAddress), | ||
3112 | GNUNET_HELLO_ADDRESS_INFO_NONE); | ||
3113 | break; | ||
3114 | case AF_INET6: | ||
3115 | s6 = vaddr; | ||
3116 | t6 = GNUNET_new (struct IPv6TcpAddress); | ||
3117 | t6->options = htonl (TCP_OPTIONS_NONE); | ||
3118 | t6->t6_port = s6->sin6_port; | ||
3119 | GNUNET_memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr)); | ||
3120 | session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity, | ||
3121 | PLUGIN_NAME, | ||
3122 | &t6, | ||
3123 | sizeof(struct IPv6TcpAddress), | ||
3124 | GNUNET_HELLO_ADDRESS_INFO_NONE); | ||
3125 | break; | ||
3126 | default: | ||
3127 | GNUNET_break_op(0); | ||
3128 | LOG(GNUNET_ERROR_TYPE_DEBUG, | ||
3129 | "Bad address for incoming connection!\n"); | ||
3130 | GNUNET_free(vaddr); | ||
3131 | GNUNET_SERVER_receive_done (client, | ||
3132 | GNUNET_SYSERR); | ||
3133 | tcp_plugin_disconnect_session (plugin, | ||
3134 | session); | ||
3135 | return; | ||
3136 | } | ||
3137 | GNUNET_free (vaddr); | ||
3138 | GNUNET_break (NULL == session->client); | ||
3139 | session->client = client; | ||
3140 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
3141 | gettext_noop ("# TCP sessions active"), | ||
3142 | 1, | ||
3143 | GNUNET_NO); | ||
3144 | process_pending_messages (session); | ||
3145 | GNUNET_SERVER_receive_done (client, | ||
3146 | GNUNET_OK); | ||
3147 | } | ||
3148 | |||
3149 | |||
3150 | /** | ||
3151 | * We've received a welcome from this peer via TCP. Possibly create a | ||
3152 | * fresh client record and send back our welcome. | ||
3153 | * | ||
3154 | * @param cls closure | ||
3155 | * @param client identification of the client | ||
3156 | * @param message the actual message | ||
3157 | */ | ||
3158 | static void | ||
3159 | handle_tcp_welcome (void *cls, | ||
3160 | struct GNUNET_SERVER_Client *client, | ||
3161 | const struct GNUNET_MessageHeader *message) | ||
3162 | { | ||
3163 | struct Plugin *plugin = cls; | ||
3164 | const struct WelcomeMessage *wm = (const struct WelcomeMessage *) message; | ||
3165 | struct GNUNET_HELLO_Address *address; | ||
3166 | struct GNUNET_ATS_Session *session; | ||
3167 | size_t alen; | ||
3168 | void *vaddr; | ||
3169 | struct IPv4TcpAddress t4; | ||
3170 | struct IPv6TcpAddress t6; | ||
3171 | const struct sockaddr_in *s4; | ||
3172 | const struct sockaddr_in6 *s6; | ||
3173 | |||
3174 | if (0 == memcmp (&wm->clientIdentity, | ||
3175 | plugin->env->my_identity, | ||
3176 | sizeof(struct GNUNET_PeerIdentity))) | ||
3177 | { | ||
3178 | /* refuse connections from ourselves */ | ||
3179 | if (GNUNET_OK == | ||
3180 | GNUNET_SERVER_client_get_address (client, | ||
3181 | &vaddr, | ||
3182 | &alen)) | ||
3183 | { | ||
3184 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
3185 | "Received WELCOME message from my own identity `%s' on address `%s'\n", | ||
3186 | GNUNET_i2s (&wm->clientIdentity), | ||
3187 | GNUNET_a2s (vaddr, alen)); | ||
3188 | GNUNET_free (vaddr); | ||
3189 | } | ||
3190 | GNUNET_SERVER_receive_done (client, | ||
3191 | GNUNET_SYSERR); | ||
3192 | return; | ||
3193 | } | ||
3194 | |||
3195 | if (GNUNET_OK == | ||
3196 | GNUNET_SERVER_client_get_address (client, | ||
3197 | &vaddr, | ||
3198 | &alen)) | ||
3199 | { | ||
3200 | LOG(GNUNET_ERROR_TYPE_DEBUG, | ||
3201 | "Received WELCOME message from `%s' on address `%s'\n", | ||
3202 | GNUNET_i2s (&wm->clientIdentity), | ||
3203 | GNUNET_a2s (vaddr, alen)); | ||
3204 | GNUNET_free (vaddr); | ||
3205 | } | ||
3206 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
3207 | gettext_noop ("# TCP WELCOME messages received"), | ||
3208 | 1, | ||
3209 | GNUNET_NO); | ||
3210 | session = lookup_session_by_client (plugin, | ||
3211 | client); | ||
3212 | if (NULL != session) | ||
3213 | { | ||
3214 | if (GNUNET_OK == | ||
3215 | GNUNET_SERVER_client_get_address (client, | ||
3216 | &vaddr, | ||
3217 | &alen)) | ||
3218 | { | ||
3219 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
3220 | "Found existing session %p for peer `%s'\n", | ||
3221 | session, | ||
3222 | GNUNET_a2s (vaddr, alen)); | ||
3223 | GNUNET_free (vaddr); | ||
3224 | } | ||
3225 | } | ||
3226 | else | ||
3227 | { | ||
3228 | if (GNUNET_OK == | ||
3229 | GNUNET_SERVER_client_get_address (client, &vaddr, &alen)) | ||
3230 | { | ||
3231 | if (alen == sizeof(struct sockaddr_in)) | ||
3232 | { | ||
3233 | s4 = vaddr; | ||
3234 | memset (&t4, '\0', sizeof (t4)); | ||
3235 | t4.options = htonl (TCP_OPTIONS_NONE); | ||
3236 | t4.t4_port = s4->sin_port; | ||
3237 | t4.ipv4_addr = s4->sin_addr.s_addr; | ||
3238 | address = GNUNET_HELLO_address_allocate (&wm->clientIdentity, | ||
3239 | PLUGIN_NAME, | ||
3240 | &t4, | ||
3241 | sizeof(t4), | ||
3242 | GNUNET_HELLO_ADDRESS_INFO_INBOUND); | ||
3243 | } | ||
3244 | else if (alen == sizeof(struct sockaddr_in6)) | ||
3245 | { | ||
3246 | s6 = vaddr; | ||
3247 | memset (&t6, '\0', sizeof (t6)); | ||
3248 | t6.options = htonl (TCP_OPTIONS_NONE); | ||
3249 | t6.t6_port = s6->sin6_port; | ||
3250 | GNUNET_memcpy (&t6.ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr)); | ||
3251 | address = GNUNET_HELLO_address_allocate (&wm->clientIdentity, | ||
3252 | PLUGIN_NAME, | ||
3253 | &t6, | ||
3254 | sizeof (t6), | ||
3255 | GNUNET_HELLO_ADDRESS_INFO_INBOUND); | ||
3256 | } | ||
3257 | else | ||
3258 | { | ||
3259 | GNUNET_break (0); | ||
3260 | GNUNET_free_non_null (vaddr); | ||
3261 | GNUNET_SERVER_receive_done (client, | ||
3262 | GNUNET_SYSERR); | ||
3263 | return; | ||
3264 | } | ||
3265 | session = create_session (plugin, | ||
3266 | address, | ||
3267 | plugin->env->get_address_type (plugin->env->cls, | ||
3268 | vaddr, | ||
3269 | alen), | ||
3270 | client, | ||
3271 | GNUNET_NO); | ||
3272 | GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != session->scope); | ||
3273 | GNUNET_HELLO_address_free (address); | ||
3274 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
3275 | "Creating new%s session %p for peer `%s' client %p\n", | ||
3276 | GNUNET_HELLO_address_check_option (session->address, | ||
3277 | GNUNET_HELLO_ADDRESS_INFO_INBOUND) | ||
3278 | ? " inbound" : "", | ||
3279 | session, | ||
3280 | tcp_plugin_address_to_string (plugin, | ||
3281 | session->address->address, | ||
3282 | session->address->address_length), | ||
3283 | client); | ||
3284 | GNUNET_free (vaddr); | ||
3285 | (void) GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, | ||
3286 | &session->target, | ||
3287 | session, | ||
3288 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
3289 | /* Notify transport and ATS about new session */ | ||
3290 | plugin->env->session_start (plugin->env->cls, | ||
3291 | session->address, | ||
3292 | session, | ||
3293 | session->scope); | ||
3294 | } | ||
3295 | else | ||
3296 | { | ||
3297 | LOG(GNUNET_ERROR_TYPE_DEBUG, | ||
3298 | "Did not obtain TCP socket address for incoming connection\n"); | ||
3299 | GNUNET_break(0); | ||
3300 | GNUNET_SERVER_receive_done (client, | ||
3301 | GNUNET_SYSERR); | ||
3302 | return; | ||
3303 | } | ||
3304 | } | ||
3305 | |||
3306 | if (GNUNET_YES != session->expecting_welcome) | ||
3307 | { | ||
3308 | GNUNET_break_op (0); | ||
3309 | GNUNET_SERVER_receive_done (client, | ||
3310 | GNUNET_SYSERR); | ||
3311 | return; | ||
3312 | } | ||
3313 | session->last_activity = GNUNET_TIME_absolute_get (); | ||
3314 | session->expecting_welcome = GNUNET_NO; | ||
3315 | |||
3316 | process_pending_messages (session); | ||
3317 | GNUNET_SERVER_client_set_timeout (client, | ||
3318 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | ||
3319 | GNUNET_SERVER_receive_done (client, | ||
3320 | GNUNET_OK); | ||
3321 | } | ||
3322 | |||
3323 | |||
3324 | /** | ||
3325 | * We've received data for this peer via TCP. Unbox, | ||
3326 | * compute latency and forward. | ||
3327 | * | ||
3328 | * @param cls closure | ||
3329 | * @param client identification of the client | ||
3330 | * @param message the actual message | ||
3331 | */ | ||
3332 | static void | ||
3333 | handle_tcp_data (void *cls, | ||
3334 | struct GNUNET_SERVER_Client *client, | ||
3335 | const struct GNUNET_MessageHeader *message) | ||
3336 | { | ||
3337 | struct Plugin *plugin = cls; | ||
3338 | struct GNUNET_ATS_Session *session; | ||
3339 | struct GNUNET_TIME_Relative delay; | ||
3340 | uint16_t type; | ||
3341 | |||
3342 | type = ntohs (message->type); | ||
3343 | if ( (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME == type) || | ||
3344 | (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE == type) ) | ||
3345 | { | ||
3346 | /* We don't want to propagate WELCOME and NAT Probe messages up! */ | ||
3347 | GNUNET_SERVER_receive_done (client, | ||
3348 | GNUNET_OK); | ||
3349 | return; | ||
3350 | } | ||
3351 | session = lookup_session_by_client (plugin, client); | ||
3352 | if (NULL == session) | ||
3353 | { | ||
3354 | /* No inbound session found */ | ||
3355 | void *vaddr = NULL; | ||
3356 | size_t alen; | ||
3357 | |||
3358 | GNUNET_assert (GNUNET_OK == | ||
3359 | GNUNET_SERVER_client_get_address (client, | ||
3360 | &vaddr, | ||
3361 | &alen)); | ||
3362 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
3363 | "Received unexpected %u bytes of type %u from `%s'\n", | ||
3364 | (unsigned int) ntohs (message->size), | ||
3365 | (unsigned int) ntohs (message->type), | ||
3366 | GNUNET_a2s (vaddr, | ||
3367 | alen)); | ||
3368 | GNUNET_break_op(0); | ||
3369 | GNUNET_SERVER_receive_done (client, | ||
3370 | GNUNET_SYSERR); | ||
3371 | GNUNET_free_non_null (vaddr); | ||
3372 | return; | ||
3373 | } | ||
3374 | if (GNUNET_YES == session->expecting_welcome) | ||
3375 | { | ||
3376 | /* Session is expecting WELCOME message */ | ||
3377 | void *vaddr = NULL; | ||
3378 | size_t alen; | ||
3379 | |||
3380 | GNUNET_SERVER_client_get_address (client, | ||
3381 | &vaddr, | ||
3382 | &alen); | ||
3383 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
3384 | "Received unexpected %u bytes of type %u from `%s'\n", | ||
3385 | (unsigned int) ntohs (message->size), | ||
3386 | (unsigned int) ntohs (message->type), | ||
3387 | GNUNET_a2s (vaddr, alen)); | ||
3388 | GNUNET_break_op(0); | ||
3389 | GNUNET_SERVER_receive_done (client, | ||
3390 | GNUNET_SYSERR); | ||
3391 | GNUNET_free_non_null (vaddr); | ||
3392 | return; | ||
3393 | } | ||
3394 | |||
3395 | session->last_activity = GNUNET_TIME_absolute_get (); | ||
3396 | { | ||
3397 | void *vaddr = NULL; | ||
3398 | size_t alen; | ||
3399 | |||
3400 | GNUNET_SERVER_client_get_address (client, | ||
3401 | &vaddr, | ||
3402 | &alen); | ||
3403 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
3404 | "Passing %u bytes of type %u from `%s' at %s to transport service.\n", | ||
3405 | (unsigned int) ntohs (message->size), | ||
3406 | (unsigned int) ntohs (message->type), | ||
3407 | GNUNET_i2s (&session->target), | ||
3408 | GNUNET_a2s (vaddr, alen)); | ||
3409 | GNUNET_free_non_null (vaddr); | ||
3410 | } | ||
3411 | |||
3412 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
3413 | gettext_noop ("# bytes received via TCP"), | ||
3414 | ntohs (message->size), | ||
3415 | GNUNET_NO); | ||
3416 | |||
3417 | GNUNET_assert (GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessionmap, | ||
3418 | &session->target, | ||
3419 | session)); | ||
3420 | delay = plugin->env->receive (plugin->env->cls, | ||
3421 | session->address, | ||
3422 | session, | ||
3423 | message); | ||
3424 | reschedule_session_timeout (session); | ||
3425 | if (0 == delay.rel_value_us) | ||
3426 | { | ||
3427 | GNUNET_SERVER_receive_done (client, | ||
3428 | GNUNET_OK); | ||
3429 | } | ||
3430 | else | ||
3431 | { | ||
3432 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
3433 | "Throttling receiving from `%s' for %s\n", | ||
3434 | GNUNET_i2s (&session->target), | ||
3435 | GNUNET_STRINGS_relative_time_to_string (delay, | ||
3436 | GNUNET_YES)); | ||
3437 | GNUNET_SERVER_disable_receive_done_warning (client); | ||
3438 | GNUNET_assert (NULL == session->receive_delay_task); | ||
3439 | session->receive_delay_task = GNUNET_SCHEDULER_add_delayed (delay, | ||
3440 | &delayed_done, | ||
3441 | session); | ||
3442 | } | ||
3443 | } | ||
3444 | |||
3445 | |||
3446 | /** | ||
3447 | * Function called whenever a peer is connected on the "SERVER" level. | ||
3448 | * Increments number of active connections and suspends server if we | ||
3449 | * have reached the limit. | ||
3450 | * | ||
3451 | * @param cls closure | ||
3452 | * @param client identification of the client | ||
3453 | */ | ||
3454 | static void | ||
3455 | connect_notify (void *cls, | ||
3456 | struct GNUNET_SERVER_Client *client) | ||
3457 | { | ||
3458 | struct Plugin *plugin = cls; | ||
3459 | |||
3460 | if (NULL == client) | ||
3461 | return; | ||
3462 | plugin->cur_connections++; | ||
3463 | GNUNET_STATISTICS_set (plugin->env->stats, | ||
3464 | gettext_noop ("# TCP server connections active"), | ||
3465 | plugin->cur_connections, | ||
3466 | GNUNET_NO); | ||
3467 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
3468 | gettext_noop ("# TCP server connect events"), | ||
3469 | 1, | ||
3470 | GNUNET_NO); | ||
3471 | if (plugin->cur_connections != plugin->max_connections) | ||
3472 | return; | ||
3473 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
3474 | _("TCP connection limit reached, suspending server\n")); | ||
3475 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
3476 | gettext_noop ("# TCP service suspended"), | ||
3477 | 1, | ||
3478 | GNUNET_NO); | ||
3479 | GNUNET_SERVER_suspend (plugin->server); /* Maximum number of connections rechead */ | ||
3480 | } | ||
3481 | |||
3482 | |||
3483 | /** | ||
3484 | * Function called whenever a peer is disconnected on the "SERVER" | ||
3485 | * level. Cleans up the connection, decrements number of active | ||
3486 | * connections and if applicable resumes listening. | ||
3487 | * | ||
3488 | * @param cls closure | ||
3489 | * @param client identification of the client | ||
3490 | */ | ||
3491 | static void | ||
3492 | disconnect_notify (void *cls, | ||
3493 | struct GNUNET_SERVER_Client *client) | ||
3494 | { | ||
3495 | struct Plugin *plugin = cls; | ||
3496 | struct GNUNET_ATS_Session *session; | ||
3497 | |||
3498 | if (NULL == client) | ||
3499 | return; | ||
3500 | GNUNET_assert (plugin->cur_connections >= 1); | ||
3501 | plugin->cur_connections--; | ||
3502 | session = lookup_session_by_client (plugin, | ||
3503 | client); | ||
3504 | if (NULL == session) | ||
3505 | return; /* unknown, nothing to do */ | ||
3506 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
3507 | "Destroying session of `%s' with %s due to network-level disconnect.\n", | ||
3508 | GNUNET_i2s (&session->target), | ||
3509 | tcp_plugin_address_to_string (session->plugin, | ||
3510 | session->address->address, | ||
3511 | session->address->address_length)); | ||
3512 | |||
3513 | if (plugin->cur_connections == plugin->max_connections) | ||
3514 | { | ||
3515 | GNUNET_STATISTICS_update (session->plugin->env->stats, | ||
3516 | gettext_noop ("# TCP service resumed"), | ||
3517 | 1, | ||
3518 | GNUNET_NO); | ||
3519 | GNUNET_SERVER_resume (plugin->server); /* Resume server */ | ||
3520 | } | ||
3521 | GNUNET_STATISTICS_set (plugin->env->stats, | ||
3522 | gettext_noop ("# TCP server connections active"), | ||
3523 | plugin->cur_connections, | ||
3524 | GNUNET_NO); | ||
3525 | GNUNET_STATISTICS_update (session->plugin->env->stats, | ||
3526 | gettext_noop ("# network-level TCP disconnect events"), | ||
3527 | 1, | ||
3528 | GNUNET_NO); | ||
3529 | tcp_plugin_disconnect_session (plugin, | ||
3530 | session); | ||
3531 | } | ||
3532 | |||
3533 | |||
3534 | /** | ||
3535 | * We can now send a probe message, copy into buffer to really send. | ||
3536 | * | ||
3537 | * @param cls closure, a `struct TCPProbeContext` | ||
3538 | * @param size max size to copy | ||
3539 | * @param buf buffer to copy message to | ||
3540 | * @return number of bytes copied into @a buf | ||
3541 | */ | ||
3542 | static size_t | ||
3543 | notify_send_probe (void *cls, | ||
3544 | size_t size, | ||
3545 | void *buf) | ||
3546 | { | ||
3547 | struct TCPProbeContext *tcp_probe_ctx = cls; | ||
3548 | struct Plugin *plugin = tcp_probe_ctx->plugin; | ||
3549 | size_t ret; | ||
3550 | |||
3551 | tcp_probe_ctx->transmit_handle = NULL; | ||
3552 | GNUNET_CONTAINER_DLL_remove (plugin->probe_head, | ||
3553 | plugin->probe_tail, | ||
3554 | tcp_probe_ctx); | ||
3555 | if (NULL == buf) | ||
3556 | { | ||
3557 | GNUNET_CONNECTION_destroy (tcp_probe_ctx->sock); | ||
3558 | GNUNET_free(tcp_probe_ctx); | ||
3559 | return 0; | ||
3560 | } | ||
3561 | GNUNET_assert(size >= sizeof(tcp_probe_ctx->message)); | ||
3562 | GNUNET_memcpy (buf, | ||
3563 | &tcp_probe_ctx->message, | ||
3564 | sizeof(tcp_probe_ctx->message)); | ||
3565 | GNUNET_SERVER_connect_socket (tcp_probe_ctx->plugin->server, | ||
3566 | tcp_probe_ctx->sock); | ||
3567 | ret = sizeof(tcp_probe_ctx->message); | ||
3568 | GNUNET_free (tcp_probe_ctx); | ||
3569 | return ret; | ||
3570 | } | ||
3571 | |||
3572 | |||
3573 | /** | ||
3574 | * Function called by the NAT subsystem suggesting another peer wants | ||
3575 | * to connect to us via connection reversal. Try to connect back to the | ||
3576 | * given IP. | ||
3577 | * | ||
3578 | * @param cls closure | ||
3579 | * @param addr address to try | ||
3580 | * @param addrlen number of bytes in @a addr | ||
3581 | */ | ||
3582 | static void | ||
3583 | try_connection_reversal (void *cls, | ||
3584 | const struct sockaddr *addr, | ||
3585 | socklen_t addrlen) | ||
3586 | { | ||
3587 | struct Plugin *plugin = cls; | ||
3588 | struct GNUNET_CONNECTION_Handle *sock; | ||
3589 | struct TCPProbeContext *tcp_probe_ctx; | ||
3590 | |||
3591 | /** | ||
3592 | * We have received an ICMP response, ostensibly from a peer | ||
3593 | * that wants to connect to us! Send a message to establish a connection. | ||
3594 | */ | ||
3595 | sock = GNUNET_CONNECTION_create_from_sockaddr (AF_INET, | ||
3596 | addr, | ||
3597 | addrlen); | ||
3598 | if (NULL == sock) | ||
3599 | { | ||
3600 | /* failed for some odd reason (out of sockets?); ignore attempt */ | ||
3601 | return; | ||
3602 | } | ||
3603 | |||
3604 | tcp_probe_ctx = GNUNET_new (struct TCPProbeContext); | ||
3605 | tcp_probe_ctx->message.header.size | ||
3606 | = htons (sizeof (struct TCP_NAT_ProbeMessage)); | ||
3607 | tcp_probe_ctx->message.header.type | ||
3608 | = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE); | ||
3609 | tcp_probe_ctx->message.clientIdentity | ||
3610 | = *plugin->env->my_identity; | ||
3611 | tcp_probe_ctx->plugin = plugin; | ||
3612 | tcp_probe_ctx->sock = sock; | ||
3613 | GNUNET_CONTAINER_DLL_insert (plugin->probe_head, | ||
3614 | plugin->probe_tail, | ||
3615 | tcp_probe_ctx); | ||
3616 | tcp_probe_ctx->transmit_handle | ||
3617 | = GNUNET_CONNECTION_notify_transmit_ready (sock, | ||
3618 | ntohs (tcp_probe_ctx->message.header.size), | ||
3619 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
3620 | ¬ify_send_probe, | ||
3621 | tcp_probe_ctx); | ||
3622 | } | ||
3623 | |||
3624 | |||
3625 | /** | ||
3626 | * Function obtain the network type for a session | ||
3627 | * | ||
3628 | * @param cls closure (`struct Plugin *`) | ||
3629 | * @param session the session | ||
3630 | * @return the network type in HBO or #GNUNET_SYSERR | ||
3631 | */ | ||
3632 | static enum GNUNET_ATS_Network_Type | ||
3633 | tcp_plugin_get_network (void *cls, | ||
3634 | struct GNUNET_ATS_Session *session) | ||
3635 | { | ||
3636 | return session->scope; | ||
3637 | } | ||
3638 | |||
3639 | |||
3640 | /** | ||
3641 | * Function obtain the network type for an address. | ||
3642 | * | ||
3643 | * @param cls closure (`struct Plugin *`) | ||
3644 | * @param address the address | ||
3645 | * @return the network type | ||
3646 | */ | ||
3647 | static enum GNUNET_ATS_Network_Type | ||
3648 | tcp_plugin_get_network_for_address (void *cls, | ||
3649 | const struct GNUNET_HELLO_Address *address) | ||
3650 | { | ||
3651 | struct Plugin *plugin = cls; | ||
3652 | size_t addrlen; | ||
3653 | struct sockaddr_in a4; | ||
3654 | struct sockaddr_in6 a6; | ||
3655 | const struct IPv4TcpAddress *t4; | ||
3656 | const struct IPv6TcpAddress *t6; | ||
3657 | const void *sb; | ||
3658 | size_t sbs; | ||
3659 | |||
3660 | addrlen = address->address_length; | ||
3661 | if (addrlen == sizeof(struct IPv6TcpAddress)) | ||
3662 | { | ||
3663 | GNUNET_assert (NULL != address->address); /* make static analysis happy */ | ||
3664 | t6 = address->address; | ||
3665 | memset (&a6, 0, sizeof(a6)); | ||
3666 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
3667 | a6.sin6_len = sizeof (a6); | ||
3668 | #endif | ||
3669 | a6.sin6_family = AF_INET6; | ||
3670 | a6.sin6_port = t6->t6_port; | ||
3671 | GNUNET_memcpy (&a6.sin6_addr, &t6->ipv6_addr, sizeof(struct in6_addr)); | ||
3672 | sb = &a6; | ||
3673 | sbs = sizeof(a6); | ||
3674 | } | ||
3675 | else if (addrlen == sizeof(struct IPv4TcpAddress)) | ||
3676 | { | ||
3677 | GNUNET_assert (NULL != address->address); /* make static analysis happy */ | ||
3678 | t4 = address->address; | ||
3679 | memset (&a4, 0, sizeof(a4)); | ||
3680 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
3681 | a4.sin_len = sizeof (a4); | ||
3682 | #endif | ||
3683 | a4.sin_family = AF_INET; | ||
3684 | a4.sin_port = t4->t4_port; | ||
3685 | a4.sin_addr.s_addr = t4->ipv4_addr; | ||
3686 | sb = &a4; | ||
3687 | sbs = sizeof(a4); | ||
3688 | } | ||
3689 | else | ||
3690 | { | ||
3691 | GNUNET_break (0); | ||
3692 | return GNUNET_ATS_NET_UNSPECIFIED; | ||
3693 | } | ||
3694 | return plugin->env->get_address_type (plugin->env->cls, | ||
3695 | sb, | ||
3696 | sbs); | ||
3697 | } | ||
3698 | |||
3699 | |||
3700 | /** | ||
3701 | * Return information about the given session to the | ||
3702 | * monitor callback. | ||
3703 | * | ||
3704 | * @param cls the `struct Plugin` with the monitor callback (`sic`) | ||
3705 | * @param peer peer we send information about | ||
3706 | * @param value our `struct GNUNET_ATS_Session` to send information about | ||
3707 | * @return #GNUNET_OK (continue to iterate) | ||
3708 | */ | ||
3709 | static int | ||
3710 | send_session_info_iter (void *cls, | ||
3711 | const struct GNUNET_PeerIdentity *peer, | ||
3712 | void *value) | ||
3713 | { | ||
3714 | struct Plugin *plugin = cls; | ||
3715 | struct GNUNET_ATS_Session *session = value; | ||
3716 | |||
3717 | notify_session_monitor (plugin, | ||
3718 | session, | ||
3719 | GNUNET_TRANSPORT_SS_INIT); | ||
3720 | /* FIXME: cannot tell if this is up or not from current | ||
3721 | session state... */ | ||
3722 | notify_session_monitor (plugin, | ||
3723 | session, | ||
3724 | GNUNET_TRANSPORT_SS_UP); | ||
3725 | return GNUNET_OK; | ||
3726 | } | ||
3727 | |||
3728 | |||
3729 | /** | ||
3730 | * Begin monitoring sessions of a plugin. There can only | ||
3731 | * be one active monitor per plugin (i.e. if there are | ||
3732 | * multiple monitors, the transport service needs to | ||
3733 | * multiplex the generated events over all of them). | ||
3734 | * | ||
3735 | * @param cls closure of the plugin | ||
3736 | * @param sic callback to invoke, NULL to disable monitor; | ||
3737 | * plugin will being by iterating over all active | ||
3738 | * sessions immediately and then enter monitor mode | ||
3739 | * @param sic_cls closure for @a sic | ||
3740 | */ | ||
3741 | static void | ||
3742 | tcp_plugin_setup_monitor (void *cls, | ||
3743 | GNUNET_TRANSPORT_SessionInfoCallback sic, | ||
3744 | void *sic_cls) | ||
3745 | { | ||
3746 | struct Plugin *plugin = cls; | ||
3747 | |||
3748 | plugin->sic = sic; | ||
3749 | plugin->sic_cls = sic_cls; | ||
3750 | if (NULL != sic) | ||
3751 | { | ||
3752 | GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap, | ||
3753 | &send_session_info_iter, | ||
3754 | plugin); | ||
3755 | /* signal end of first iteration */ | ||
3756 | sic (sic_cls, NULL, NULL); | ||
3757 | } | ||
3758 | } | ||
3759 | |||
3760 | |||
3761 | /** | ||
3762 | * Entry point for the plugin. | ||
3763 | * | ||
3764 | * @param cls closure, the `struct GNUNET_TRANSPORT_PluginEnvironment *` | ||
3765 | * @return the `struct GNUNET_TRANSPORT_PluginFunctions *` or NULL on error | ||
3766 | */ | ||
3767 | void * | ||
3768 | libgnunet_plugin_transport_xt_init (void *cls) | ||
3769 | { | ||
3770 | static const struct GNUNET_SERVER_MessageHandler my_handlers[] = { | ||
3771 | { &handle_tcp_welcome, NULL, | ||
3772 | GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME, | ||
3773 | sizeof(struct WelcomeMessage) }, | ||
3774 | { &handle_tcp_nat_probe, NULL, | ||
3775 | GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_NAT_PROBE, | ||
3776 | sizeof(struct TCP_NAT_ProbeMessage) }, | ||
3777 | { &handle_tcp_data, NULL, | ||
3778 | GNUNET_MESSAGE_TYPE_ALL, 0 }, | ||
3779 | { NULL, NULL, 0, 0 } | ||
3780 | }; | ||
3781 | struct GNUNET_TRANSPORT_PluginEnvironment *env = cls; | ||
3782 | struct GNUNET_TRANSPORT_PluginFunctions *api; | ||
3783 | struct Plugin *plugin; | ||
3784 | struct LEGACY_SERVICE_Context *service; | ||
3785 | unsigned long long aport; | ||
3786 | unsigned long long bport; | ||
3787 | unsigned long long max_connections; | ||
3788 | unsigned int i; | ||
3789 | struct GNUNET_TIME_Relative idle_timeout; | ||
3790 | #ifdef TCP_STEALTH | ||
3791 | struct GNUNET_NETWORK_Handle *const*lsocks; | ||
3792 | #endif | ||
3793 | int ret; | ||
3794 | int ret_s; | ||
3795 | struct sockaddr **addrs; | ||
3796 | socklen_t *addrlens; | ||
3797 | |||
3798 | if (NULL == env->receive) | ||
3799 | { | ||
3800 | /* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully | ||
3801 | initialze the plugin or the API */ | ||
3802 | api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions); | ||
3803 | api->cls = NULL; | ||
3804 | api->address_pretty_printer = &tcp_plugin_address_pretty_printer; | ||
3805 | api->address_to_string = &tcp_plugin_address_to_string; | ||
3806 | api->string_to_address = &tcp_plugin_string_to_address; | ||
3807 | return api; | ||
3808 | } | ||
3809 | |||
3810 | GNUNET_assert (NULL != env->cfg); | ||
3811 | if (GNUNET_OK != | ||
3812 | GNUNET_CONFIGURATION_get_value_number (env->cfg, | ||
3813 | "transport-xt", | ||
3814 | "MAX_CONNECTIONS", | ||
3815 | &max_connections)) | ||
3816 | max_connections = 128; | ||
3817 | |||
3818 | aport = 0; | ||
3819 | if ((GNUNET_OK != | ||
3820 | GNUNET_CONFIGURATION_get_value_number (env->cfg, | ||
3821 | "transport-xt", | ||
3822 | "PORT", &bport)) || | ||
3823 | (bport > 65535) || | ||
3824 | ((GNUNET_OK == | ||
3825 | GNUNET_CONFIGURATION_get_value_number (env->cfg, | ||
3826 | "transport-xt", | ||
3827 | "ADVERTISED-PORT", &aport)) && | ||
3828 | (aport > 65535) )) | ||
3829 | { | ||
3830 | LOG(GNUNET_ERROR_TYPE_ERROR, | ||
3831 | _("Require valid port number for service `%s' in configuration!\n"), | ||
3832 | "transport-xt"); | ||
3833 | return NULL ; | ||
3834 | } | ||
3835 | if (0 == aport) | ||
3836 | aport = bport; | ||
3837 | if (0 == bport) | ||
3838 | aport = 0; | ||
3839 | if (0 != bport) | ||
3840 | { | ||
3841 | service = LEGACY_SERVICE_start ("transport-xt", | ||
3842 | env->cfg, | ||
3843 | LEGACY_SERVICE_OPTION_NONE); | ||
3844 | if (NULL == service) | ||
3845 | { | ||
3846 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
3847 | _("Failed to start service.\n")); | ||
3848 | return NULL; | ||
3849 | } | ||
3850 | } | ||
3851 | else | ||
3852 | service = NULL; | ||
3853 | |||
3854 | api = NULL; | ||
3855 | plugin = GNUNET_new (struct Plugin); | ||
3856 | plugin->sessionmap = GNUNET_CONTAINER_multipeermap_create (max_connections, | ||
3857 | GNUNET_YES); | ||
3858 | plugin->max_connections = max_connections; | ||
3859 | plugin->open_port = bport; | ||
3860 | plugin->adv_port = aport; | ||
3861 | plugin->env = env; | ||
3862 | plugin->my_welcome.header.size = htons (sizeof(struct WelcomeMessage)); | ||
3863 | plugin->my_welcome.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME); | ||
3864 | plugin->my_welcome.clientIdentity = *plugin->env->my_identity; | ||
3865 | |||
3866 | if ( (NULL != service) && | ||
3867 | (GNUNET_YES == | ||
3868 | GNUNET_CONFIGURATION_get_value_yesno (env->cfg, | ||
3869 | "transport-xt", | ||
3870 | "TCP_STEALTH")) ) | ||
3871 | { | ||
3872 | #ifdef TCP_STEALTH | ||
3873 | plugin->myoptions |= TCP_OPTIONS_TCP_STEALTH; | ||
3874 | lsocks = LEGACY_SERVICE_get_listen_sockets (service); | ||
3875 | if (NULL != lsocks) | ||
3876 | { | ||
3877 | uint32_t len = sizeof (struct WelcomeMessage); | ||
3878 | |||
3879 | for (i=0;NULL!=lsocks[i];i++) | ||
3880 | { | ||
3881 | if ( (GNUNET_OK != | ||
3882 | GNUNET_NETWORK_socket_setsockopt (lsocks[i], | ||
3883 | IPPROTO_TCP, | ||
3884 | TCP_STEALTH, | ||
3885 | env->my_identity, | ||
3886 | sizeof (struct GNUNET_PeerIdentity))) || | ||
3887 | (GNUNET_OK != | ||
3888 | GNUNET_NETWORK_socket_setsockopt (lsocks[i], | ||
3889 | IPPROTO_TCP, | ||
3890 | TCP_STEALTH_INTEGRITY_LEN, | ||
3891 | &len, | ||
3892 | sizeof (len))) ) | ||
3893 | { | ||
3894 | /* TCP STEALTH not supported by kernel */ | ||
3895 | GNUNET_assert (0 == i); | ||
3896 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
3897 | _("TCP_STEALTH not supported on this platform.\n")); | ||
3898 | goto die; | ||
3899 | } | ||
3900 | } | ||
3901 | } | ||
3902 | #else | ||
3903 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
3904 | _("TCP_STEALTH not supported on this platform.\n")); | ||
3905 | goto die; | ||
3906 | #endif | ||
3907 | } | ||
3908 | |||
3909 | if ( (NULL != service) && | ||
3910 | (GNUNET_SYSERR != | ||
3911 | (ret_s = | ||
3912 | get_server_addresses ("transport-xt", | ||
3913 | env->cfg, | ||
3914 | &addrs, | ||
3915 | &addrlens)))) | ||
3916 | { | ||
3917 | for (ret = ret_s-1; ret >= 0; ret--) | ||
3918 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
3919 | "Binding to address `%s'\n", | ||
3920 | GNUNET_a2s (addrs[ret], addrlens[ret])); | ||
3921 | plugin->nat | ||
3922 | = GNUNET_NAT_register (env->cfg, | ||
3923 | "transport-xt", | ||
3924 | IPPROTO_TCP, | ||
3925 | (unsigned int) ret_s, | ||
3926 | (const struct sockaddr **) addrs, | ||
3927 | addrlens, | ||
3928 | &tcp_nat_port_map_callback, | ||
3929 | &try_connection_reversal, | ||
3930 | plugin); | ||
3931 | for (ret = ret_s -1; ret >= 0; ret--) | ||
3932 | GNUNET_free (addrs[ret]); | ||
3933 | GNUNET_free_non_null (addrs); | ||
3934 | GNUNET_free_non_null (addrlens); | ||
3935 | } | ||
3936 | else | ||
3937 | { | ||
3938 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, | ||
3939 | "transport-xt", | ||
3940 | IPPROTO_TCP, | ||
3941 | 0, | ||
3942 | NULL, | ||
3943 | NULL, | ||
3944 | NULL, | ||
3945 | &try_connection_reversal, | ||
3946 | plugin); | ||
3947 | } | ||
3948 | api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions); | ||
3949 | api->cls = plugin; | ||
3950 | api->send = &tcp_plugin_send; | ||
3951 | api->get_session = &tcp_plugin_get_session; | ||
3952 | api->disconnect_session = &tcp_plugin_disconnect_session; | ||
3953 | api->query_keepalive_factor = &tcp_plugin_query_keepalive_factor; | ||
3954 | api->disconnect_peer = &tcp_plugin_disconnect; | ||
3955 | api->address_pretty_printer = &tcp_plugin_address_pretty_printer; | ||
3956 | api->check_address = &tcp_plugin_check_address; | ||
3957 | api->address_to_string = &tcp_plugin_address_to_string; | ||
3958 | api->string_to_address = &tcp_plugin_string_to_address; | ||
3959 | api->get_network = &tcp_plugin_get_network; | ||
3960 | api->get_network_for_address = &tcp_plugin_get_network_for_address; | ||
3961 | api->update_session_timeout = &tcp_plugin_update_session_timeout; | ||
3962 | api->update_inbound_delay = &tcp_plugin_update_inbound_delay; | ||
3963 | api->setup_monitor = &tcp_plugin_setup_monitor; | ||
3964 | plugin->service = service; | ||
3965 | if (NULL != service) | ||
3966 | { | ||
3967 | plugin->server = LEGACY_SERVICE_get_server (service); | ||
3968 | } | ||
3969 | else | ||
3970 | { | ||
3971 | if (GNUNET_OK != | ||
3972 | GNUNET_CONFIGURATION_get_value_time (env->cfg, | ||
3973 | "transport-xt", | ||
3974 | "TIMEOUT", | ||
3975 | &idle_timeout)) | ||
3976 | { | ||
3977 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | ||
3978 | "transport-xt", | ||
3979 | "TIMEOUT"); | ||
3980 | goto die; | ||
3981 | } | ||
3982 | plugin->server | ||
3983 | = GNUNET_SERVER_create_with_sockets (NULL, | ||
3984 | plugin, | ||
3985 | NULL, | ||
3986 | idle_timeout, | ||
3987 | GNUNET_YES); | ||
3988 | } | ||
3989 | plugin->handlers = GNUNET_malloc (sizeof (my_handlers)); | ||
3990 | GNUNET_memcpy (plugin->handlers, | ||
3991 | my_handlers, | ||
3992 | sizeof(my_handlers)); | ||
3993 | for (i = 0;i < sizeof(my_handlers) / sizeof(struct GNUNET_SERVER_MessageHandler);i++) | ||
3994 | plugin->handlers[i].callback_cls = plugin; | ||
3995 | |||
3996 | GNUNET_SERVER_add_handlers (plugin->server, | ||
3997 | plugin->handlers); | ||
3998 | GNUNET_SERVER_connect_notify (plugin->server, | ||
3999 | &connect_notify, | ||
4000 | plugin); | ||
4001 | GNUNET_SERVER_disconnect_notify (plugin->server, | ||
4002 | &disconnect_notify, | ||
4003 | plugin); | ||
4004 | plugin->nat_wait_conns = GNUNET_CONTAINER_multipeermap_create (16, | ||
4005 | GNUNET_YES); | ||
4006 | if (0 != bport) | ||
4007 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
4008 | _("XT transport listening on port %llu\n"), | ||
4009 | bport); | ||
4010 | else | ||
4011 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
4012 | _("XT transport not listening on any port (client only)\n")); | ||
4013 | if ( (aport != bport) && | ||
4014 | (0 != bport) ) | ||
4015 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
4016 | _("XT transport advertises itself as being on port %llu\n"), | ||
4017 | aport); | ||
4018 | /* Initially set connections to 0 */ | ||
4019 | GNUNET_STATISTICS_set (plugin->env->stats, | ||
4020 | gettext_noop ("# XT sessions active"), | ||
4021 | 0, | ||
4022 | GNUNET_NO); | ||
4023 | return api; | ||
4024 | |||
4025 | die: | ||
4026 | if (NULL != plugin->nat) | ||
4027 | GNUNET_NAT_unregister (plugin->nat); | ||
4028 | GNUNET_CONTAINER_multipeermap_destroy (plugin->sessionmap); | ||
4029 | if (NULL != service) | ||
4030 | LEGACY_SERVICE_stop (service); | ||
4031 | GNUNET_free (plugin); | ||
4032 | GNUNET_free_non_null (api); | ||
4033 | return NULL; | ||
4034 | } | ||
4035 | |||
4036 | |||
4037 | /** | ||
4038 | * Exit point from the plugin. | ||
4039 | * | ||
4040 | * @param cls the `struct GNUNET_TRANSPORT_PluginFunctions` | ||
4041 | * @return NULL | ||
4042 | */ | ||
4043 | void * | ||
4044 | libgnunet_plugin_transport_xt_done (void *cls) | ||
4045 | { | ||
4046 | struct GNUNET_TRANSPORT_PluginFunctions *api = cls; | ||
4047 | struct Plugin *plugin = api->cls; | ||
4048 | struct TCPProbeContext *tcp_probe; | ||
4049 | struct PrettyPrinterContext *cur; | ||
4050 | struct PrettyPrinterContext *next; | ||
4051 | |||
4052 | if (NULL == plugin) | ||
4053 | { | ||
4054 | GNUNET_free(api); | ||
4055 | return NULL ; | ||
4056 | } | ||
4057 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
4058 | "Shutting down XT plugin\n"); | ||
4059 | |||
4060 | /* Removing leftover sessions */ | ||
4061 | GNUNET_CONTAINER_multipeermap_iterate (plugin->sessionmap, | ||
4062 | &session_disconnect_it, | ||
4063 | plugin); | ||
4064 | /* Removing leftover NAT sessions */ | ||
4065 | GNUNET_CONTAINER_multipeermap_iterate (plugin->nat_wait_conns, | ||
4066 | &session_disconnect_it, | ||
4067 | plugin); | ||
4068 | |||
4069 | for (cur = plugin->ppc_dll_head; NULL != cur; cur = next) | ||
4070 | { | ||
4071 | next = cur->next; | ||
4072 | GNUNET_CONTAINER_DLL_remove (plugin->ppc_dll_head, | ||
4073 | plugin->ppc_dll_tail, | ||
4074 | cur); | ||
4075 | GNUNET_RESOLVER_request_cancel (cur->resolver_handle); | ||
4076 | cur->asc (cur->asc_cls, | ||
4077 | NULL, | ||
4078 | GNUNET_OK); | ||
4079 | GNUNET_free (cur); | ||
4080 | } | ||
4081 | |||
4082 | if (NULL != plugin->service) | ||
4083 | LEGACY_SERVICE_stop (plugin->service); | ||
4084 | else | ||
4085 | GNUNET_SERVER_destroy (plugin->server); | ||
4086 | GNUNET_free (plugin->handlers); | ||
4087 | if (NULL != plugin->nat) | ||
4088 | GNUNET_NAT_unregister (plugin->nat); | ||
4089 | while (NULL != (tcp_probe = plugin->probe_head)) | ||
4090 | { | ||
4091 | GNUNET_CONTAINER_DLL_remove (plugin->probe_head, | ||
4092 | plugin->probe_tail, | ||
4093 | tcp_probe); | ||
4094 | GNUNET_CONNECTION_destroy (tcp_probe->sock); | ||
4095 | GNUNET_free (tcp_probe); | ||
4096 | } | ||
4097 | GNUNET_CONTAINER_multipeermap_destroy (plugin->nat_wait_conns); | ||
4098 | GNUNET_CONTAINER_multipeermap_destroy (plugin->sessionmap); | ||
4099 | GNUNET_break (0 == plugin->cur_connections); | ||
4100 | GNUNET_free (plugin); | ||
4101 | GNUNET_free (api); | ||
4102 | return NULL; | ||
4103 | } | ||
4104 | |||
4105 | /* end of plugin_transport_xt.c */ | ||
diff --git a/src/transport/plugin_transport_xu.c b/src/transport/plugin_transport_xu.c new file mode 100644 index 000000000..59e00f80e --- /dev/null +++ b/src/transport/plugin_transport_xu.c | |||
@@ -0,0 +1,2490 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2010-2017 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | /** | ||
20 | * @file transport/plugin_transport_xu.c | ||
21 | * @brief Implementation of the XU transport protocol | ||
22 | * @author Christian Grothoff | ||
23 | * @author Nathan Evans | ||
24 | * @author Matthias Wachs | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "plugin_transport_xu.h" | ||
28 | #include "gnunet_hello_lib.h" | ||
29 | #include "gnunet_util_lib.h" | ||
30 | #include "gnunet_fragmentation_lib.h" | ||
31 | #include "gnunet_nat_service.h" | ||
32 | #include "gnunet_protocols.h" | ||
33 | #include "gnunet_resolver_service.h" | ||
34 | #include "gnunet_signatures.h" | ||
35 | #include "gnunet_constants.h" | ||
36 | #include "gnunet_statistics_service.h" | ||
37 | #include "gnunet_transport_service.h" | ||
38 | #include "gnunet_transport_plugin.h" | ||
39 | #include "transport.h" | ||
40 | |||
41 | #define LOG(kind,...) GNUNET_log_from (kind, "transport-xu", __VA_ARGS__) | ||
42 | |||
43 | /** | ||
44 | * After how much inactivity should a XU session time out? | ||
45 | */ | ||
46 | #define XU_SESSION_TIME_OUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) | ||
47 | |||
48 | |||
49 | /** | ||
50 | * XU Message-Packet header (after defragmentation). | ||
51 | */ | ||
52 | struct XUMessage | ||
53 | { | ||
54 | /** | ||
55 | * Message header. | ||
56 | */ | ||
57 | struct GNUNET_MessageHeader header; | ||
58 | |||
59 | /** | ||
60 | * Always zero for now. | ||
61 | */ | ||
62 | uint32_t reserved; | ||
63 | |||
64 | /** | ||
65 | * What is the identity of the sender | ||
66 | */ | ||
67 | struct GNUNET_PeerIdentity sender; | ||
68 | |||
69 | }; | ||
70 | |||
71 | |||
72 | /** | ||
73 | * Closure for #append_port(). | ||
74 | */ | ||
75 | struct PrettyPrinterContext | ||
76 | { | ||
77 | /** | ||
78 | * DLL | ||
79 | */ | ||
80 | struct PrettyPrinterContext *next; | ||
81 | |||
82 | /** | ||
83 | * DLL | ||
84 | */ | ||
85 | struct PrettyPrinterContext *prev; | ||
86 | |||
87 | /** | ||
88 | * Our plugin. | ||
89 | */ | ||
90 | struct Plugin *plugin; | ||
91 | |||
92 | /** | ||
93 | * Resolver handle | ||
94 | */ | ||
95 | struct GNUNET_RESOLVER_RequestHandle *resolver_handle; | ||
96 | |||
97 | /** | ||
98 | * Function to call with the result. | ||
99 | */ | ||
100 | GNUNET_TRANSPORT_AddressStringCallback asc; | ||
101 | |||
102 | /** | ||
103 | * Clsoure for @e asc. | ||
104 | */ | ||
105 | void *asc_cls; | ||
106 | |||
107 | /** | ||
108 | * Timeout task | ||
109 | */ | ||
110 | struct GNUNET_SCHEDULER_Task *timeout_task; | ||
111 | |||
112 | /** | ||
113 | * Is this an IPv6 address? | ||
114 | */ | ||
115 | int ipv6; | ||
116 | |||
117 | /** | ||
118 | * Options | ||
119 | */ | ||
120 | uint32_t options; | ||
121 | |||
122 | /** | ||
123 | * Port to add after the IP address. | ||
124 | */ | ||
125 | uint16_t port; | ||
126 | |||
127 | }; | ||
128 | |||
129 | |||
130 | /** | ||
131 | * Session with another peer. | ||
132 | */ | ||
133 | struct GNUNET_ATS_Session | ||
134 | { | ||
135 | /** | ||
136 | * Which peer is this session for? | ||
137 | */ | ||
138 | struct GNUNET_PeerIdentity target; | ||
139 | |||
140 | /** | ||
141 | * Tokenizer for inbound messages. | ||
142 | */ | ||
143 | struct GNUNET_MessageStreamTokenizer *mst; | ||
144 | |||
145 | /** | ||
146 | * Plugin this session belongs to. | ||
147 | */ | ||
148 | struct Plugin *plugin; | ||
149 | |||
150 | /** | ||
151 | * Session timeout task | ||
152 | */ | ||
153 | struct GNUNET_SCHEDULER_Task *timeout_task; | ||
154 | |||
155 | /** | ||
156 | * When does this session time out? | ||
157 | */ | ||
158 | struct GNUNET_TIME_Absolute timeout; | ||
159 | |||
160 | /** | ||
161 | * What time did we last transmit? | ||
162 | */ | ||
163 | struct GNUNET_TIME_Absolute last_transmit_time; | ||
164 | |||
165 | /** | ||
166 | * expected delay for ACKs | ||
167 | */ | ||
168 | struct GNUNET_TIME_Relative last_expected_ack_delay; | ||
169 | |||
170 | /** | ||
171 | * desired delay between XU messages | ||
172 | */ | ||
173 | struct GNUNET_TIME_Relative last_expected_msg_delay; | ||
174 | |||
175 | /** | ||
176 | */ | ||
177 | struct GNUNET_TIME_Relative flow_delay_for_other_peer; | ||
178 | struct GNUNET_TIME_Relative flow_delay_from_other_peer; | ||
179 | |||
180 | /** | ||
181 | * Our own address. | ||
182 | */ | ||
183 | struct GNUNET_HELLO_Address *address; | ||
184 | |||
185 | /** | ||
186 | * Number of bytes waiting for transmission to this peer. | ||
187 | */ | ||
188 | unsigned long long bytes_in_queue; | ||
189 | |||
190 | /** | ||
191 | * Number of messages waiting for transmission to this peer. | ||
192 | */ | ||
193 | unsigned int msgs_in_queue; | ||
194 | |||
195 | /** | ||
196 | * Reference counter to indicate that this session is | ||
197 | * currently being used and must not be destroyed; | ||
198 | * setting @e in_destroy will destroy it as soon as | ||
199 | * possible. | ||
200 | */ | ||
201 | unsigned int rc; | ||
202 | |||
203 | /** | ||
204 | * Network type of the address. | ||
205 | */ | ||
206 | enum GNUNET_ATS_Network_Type scope; | ||
207 | |||
208 | /** | ||
209 | * Is this session about to be destroyed (sometimes we cannot | ||
210 | * destroy a session immediately as below us on the stack | ||
211 | * there might be code that still uses it; in this case, | ||
212 | * @e rc is non-zero). | ||
213 | */ | ||
214 | int in_destroy; | ||
215 | }; | ||
216 | |||
217 | |||
218 | |||
219 | /** | ||
220 | * If a session monitor is attached, notify it about the new | ||
221 | * session state. | ||
222 | * | ||
223 | * @param plugin our plugin | ||
224 | * @param session session that changed state | ||
225 | * @param state new state of the session | ||
226 | */ | ||
227 | static void | ||
228 | notify_session_monitor (struct Plugin *plugin, | ||
229 | struct GNUNET_ATS_Session *session, | ||
230 | enum GNUNET_TRANSPORT_SessionState state) | ||
231 | { | ||
232 | struct GNUNET_TRANSPORT_SessionInfo info; | ||
233 | |||
234 | if (NULL == plugin->sic) | ||
235 | return; | ||
236 | if (GNUNET_YES == session->in_destroy) | ||
237 | return; /* already destroyed, just RC>0 left-over actions */ | ||
238 | memset (&info, | ||
239 | 0, | ||
240 | sizeof (info)); | ||
241 | info.state = state; | ||
242 | info.is_inbound = GNUNET_SYSERR; /* hard to say */ | ||
243 | info.num_msg_pending = session->msgs_in_queue; | ||
244 | info.num_bytes_pending = session->bytes_in_queue; | ||
245 | /* info.receive_delay remains zero as this is not supported by XU | ||
246 | (cannot selectively not receive from 'some' peer while continuing | ||
247 | to receive from others) */ | ||
248 | info.session_timeout = session->timeout; | ||
249 | info.address = session->address; | ||
250 | plugin->sic (plugin->sic_cls, | ||
251 | session, | ||
252 | &info); | ||
253 | } | ||
254 | |||
255 | |||
256 | /** | ||
257 | * Return information about the given session to the monitor callback. | ||
258 | * | ||
259 | * @param cls the `struct Plugin` with the monitor callback (`sic`) | ||
260 | * @param peer peer we send information about | ||
261 | * @param value our `struct GNUNET_ATS_Session` to send information about | ||
262 | * @return #GNUNET_OK (continue to iterate) | ||
263 | */ | ||
264 | static int | ||
265 | send_session_info_iter (void *cls, | ||
266 | const struct GNUNET_PeerIdentity *peer, | ||
267 | void *value) | ||
268 | { | ||
269 | struct Plugin *plugin = cls; | ||
270 | struct GNUNET_ATS_Session *session = value; | ||
271 | |||
272 | (void) peer; | ||
273 | notify_session_monitor (plugin, | ||
274 | session, | ||
275 | GNUNET_TRANSPORT_SS_INIT); | ||
276 | notify_session_monitor (plugin, | ||
277 | session, | ||
278 | GNUNET_TRANSPORT_SS_UP); | ||
279 | return GNUNET_OK; | ||
280 | } | ||
281 | |||
282 | |||
283 | /** | ||
284 | * Begin monitoring sessions of a plugin. There can only | ||
285 | * be one active monitor per plugin (i.e. if there are | ||
286 | * multiple monitors, the transport service needs to | ||
287 | * multiplex the generated events over all of them). | ||
288 | * | ||
289 | * @param cls closure of the plugin | ||
290 | * @param sic callback to invoke, NULL to disable monitor; | ||
291 | * plugin will being by iterating over all active | ||
292 | * sessions immediately and then enter monitor mode | ||
293 | * @param sic_cls closure for @a sic | ||
294 | */ | ||
295 | static void | ||
296 | xu_plugin_setup_monitor (void *cls, | ||
297 | GNUNET_TRANSPORT_SessionInfoCallback sic, | ||
298 | void *sic_cls) | ||
299 | { | ||
300 | struct Plugin *plugin = cls; | ||
301 | |||
302 | plugin->sic = sic; | ||
303 | plugin->sic_cls = sic_cls; | ||
304 | if (NULL != sic) | ||
305 | { | ||
306 | GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions, | ||
307 | &send_session_info_iter, | ||
308 | plugin); | ||
309 | /* signal end of first iteration */ | ||
310 | sic (sic_cls, | ||
311 | NULL, | ||
312 | NULL); | ||
313 | } | ||
314 | } | ||
315 | |||
316 | |||
317 | /* ****************** Little Helpers ****************** */ | ||
318 | |||
319 | |||
320 | /** | ||
321 | * Function to free last resources associated with a session. | ||
322 | * | ||
323 | * @param s session to free | ||
324 | */ | ||
325 | static void | ||
326 | free_session (struct GNUNET_ATS_Session *s) | ||
327 | { | ||
328 | if (NULL != s->address) | ||
329 | { | ||
330 | GNUNET_HELLO_address_free (s->address); | ||
331 | s->address = NULL; | ||
332 | } | ||
333 | if (NULL != s->mst) | ||
334 | { | ||
335 | GNUNET_MST_destroy (s->mst); | ||
336 | s->mst = NULL; | ||
337 | } | ||
338 | GNUNET_free (s); | ||
339 | } | ||
340 | |||
341 | |||
342 | /** | ||
343 | * Function that is called to get the keepalive factor. | ||
344 | * #GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT is divided by this number to | ||
345 | * calculate the interval between keepalive packets. | ||
346 | * | ||
347 | * @param cls closure with the `struct Plugin` | ||
348 | * @return keepalive factor | ||
349 | */ | ||
350 | static unsigned int | ||
351 | xu_query_keepalive_factor (void *cls) | ||
352 | { | ||
353 | (void) cls; | ||
354 | return 15; | ||
355 | } | ||
356 | |||
357 | |||
358 | /** | ||
359 | * Function obtain the network type for a session | ||
360 | * | ||
361 | * @param cls closure (`struct Plugin *`) | ||
362 | * @param session the session | ||
363 | * @return the network type | ||
364 | */ | ||
365 | static enum GNUNET_ATS_Network_Type | ||
366 | xu_plugin_get_network (void *cls, | ||
367 | struct GNUNET_ATS_Session *session) | ||
368 | { | ||
369 | (void) cls; | ||
370 | return session->scope; | ||
371 | } | ||
372 | |||
373 | |||
374 | /** | ||
375 | * Function obtain the network type for an address. | ||
376 | * | ||
377 | * @param cls closure (`struct Plugin *`) | ||
378 | * @param address the address | ||
379 | * @return the network type | ||
380 | */ | ||
381 | static enum GNUNET_ATS_Network_Type | ||
382 | xu_plugin_get_network_for_address (void *cls, | ||
383 | const struct GNUNET_HELLO_Address *address) | ||
384 | { | ||
385 | struct Plugin *plugin = cls; | ||
386 | size_t addrlen; | ||
387 | struct sockaddr_in a4; | ||
388 | struct sockaddr_in6 a6; | ||
389 | const struct IPv4XuAddress *u4; | ||
390 | const struct IPv6XuAddress *u6; | ||
391 | const void *sb; | ||
392 | size_t sbs; | ||
393 | |||
394 | addrlen = address->address_length; | ||
395 | if (addrlen == sizeof(struct IPv6XuAddress)) | ||
396 | { | ||
397 | GNUNET_assert (NULL != address->address); /* make static analysis happy */ | ||
398 | u6 = address->address; | ||
399 | memset (&a6, 0, sizeof(a6)); | ||
400 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
401 | a6.sin6_len = sizeof (a6); | ||
402 | #endif | ||
403 | a6.sin6_family = AF_INET6; | ||
404 | a6.sin6_port = u6->u6_port; | ||
405 | GNUNET_memcpy (&a6.sin6_addr, &u6->ipv6_addr, sizeof(struct in6_addr)); | ||
406 | sb = &a6; | ||
407 | sbs = sizeof(a6); | ||
408 | } | ||
409 | else if (addrlen == sizeof(struct IPv4XuAddress)) | ||
410 | { | ||
411 | GNUNET_assert (NULL != address->address); /* make static analysis happy */ | ||
412 | u4 = address->address; | ||
413 | memset (&a4, 0, sizeof(a4)); | ||
414 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
415 | a4.sin_len = sizeof (a4); | ||
416 | #endif | ||
417 | a4.sin_family = AF_INET; | ||
418 | a4.sin_port = u4->u4_port; | ||
419 | a4.sin_addr.s_addr = u4->ipv4_addr; | ||
420 | sb = &a4; | ||
421 | sbs = sizeof(a4); | ||
422 | } | ||
423 | else | ||
424 | { | ||
425 | GNUNET_break (0); | ||
426 | return GNUNET_ATS_NET_UNSPECIFIED; | ||
427 | } | ||
428 | return plugin->env->get_address_type (plugin->env->cls, | ||
429 | sb, | ||
430 | sbs); | ||
431 | } | ||
432 | |||
433 | |||
434 | /* ******************* Event loop ******************** */ | ||
435 | |||
436 | /** | ||
437 | * We have been notified that our readset has something to read. We don't | ||
438 | * know which socket needs to be read, so we have to check each one | ||
439 | * Then reschedule this function to be called again once more is available. | ||
440 | * | ||
441 | * @param cls the plugin handle | ||
442 | */ | ||
443 | static void | ||
444 | xu_plugin_select_v4 (void *cls); | ||
445 | |||
446 | |||
447 | /** | ||
448 | * We have been notified that our readset has something to read. We don't | ||
449 | * know which socket needs to be read, so we have to check each one | ||
450 | * Then reschedule this function to be called again once more is available. | ||
451 | * | ||
452 | * @param cls the plugin handle | ||
453 | */ | ||
454 | static void | ||
455 | xu_plugin_select_v6 (void *cls); | ||
456 | |||
457 | |||
458 | /** | ||
459 | * (re)schedule IPv4-select tasks for this plugin. | ||
460 | * | ||
461 | * @param plugin plugin to reschedule | ||
462 | */ | ||
463 | static void | ||
464 | schedule_select_v4 (struct Plugin *plugin) | ||
465 | { | ||
466 | if ( (GNUNET_YES != plugin->enable_ipv4) || | ||
467 | (NULL == plugin->sockv4) ) | ||
468 | return; | ||
469 | if (NULL != plugin->select_task_v4) | ||
470 | GNUNET_SCHEDULER_cancel (plugin->select_task_v4); | ||
471 | plugin->select_task_v4 | ||
472 | = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, | ||
473 | plugin->sockv4, | ||
474 | &xu_plugin_select_v4, | ||
475 | plugin); | ||
476 | } | ||
477 | |||
478 | |||
479 | /** | ||
480 | * (re)schedule IPv6-select tasks for this plugin. | ||
481 | * | ||
482 | * @param plugin plugin to reschedule | ||
483 | */ | ||
484 | static void | ||
485 | schedule_select_v6 (struct Plugin *plugin) | ||
486 | { | ||
487 | if ( (GNUNET_YES != plugin->enable_ipv6) || | ||
488 | (NULL == plugin->sockv6) ) | ||
489 | return; | ||
490 | if (NULL != plugin->select_task_v6) | ||
491 | GNUNET_SCHEDULER_cancel (plugin->select_task_v6); | ||
492 | plugin->select_task_v6 | ||
493 | = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, | ||
494 | plugin->sockv6, | ||
495 | &xu_plugin_select_v6, | ||
496 | plugin); | ||
497 | } | ||
498 | |||
499 | |||
500 | /* ******************* Address to string and back ***************** */ | ||
501 | |||
502 | |||
503 | /** | ||
504 | * Function called for a quick conversion of the binary address to | ||
505 | * a numeric address. Note that the caller must not free the | ||
506 | * address and that the next call to this function is allowed | ||
507 | * to override the address again. | ||
508 | * | ||
509 | * @param cls closure | ||
510 | * @param addr binary address (a `union XuAddress`) | ||
511 | * @param addrlen length of the @a addr | ||
512 | * @return string representing the same address | ||
513 | */ | ||
514 | const char * | ||
515 | xu_address_to_string (void *cls, | ||
516 | const void *addr, | ||
517 | size_t addrlen) | ||
518 | { | ||
519 | static char rbuf[INET6_ADDRSTRLEN + 10]; | ||
520 | char buf[INET6_ADDRSTRLEN]; | ||
521 | const void *sb; | ||
522 | struct in_addr a4; | ||
523 | struct in6_addr a6; | ||
524 | const struct IPv4XuAddress *t4; | ||
525 | const struct IPv6XuAddress *t6; | ||
526 | int af; | ||
527 | uint16_t port; | ||
528 | uint32_t options; | ||
529 | |||
530 | (void) cls; | ||
531 | if (NULL == addr) | ||
532 | { | ||
533 | GNUNET_break_op (0); | ||
534 | return NULL; | ||
535 | } | ||
536 | |||
537 | if (addrlen == sizeof(struct IPv6XuAddress)) | ||
538 | { | ||
539 | t6 = addr; | ||
540 | af = AF_INET6; | ||
541 | options = ntohl (t6->options); | ||
542 | port = ntohs (t6->u6_port); | ||
543 | a6 = t6->ipv6_addr; | ||
544 | sb = &a6; | ||
545 | } | ||
546 | else if (addrlen == sizeof(struct IPv4XuAddress)) | ||
547 | { | ||
548 | t4 = addr; | ||
549 | af = AF_INET; | ||
550 | options = ntohl (t4->options); | ||
551 | port = ntohs (t4->u4_port); | ||
552 | a4.s_addr = t4->ipv4_addr; | ||
553 | sb = &a4; | ||
554 | } | ||
555 | else | ||
556 | { | ||
557 | GNUNET_break_op (0); | ||
558 | return NULL; | ||
559 | } | ||
560 | inet_ntop (af, | ||
561 | sb, | ||
562 | buf, | ||
563 | INET6_ADDRSTRLEN); | ||
564 | GNUNET_snprintf (rbuf, | ||
565 | sizeof(rbuf), | ||
566 | (af == AF_INET6) | ||
567 | ? "%s.%u.[%s]:%u" | ||
568 | : "%s.%u.%s:%u", | ||
569 | PLUGIN_NAME, | ||
570 | options, | ||
571 | buf, | ||
572 | port); | ||
573 | return rbuf; | ||
574 | } | ||
575 | |||
576 | |||
577 | /** | ||
578 | * Function called to convert a string address to a binary address. | ||
579 | * | ||
580 | * @param cls closure (`struct Plugin *`) | ||
581 | * @param addr string address | ||
582 | * @param addrlen length of the address | ||
583 | * @param buf location to store the buffer | ||
584 | * @param added location to store the number of bytes in the buffer. | ||
585 | * If the function returns #GNUNET_SYSERR, its contents are undefined. | ||
586 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
587 | */ | ||
588 | static int | ||
589 | xu_string_to_address (void *cls, | ||
590 | const char *addr, | ||
591 | uint16_t addrlen, | ||
592 | void **buf, | ||
593 | size_t *added) | ||
594 | { | ||
595 | struct sockaddr_storage socket_address; | ||
596 | char *address; | ||
597 | char *plugin; | ||
598 | char *optionstr; | ||
599 | uint32_t options; | ||
600 | |||
601 | (void) cls; | ||
602 | /* Format tcp.options.address:port */ | ||
603 | address = NULL; | ||
604 | plugin = NULL; | ||
605 | optionstr = NULL; | ||
606 | |||
607 | if ((NULL == addr) || (0 == addrlen)) | ||
608 | { | ||
609 | GNUNET_break (0); | ||
610 | return GNUNET_SYSERR; | ||
611 | } | ||
612 | if ('\0' != addr[addrlen - 1]) | ||
613 | { | ||
614 | GNUNET_break (0); | ||
615 | return GNUNET_SYSERR; | ||
616 | } | ||
617 | if (strlen (addr) + 1 != (size_t) addrlen) | ||
618 | { | ||
619 | GNUNET_break (0); | ||
620 | return GNUNET_SYSERR; | ||
621 | } | ||
622 | plugin = GNUNET_strdup (addr); | ||
623 | optionstr = strchr (plugin, '.'); | ||
624 | if (NULL == optionstr) | ||
625 | { | ||
626 | GNUNET_break (0); | ||
627 | GNUNET_free (plugin); | ||
628 | return GNUNET_SYSERR; | ||
629 | } | ||
630 | optionstr[0] = '\0'; | ||
631 | optionstr++; | ||
632 | options = atol (optionstr); | ||
633 | address = strchr (optionstr, '.'); | ||
634 | if (NULL == address) | ||
635 | { | ||
636 | GNUNET_break (0); | ||
637 | GNUNET_free (plugin); | ||
638 | return GNUNET_SYSERR; | ||
639 | } | ||
640 | address[0] = '\0'; | ||
641 | address++; | ||
642 | |||
643 | if (GNUNET_OK != | ||
644 | GNUNET_STRINGS_to_address_ip (address, | ||
645 | strlen (address), | ||
646 | &socket_address)) | ||
647 | { | ||
648 | GNUNET_break (0); | ||
649 | GNUNET_free (plugin); | ||
650 | return GNUNET_SYSERR; | ||
651 | } | ||
652 | GNUNET_free(plugin); | ||
653 | |||
654 | switch (socket_address.ss_family) | ||
655 | { | ||
656 | case AF_INET: | ||
657 | { | ||
658 | struct IPv4XuAddress *u4; | ||
659 | const struct sockaddr_in *in4 = (const struct sockaddr_in *) &socket_address; | ||
660 | |||
661 | u4 = GNUNET_new (struct IPv4XuAddress); | ||
662 | u4->options = htonl (options); | ||
663 | u4->ipv4_addr = in4->sin_addr.s_addr; | ||
664 | u4->u4_port = in4->sin_port; | ||
665 | *buf = u4; | ||
666 | *added = sizeof (struct IPv4XuAddress); | ||
667 | return GNUNET_OK; | ||
668 | } | ||
669 | case AF_INET6: | ||
670 | { | ||
671 | struct IPv6XuAddress *u6; | ||
672 | const struct sockaddr_in6 *in6 = (const struct sockaddr_in6 *) &socket_address; | ||
673 | |||
674 | u6 = GNUNET_new (struct IPv6XuAddress); | ||
675 | u6->options = htonl (options); | ||
676 | u6->ipv6_addr = in6->sin6_addr; | ||
677 | u6->u6_port = in6->sin6_port; | ||
678 | *buf = u6; | ||
679 | *added = sizeof (struct IPv6XuAddress); | ||
680 | return GNUNET_OK; | ||
681 | } | ||
682 | default: | ||
683 | GNUNET_break (0); | ||
684 | return GNUNET_SYSERR; | ||
685 | } | ||
686 | } | ||
687 | |||
688 | |||
689 | /** | ||
690 | * Append our port and forward the result. | ||
691 | * | ||
692 | * @param cls a `struct PrettyPrinterContext *` | ||
693 | * @param hostname result from DNS resolver | ||
694 | */ | ||
695 | static void | ||
696 | append_port (void *cls, | ||
697 | const char *hostname) | ||
698 | { | ||
699 | struct PrettyPrinterContext *ppc = cls; | ||
700 | struct Plugin *plugin = ppc->plugin; | ||
701 | char *ret; | ||
702 | |||
703 | if (NULL == hostname) | ||
704 | { | ||
705 | /* Final call, done */ | ||
706 | GNUNET_CONTAINER_DLL_remove (plugin->ppc_dll_head, | ||
707 | plugin->ppc_dll_tail, | ||
708 | ppc); | ||
709 | ppc->resolver_handle = NULL; | ||
710 | ppc->asc (ppc->asc_cls, | ||
711 | NULL, | ||
712 | GNUNET_OK); | ||
713 | GNUNET_free (ppc); | ||
714 | return; | ||
715 | } | ||
716 | if (GNUNET_YES == ppc->ipv6) | ||
717 | GNUNET_asprintf (&ret, | ||
718 | "%s.%u.[%s]:%d", | ||
719 | PLUGIN_NAME, | ||
720 | ppc->options, | ||
721 | hostname, | ||
722 | ppc->port); | ||
723 | else | ||
724 | GNUNET_asprintf (&ret, | ||
725 | "%s.%u.%s:%d", | ||
726 | PLUGIN_NAME, | ||
727 | ppc->options, | ||
728 | hostname, | ||
729 | ppc->port); | ||
730 | ppc->asc (ppc->asc_cls, | ||
731 | ret, | ||
732 | GNUNET_OK); | ||
733 | GNUNET_free (ret); | ||
734 | } | ||
735 | |||
736 | |||
737 | /** | ||
738 | * Convert the transports address to a nice, human-readable format. | ||
739 | * | ||
740 | * @param cls closure with the `struct Plugin *` | ||
741 | * @param type name of the transport that generated the address | ||
742 | * @param addr one of the addresses of the host, NULL for the last address | ||
743 | * the specific address format depends on the transport; | ||
744 | * a `union XuAddress` | ||
745 | * @param addrlen length of the address | ||
746 | * @param numeric should (IP) addresses be displayed in numeric form? | ||
747 | * @param timeout after how long should we give up? | ||
748 | * @param asc function to call on each string | ||
749 | * @param asc_cls closure for @a asc | ||
750 | */ | ||
751 | static void | ||
752 | xu_plugin_address_pretty_printer (void *cls, | ||
753 | const char *type, | ||
754 | const void *addr, | ||
755 | size_t addrlen, | ||
756 | int numeric, | ||
757 | struct GNUNET_TIME_Relative timeout, | ||
758 | GNUNET_TRANSPORT_AddressStringCallback asc, | ||
759 | void *asc_cls) | ||
760 | { | ||
761 | struct Plugin *plugin = cls; | ||
762 | struct PrettyPrinterContext *ppc; | ||
763 | const struct sockaddr *sb; | ||
764 | size_t sbs; | ||
765 | struct sockaddr_in a4; | ||
766 | struct sockaddr_in6 a6; | ||
767 | const struct IPv4XuAddress *u4; | ||
768 | const struct IPv6XuAddress *u6; | ||
769 | uint16_t port; | ||
770 | uint32_t options; | ||
771 | |||
772 | (void) type; | ||
773 | if (addrlen == sizeof(struct IPv6XuAddress)) | ||
774 | { | ||
775 | u6 = addr; | ||
776 | memset (&a6, | ||
777 | 0, | ||
778 | sizeof (a6)); | ||
779 | a6.sin6_family = AF_INET6; | ||
780 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
781 | a6.sin6_len = sizeof (a6); | ||
782 | #endif | ||
783 | a6.sin6_port = u6->u6_port; | ||
784 | a6.sin6_addr = u6->ipv6_addr; | ||
785 | port = ntohs (u6->u6_port); | ||
786 | options = ntohl (u6->options); | ||
787 | sb = (const struct sockaddr *) &a6; | ||
788 | sbs = sizeof (a6); | ||
789 | } | ||
790 | else if (addrlen == sizeof (struct IPv4XuAddress)) | ||
791 | { | ||
792 | u4 = addr; | ||
793 | memset (&a4, | ||
794 | 0, | ||
795 | sizeof(a4)); | ||
796 | a4.sin_family = AF_INET; | ||
797 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
798 | a4.sin_len = sizeof (a4); | ||
799 | #endif | ||
800 | a4.sin_port = u4->u4_port; | ||
801 | a4.sin_addr.s_addr = u4->ipv4_addr; | ||
802 | port = ntohs (u4->u4_port); | ||
803 | options = ntohl (u4->options); | ||
804 | sb = (const struct sockaddr *) &a4; | ||
805 | sbs = sizeof(a4); | ||
806 | } | ||
807 | else | ||
808 | { | ||
809 | /* invalid address */ | ||
810 | GNUNET_break_op (0); | ||
811 | asc (asc_cls, | ||
812 | NULL, | ||
813 | GNUNET_SYSERR); | ||
814 | asc (asc_cls, | ||
815 | NULL, | ||
816 | GNUNET_OK); | ||
817 | return; | ||
818 | } | ||
819 | ppc = GNUNET_new (struct PrettyPrinterContext); | ||
820 | ppc->plugin = plugin; | ||
821 | ppc->asc = asc; | ||
822 | ppc->asc_cls = asc_cls; | ||
823 | ppc->port = port; | ||
824 | ppc->options = options; | ||
825 | if (addrlen == sizeof (struct IPv6XuAddress)) | ||
826 | ppc->ipv6 = GNUNET_YES; | ||
827 | else | ||
828 | ppc->ipv6 = GNUNET_NO; | ||
829 | GNUNET_CONTAINER_DLL_insert (plugin->ppc_dll_head, | ||
830 | plugin->ppc_dll_tail, | ||
831 | ppc); | ||
832 | ppc->resolver_handle | ||
833 | = GNUNET_RESOLVER_hostname_get (sb, | ||
834 | sbs, | ||
835 | ! numeric, | ||
836 | timeout, | ||
837 | &append_port, | ||
838 | ppc); | ||
839 | } | ||
840 | |||
841 | |||
842 | /** | ||
843 | * Check if the given port is plausible (must be either our listen | ||
844 | * port or our advertised port). If it is neither, we return | ||
845 | * #GNUNET_SYSERR. | ||
846 | * | ||
847 | * @param plugin global variables | ||
848 | * @param in_port port number to check | ||
849 | * @return #GNUNET_OK if port is either our open or advertised port | ||
850 | */ | ||
851 | static int | ||
852 | check_port (const struct Plugin *plugin, | ||
853 | uint16_t in_port) | ||
854 | { | ||
855 | if ( (plugin->port == in_port) || | ||
856 | (plugin->aport == in_port) ) | ||
857 | return GNUNET_OK; | ||
858 | return GNUNET_SYSERR; | ||
859 | } | ||
860 | |||
861 | |||
862 | /** | ||
863 | * Function that will be called to check if a binary address for this | ||
864 | * plugin is well-formed and corresponds to an address for THIS peer | ||
865 | * (as per our configuration). Naturally, if absolutely necessary, | ||
866 | * plugins can be a bit conservative in their answer, but in general | ||
867 | * plugins should make sure that the address does not redirect | ||
868 | * traffic to a 3rd party that might try to man-in-the-middle our | ||
869 | * traffic. | ||
870 | * | ||
871 | * @param cls closure, should be our handle to the Plugin | ||
872 | * @param addr pointer to a `union XuAddress` | ||
873 | * @param addrlen length of @a addr | ||
874 | * @return #GNUNET_OK if this is a plausible address for this peer | ||
875 | * and transport, #GNUNET_SYSERR if not | ||
876 | */ | ||
877 | static int | ||
878 | xu_plugin_check_address (void *cls, | ||
879 | const void *addr, | ||
880 | size_t addrlen) | ||
881 | { | ||
882 | struct Plugin *plugin = cls; | ||
883 | const struct IPv4XuAddress *v4; | ||
884 | const struct IPv6XuAddress *v6; | ||
885 | |||
886 | if (sizeof(struct IPv4XuAddress) == addrlen) | ||
887 | { | ||
888 | struct sockaddr_in s4; | ||
889 | |||
890 | v4 = (const struct IPv4XuAddress *) addr; | ||
891 | if (GNUNET_OK != check_port (plugin, | ||
892 | ntohs (v4->u4_port))) | ||
893 | return GNUNET_SYSERR; | ||
894 | memset (&s4, 0, sizeof (s4)); | ||
895 | s4.sin_family = AF_INET; | ||
896 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
897 | s4.sin_len = sizeof (s4); | ||
898 | #endif | ||
899 | s4.sin_port = v4->u4_port; | ||
900 | s4.sin_addr.s_addr = v4->ipv4_addr; | ||
901 | |||
902 | if (GNUNET_OK != | ||
903 | GNUNET_NAT_test_address (plugin->nat, | ||
904 | &s4, | ||
905 | sizeof (struct sockaddr_in))) | ||
906 | return GNUNET_SYSERR; | ||
907 | } | ||
908 | else if (sizeof(struct IPv6XuAddress) == addrlen) | ||
909 | { | ||
910 | struct sockaddr_in6 s6; | ||
911 | |||
912 | v6 = (const struct IPv6XuAddress *) addr; | ||
913 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) | ||
914 | return GNUNET_OK; /* plausible, if unlikely... */ | ||
915 | memset (&s6, 0, sizeof (s6)); | ||
916 | s6.sin6_family = AF_INET6; | ||
917 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
918 | s6.sin6_len = sizeof (s6); | ||
919 | #endif | ||
920 | s6.sin6_port = v6->u6_port; | ||
921 | s6.sin6_addr = v6->ipv6_addr; | ||
922 | |||
923 | if (GNUNET_OK != | ||
924 | GNUNET_NAT_test_address (plugin->nat, | ||
925 | &s6, | ||
926 | sizeof(struct sockaddr_in6))) | ||
927 | return GNUNET_SYSERR; | ||
928 | } | ||
929 | else | ||
930 | { | ||
931 | GNUNET_break_op (0); | ||
932 | return GNUNET_SYSERR; | ||
933 | } | ||
934 | return GNUNET_OK; | ||
935 | } | ||
936 | |||
937 | |||
938 | /** | ||
939 | * Our external IP address/port mapping has changed. | ||
940 | * | ||
941 | * @param cls closure, the `struct Plugin` | ||
942 | * @param add_remove #GNUNET_YES to mean the new public IP address, | ||
943 | * #GNUNET_NO to mean the previous (now invalid) one | ||
944 | * @param ac address class the address belongs to | ||
945 | * @param addr either the previous or the new public IP address | ||
946 | * @param addrlen actual length of the @a addr | ||
947 | */ | ||
948 | static void | ||
949 | xu_nat_port_map_callback (void *cls, | ||
950 | int add_remove, | ||
951 | enum GNUNET_NAT_AddressClass ac, | ||
952 | const struct sockaddr *addr, | ||
953 | socklen_t addrlen) | ||
954 | { | ||
955 | struct Plugin *plugin = cls; | ||
956 | struct GNUNET_HELLO_Address *address; | ||
957 | struct IPv4XuAddress u4; | ||
958 | struct IPv6XuAddress u6; | ||
959 | void *arg; | ||
960 | size_t args; | ||
961 | |||
962 | if (GNUNET_NAT_AC_LOOPBACK == ac) | ||
963 | return; | ||
964 | if (GNUNET_NAT_AC_LAN == ac) | ||
965 | return; | ||
966 | if (GNUNET_NAT_AC_LAN_PRIVATE == ac) | ||
967 | return; | ||
968 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
969 | (GNUNET_YES == add_remove) | ||
970 | ? "NAT notification to add address `%s'\n" | ||
971 | : "NAT notification to remove address `%s'\n", | ||
972 | GNUNET_a2s (addr, | ||
973 | addrlen)); | ||
974 | /* convert 'address' to our internal format */ | ||
975 | switch (addr->sa_family) | ||
976 | { | ||
977 | case AF_INET: | ||
978 | { | ||
979 | const struct sockaddr_in *i4; | ||
980 | |||
981 | GNUNET_assert (sizeof(struct sockaddr_in) == addrlen); | ||
982 | i4 = (const struct sockaddr_in *) addr; | ||
983 | if (0 == ntohs (i4->sin_port)) | ||
984 | return; /* Port = 0 means unmapped, ignore these for XU. */ | ||
985 | memset (&u4, | ||
986 | 0, | ||
987 | sizeof(u4)); | ||
988 | u4.options = htonl (plugin->myoptions); | ||
989 | u4.ipv4_addr = i4->sin_addr.s_addr; | ||
990 | u4.u4_port = i4->sin_port; | ||
991 | arg = &u4; | ||
992 | args = sizeof (struct IPv4XuAddress); | ||
993 | break; | ||
994 | } | ||
995 | case AF_INET6: | ||
996 | { | ||
997 | const struct sockaddr_in6 *i6; | ||
998 | |||
999 | GNUNET_assert (sizeof(struct sockaddr_in6) == addrlen); | ||
1000 | i6 = (const struct sockaddr_in6 *) addr; | ||
1001 | if (0 == ntohs (i6->sin6_port)) | ||
1002 | return; /* Port = 0 means unmapped, ignore these for XU. */ | ||
1003 | memset (&u6, | ||
1004 | 0, | ||
1005 | sizeof(u6)); | ||
1006 | u6.options = htonl (plugin->myoptions); | ||
1007 | u6.ipv6_addr = i6->sin6_addr; | ||
1008 | u6.u6_port = i6->sin6_port; | ||
1009 | arg = &u6; | ||
1010 | args = sizeof (struct IPv6XuAddress); | ||
1011 | break; | ||
1012 | } | ||
1013 | default: | ||
1014 | GNUNET_break (0); | ||
1015 | return; | ||
1016 | } | ||
1017 | /* modify our published address list */ | ||
1018 | /* TODO: use 'ac' here in the future... */ | ||
1019 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, | ||
1020 | PLUGIN_NAME, | ||
1021 | arg, | ||
1022 | args, | ||
1023 | GNUNET_HELLO_ADDRESS_INFO_NONE); | ||
1024 | plugin->env->notify_address (plugin->env->cls, | ||
1025 | add_remove, | ||
1026 | address); | ||
1027 | GNUNET_HELLO_address_free (address); | ||
1028 | } | ||
1029 | |||
1030 | |||
1031 | /* ********************* Finding sessions ******************* */ | ||
1032 | |||
1033 | |||
1034 | /** | ||
1035 | * Closure for #session_cmp_it(). | ||
1036 | */ | ||
1037 | struct GNUNET_ATS_SessionCompareContext | ||
1038 | { | ||
1039 | /** | ||
1040 | * Set to session matching the address. | ||
1041 | */ | ||
1042 | struct GNUNET_ATS_Session *res; | ||
1043 | |||
1044 | /** | ||
1045 | * Address we are looking for. | ||
1046 | */ | ||
1047 | const struct GNUNET_HELLO_Address *address; | ||
1048 | }; | ||
1049 | |||
1050 | |||
1051 | /** | ||
1052 | * Find a session with a matching address. | ||
1053 | * | ||
1054 | * @param cls the `struct GNUNET_ATS_SessionCompareContext *` | ||
1055 | * @param key peer identity (unused) | ||
1056 | * @param value the `struct GNUNET_ATS_Session *` | ||
1057 | * @return #GNUNET_NO if we found the session, #GNUNET_OK if not | ||
1058 | */ | ||
1059 | static int | ||
1060 | session_cmp_it (void *cls, | ||
1061 | const struct GNUNET_PeerIdentity *key, | ||
1062 | void *value) | ||
1063 | { | ||
1064 | struct GNUNET_ATS_SessionCompareContext *cctx = cls; | ||
1065 | struct GNUNET_ATS_Session *s = value; | ||
1066 | |||
1067 | (void) key; | ||
1068 | if (0 == GNUNET_HELLO_address_cmp (s->address, | ||
1069 | cctx->address)) | ||
1070 | { | ||
1071 | GNUNET_assert (GNUNET_NO == s->in_destroy); | ||
1072 | cctx->res = s; | ||
1073 | return GNUNET_NO; | ||
1074 | } | ||
1075 | return GNUNET_OK; | ||
1076 | } | ||
1077 | |||
1078 | |||
1079 | /** | ||
1080 | * Locate an existing session the transport service is using to | ||
1081 | * send data to another peer. Performs some basic sanity checks | ||
1082 | * on the address and then tries to locate a matching session. | ||
1083 | * | ||
1084 | * @param cls the plugin | ||
1085 | * @param address the address we should locate the session by | ||
1086 | * @return the session if it exists, or NULL if it is not found | ||
1087 | */ | ||
1088 | static struct GNUNET_ATS_Session * | ||
1089 | xu_plugin_lookup_session (void *cls, | ||
1090 | const struct GNUNET_HELLO_Address *address) | ||
1091 | { | ||
1092 | struct Plugin *plugin = cls; | ||
1093 | const struct IPv6XuAddress *xu_a6; | ||
1094 | const struct IPv4XuAddress *xu_a4; | ||
1095 | struct GNUNET_ATS_SessionCompareContext cctx; | ||
1096 | |||
1097 | if (NULL == address->address) | ||
1098 | { | ||
1099 | GNUNET_break (0); | ||
1100 | return NULL; | ||
1101 | } | ||
1102 | if (sizeof(struct IPv4XuAddress) == address->address_length) | ||
1103 | { | ||
1104 | if (NULL == plugin->sockv4) | ||
1105 | return NULL; | ||
1106 | xu_a4 = (const struct IPv4XuAddress *) address->address; | ||
1107 | if (0 == xu_a4->u4_port) | ||
1108 | { | ||
1109 | GNUNET_break (0); | ||
1110 | return NULL; | ||
1111 | } | ||
1112 | } | ||
1113 | else if (sizeof(struct IPv6XuAddress) == address->address_length) | ||
1114 | { | ||
1115 | if (NULL == plugin->sockv6) | ||
1116 | return NULL; | ||
1117 | xu_a6 = (const struct IPv6XuAddress *) address->address; | ||
1118 | if (0 == xu_a6->u6_port) | ||
1119 | { | ||
1120 | GNUNET_break (0); | ||
1121 | return NULL; | ||
1122 | } | ||
1123 | } | ||
1124 | else | ||
1125 | { | ||
1126 | GNUNET_break (0); | ||
1127 | return NULL; | ||
1128 | } | ||
1129 | |||
1130 | /* check if session already exists */ | ||
1131 | cctx.address = address; | ||
1132 | cctx.res = NULL; | ||
1133 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1134 | "Looking for existing session for peer `%s' with address `%s'\n", | ||
1135 | GNUNET_i2s (&address->peer), | ||
1136 | xu_address_to_string (plugin, | ||
1137 | address->address, | ||
1138 | address->address_length)); | ||
1139 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions, | ||
1140 | &address->peer, | ||
1141 | &session_cmp_it, | ||
1142 | &cctx); | ||
1143 | if (NULL == cctx.res) | ||
1144 | return NULL; | ||
1145 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1146 | "Found existing session %p\n", | ||
1147 | cctx.res); | ||
1148 | return cctx.res; | ||
1149 | } | ||
1150 | |||
1151 | |||
1152 | /* ********************** Timeout ****************** */ | ||
1153 | |||
1154 | |||
1155 | /** | ||
1156 | * Increment session timeout due to activity. | ||
1157 | * | ||
1158 | * @param s session to reschedule timeout activity for | ||
1159 | */ | ||
1160 | static void | ||
1161 | reschedule_session_timeout (struct GNUNET_ATS_Session *s) | ||
1162 | { | ||
1163 | if (GNUNET_YES == s->in_destroy) | ||
1164 | return; | ||
1165 | GNUNET_assert (NULL != s->timeout_task); | ||
1166 | s->timeout = GNUNET_TIME_relative_to_absolute (XU_SESSION_TIME_OUT); | ||
1167 | } | ||
1168 | |||
1169 | |||
1170 | |||
1171 | /** | ||
1172 | * Function that will be called whenever the transport service wants to | ||
1173 | * notify the plugin that a session is still active and in use and | ||
1174 | * therefore the session timeout for this session has to be updated | ||
1175 | * | ||
1176 | * @param cls closure with the `struct Plugin` | ||
1177 | * @param peer which peer was the session for | ||
1178 | * @param session which session is being updated | ||
1179 | */ | ||
1180 | static void | ||
1181 | xu_plugin_update_session_timeout (void *cls, | ||
1182 | const struct GNUNET_PeerIdentity *peer, | ||
1183 | struct GNUNET_ATS_Session *session) | ||
1184 | { | ||
1185 | struct Plugin *plugin = cls; | ||
1186 | |||
1187 | if (GNUNET_YES != | ||
1188 | GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessions, | ||
1189 | peer, | ||
1190 | session)) | ||
1191 | { | ||
1192 | GNUNET_break (0); | ||
1193 | return; | ||
1194 | } | ||
1195 | /* Reschedule session timeout */ | ||
1196 | reschedule_session_timeout (session); | ||
1197 | } | ||
1198 | |||
1199 | |||
1200 | /* ************************* Sending ************************ */ | ||
1201 | |||
1202 | |||
1203 | /** | ||
1204 | * We failed to transmit a message via XU. Generate | ||
1205 | * a descriptive error message. | ||
1206 | * | ||
1207 | * @param plugin our plugin | ||
1208 | * @param sa target address we were trying to reach | ||
1209 | * @param slen number of bytes in @a sa | ||
1210 | * @param error the errno value returned from the sendto() call | ||
1211 | */ | ||
1212 | static void | ||
1213 | analyze_send_error (struct Plugin *plugin, | ||
1214 | const struct sockaddr *sa, | ||
1215 | socklen_t slen, | ||
1216 | int error) | ||
1217 | { | ||
1218 | enum GNUNET_ATS_Network_Type type; | ||
1219 | |||
1220 | type = plugin->env->get_address_type (plugin->env->cls, | ||
1221 | sa, | ||
1222 | slen); | ||
1223 | if ( ( (GNUNET_ATS_NET_LAN == type) || | ||
1224 | (GNUNET_ATS_NET_WAN == type) ) && | ||
1225 | ( (ENETUNREACH == errno) || | ||
1226 | (ENETDOWN == errno) ) ) | ||
1227 | { | ||
1228 | if (slen == sizeof (struct sockaddr_in)) | ||
1229 | { | ||
1230 | /* IPv4: "Network unreachable" or "Network down" | ||
1231 | * | ||
1232 | * This indicates we do not have connectivity | ||
1233 | */ | ||
1234 | LOG (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, | ||
1235 | _("XU could not transmit message to `%s': " | ||
1236 | "Network seems down, please check your network configuration\n"), | ||
1237 | GNUNET_a2s (sa, | ||
1238 | slen)); | ||
1239 | } | ||
1240 | if (slen == sizeof (struct sockaddr_in6)) | ||
1241 | { | ||
1242 | /* IPv6: "Network unreachable" or "Network down" | ||
1243 | * | ||
1244 | * This indicates that this system is IPv6 enabled, but does not | ||
1245 | * have a valid global IPv6 address assigned or we do not have | ||
1246 | * connectivity | ||
1247 | */ | ||
1248 | LOG (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, | ||
1249 | _("XU could not transmit IPv6 message! " | ||
1250 | "Please check your network configuration and disable IPv6 if your " | ||
1251 | "connection does not have a global IPv6 address\n")); | ||
1252 | } | ||
1253 | } | ||
1254 | else | ||
1255 | { | ||
1256 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1257 | "XU could not transmit message to `%s': `%s'\n", | ||
1258 | GNUNET_a2s (sa, | ||
1259 | slen), | ||
1260 | STRERROR (error)); | ||
1261 | } | ||
1262 | } | ||
1263 | |||
1264 | |||
1265 | |||
1266 | |||
1267 | /** | ||
1268 | * Function that can be used by the transport service to transmit a | ||
1269 | * message using the plugin. Note that in the case of a peer | ||
1270 | * disconnecting, the continuation MUST be called prior to the | ||
1271 | * disconnect notification itself. This function will be called with | ||
1272 | * this peer's HELLO message to initiate a fresh connection to another | ||
1273 | * peer. | ||
1274 | * | ||
1275 | * @param cls closure | ||
1276 | * @param s which session must be used | ||
1277 | * @param msgbuf the message to transmit | ||
1278 | * @param msgbuf_size number of bytes in @a msgbuf | ||
1279 | * @param priority how important is the message (most plugins will | ||
1280 | * ignore message priority and just FIFO) | ||
1281 | * @param to how long to wait at most for the transmission (does not | ||
1282 | * require plugins to discard the message after the timeout, | ||
1283 | * just advisory for the desired delay; most plugins will ignore | ||
1284 | * this as well) | ||
1285 | * @param cont continuation to call once the message has | ||
1286 | * been transmitted (or if the transport is ready | ||
1287 | * for the next transmission call; or if the | ||
1288 | * peer disconnected...); can be NULL | ||
1289 | * @param cont_cls closure for @a cont | ||
1290 | * @return number of bytes used (on the physical network, with overheads); | ||
1291 | * -1 on hard errors (i.e. address invalid); 0 is a legal value | ||
1292 | * and does NOT mean that the message was not transmitted (DV) | ||
1293 | */ | ||
1294 | static ssize_t | ||
1295 | xu_plugin_send (void *cls, | ||
1296 | struct GNUNET_ATS_Session *s, | ||
1297 | const char *msgbuf, | ||
1298 | size_t msgbuf_size, | ||
1299 | unsigned int priority, | ||
1300 | struct GNUNET_TIME_Relative to, | ||
1301 | GNUNET_TRANSPORT_TransmitContinuation cont, | ||
1302 | void *cont_cls) | ||
1303 | { | ||
1304 | struct Plugin *plugin = cls; | ||
1305 | size_t xumlen = msgbuf_size + sizeof(struct XUMessage); | ||
1306 | struct XUMessage *xu; | ||
1307 | char mbuf[xumlen] GNUNET_ALIGN; | ||
1308 | ssize_t sent; | ||
1309 | socklen_t slen; | ||
1310 | const struct sockaddr *a; | ||
1311 | const struct IPv4XuAddress *u4; | ||
1312 | struct sockaddr_in a4; | ||
1313 | const struct IPv6XuAddress *u6; | ||
1314 | struct sockaddr_in6 a6; | ||
1315 | struct GNUNET_NETWORK_Handle *sock; | ||
1316 | |||
1317 | (void) priority; | ||
1318 | (void) to; | ||
1319 | if ( (sizeof(struct IPv6XuAddress) == s->address->address_length) && | ||
1320 | (NULL == plugin->sockv6) ) | ||
1321 | return GNUNET_SYSERR; | ||
1322 | if ( (sizeof(struct IPv4XuAddress) == s->address->address_length) && | ||
1323 | (NULL == plugin->sockv4) ) | ||
1324 | return GNUNET_SYSERR; | ||
1325 | if (xumlen >= GNUNET_MAX_MESSAGE_SIZE) | ||
1326 | { | ||
1327 | GNUNET_break (0); | ||
1328 | return GNUNET_SYSERR; | ||
1329 | } | ||
1330 | if (GNUNET_YES != | ||
1331 | GNUNET_CONTAINER_multipeermap_contains_value (plugin->sessions, | ||
1332 | &s->target, | ||
1333 | s)) | ||
1334 | { | ||
1335 | GNUNET_break (0); | ||
1336 | return GNUNET_SYSERR; | ||
1337 | } | ||
1338 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1339 | "XU transmits %u-byte message to `%s' using address `%s'\n", | ||
1340 | xumlen, | ||
1341 | GNUNET_i2s (&s->target), | ||
1342 | xu_address_to_string (plugin, | ||
1343 | s->address->address, | ||
1344 | s->address->address_length)); | ||
1345 | xu = (struct XUMessage *) mbuf; | ||
1346 | xu->header.size = htons (xumlen); | ||
1347 | xu->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_XU_MESSAGE); | ||
1348 | xu->reserved = htonl (0); | ||
1349 | xu->sender = *plugin->env->my_identity; | ||
1350 | GNUNET_memcpy (&xu[1], | ||
1351 | msgbuf, | ||
1352 | msgbuf_size); | ||
1353 | |||
1354 | if (sizeof (struct IPv4XuAddress) == s->address->address_length) | ||
1355 | { | ||
1356 | u4 = s->address->address; | ||
1357 | memset (&a4, | ||
1358 | 0, | ||
1359 | sizeof(a4)); | ||
1360 | a4.sin_family = AF_INET; | ||
1361 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
1362 | a4.sin_len = sizeof (a4); | ||
1363 | #endif | ||
1364 | a4.sin_port = u4->u4_port; | ||
1365 | a4.sin_addr.s_addr = u4->ipv4_addr; | ||
1366 | a = (const struct sockaddr *) &a4; | ||
1367 | slen = sizeof (a4); | ||
1368 | sock = plugin->sockv4; | ||
1369 | } | ||
1370 | else if (sizeof (struct IPv6XuAddress) == s->address->address_length) | ||
1371 | { | ||
1372 | u6 = s->address->address; | ||
1373 | memset (&a6, | ||
1374 | 0, | ||
1375 | sizeof(a6)); | ||
1376 | a6.sin6_family = AF_INET6; | ||
1377 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
1378 | a6.sin6_len = sizeof (a6); | ||
1379 | #endif | ||
1380 | a6.sin6_port = u6->u6_port; | ||
1381 | a6.sin6_addr = u6->ipv6_addr; | ||
1382 | a = (const struct sockaddr *) &a6; | ||
1383 | slen = sizeof (a6); | ||
1384 | sock = plugin->sockv6; | ||
1385 | } | ||
1386 | else | ||
1387 | { | ||
1388 | GNUNET_break (0); | ||
1389 | return GNUNET_SYSERR; | ||
1390 | } | ||
1391 | |||
1392 | sent = GNUNET_NETWORK_socket_sendto (sock, | ||
1393 | mbuf, | ||
1394 | xumlen, | ||
1395 | a, | ||
1396 | slen); | ||
1397 | s->last_transmit_time | ||
1398 | = GNUNET_TIME_absolute_max (GNUNET_TIME_absolute_get (), | ||
1399 | s->last_transmit_time); | ||
1400 | |||
1401 | if (GNUNET_SYSERR == sent) | ||
1402 | { | ||
1403 | /* Failure */ | ||
1404 | analyze_send_error (plugin, | ||
1405 | a, | ||
1406 | slen, | ||
1407 | errno); | ||
1408 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1409 | "# XU, total, bytes, sent, failure", | ||
1410 | sent, | ||
1411 | GNUNET_NO); | ||
1412 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1413 | "# XU, total, messages, sent, failure", | ||
1414 | 1, | ||
1415 | GNUNET_NO); | ||
1416 | return GNUNET_SYSERR; | ||
1417 | } | ||
1418 | /* Success */ | ||
1419 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1420 | "XU transmitted %u-byte message to `%s' `%s' (%d: %s)\n", | ||
1421 | (unsigned int) (msgbuf_size), | ||
1422 | GNUNET_i2s (&s->target), | ||
1423 | GNUNET_a2s (a, | ||
1424 | slen), | ||
1425 | (int ) sent, | ||
1426 | (sent < 0) ? STRERROR (errno) : "ok"); | ||
1427 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1428 | "# XU, total, bytes, sent, success", | ||
1429 | sent, | ||
1430 | GNUNET_NO); | ||
1431 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1432 | "# XU, total, messages, sent, success", | ||
1433 | 1, | ||
1434 | GNUNET_NO); | ||
1435 | cont (cont_cls, | ||
1436 | &s->target, | ||
1437 | GNUNET_OK, | ||
1438 | msgbuf_size, | ||
1439 | xumlen); | ||
1440 | notify_session_monitor (s->plugin, | ||
1441 | s, | ||
1442 | GNUNET_TRANSPORT_SS_UPDATE); | ||
1443 | return xumlen; | ||
1444 | } | ||
1445 | |||
1446 | |||
1447 | /* ********************** Receiving ********************** */ | ||
1448 | |||
1449 | |||
1450 | /** | ||
1451 | * Functions with this signature are called whenever we need to close | ||
1452 | * a session due to a disconnect or failure to establish a connection. | ||
1453 | * | ||
1454 | * @param cls closure with the `struct Plugin` | ||
1455 | * @param s session to close down | ||
1456 | * @return #GNUNET_OK on success | ||
1457 | */ | ||
1458 | static int | ||
1459 | xu_disconnect_session (void *cls, | ||
1460 | struct GNUNET_ATS_Session *s) | ||
1461 | { | ||
1462 | struct Plugin *plugin = cls; | ||
1463 | |||
1464 | GNUNET_assert (GNUNET_YES != s->in_destroy); | ||
1465 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1466 | "Session %p to peer `%s' at address %s ended\n", | ||
1467 | s, | ||
1468 | GNUNET_i2s (&s->target), | ||
1469 | xu_address_to_string (plugin, | ||
1470 | s->address->address, | ||
1471 | s->address->address_length)); | ||
1472 | if (NULL != s->timeout_task) | ||
1473 | { | ||
1474 | GNUNET_SCHEDULER_cancel (s->timeout_task); | ||
1475 | s->timeout_task = NULL; | ||
1476 | } | ||
1477 | GNUNET_assert (GNUNET_YES == | ||
1478 | GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, | ||
1479 | &s->target, | ||
1480 | s)); | ||
1481 | s->in_destroy = GNUNET_YES; | ||
1482 | notify_session_monitor (s->plugin, | ||
1483 | s, | ||
1484 | GNUNET_TRANSPORT_SS_DONE); | ||
1485 | plugin->env->session_end (plugin->env->cls, | ||
1486 | s->address, | ||
1487 | s); | ||
1488 | GNUNET_STATISTICS_set (plugin->env->stats, | ||
1489 | "# XU sessions active", | ||
1490 | GNUNET_CONTAINER_multipeermap_size (plugin->sessions), | ||
1491 | GNUNET_NO); | ||
1492 | if (0 == s->rc) | ||
1493 | free_session (s); | ||
1494 | return GNUNET_OK; | ||
1495 | } | ||
1496 | |||
1497 | |||
1498 | /** | ||
1499 | * Message tokenizer has broken up an incomming message. Pass it on | ||
1500 | * to the service. | ||
1501 | * | ||
1502 | * @param cls the `struct GNUNET_ATS_Session *` | ||
1503 | * @param hdr the actual message | ||
1504 | * @return #GNUNET_OK (always) | ||
1505 | */ | ||
1506 | static int | ||
1507 | process_inbound_tokenized_messages (void *cls, | ||
1508 | const struct GNUNET_MessageHeader *hdr) | ||
1509 | { | ||
1510 | struct GNUNET_ATS_Session *session = cls; | ||
1511 | struct Plugin *plugin = session->plugin; | ||
1512 | |||
1513 | if (GNUNET_YES == session->in_destroy) | ||
1514 | return GNUNET_OK; | ||
1515 | reschedule_session_timeout (session); | ||
1516 | session->flow_delay_for_other_peer | ||
1517 | = plugin->env->receive (plugin->env->cls, | ||
1518 | session->address, | ||
1519 | session, | ||
1520 | hdr); | ||
1521 | return GNUNET_OK; | ||
1522 | } | ||
1523 | |||
1524 | |||
1525 | /** | ||
1526 | * Destroy a session, plugin is being unloaded. | ||
1527 | * | ||
1528 | * @param cls the `struct Plugin` | ||
1529 | * @param key hash of public key of target peer | ||
1530 | * @param value a `struct PeerSession *` to clean up | ||
1531 | * @return #GNUNET_OK (continue to iterate) | ||
1532 | */ | ||
1533 | static int | ||
1534 | disconnect_and_free_it (void *cls, | ||
1535 | const struct GNUNET_PeerIdentity *key, | ||
1536 | void *value) | ||
1537 | { | ||
1538 | struct Plugin *plugin = cls; | ||
1539 | |||
1540 | (void) key; | ||
1541 | xu_disconnect_session (plugin, | ||
1542 | value); | ||
1543 | return GNUNET_OK; | ||
1544 | } | ||
1545 | |||
1546 | |||
1547 | /** | ||
1548 | * Disconnect from a remote node. Clean up session if we have one for | ||
1549 | * this peer. | ||
1550 | * | ||
1551 | * @param cls closure for this call (should be handle to Plugin) | ||
1552 | * @param target the peeridentity of the peer to disconnect | ||
1553 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the operation failed | ||
1554 | */ | ||
1555 | static void | ||
1556 | xu_disconnect (void *cls, | ||
1557 | const struct GNUNET_PeerIdentity *target) | ||
1558 | { | ||
1559 | struct Plugin *plugin = cls; | ||
1560 | |||
1561 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1562 | "Disconnecting from peer `%s'\n", | ||
1563 | GNUNET_i2s (target)); | ||
1564 | GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions, | ||
1565 | target, | ||
1566 | &disconnect_and_free_it, | ||
1567 | plugin); | ||
1568 | } | ||
1569 | |||
1570 | |||
1571 | /** | ||
1572 | * Session was idle, so disconnect it. | ||
1573 | * | ||
1574 | * @param cls the `struct GNUNET_ATS_Session` to time out | ||
1575 | */ | ||
1576 | static void | ||
1577 | session_timeout (void *cls) | ||
1578 | { | ||
1579 | struct GNUNET_ATS_Session *s = cls; | ||
1580 | struct Plugin *plugin = s->plugin; | ||
1581 | struct GNUNET_TIME_Relative left; | ||
1582 | |||
1583 | s->timeout_task = NULL; | ||
1584 | left = GNUNET_TIME_absolute_get_remaining (s->timeout); | ||
1585 | if (left.rel_value_us > 0) | ||
1586 | { | ||
1587 | /* not actually our turn yet, but let's at least update | ||
1588 | the monitor, it may think we're about to die ... */ | ||
1589 | notify_session_monitor (s->plugin, | ||
1590 | s, | ||
1591 | GNUNET_TRANSPORT_SS_UPDATE); | ||
1592 | s->timeout_task = GNUNET_SCHEDULER_add_delayed (left, | ||
1593 | &session_timeout, | ||
1594 | s); | ||
1595 | return; | ||
1596 | } | ||
1597 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1598 | "Session %p was idle for %s, disconnecting\n", | ||
1599 | s, | ||
1600 | GNUNET_STRINGS_relative_time_to_string (XU_SESSION_TIME_OUT, | ||
1601 | GNUNET_YES)); | ||
1602 | /* call session destroy function */ | ||
1603 | xu_disconnect_session (plugin, | ||
1604 | s); | ||
1605 | } | ||
1606 | |||
1607 | |||
1608 | /** | ||
1609 | * Allocate a new session for the given endpoint address. | ||
1610 | * Note that this function does not inform the service | ||
1611 | * of the new session, this is the responsibility of the | ||
1612 | * caller (if needed). | ||
1613 | * | ||
1614 | * @param cls the `struct Plugin` | ||
1615 | * @param address address of the other peer to use | ||
1616 | * @param network_type network type the address belongs to | ||
1617 | * @return NULL on error, otherwise session handle | ||
1618 | */ | ||
1619 | static struct GNUNET_ATS_Session * | ||
1620 | xu_plugin_create_session (void *cls, | ||
1621 | const struct GNUNET_HELLO_Address *address, | ||
1622 | enum GNUNET_ATS_Network_Type network_type) | ||
1623 | { | ||
1624 | struct Plugin *plugin = cls; | ||
1625 | struct GNUNET_ATS_Session *s; | ||
1626 | |||
1627 | s = GNUNET_new (struct GNUNET_ATS_Session); | ||
1628 | s->mst = GNUNET_MST_create (&process_inbound_tokenized_messages, | ||
1629 | s); | ||
1630 | s->plugin = plugin; | ||
1631 | s->address = GNUNET_HELLO_address_copy (address); | ||
1632 | s->target = address->peer; | ||
1633 | s->last_transmit_time = GNUNET_TIME_absolute_get (); | ||
1634 | s->last_expected_ack_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, | ||
1635 | 250); | ||
1636 | s->last_expected_msg_delay = GNUNET_TIME_UNIT_MILLISECONDS; | ||
1637 | s->flow_delay_from_other_peer = GNUNET_TIME_UNIT_ZERO; | ||
1638 | s->flow_delay_for_other_peer = GNUNET_TIME_UNIT_ZERO; | ||
1639 | s->timeout = GNUNET_TIME_relative_to_absolute (XU_SESSION_TIME_OUT); | ||
1640 | s->timeout_task = GNUNET_SCHEDULER_add_delayed (XU_SESSION_TIME_OUT, | ||
1641 | &session_timeout, | ||
1642 | s); | ||
1643 | s->scope = network_type; | ||
1644 | |||
1645 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1646 | "Creating new session %p for peer `%s' address `%s'\n", | ||
1647 | s, | ||
1648 | GNUNET_i2s (&address->peer), | ||
1649 | xu_address_to_string (plugin, | ||
1650 | address->address, | ||
1651 | address->address_length)); | ||
1652 | GNUNET_assert (GNUNET_OK == | ||
1653 | GNUNET_CONTAINER_multipeermap_put (plugin->sessions, | ||
1654 | &s->target, | ||
1655 | s, | ||
1656 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); | ||
1657 | GNUNET_STATISTICS_set (plugin->env->stats, | ||
1658 | "# XU sessions active", | ||
1659 | GNUNET_CONTAINER_multipeermap_size (plugin->sessions), | ||
1660 | GNUNET_NO); | ||
1661 | notify_session_monitor (plugin, | ||
1662 | s, | ||
1663 | GNUNET_TRANSPORT_SS_INIT); | ||
1664 | return s; | ||
1665 | } | ||
1666 | |||
1667 | |||
1668 | /** | ||
1669 | * Creates a new outbound session the transport service will use to | ||
1670 | * send data to the peer. | ||
1671 | * | ||
1672 | * @param cls the `struct Plugin *` | ||
1673 | * @param address the address | ||
1674 | * @return the session or NULL of max connections exceeded | ||
1675 | */ | ||
1676 | static struct GNUNET_ATS_Session * | ||
1677 | xu_plugin_get_session (void *cls, | ||
1678 | const struct GNUNET_HELLO_Address *address) | ||
1679 | { | ||
1680 | struct Plugin *plugin = cls; | ||
1681 | struct GNUNET_ATS_Session *s; | ||
1682 | enum GNUNET_ATS_Network_Type network_type = GNUNET_ATS_NET_UNSPECIFIED; | ||
1683 | const struct IPv4XuAddress *xu_v4; | ||
1684 | const struct IPv6XuAddress *xu_v6; | ||
1685 | |||
1686 | if (NULL == address) | ||
1687 | { | ||
1688 | GNUNET_break (0); | ||
1689 | return NULL; | ||
1690 | } | ||
1691 | if ( (address->address_length != sizeof(struct IPv4XuAddress)) && | ||
1692 | (address->address_length != sizeof(struct IPv6XuAddress)) ) | ||
1693 | { | ||
1694 | GNUNET_break_op (0); | ||
1695 | return NULL; | ||
1696 | } | ||
1697 | if (NULL != (s = xu_plugin_lookup_session (cls, | ||
1698 | address))) | ||
1699 | return s; | ||
1700 | |||
1701 | /* need to create new session */ | ||
1702 | if (sizeof (struct IPv4XuAddress) == address->address_length) | ||
1703 | { | ||
1704 | struct sockaddr_in v4; | ||
1705 | |||
1706 | xu_v4 = (const struct IPv4XuAddress *) address->address; | ||
1707 | memset (&v4, '\0', sizeof (v4)); | ||
1708 | v4.sin_family = AF_INET; | ||
1709 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
1710 | v4.sin_len = sizeof (struct sockaddr_in); | ||
1711 | #endif | ||
1712 | v4.sin_port = xu_v4->u4_port; | ||
1713 | v4.sin_addr.s_addr = xu_v4->ipv4_addr; | ||
1714 | network_type = plugin->env->get_address_type (plugin->env->cls, | ||
1715 | (const struct sockaddr *) &v4, | ||
1716 | sizeof (v4)); | ||
1717 | } | ||
1718 | if (sizeof (struct IPv6XuAddress) == address->address_length) | ||
1719 | { | ||
1720 | struct sockaddr_in6 v6; | ||
1721 | |||
1722 | xu_v6 = (const struct IPv6XuAddress *) address->address; | ||
1723 | memset (&v6, '\0', sizeof (v6)); | ||
1724 | v6.sin6_family = AF_INET6; | ||
1725 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
1726 | v6.sin6_len = sizeof (struct sockaddr_in6); | ||
1727 | #endif | ||
1728 | v6.sin6_port = xu_v6->u6_port; | ||
1729 | v6.sin6_addr = xu_v6->ipv6_addr; | ||
1730 | network_type = plugin->env->get_address_type (plugin->env->cls, | ||
1731 | (const struct sockaddr *) &v6, | ||
1732 | sizeof (v6)); | ||
1733 | } | ||
1734 | GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != network_type); | ||
1735 | return xu_plugin_create_session (cls, | ||
1736 | address, | ||
1737 | network_type); | ||
1738 | } | ||
1739 | |||
1740 | |||
1741 | /** | ||
1742 | * We've received a XU Message. Process it (pass contents to main service). | ||
1743 | * | ||
1744 | * @param plugin plugin context | ||
1745 | * @param msg the message | ||
1746 | * @param xu_addr sender address | ||
1747 | * @param xu_addr_len number of bytes in @a xu_addr | ||
1748 | * @param network_type network type the address belongs to | ||
1749 | */ | ||
1750 | static void | ||
1751 | process_xu_message (struct Plugin *plugin, | ||
1752 | const struct XUMessage *msg, | ||
1753 | const union XuAddress *xu_addr, | ||
1754 | size_t xu_addr_len, | ||
1755 | enum GNUNET_ATS_Network_Type network_type) | ||
1756 | { | ||
1757 | struct GNUNET_ATS_Session *s; | ||
1758 | struct GNUNET_HELLO_Address *address; | ||
1759 | |||
1760 | GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != network_type); | ||
1761 | if (0 != ntohl (msg->reserved)) | ||
1762 | { | ||
1763 | GNUNET_break_op(0); | ||
1764 | return; | ||
1765 | } | ||
1766 | if (ntohs (msg->header.size) | ||
1767 | < sizeof(struct GNUNET_MessageHeader) + sizeof(struct XUMessage)) | ||
1768 | { | ||
1769 | GNUNET_break_op(0); | ||
1770 | return; | ||
1771 | } | ||
1772 | |||
1773 | address = GNUNET_HELLO_address_allocate (&msg->sender, | ||
1774 | PLUGIN_NAME, | ||
1775 | xu_addr, | ||
1776 | xu_addr_len, | ||
1777 | GNUNET_HELLO_ADDRESS_INFO_NONE); | ||
1778 | if (NULL == | ||
1779 | (s = xu_plugin_lookup_session (plugin, | ||
1780 | address))) | ||
1781 | { | ||
1782 | s = xu_plugin_create_session (plugin, | ||
1783 | address, | ||
1784 | network_type); | ||
1785 | plugin->env->session_start (plugin->env->cls, | ||
1786 | address, | ||
1787 | s, | ||
1788 | s->scope); | ||
1789 | notify_session_monitor (plugin, | ||
1790 | s, | ||
1791 | GNUNET_TRANSPORT_SS_UP); | ||
1792 | } | ||
1793 | GNUNET_free (address); | ||
1794 | |||
1795 | s->rc++; | ||
1796 | GNUNET_MST_from_buffer (s->mst, | ||
1797 | (const char *) &msg[1], | ||
1798 | ntohs (msg->header.size) - sizeof(struct XUMessage), | ||
1799 | GNUNET_YES, | ||
1800 | GNUNET_NO); | ||
1801 | s->rc--; | ||
1802 | if ( (0 == s->rc) && | ||
1803 | (GNUNET_YES == s->in_destroy) ) | ||
1804 | free_session (s); | ||
1805 | } | ||
1806 | |||
1807 | |||
1808 | /** | ||
1809 | * Read and process a message from the given socket. | ||
1810 | * | ||
1811 | * @param plugin the overall plugin | ||
1812 | * @param rsock socket to read from | ||
1813 | */ | ||
1814 | static void | ||
1815 | xu_select_read (struct Plugin *plugin, | ||
1816 | struct GNUNET_NETWORK_Handle *rsock) | ||
1817 | { | ||
1818 | socklen_t fromlen; | ||
1819 | struct sockaddr_storage addr; | ||
1820 | char buf[65536] GNUNET_ALIGN; | ||
1821 | ssize_t size; | ||
1822 | const struct GNUNET_MessageHeader *msg; | ||
1823 | struct IPv4XuAddress v4; | ||
1824 | struct IPv6XuAddress v6; | ||
1825 | const struct sockaddr *sa; | ||
1826 | const struct sockaddr_in *sa4; | ||
1827 | const struct sockaddr_in6 *sa6; | ||
1828 | const union XuAddress *int_addr; | ||
1829 | size_t int_addr_len; | ||
1830 | enum GNUNET_ATS_Network_Type network_type; | ||
1831 | |||
1832 | fromlen = sizeof (addr); | ||
1833 | memset (&addr, | ||
1834 | 0, | ||
1835 | sizeof(addr)); | ||
1836 | size = GNUNET_NETWORK_socket_recvfrom (rsock, | ||
1837 | buf, | ||
1838 | sizeof (buf), | ||
1839 | (struct sockaddr *) &addr, | ||
1840 | &fromlen); | ||
1841 | sa = (const struct sockaddr *) &addr; | ||
1842 | #if MINGW | ||
1843 | /* On SOCK_DGRAM XU sockets recvfrom might fail with a | ||
1844 | * WSAECONNRESET error to indicate that previous sendto() (yes, sendto!) | ||
1845 | * on this socket has failed. | ||
1846 | * Quote from MSDN: | ||
1847 | * WSAECONNRESET - The virtual circuit was reset by the remote side | ||
1848 | * executing a hard or abortive close. The application should close | ||
1849 | * the socket; it is no longer usable. On a XU-datagram socket this | ||
1850 | * error indicates a previous send operation resulted in an ICMP Port | ||
1851 | * Unreachable message. | ||
1852 | */ | ||
1853 | if ( (-1 == size) && | ||
1854 | (ECONNRESET == errno) ) | ||
1855 | return; | ||
1856 | #endif | ||
1857 | if (-1 == size) | ||
1858 | { | ||
1859 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1860 | "XU failed to receive data: %s\n", | ||
1861 | STRERROR (errno)); | ||
1862 | /* Connection failure or something. Not a protocol violation. */ | ||
1863 | return; | ||
1864 | } | ||
1865 | |||
1866 | /* Check if this is a STUN packet */ | ||
1867 | if (GNUNET_NO != | ||
1868 | GNUNET_NAT_stun_handle_packet (plugin->nat, | ||
1869 | (const struct sockaddr *) &addr, | ||
1870 | fromlen, | ||
1871 | buf, | ||
1872 | size)) | ||
1873 | return; /* was STUN, do not process further */ | ||
1874 | |||
1875 | if (((size_t) size) < sizeof(struct GNUNET_MessageHeader)) | ||
1876 | { | ||
1877 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1878 | "XU got %u bytes from %s, which is not enough for a GNUnet message header\n", | ||
1879 | (unsigned int ) size, | ||
1880 | GNUNET_a2s (sa, | ||
1881 | fromlen)); | ||
1882 | /* _MAY_ be a connection failure (got partial message) */ | ||
1883 | /* But it _MAY_ also be that the other side uses non-GNUnet protocol. */ | ||
1884 | GNUNET_break_op (0); | ||
1885 | return; | ||
1886 | } | ||
1887 | |||
1888 | msg = (const struct GNUNET_MessageHeader *) buf; | ||
1889 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1890 | "XU received %u-byte message from `%s' type %u\n", | ||
1891 | (unsigned int) size, | ||
1892 | GNUNET_a2s (sa, | ||
1893 | fromlen), | ||
1894 | ntohs (msg->type)); | ||
1895 | if (size != ntohs (msg->size)) | ||
1896 | { | ||
1897 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1898 | "XU malformed message (size %u) header from %s\n", | ||
1899 | (unsigned int) size, | ||
1900 | GNUNET_a2s (sa, | ||
1901 | fromlen)); | ||
1902 | GNUNET_break_op (0); | ||
1903 | return; | ||
1904 | } | ||
1905 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1906 | "# XU, total bytes received", | ||
1907 | size, | ||
1908 | GNUNET_NO); | ||
1909 | network_type = plugin->env->get_address_type (plugin->env->cls, | ||
1910 | sa, | ||
1911 | fromlen); | ||
1912 | switch (sa->sa_family) | ||
1913 | { | ||
1914 | case AF_INET: | ||
1915 | sa4 = (const struct sockaddr_in *) &addr; | ||
1916 | v4.options = 0; | ||
1917 | v4.ipv4_addr = sa4->sin_addr.s_addr; | ||
1918 | v4.u4_port = sa4->sin_port; | ||
1919 | int_addr = (union XuAddress *) &v4; | ||
1920 | int_addr_len = sizeof (v4); | ||
1921 | break; | ||
1922 | case AF_INET6: | ||
1923 | sa6 = (const struct sockaddr_in6 *) &addr; | ||
1924 | v6.options = 0; | ||
1925 | v6.ipv6_addr = sa6->sin6_addr; | ||
1926 | v6.u6_port = sa6->sin6_port; | ||
1927 | int_addr = (union XuAddress *) &v6; | ||
1928 | int_addr_len = sizeof (v6); | ||
1929 | break; | ||
1930 | default: | ||
1931 | GNUNET_break (0); | ||
1932 | return; | ||
1933 | } | ||
1934 | |||
1935 | switch (ntohs (msg->type)) | ||
1936 | { | ||
1937 | case GNUNET_MESSAGE_TYPE_TRANSPORT_XU_MESSAGE: | ||
1938 | if (ntohs (msg->size) < sizeof(struct XUMessage)) | ||
1939 | { | ||
1940 | GNUNET_break_op(0); | ||
1941 | return; | ||
1942 | } | ||
1943 | process_xu_message (plugin, | ||
1944 | (const struct XUMessage *) msg, | ||
1945 | int_addr, | ||
1946 | int_addr_len, | ||
1947 | network_type); | ||
1948 | return; | ||
1949 | default: | ||
1950 | GNUNET_break_op(0); | ||
1951 | return; | ||
1952 | } | ||
1953 | } | ||
1954 | |||
1955 | |||
1956 | /* ***************** Event loop (part 2) *************** */ | ||
1957 | |||
1958 | |||
1959 | /** | ||
1960 | * We have been notified that our readset has something to read. We don't | ||
1961 | * know which socket needs to be read, so we have to check each one | ||
1962 | * Then reschedule this function to be called again once more is available. | ||
1963 | * | ||
1964 | * @param cls the plugin handle | ||
1965 | */ | ||
1966 | static void | ||
1967 | xu_plugin_select_v4 (void *cls) | ||
1968 | { | ||
1969 | struct Plugin *plugin = cls; | ||
1970 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
1971 | |||
1972 | plugin->select_task_v4 = NULL; | ||
1973 | if (NULL == plugin->sockv4) | ||
1974 | return; | ||
1975 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
1976 | if ( (0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) && | ||
1977 | (GNUNET_NETWORK_fdset_isset (tc->read_ready, | ||
1978 | plugin->sockv4)) ) | ||
1979 | xu_select_read (plugin, | ||
1980 | plugin->sockv4); | ||
1981 | schedule_select_v4 (plugin); | ||
1982 | } | ||
1983 | |||
1984 | |||
1985 | /** | ||
1986 | * We have been notified that our readset has something to read. We don't | ||
1987 | * know which socket needs to be read, so we have to check each one | ||
1988 | * Then reschedule this function to be called again once more is available. | ||
1989 | * | ||
1990 | * @param cls the plugin handle | ||
1991 | */ | ||
1992 | static void | ||
1993 | xu_plugin_select_v6 (void *cls) | ||
1994 | { | ||
1995 | struct Plugin *plugin = cls; | ||
1996 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
1997 | |||
1998 | plugin->select_task_v6 = NULL; | ||
1999 | if (NULL == plugin->sockv6) | ||
2000 | return; | ||
2001 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
2002 | if ( (0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) && | ||
2003 | (GNUNET_NETWORK_fdset_isset (tc->read_ready, | ||
2004 | plugin->sockv6)) ) | ||
2005 | xu_select_read (plugin, | ||
2006 | plugin->sockv6); | ||
2007 | schedule_select_v6 (plugin); | ||
2008 | } | ||
2009 | |||
2010 | |||
2011 | /* ******************* Initialization *************** */ | ||
2012 | |||
2013 | |||
2014 | /** | ||
2015 | * Setup the XU sockets (for IPv4 and IPv6) for the plugin. | ||
2016 | * | ||
2017 | * @param plugin the plugin to initialize | ||
2018 | * @param bind_v6 IPv6 address to bind to (can be NULL, for 'any') | ||
2019 | * @param bind_v4 IPv4 address to bind to (can be NULL, for 'any') | ||
2020 | * @return number of sockets that were successfully bound | ||
2021 | */ | ||
2022 | static unsigned int | ||
2023 | setup_sockets (struct Plugin *plugin, | ||
2024 | const struct sockaddr_in6 *bind_v6, | ||
2025 | const struct sockaddr_in *bind_v4) | ||
2026 | { | ||
2027 | int tries; | ||
2028 | unsigned int sockets_created = 0; | ||
2029 | struct sockaddr_in6 server_addrv6; | ||
2030 | struct sockaddr_in server_addrv4; | ||
2031 | const struct sockaddr *server_addr; | ||
2032 | const struct sockaddr *addrs[2]; | ||
2033 | socklen_t addrlens[2]; | ||
2034 | socklen_t addrlen; | ||
2035 | int eno; | ||
2036 | |||
2037 | /* Create IPv6 socket */ | ||
2038 | eno = EINVAL; | ||
2039 | if (GNUNET_YES == plugin->enable_ipv6) | ||
2040 | { | ||
2041 | plugin->sockv6 = GNUNET_NETWORK_socket_create (PF_INET6, | ||
2042 | SOCK_DGRAM, | ||
2043 | 0); | ||
2044 | if (NULL == plugin->sockv6) | ||
2045 | { | ||
2046 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
2047 | _("Disabling IPv6 since it is not supported on this system!\n")); | ||
2048 | plugin->enable_ipv6 = GNUNET_NO; | ||
2049 | } | ||
2050 | else | ||
2051 | { | ||
2052 | memset (&server_addrv6, | ||
2053 | 0, | ||
2054 | sizeof(struct sockaddr_in6)); | ||
2055 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
2056 | server_addrv6.sin6_len = sizeof (struct sockaddr_in6); | ||
2057 | #endif | ||
2058 | server_addrv6.sin6_family = AF_INET6; | ||
2059 | if (NULL != bind_v6) | ||
2060 | server_addrv6.sin6_addr = bind_v6->sin6_addr; | ||
2061 | else | ||
2062 | server_addrv6.sin6_addr = in6addr_any; | ||
2063 | |||
2064 | if (0 == plugin->port) /* autodetect */ | ||
2065 | server_addrv6.sin6_port | ||
2066 | = htons (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, | ||
2067 | 33537) | ||
2068 | + 32000); | ||
2069 | else | ||
2070 | server_addrv6.sin6_port = htons (plugin->port); | ||
2071 | addrlen = sizeof (struct sockaddr_in6); | ||
2072 | server_addr = (const struct sockaddr *) &server_addrv6; | ||
2073 | |||
2074 | tries = 0; | ||
2075 | while (tries < 10) | ||
2076 | { | ||
2077 | LOG(GNUNET_ERROR_TYPE_DEBUG, | ||
2078 | "Binding to IPv6 `%s'\n", | ||
2079 | GNUNET_a2s (server_addr, | ||
2080 | addrlen)); | ||
2081 | /* binding */ | ||
2082 | if (GNUNET_OK == | ||
2083 | GNUNET_NETWORK_socket_bind (plugin->sockv6, | ||
2084 | server_addr, | ||
2085 | addrlen)) | ||
2086 | break; | ||
2087 | eno = errno; | ||
2088 | if (0 != plugin->port) | ||
2089 | { | ||
2090 | tries = 10; /* fail immediately */ | ||
2091 | break; /* bind failed on specific port */ | ||
2092 | } | ||
2093 | /* autodetect */ | ||
2094 | server_addrv6.sin6_port | ||
2095 | = htons (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, | ||
2096 | 33537) | ||
2097 | + 32000); | ||
2098 | tries++; | ||
2099 | } | ||
2100 | if (tries >= 10) | ||
2101 | { | ||
2102 | GNUNET_NETWORK_socket_close (plugin->sockv6); | ||
2103 | plugin->enable_ipv6 = GNUNET_NO; | ||
2104 | plugin->sockv6 = NULL; | ||
2105 | } | ||
2106 | else | ||
2107 | { | ||
2108 | plugin->port = ntohs (server_addrv6.sin6_port); | ||
2109 | } | ||
2110 | if (NULL != plugin->sockv6) | ||
2111 | { | ||
2112 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2113 | "IPv6 XU socket created listinging at %s\n", | ||
2114 | GNUNET_a2s (server_addr, | ||
2115 | addrlen)); | ||
2116 | addrs[sockets_created] = server_addr; | ||
2117 | addrlens[sockets_created] = addrlen; | ||
2118 | sockets_created++; | ||
2119 | } | ||
2120 | else | ||
2121 | { | ||
2122 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
2123 | _("Failed to bind XU socket to %s: %s\n"), | ||
2124 | GNUNET_a2s (server_addr, | ||
2125 | addrlen), | ||
2126 | STRERROR (eno)); | ||
2127 | } | ||
2128 | } | ||
2129 | } | ||
2130 | |||
2131 | /* Create IPv4 socket */ | ||
2132 | eno = EINVAL; | ||
2133 | plugin->sockv4 = GNUNET_NETWORK_socket_create (PF_INET, | ||
2134 | SOCK_DGRAM, | ||
2135 | 0); | ||
2136 | if (NULL == plugin->sockv4) | ||
2137 | { | ||
2138 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, | ||
2139 | "socket"); | ||
2140 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
2141 | _("Disabling IPv4 since it is not supported on this system!\n")); | ||
2142 | plugin->enable_ipv4 = GNUNET_NO; | ||
2143 | } | ||
2144 | else | ||
2145 | { | ||
2146 | memset (&server_addrv4, | ||
2147 | 0, | ||
2148 | sizeof(struct sockaddr_in)); | ||
2149 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
2150 | server_addrv4.sin_len = sizeof (struct sockaddr_in); | ||
2151 | #endif | ||
2152 | server_addrv4.sin_family = AF_INET; | ||
2153 | if (NULL != bind_v4) | ||
2154 | server_addrv4.sin_addr = bind_v4->sin_addr; | ||
2155 | else | ||
2156 | server_addrv4.sin_addr.s_addr = INADDR_ANY; | ||
2157 | |||
2158 | if (0 == plugin->port) | ||
2159 | /* autodetect */ | ||
2160 | server_addrv4.sin_port | ||
2161 | = htons (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, | ||
2162 | 33537) | ||
2163 | + 32000); | ||
2164 | else | ||
2165 | server_addrv4.sin_port = htons (plugin->port); | ||
2166 | |||
2167 | addrlen = sizeof (struct sockaddr_in); | ||
2168 | server_addr = (const struct sockaddr *) &server_addrv4; | ||
2169 | |||
2170 | tries = 0; | ||
2171 | while (tries < 10) | ||
2172 | { | ||
2173 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2174 | "Binding to IPv4 `%s'\n", | ||
2175 | GNUNET_a2s (server_addr, | ||
2176 | addrlen)); | ||
2177 | |||
2178 | /* binding */ | ||
2179 | if (GNUNET_OK == | ||
2180 | GNUNET_NETWORK_socket_bind (plugin->sockv4, | ||
2181 | server_addr, | ||
2182 | addrlen)) | ||
2183 | break; | ||
2184 | eno = errno; | ||
2185 | if (0 != plugin->port) | ||
2186 | { | ||
2187 | tries = 10; /* fail */ | ||
2188 | break; /* bind failed on specific port */ | ||
2189 | } | ||
2190 | |||
2191 | /* autodetect */ | ||
2192 | server_addrv4.sin_port | ||
2193 | = htons (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG, | ||
2194 | 33537) | ||
2195 | + 32000); | ||
2196 | tries++; | ||
2197 | } | ||
2198 | if (tries >= 10) | ||
2199 | { | ||
2200 | GNUNET_NETWORK_socket_close (plugin->sockv4); | ||
2201 | plugin->enable_ipv4 = GNUNET_NO; | ||
2202 | plugin->sockv4 = NULL; | ||
2203 | } | ||
2204 | else | ||
2205 | { | ||
2206 | plugin->port = ntohs (server_addrv4.sin_port); | ||
2207 | } | ||
2208 | |||
2209 | if (NULL != plugin->sockv4) | ||
2210 | { | ||
2211 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2212 | "IPv4 socket created on port %s\n", | ||
2213 | GNUNET_a2s (server_addr, | ||
2214 | addrlen)); | ||
2215 | addrs[sockets_created] = server_addr; | ||
2216 | addrlens[sockets_created] = addrlen; | ||
2217 | sockets_created++; | ||
2218 | } | ||
2219 | else | ||
2220 | { | ||
2221 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
2222 | _("Failed to bind XU socket to %s: %s\n"), | ||
2223 | GNUNET_a2s (server_addr, | ||
2224 | addrlen), | ||
2225 | STRERROR (eno)); | ||
2226 | } | ||
2227 | } | ||
2228 | |||
2229 | if (0 == sockets_created) | ||
2230 | { | ||
2231 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
2232 | _("Failed to open XU sockets\n")); | ||
2233 | return 0; /* No sockets created, return */ | ||
2234 | } | ||
2235 | schedule_select_v4 (plugin); | ||
2236 | schedule_select_v6 (plugin); | ||
2237 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, | ||
2238 | "transport-xu", | ||
2239 | IPPROTO_UDP, | ||
2240 | sockets_created, | ||
2241 | addrs, | ||
2242 | addrlens, | ||
2243 | &xu_nat_port_map_callback, | ||
2244 | NULL, | ||
2245 | plugin); | ||
2246 | return sockets_created; | ||
2247 | } | ||
2248 | |||
2249 | |||
2250 | /** | ||
2251 | * The exported method. Makes the core api available via a global and | ||
2252 | * returns the xu transport API. | ||
2253 | * | ||
2254 | * @param cls our `struct GNUNET_TRANSPORT_PluginEnvironment` | ||
2255 | * @return our `struct GNUNET_TRANSPORT_PluginFunctions` | ||
2256 | */ | ||
2257 | void * | ||
2258 | libgnunet_plugin_transport_xu_init (void *cls) | ||
2259 | { | ||
2260 | struct GNUNET_TRANSPORT_PluginEnvironment *env = cls; | ||
2261 | struct GNUNET_TRANSPORT_PluginFunctions *api; | ||
2262 | struct Plugin *p; | ||
2263 | unsigned long long port; | ||
2264 | unsigned long long aport; | ||
2265 | int enable_v6; | ||
2266 | char *bind4_address; | ||
2267 | char *bind6_address; | ||
2268 | struct sockaddr_in server_addrv4; | ||
2269 | struct sockaddr_in6 server_addrv6; | ||
2270 | unsigned int res; | ||
2271 | int have_bind4; | ||
2272 | int have_bind6; | ||
2273 | |||
2274 | if (NULL == env->receive) | ||
2275 | { | ||
2276 | /* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully | ||
2277 | initialze the plugin or the API */ | ||
2278 | api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions); | ||
2279 | api->cls = NULL; | ||
2280 | api->address_pretty_printer = &xu_plugin_address_pretty_printer; | ||
2281 | api->address_to_string = &xu_address_to_string; | ||
2282 | api->string_to_address = &xu_string_to_address; | ||
2283 | return api; | ||
2284 | } | ||
2285 | |||
2286 | /* Get port number: port == 0 : autodetect a port, | ||
2287 | * > 0 : use this port, not given : 2086 default */ | ||
2288 | if (GNUNET_OK != | ||
2289 | GNUNET_CONFIGURATION_get_value_number (env->cfg, | ||
2290 | "transport-xu", | ||
2291 | "PORT", | ||
2292 | &port)) | ||
2293 | port = 2086; | ||
2294 | if (port > 65535) | ||
2295 | { | ||
2296 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | ||
2297 | "transport-xu", | ||
2298 | "PORT", | ||
2299 | _("must be in [0,65535]")); | ||
2300 | return NULL; | ||
2301 | } | ||
2302 | if (GNUNET_OK != | ||
2303 | GNUNET_CONFIGURATION_get_value_number (env->cfg, | ||
2304 | "transport-xu", | ||
2305 | "ADVERTISED_PORT", | ||
2306 | &aport)) | ||
2307 | aport = port; | ||
2308 | if (aport > 65535) | ||
2309 | { | ||
2310 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | ||
2311 | "transport-xu", | ||
2312 | "ADVERTISED_PORT", | ||
2313 | _("must be in [0,65535]")); | ||
2314 | return NULL; | ||
2315 | } | ||
2316 | |||
2317 | if (GNUNET_YES == | ||
2318 | GNUNET_CONFIGURATION_get_value_yesno (env->cfg, | ||
2319 | "nat", | ||
2320 | "DISABLEV6")) | ||
2321 | enable_v6 = GNUNET_NO; | ||
2322 | else | ||
2323 | enable_v6 = GNUNET_YES; | ||
2324 | |||
2325 | have_bind4 = GNUNET_NO; | ||
2326 | memset (&server_addrv4, | ||
2327 | 0, | ||
2328 | sizeof (server_addrv4)); | ||
2329 | if (GNUNET_YES == | ||
2330 | GNUNET_CONFIGURATION_get_value_string (env->cfg, | ||
2331 | "transport-xu", | ||
2332 | "BINDTO", | ||
2333 | &bind4_address)) | ||
2334 | { | ||
2335 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2336 | "Binding XU plugin to specific address: `%s'\n", | ||
2337 | bind4_address); | ||
2338 | if (1 != inet_pton (AF_INET, | ||
2339 | bind4_address, | ||
2340 | &server_addrv4.sin_addr)) | ||
2341 | { | ||
2342 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | ||
2343 | "transport-xu", | ||
2344 | "BINDTO", | ||
2345 | _("must be valid IPv4 address")); | ||
2346 | GNUNET_free (bind4_address); | ||
2347 | return NULL; | ||
2348 | } | ||
2349 | have_bind4 = GNUNET_YES; | ||
2350 | } | ||
2351 | GNUNET_free_non_null (bind4_address); | ||
2352 | have_bind6 = GNUNET_NO; | ||
2353 | memset (&server_addrv6, | ||
2354 | 0, | ||
2355 | sizeof (server_addrv6)); | ||
2356 | if (GNUNET_YES == | ||
2357 | GNUNET_CONFIGURATION_get_value_string (env->cfg, | ||
2358 | "transport-xu", | ||
2359 | "BINDTO6", | ||
2360 | &bind6_address)) | ||
2361 | { | ||
2362 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2363 | "Binding xu plugin to specific address: `%s'\n", | ||
2364 | bind6_address); | ||
2365 | if (1 != inet_pton (AF_INET6, | ||
2366 | bind6_address, | ||
2367 | &server_addrv6.sin6_addr)) | ||
2368 | { | ||
2369 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | ||
2370 | "transport-xu", | ||
2371 | "BINDTO6", | ||
2372 | _("must be valid IPv6 address")); | ||
2373 | GNUNET_free (bind6_address); | ||
2374 | return NULL; | ||
2375 | } | ||
2376 | have_bind6 = GNUNET_YES; | ||
2377 | } | ||
2378 | GNUNET_free_non_null (bind6_address); | ||
2379 | |||
2380 | p = GNUNET_new (struct Plugin); | ||
2381 | p->port = port; | ||
2382 | p->aport = aport; | ||
2383 | p->enable_ipv6 = enable_v6; | ||
2384 | p->enable_ipv4 = GNUNET_YES; /* default */ | ||
2385 | p->env = env; | ||
2386 | p->sessions = GNUNET_CONTAINER_multipeermap_create (16, | ||
2387 | GNUNET_NO); | ||
2388 | res = setup_sockets (p, | ||
2389 | (GNUNET_YES == have_bind6) ? &server_addrv6 : NULL, | ||
2390 | (GNUNET_YES == have_bind4) ? &server_addrv4 : NULL); | ||
2391 | if ( (0 == res) || | ||
2392 | ( (NULL == p->sockv4) && | ||
2393 | (NULL == p->sockv6) ) ) | ||
2394 | { | ||
2395 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
2396 | _("Failed to create XU network sockets\n")); | ||
2397 | GNUNET_CONTAINER_multipeermap_destroy (p->sessions); | ||
2398 | if (NULL != p->nat) | ||
2399 | GNUNET_NAT_unregister (p->nat); | ||
2400 | GNUNET_free (p); | ||
2401 | return NULL; | ||
2402 | } | ||
2403 | |||
2404 | api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions); | ||
2405 | api->cls = p; | ||
2406 | api->disconnect_session = &xu_disconnect_session; | ||
2407 | api->query_keepalive_factor = &xu_query_keepalive_factor; | ||
2408 | api->disconnect_peer = &xu_disconnect; | ||
2409 | api->address_pretty_printer = &xu_plugin_address_pretty_printer; | ||
2410 | api->address_to_string = &xu_address_to_string; | ||
2411 | api->string_to_address = &xu_string_to_address; | ||
2412 | api->check_address = &xu_plugin_check_address; | ||
2413 | api->get_session = &xu_plugin_get_session; | ||
2414 | api->send = &xu_plugin_send; | ||
2415 | api->get_network = &xu_plugin_get_network; | ||
2416 | api->get_network_for_address = &xu_plugin_get_network_for_address; | ||
2417 | api->update_session_timeout = &xu_plugin_update_session_timeout; | ||
2418 | api->setup_monitor = &xu_plugin_setup_monitor; | ||
2419 | return api; | ||
2420 | } | ||
2421 | |||
2422 | |||
2423 | /** | ||
2424 | * The exported method. Makes the core api available via a global and | ||
2425 | * returns the xu transport API. | ||
2426 | * | ||
2427 | * @param cls our `struct GNUNET_TRANSPORT_PluginEnvironment` | ||
2428 | * @return NULL | ||
2429 | */ | ||
2430 | void * | ||
2431 | libgnunet_plugin_transport_xu_done (void *cls) | ||
2432 | { | ||
2433 | struct GNUNET_TRANSPORT_PluginFunctions *api = cls; | ||
2434 | struct Plugin *plugin = api->cls; | ||
2435 | struct PrettyPrinterContext *cur; | ||
2436 | |||
2437 | if (NULL == plugin) | ||
2438 | { | ||
2439 | GNUNET_free (api); | ||
2440 | return NULL; | ||
2441 | } | ||
2442 | if (NULL != plugin->select_task_v4) | ||
2443 | { | ||
2444 | GNUNET_SCHEDULER_cancel (plugin->select_task_v4); | ||
2445 | plugin->select_task_v4 = NULL; | ||
2446 | } | ||
2447 | if (NULL != plugin->select_task_v6) | ||
2448 | { | ||
2449 | GNUNET_SCHEDULER_cancel (plugin->select_task_v6); | ||
2450 | plugin->select_task_v6 = NULL; | ||
2451 | } | ||
2452 | if (NULL != plugin->sockv4) | ||
2453 | { | ||
2454 | GNUNET_break (GNUNET_OK == | ||
2455 | GNUNET_NETWORK_socket_close (plugin->sockv4)); | ||
2456 | plugin->sockv4 = NULL; | ||
2457 | } | ||
2458 | if (NULL != plugin->sockv6) | ||
2459 | { | ||
2460 | GNUNET_break (GNUNET_OK == | ||
2461 | GNUNET_NETWORK_socket_close (plugin->sockv6)); | ||
2462 | plugin->sockv6 = NULL; | ||
2463 | } | ||
2464 | if (NULL != plugin->nat) | ||
2465 | { | ||
2466 | GNUNET_NAT_unregister (plugin->nat); | ||
2467 | plugin->nat = NULL; | ||
2468 | } | ||
2469 | GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions); | ||
2470 | |||
2471 | while (NULL != (cur = plugin->ppc_dll_head)) | ||
2472 | { | ||
2473 | GNUNET_break (0); | ||
2474 | GNUNET_CONTAINER_DLL_remove (plugin->ppc_dll_head, | ||
2475 | plugin->ppc_dll_tail, | ||
2476 | cur); | ||
2477 | GNUNET_RESOLVER_request_cancel (cur->resolver_handle); | ||
2478 | if (NULL != cur->timeout_task) | ||
2479 | { | ||
2480 | GNUNET_SCHEDULER_cancel (cur->timeout_task); | ||
2481 | cur->timeout_task = NULL; | ||
2482 | } | ||
2483 | GNUNET_free (cur); | ||
2484 | } | ||
2485 | GNUNET_free (plugin); | ||
2486 | GNUNET_free (api); | ||
2487 | return NULL; | ||
2488 | } | ||
2489 | |||
2490 | /* end of plugin_transport_xu.c */ | ||
diff --git a/src/transport/plugin_transport_xu.h b/src/transport/plugin_transport_xu.h new file mode 100644 index 000000000..cbf9706b6 --- /dev/null +++ b/src/transport/plugin_transport_xu.h | |||
@@ -0,0 +1,271 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2010-2014 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | /** | ||
20 | * @file transport/plugin_transport_xu.h | ||
21 | * @brief Implementation of the XU transport protocol | ||
22 | * @author Christian Grothoff | ||
23 | * @author Nathan Evans | ||
24 | * @author Matthias Wachs | ||
25 | */ | ||
26 | #ifndef PLUGIN_TRANSPORT_XU_H | ||
27 | #define PLUGIN_TRANSPORT_XU_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_hello_lib.h" | ||
31 | #include "gnunet_util_lib.h" | ||
32 | #include "gnunet_fragmentation_lib.h" | ||
33 | #include "gnunet_protocols.h" | ||
34 | #include "gnunet_resolver_service.h" | ||
35 | #include "gnunet_signatures.h" | ||
36 | #include "gnunet_constants.h" | ||
37 | #include "gnunet_statistics_service.h" | ||
38 | #include "gnunet_transport_service.h" | ||
39 | #include "gnunet_transport_plugin.h" | ||
40 | #include "transport.h" | ||
41 | |||
42 | #define LOG(kind,...) GNUNET_log_from (kind, "transport-xu", __VA_ARGS__) | ||
43 | |||
44 | #define PLUGIN_NAME "xu" | ||
45 | |||
46 | #define DEBUG_XU GNUNET_NO | ||
47 | |||
48 | #define DEBUG_XU_BROADCASTING GNUNET_NO | ||
49 | |||
50 | /** | ||
51 | * MTU for fragmentation subsystem. Should be conservative since | ||
52 | * all communicating peers MUST work with this MTU. | ||
53 | */ | ||
54 | #define XU_MTU 1400 | ||
55 | |||
56 | |||
57 | GNUNET_NETWORK_STRUCT_BEGIN | ||
58 | /** | ||
59 | * Network format for IPv4 addresses. | ||
60 | */ | ||
61 | struct IPv4XuAddress | ||
62 | { | ||
63 | /** | ||
64 | * Optional options and flags for this address | ||
65 | */ | ||
66 | uint32_t options GNUNET_PACKED; | ||
67 | |||
68 | /** | ||
69 | * IPv4 address, in network byte order. | ||
70 | */ | ||
71 | uint32_t ipv4_addr GNUNET_PACKED; | ||
72 | |||
73 | /** | ||
74 | * Port number, in network byte order. | ||
75 | */ | ||
76 | uint16_t u4_port GNUNET_PACKED; | ||
77 | }; | ||
78 | |||
79 | |||
80 | /** | ||
81 | * Network format for IPv6 addresses. | ||
82 | */ | ||
83 | struct IPv6XuAddress | ||
84 | { | ||
85 | /** | ||
86 | * Optional options and flags for this address | ||
87 | */ | ||
88 | uint32_t options GNUNET_PACKED; | ||
89 | |||
90 | /** | ||
91 | * IPv6 address. | ||
92 | */ | ||
93 | struct in6_addr ipv6_addr GNUNET_PACKED; | ||
94 | |||
95 | /** | ||
96 | * Port number, in network byte order. | ||
97 | */ | ||
98 | uint16_t u6_port GNUNET_PACKED; | ||
99 | }; | ||
100 | GNUNET_NETWORK_STRUCT_END | ||
101 | |||
102 | /** | ||
103 | * Either an IPv4 or IPv6 XU address. Note that without a "length", | ||
104 | * one cannot tell which one of the two types this address represents. | ||
105 | */ | ||
106 | union XuAddress | ||
107 | { | ||
108 | /** | ||
109 | * IPv4 case. | ||
110 | */ | ||
111 | struct IPv4XuAddress v4; | ||
112 | |||
113 | /** | ||
114 | * IPv6 case. | ||
115 | */ | ||
116 | struct IPv6XuAddress v6; | ||
117 | }; | ||
118 | |||
119 | |||
120 | /** | ||
121 | * Information we track for each message in the queue. | ||
122 | */ | ||
123 | struct XU_MessageWrapper; | ||
124 | |||
125 | |||
126 | /** | ||
127 | * Closure for #append_port(). | ||
128 | */ | ||
129 | struct PrettyPrinterContext; | ||
130 | |||
131 | |||
132 | /** | ||
133 | * Encapsulation of all of the state of the plugin. | ||
134 | */ | ||
135 | struct Plugin | ||
136 | { | ||
137 | |||
138 | /** | ||
139 | * Our environment. | ||
140 | */ | ||
141 | struct GNUNET_TRANSPORT_PluginEnvironment *env; | ||
142 | |||
143 | /** | ||
144 | * Session of peers with whom we are currently connected, | ||
145 | * map of peer identity to `struct GNUNET_ATS_Session *`. | ||
146 | */ | ||
147 | struct GNUNET_CONTAINER_MultiPeerMap *sessions; | ||
148 | |||
149 | /** | ||
150 | * ID of select task for IPv4 | ||
151 | */ | ||
152 | struct GNUNET_SCHEDULER_Task *select_task_v4; | ||
153 | |||
154 | /** | ||
155 | * ID of select task for IPv6 | ||
156 | */ | ||
157 | struct GNUNET_SCHEDULER_Task *select_task_v6; | ||
158 | |||
159 | /** | ||
160 | * Address we were told to bind to exclusively (IPv4). | ||
161 | */ | ||
162 | char *bind4_address; | ||
163 | |||
164 | /** | ||
165 | * Address we were told to bind to exclusively (IPv6). | ||
166 | */ | ||
167 | char *bind6_address; | ||
168 | |||
169 | /** | ||
170 | * Handle to NAT traversal support. | ||
171 | */ | ||
172 | struct GNUNET_NAT_Handle *nat; | ||
173 | |||
174 | /** | ||
175 | * Handle to NAT traversal support. | ||
176 | */ | ||
177 | struct GNUNET_NAT_STUN_Handle *stun; | ||
178 | |||
179 | /** | ||
180 | * The read socket for IPv4 | ||
181 | */ | ||
182 | struct GNUNET_NETWORK_Handle *sockv4; | ||
183 | |||
184 | /** | ||
185 | * The read socket for IPv6 | ||
186 | */ | ||
187 | struct GNUNET_NETWORK_Handle *sockv6; | ||
188 | |||
189 | /** | ||
190 | * Running pretty printers: head | ||
191 | */ | ||
192 | struct PrettyPrinterContext *ppc_dll_head; | ||
193 | |||
194 | /** | ||
195 | * Running pretty printers: tail | ||
196 | */ | ||
197 | struct PrettyPrinterContext *ppc_dll_tail; | ||
198 | |||
199 | /** | ||
200 | * Function to call about session status changes. | ||
201 | */ | ||
202 | GNUNET_TRANSPORT_SessionInfoCallback sic; | ||
203 | |||
204 | /** | ||
205 | * Closure for @e sic. | ||
206 | */ | ||
207 | void *sic_cls; | ||
208 | |||
209 | /** | ||
210 | * IPv6 multicast address | ||
211 | */ | ||
212 | struct sockaddr_in6 ipv6_multicast_address; | ||
213 | |||
214 | /** | ||
215 | * Broadcast interval | ||
216 | */ | ||
217 | struct GNUNET_TIME_Relative broadcast_interval; | ||
218 | |||
219 | /** | ||
220 | * Bytes currently in buffer | ||
221 | */ | ||
222 | int64_t bytes_in_buffer; | ||
223 | |||
224 | /** | ||
225 | * Address options | ||
226 | */ | ||
227 | uint32_t myoptions; | ||
228 | |||
229 | /** | ||
230 | * Is IPv6 enabled: #GNUNET_YES or #GNUNET_NO | ||
231 | */ | ||
232 | int enable_ipv6; | ||
233 | |||
234 | /** | ||
235 | * Is IPv4 enabled: #GNUNET_YES or #GNUNET_NO | ||
236 | */ | ||
237 | int enable_ipv4; | ||
238 | |||
239 | /** | ||
240 | * Port we listen on. | ||
241 | */ | ||
242 | uint16_t port; | ||
243 | |||
244 | /** | ||
245 | * Port we advertise on. | ||
246 | */ | ||
247 | uint16_t aport; | ||
248 | |||
249 | }; | ||
250 | |||
251 | |||
252 | /** | ||
253 | * Function called for a quick conversion of the binary address to | ||
254 | * a numeric address. Note that the caller must not free the | ||
255 | * address and that the next call to this function is allowed | ||
256 | * to override the address again. | ||
257 | * | ||
258 | * @param cls closure | ||
259 | * @param addr binary address (a `union XuAddress`) | ||
260 | * @param addrlen length of the @a addr | ||
261 | * @return string representing the same address | ||
262 | */ | ||
263 | const char * | ||
264 | xu_address_to_string (void *cls, | ||
265 | const void *addr, | ||
266 | size_t addrlen); | ||
267 | |||
268 | |||
269 | /*#ifndef PLUGIN_TRANSPORT_XU_H*/ | ||
270 | #endif | ||
271 | /* end of plugin_transport_xu.h */ | ||
diff --git a/src/transport/tcp_connection_legacy.c b/src/transport/tcp_connection_legacy.c index 17157436d..66902c6a0 100644 --- a/src/transport/tcp_connection_legacy.c +++ b/src/transport/tcp_connection_legacy.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2013 GNUnet e.V. | 3 | Copyright (C) 2009-2013 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/tcp_server_legacy.c b/src/transport/tcp_server_legacy.c index f75b41e8c..4744e20d8 100644 --- a/src/transport/tcp_server_legacy.c +++ b/src/transport/tcp_server_legacy.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2013 GNUnet e.V. | 3 | Copyright (C) 2009-2013 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/tcp_server_mst_legacy.c b/src/transport/tcp_server_mst_legacy.c index 78e04c1b1..5bd9ba35e 100644 --- a/src/transport/tcp_server_mst_legacy.c +++ b/src/transport/tcp_server_mst_legacy.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010 GNUnet e.V. | 3 | Copyright (C) 2010 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/tcp_service_legacy.c b/src/transport/tcp_service_legacy.c index 1f1f6c063..b7ea9b20a 100644 --- a/src/transport/tcp_service_legacy.c +++ b/src/transport/tcp_service_legacy.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2012 GNUnet e.V. | 3 | Copyright (C) 2009, 2012 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/template_cfg_peer1.conf b/src/transport/template_cfg_peer1.conf index b26f43bf4..5ba198450 100644 --- a/src/transport/template_cfg_peer1.conf +++ b/src/transport/template_cfg_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ test_transport_defaults.conf | 1 | @INLINE@ test_transport_defaults.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | GNUNET_RUNTIME_DIR = $GNUNET_TEST_HOME/runtime/ | 4 | GNUNET_RUNTIME_DIR = $GNUNET_TEST_HOME/runtime/ |
5 | GNUNET_USER_RUNTIME_DIR = $GNUNET_TEST_HOME/runtime/ | 5 | GNUNET_USER_RUNTIME_DIR = $GNUNET_TEST_HOME/runtime/ |
6 | 6 | ||
diff --git a/src/transport/template_cfg_peer2.conf b/src/transport/template_cfg_peer2.conf index 8df39d488..6ac610fec 100644 --- a/src/transport/template_cfg_peer2.conf +++ b/src/transport/template_cfg_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ test_transport_defaults.conf | 1 | @INLINE@ test_transport_defaults.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | GNUNET_RUNTIME_DIR = $GNUNET_TEST_HOME/runtime/ | 4 | GNUNET_RUNTIME_DIR = $GNUNET_TEST_HOME/runtime/ |
5 | GNUNET_USER_RUNTIME_DIR = $GNUNET_TEST_HOME/runtime/ | 5 | GNUNET_USER_RUNTIME_DIR = $GNUNET_TEST_HOME/runtime/ |
6 | 6 | ||
diff --git a/src/transport/test_http_common.c b/src/transport/test_http_common.c index a13a84b77..bad06b89d 100644 --- a/src/transport/test_http_common.c +++ b/src/transport/test_http_common.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010 GNUnet e.V. | 3 | Copyright (C) 2009, 2010 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_http_common.c | 19 | * @file transport/test_http_common.c |
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 1d92588ea..85ab9659d 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c | |||
@@ -1,21 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009 GNUnet e.V. | 3 | Copyright (C) 2009, 2018 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_plugin_transport.c | 19 | * @file transport/test_plugin_transport.c |
@@ -566,8 +564,10 @@ handle_helper_message (void *cls, | |||
566 | * @param c configuration to use | 564 | * @param c configuration to use |
567 | */ | 565 | */ |
568 | static void | 566 | static void |
569 | run (void *cls, char * const *args, const char *cfgfile, | 567 | run (void *cls, |
570 | const struct GNUNET_CONFIGURATION_Handle *c) | 568 | char * const *args, |
569 | const char *cfgfile, | ||
570 | const struct GNUNET_CONFIGURATION_Handle *c) | ||
571 | { | 571 | { |
572 | char * const *argv = cls; | 572 | char * const *argv = cls; |
573 | unsigned long long tneigh; | 573 | unsigned long long tneigh; |
@@ -575,26 +575,32 @@ run (void *cls, char * const *args, const char *cfgfile, | |||
575 | char *plugin; | 575 | char *plugin; |
576 | char *sep; | 576 | char *sep; |
577 | 577 | ||
578 | timeout_endbadly = GNUNET_SCHEDULER_add_delayed (TIMEOUT, end_badly, &ok); | 578 | timeout_endbadly = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
579 | 579 | &end_badly, | |
580 | &ok); | ||
580 | cfg = c; | 581 | cfg = c; |
581 | /* parse configuration */ | 582 | /* parse configuration */ |
582 | if ((GNUNET_OK | 583 | if ( (GNUNET_OK != |
583 | != GNUNET_CONFIGURATION_get_value_number (c, "TRANSPORT", | 584 | GNUNET_CONFIGURATION_get_value_number (c, |
584 | "NEIGHBOUR_LIMIT", &tneigh)) | 585 | "TRANSPORT", |
585 | || (GNUNET_OK | 586 | "NEIGHBOUR_LIMIT", |
586 | != GNUNET_CONFIGURATION_get_value_filename (c, "PEER", "PRIVATE_KEY", | 587 | &tneigh)) || |
587 | &keyfile))) | 588 | (GNUNET_OK != |
589 | GNUNET_CONFIGURATION_get_value_filename (c, | ||
590 | "PEER", | ||
591 | "PRIVATE_KEY", | ||
592 | &keyfile))) | ||
588 | { | 593 | { |
589 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 594 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
590 | "Transport service is lacking key configuration settings. Exiting.\n"); | 595 | "Transport service is lacking key configuration settings. Exiting.\n"); |
591 | return; | 596 | return; |
592 | } | 597 | } |
593 | 598 | ||
594 | if (NULL == (stats = GNUNET_STATISTICS_create ("transport", cfg))) | 599 | if (NULL == (stats = GNUNET_STATISTICS_create ("transport", |
600 | cfg))) | ||
595 | { | 601 | { |
596 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 602 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
597 | "Could not create statistics. Exiting.\n"); | 603 | "Could not create statistics. Exiting.\n"); |
598 | GNUNET_free(keyfile); | 604 | GNUNET_free(keyfile); |
599 | end_badly_now (); | 605 | end_badly_now (); |
600 | return; | 606 | return; |
@@ -602,27 +608,33 @@ run (void *cls, char * const *args, const char *cfgfile, | |||
602 | 608 | ||
603 | if (GNUNET_OK != GNUNET_DISK_file_test (HOSTKEY_FILE)) | 609 | if (GNUNET_OK != GNUNET_DISK_file_test (HOSTKEY_FILE)) |
604 | { | 610 | { |
605 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Hostkey `%s' missing. Exiting.\n", | 611 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
606 | HOSTKEY_FILE); | 612 | "Hostkey `%s' missing. Exiting.\n", |
613 | HOSTKEY_FILE); | ||
607 | GNUNET_free(keyfile); | 614 | GNUNET_free(keyfile); |
608 | end_badly_now (); | 615 | end_badly_now (); |
609 | return; | 616 | return; |
610 | } | 617 | } |
611 | 618 | ||
612 | if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (keyfile)) | 619 | if (GNUNET_OK != |
620 | GNUNET_DISK_directory_create_for_file (keyfile)) | ||
613 | { | 621 | { |
614 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 622 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
615 | "Could not create a directory for hostkey `%s'. Exiting.\n", keyfile); | 623 | "Could not create a directory for hostkey `%s'. Exiting.\n", |
624 | keyfile); | ||
616 | GNUNET_free(keyfile); | 625 | GNUNET_free(keyfile); |
617 | end_badly_now (); | 626 | end_badly_now (); |
618 | return; | 627 | return; |
619 | } | 628 | } |
620 | 629 | ||
621 | if (GNUNET_OK != GNUNET_DISK_file_copy (HOSTKEY_FILE, keyfile)) | 630 | if (GNUNET_OK != |
631 | GNUNET_DISK_file_copy (HOSTKEY_FILE, | ||
632 | keyfile)) | ||
622 | { | 633 | { |
623 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 634 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
624 | "Could not copy hostkey `%s' to destination `%s'. Exiting.\n", | 635 | "Could not copy hostkey `%s' to destination `%s'. Exiting.\n", |
625 | HOSTKEY_FILE, keyfile); | 636 | HOSTKEY_FILE, |
637 | keyfile); | ||
626 | GNUNET_free(keyfile); | 638 | GNUNET_free(keyfile); |
627 | end_badly_now (); | 639 | end_badly_now (); |
628 | return; | 640 | return; |
@@ -730,9 +742,9 @@ run (void *cls, char * const *args, const char *cfgfile, | |||
730 | end_badly_now (); | 742 | end_badly_now (); |
731 | return; | 743 | return; |
732 | } | 744 | } |
733 | |||
734 | } | 745 | } |
735 | 746 | ||
747 | |||
736 | /** | 748 | /** |
737 | * The main function for the test | 749 | * The main function for the test |
738 | * | 750 | * |
@@ -741,23 +753,32 @@ run (void *cls, char * const *args, const char *cfgfile, | |||
741 | * @return 0 ok, 1 on error | 753 | * @return 0 ok, 1 on error |
742 | */ | 754 | */ |
743 | int | 755 | int |
744 | main (int argc, char * const *argv) | 756 | main (int argc, |
757 | char * const *argv) | ||
745 | { | 758 | { |
746 | static struct GNUNET_GETOPT_CommandLineOption options[] = { | 759 | static struct GNUNET_GETOPT_CommandLineOption options[] = { |
747 | GNUNET_GETOPT_OPTION_END }; | 760 | GNUNET_GETOPT_OPTION_END |
761 | }; | ||
748 | int ret; | 762 | int ret; |
749 | 763 | char * const argv_prog[] = { | |
750 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-plugin-transport"); | 764 | "test_plugin_transport", |
751 | 765 | "-c", | |
752 | char * const argv_prog[] = { "test_plugin_transport", "-c", | 766 | "test_plugin_transport_data.conf", |
753 | "test_plugin_transport_data.conf", NULL }; | 767 | NULL |
754 | GNUNET_log_setup ("test-plugin-transport", "WARNING", NULL ); | 768 | }; |
769 | |||
770 | GNUNET_log_setup ("test-plugin-transport", | ||
771 | "WARNING", | ||
772 | NULL); | ||
773 | GNUNET_DISK_purge_cfg_dir ("test_plugin_transport_data.conf", | ||
774 | "GNUNET_TEST_HOME"); | ||
755 | ok = 1; /* set to fail */ | 775 | ok = 1; /* set to fail */ |
756 | ret = | 776 | ret = |
757 | (GNUNET_OK | 777 | (GNUNET_OK |
758 | == GNUNET_PROGRAM_run (3, argv_prog, "test-plugin-transport", | 778 | == GNUNET_PROGRAM_run (3, argv_prog, "test-plugin-transport", |
759 | "testcase", options, &run, (void *) argv)) ? ok : 1; | 779 | "testcase", options, &run, (void *) argv)) ? ok : 1; |
760 | GNUNET_DISK_directory_remove ("/tmp/test-gnunetd-plugin-transport"); | 780 | GNUNET_DISK_purge_cfg_dir ("test_plugin_transport_data.conf", |
781 | "GNUNET_TEST_HOME"); | ||
761 | return ret; | 782 | return ret; |
762 | } | 783 | } |
763 | 784 | ||
diff --git a/src/transport/test_plugin_transport_data.conf b/src/transport/test_plugin_transport_data.conf index 2b9d134dc..b667a4854 100644 --- a/src/transport/test_plugin_transport_data.conf +++ b/src/transport/test_plugin_transport_data.conf | |||
@@ -1,12 +1,12 @@ | |||
1 | @INLINE@ test_transport_defaults.conf | 1 | @INLINE@ test_transport_defaults.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-gnunetd-plugin-transport/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunetd-plugin-transport/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 2400 | 6 | PORT = 52400 |
7 | 7 | ||
8 | [transport-udp] | 8 | [transport-udp] |
9 | PORT = 2401 | 9 | PORT = 52401 |
10 | 10 | ||
11 | [transport-wlan] | 11 | [transport-wlan] |
12 | INTERFACE = mon0 | 12 | INTERFACE = mon0 |
@@ -17,29 +17,29 @@ INTERFACE = hci0 | |||
17 | TESTMODE = 1 | 17 | TESTMODE = 1 |
18 | 18 | ||
19 | [transport-http_server] | 19 | [transport-http_server] |
20 | PORT = 2402 | 20 | PORT = 52402 |
21 | 21 | ||
22 | [transport-https_server] | 22 | [transport-https_server] |
23 | PORT = 2403 | 23 | PORT = 52403 |
24 | 24 | ||
25 | [arm] | 25 | [arm] |
26 | PORT = 2360 | 26 | PORT = 52360 |
27 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-arm.sock | 27 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-arm.sock |
28 | 28 | ||
29 | [statistics] | 29 | [statistics] |
30 | PORT = 2361 | 30 | PORT = 52361 |
31 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics.sock | 31 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-statistics.sock |
32 | 32 | ||
33 | [resolver] | 33 | [resolver] |
34 | PORT = 2362 | 34 | PORT = 52362 |
35 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver.sock | 35 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver.sock |
36 | 36 | ||
37 | [peerinfo] | 37 | [peerinfo] |
38 | PORT = 2363 | 38 | PORT = 52363 |
39 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-peerinfo.sock | 39 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-peerinfo.sock |
40 | 40 | ||
41 | [transport] | 41 | [transport] |
42 | PORT = 2364 | 42 | PORT = 52364 |
43 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport.sock | 43 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport.sock |
44 | 44 | ||
45 | [nat] | 45 | [nat] |
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 3ea5706d1..cd93ff855 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2011, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2011, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_quota_compliance.c | 19 | * @file transport/test_quota_compliance.c |
@@ -67,6 +65,8 @@ report () | |||
67 | unsigned long long datarate; | 65 | unsigned long long datarate; |
68 | 66 | ||
69 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; | 67 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; |
68 | if (0 == delta) | ||
69 | delta = 1; | ||
70 | datarate = (total_bytes_recv * 1000 * 1000) / delta; | 70 | datarate = (total_bytes_recv * 1000 * 1000) / delta; |
71 | 71 | ||
72 | FPRINTF (stderr, | 72 | FPRINTF (stderr, |
diff --git a/src/transport/test_quota_compliance_bluetooth_asymmetric_peer1.conf b/src/transport/test_quota_compliance_bluetooth_asymmetric_peer1.conf index b707ee971..86bdf6db4 100644 --- a/src/transport/test_quota_compliance_bluetooth_asymmetric_peer1.conf +++ b/src/transport/test_quota_compliance_bluetooth_asymmetric_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci0 | 6 | INTERFACE = hci0 |
diff --git a/src/transport/test_quota_compliance_bluetooth_asymmetric_peer2.conf b/src/transport/test_quota_compliance_bluetooth_asymmetric_peer2.conf index ba79f4ab2..086688e73 100644 --- a/src/transport/test_quota_compliance_bluetooth_asymmetric_peer2.conf +++ b/src/transport/test_quota_compliance_bluetooth_asymmetric_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci1 | 6 | INTERFACE = hci1 |
diff --git a/src/transport/test_quota_compliance_bluetooth_peer1.conf b/src/transport/test_quota_compliance_bluetooth_peer1.conf index 8f50bf113..3f86ee940 100644 --- a/src/transport/test_quota_compliance_bluetooth_peer1.conf +++ b/src/transport/test_quota_compliance_bluetooth_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci0 | 6 | INTERFACE = hci0 |
diff --git a/src/transport/test_quota_compliance_bluetooth_peer2.conf b/src/transport/test_quota_compliance_bluetooth_peer2.conf index 1816ec99e..5fc178395 100644 --- a/src/transport/test_quota_compliance_bluetooth_peer2.conf +++ b/src/transport/test_quota_compliance_bluetooth_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci1 | 6 | INTERFACE = hci1 |
diff --git a/src/transport/test_quota_compliance_data.conf b/src/transport/test_quota_compliance_data.conf index 576d2fc0f..1bc607770 100644 --- a/src/transport/test_quota_compliance_data.conf +++ b/src/transport/test_quota_compliance_data.conf | |||
@@ -1,24 +1,24 @@ | |||
1 | @INLINE@ test_transport_defaults.conf | 1 | @INLINE@ test_transport_defaults.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-gnunetd-plugin-transport/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunetd-plugin-transport/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 2368 | 6 | PORT = 52368 |
7 | TIMEOUT = 5 s | 7 | TIMEOUT = 5 s |
8 | 8 | ||
9 | [arm] | 9 | [arm] |
10 | PORT = 2366 | 10 | PORT = 52366 |
11 | 11 | ||
12 | [statistics] | 12 | [statistics] |
13 | PORT = 2367 | 13 | PORT = 52367 |
14 | 14 | ||
15 | [resolver] | 15 | [resolver] |
16 | PORT = 2364 | 16 | PORT = 52364 |
17 | 17 | ||
18 | [peerinfo] | 18 | [peerinfo] |
19 | PORT = 2369 | 19 | PORT = 52369 |
20 | 20 | ||
21 | [transport] | 21 | [transport] |
22 | PORT = 2365 | 22 | PORT = 52365 |
23 | 23 | ||
24 | 24 | ||
diff --git a/src/transport/test_quota_compliance_http_asymmetric_peer1.conf b/src/transport/test_quota_compliance_http_asymmetric_peer1.conf index 10ee02936..b2ff1913f 100644 --- a/src/transport/test_quota_compliance_http_asymmetric_peer1.conf +++ b/src/transport/test_quota_compliance_http_asymmetric_peer1.conf | |||
@@ -1,27 +1,27 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer1 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1 |
4 | 4 | ||
5 | [transport-http_client] | 5 | [transport-http_client] |
6 | 6 | ||
7 | [arm] | 7 | [arm] |
8 | PORT = 4015 | 8 | PORT = 54015 |
9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer1.sock | 9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer1.sock |
10 | 10 | ||
11 | [statistics] | 11 | [statistics] |
12 | PORT = 4014 | 12 | PORT = 54014 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer1.sock |
14 | 14 | ||
15 | [resolver] | 15 | [resolver] |
16 | PORT = 4013 | 16 | PORT = 54013 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer1.sock |
18 | 18 | ||
19 | [peerinfo] | 19 | [peerinfo] |
20 | PORT = 4012 | 20 | PORT = 54012 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer1.sock |
22 | 22 | ||
23 | [transport] | 23 | [transport] |
24 | PORT = 4011 | 24 | PORT = 54011 |
25 | PLUGINS = http_client | 25 | PLUGINS = http_client |
26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer1.sock | 26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer1.sock |
27 | 27 | ||
diff --git a/src/transport/test_quota_compliance_http_asymmetric_peer2.conf b/src/transport/test_quota_compliance_http_asymmetric_peer2.conf index 470b3003a..3408d9f2e 100644 --- a/src/transport/test_quota_compliance_http_asymmetric_peer2.conf +++ b/src/transport/test_quota_compliance_http_asymmetric_peer2.conf | |||
@@ -1,31 +1,31 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [transport-http_server] | 5 | [transport-http_server] |
6 | PORT = 3010 | 6 | PORT = 53010 |
7 | USE_IPv6 = NO | 7 | USE_IPv6 = NO |
8 | BINDTO = 127.0.0.1 | 8 | BINDTO = 127.0.0.1 |
9 | 9 | ||
10 | 10 | ||
11 | [arm] | 11 | [arm] |
12 | PORT = 3015 | 12 | PORT = 53015 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer2.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer2.sock |
14 | 14 | ||
15 | [statistics] | 15 | [statistics] |
16 | PORT = 3014 | 16 | PORT = 53014 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer2.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer2.sock |
18 | 18 | ||
19 | [resolver] | 19 | [resolver] |
20 | PORT = 3013 | 20 | PORT = 53013 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer2.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer2.sock |
22 | 22 | ||
23 | [peerinfo] | 23 | [peerinfo] |
24 | PORT = 3012 | 24 | PORT = 53012 |
25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer2.sock | 25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer2.sock |
26 | 26 | ||
27 | [transport] | 27 | [transport] |
28 | PORT = 3011 | 28 | PORT = 53011 |
29 | PLUGINS = http_server | 29 | PLUGINS = http_server |
30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer2.sock | 30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer2.sock |
31 | 31 | ||
diff --git a/src/transport/test_quota_compliance_http_peer1.conf b/src/transport/test_quota_compliance_http_peer1.conf index 10ee02936..b2ff1913f 100644 --- a/src/transport/test_quota_compliance_http_peer1.conf +++ b/src/transport/test_quota_compliance_http_peer1.conf | |||
@@ -1,27 +1,27 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer1 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1 |
4 | 4 | ||
5 | [transport-http_client] | 5 | [transport-http_client] |
6 | 6 | ||
7 | [arm] | 7 | [arm] |
8 | PORT = 4015 | 8 | PORT = 54015 |
9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer1.sock | 9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer1.sock |
10 | 10 | ||
11 | [statistics] | 11 | [statistics] |
12 | PORT = 4014 | 12 | PORT = 54014 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer1.sock |
14 | 14 | ||
15 | [resolver] | 15 | [resolver] |
16 | PORT = 4013 | 16 | PORT = 54013 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer1.sock |
18 | 18 | ||
19 | [peerinfo] | 19 | [peerinfo] |
20 | PORT = 4012 | 20 | PORT = 54012 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer1.sock |
22 | 22 | ||
23 | [transport] | 23 | [transport] |
24 | PORT = 4011 | 24 | PORT = 54011 |
25 | PLUGINS = http_client | 25 | PLUGINS = http_client |
26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer1.sock | 26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer1.sock |
27 | 27 | ||
diff --git a/src/transport/test_quota_compliance_http_peer2.conf b/src/transport/test_quota_compliance_http_peer2.conf index 470b3003a..3408d9f2e 100644 --- a/src/transport/test_quota_compliance_http_peer2.conf +++ b/src/transport/test_quota_compliance_http_peer2.conf | |||
@@ -1,31 +1,31 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [transport-http_server] | 5 | [transport-http_server] |
6 | PORT = 3010 | 6 | PORT = 53010 |
7 | USE_IPv6 = NO | 7 | USE_IPv6 = NO |
8 | BINDTO = 127.0.0.1 | 8 | BINDTO = 127.0.0.1 |
9 | 9 | ||
10 | 10 | ||
11 | [arm] | 11 | [arm] |
12 | PORT = 3015 | 12 | PORT = 53015 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer2.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_arm_peer2.sock |
14 | 14 | ||
15 | [statistics] | 15 | [statistics] |
16 | PORT = 3014 | 16 | PORT = 53014 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer2.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_statistics_peer2.sock |
18 | 18 | ||
19 | [resolver] | 19 | [resolver] |
20 | PORT = 3013 | 20 | PORT = 53013 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer2.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_resolver_peer2.sock |
22 | 22 | ||
23 | [peerinfo] | 23 | [peerinfo] |
24 | PORT = 3012 | 24 | PORT = 53012 |
25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer2.sock | 25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_peerinfo_peer2.sock |
26 | 26 | ||
27 | [transport] | 27 | [transport] |
28 | PORT = 3011 | 28 | PORT = 53011 |
29 | PLUGINS = http_server | 29 | PLUGINS = http_server |
30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer2.sock | 30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_http_transport_peer2.sock |
31 | 31 | ||
diff --git a/src/transport/test_quota_compliance_https_asymmetric_peer1.conf b/src/transport/test_quota_compliance_https_asymmetric_peer1.conf index 52504d34d..94aa534ef 100644 --- a/src/transport/test_quota_compliance_https_asymmetric_peer1.conf +++ b/src/transport/test_quota_compliance_https_asymmetric_peer1.conf | |||
@@ -1,27 +1,27 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ |
4 | 4 | ||
5 | [transport-https_client] | 5 | [transport-https_client] |
6 | 6 | ||
7 | [arm] | 7 | [arm] |
8 | PORT = 4006 | 8 | PORT = 54006 |
9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer1.sock | 9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer1.sock |
10 | 10 | ||
11 | [statistics] | 11 | [statistics] |
12 | PORT = 4005 | 12 | PORT = 54005 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer1.sock |
14 | 14 | ||
15 | [resolver] | 15 | [resolver] |
16 | PORT = 4004 | 16 | PORT = 54004 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer1.sock |
18 | 18 | ||
19 | [peerinfo] | 19 | [peerinfo] |
20 | PORT = 4003 | 20 | PORT = 54003 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer1.sock |
22 | 22 | ||
23 | [transport] | 23 | [transport] |
24 | PORT = 4002 | 24 | PORT = 54002 |
25 | PLUGINS = https_client | 25 | PLUGINS = https_client |
26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_transport_peer1.sock | 26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_transport_peer1.sock |
27 | 27 | ||
diff --git a/src/transport/test_quota_compliance_https_asymmetric_peer2.conf b/src/transport/test_quota_compliance_https_asymmetric_peer2.conf index 59ac327d5..8fb8861cd 100644 --- a/src/transport/test_quota_compliance_https_asymmetric_peer2.conf +++ b/src/transport/test_quota_compliance_https_asymmetric_peer2.conf | |||
@@ -1,30 +1,30 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [transport-https_server] | 5 | [transport-https_server] |
6 | PORT = 3001 | 6 | PORT = 53001 |
7 | KEY_FILE = https_key_quota_p2.key | 7 | KEY_FILE = https_key_quota_p2.key |
8 | CERT_FILE = https_cert_qutoa_p2.crt | 8 | CERT_FILE = https_cert_qutoa_p2.crt |
9 | 9 | ||
10 | [arm] | 10 | [arm] |
11 | PORT = 3006 | 11 | PORT = 53006 |
12 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer2.sock | 12 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer2.sock |
13 | 13 | ||
14 | [statistics] | 14 | [statistics] |
15 | PORT = 3005 | 15 | PORT = 53005 |
16 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer2.sock | 16 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer2.sock |
17 | 17 | ||
18 | [resolver] | 18 | [resolver] |
19 | PORT = 3004 | 19 | PORT = 53004 |
20 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer2.sock | 20 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer2.sock |
21 | 21 | ||
22 | [peerinfo] | 22 | [peerinfo] |
23 | PORT = 3003 | 23 | PORT = 53003 |
24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer2.sock | 24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer2.sock |
25 | 25 | ||
26 | [transport] | 26 | [transport] |
27 | PORT = 3002 | 27 | PORT = 53002 |
28 | PLUGINS = https_server | 28 | PLUGINS = https_server |
29 | UNIXPATH = $GNUNET_RUNTIME_DIR/https_transport_peer2.sock | 29 | UNIXPATH = $GNUNET_RUNTIME_DIR/https_transport_peer2.sock |
30 | 30 | ||
diff --git a/src/transport/test_quota_compliance_https_peer1.conf b/src/transport/test_quota_compliance_https_peer1.conf index 52504d34d..94aa534ef 100644 --- a/src/transport/test_quota_compliance_https_peer1.conf +++ b/src/transport/test_quota_compliance_https_peer1.conf | |||
@@ -1,27 +1,27 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ |
4 | 4 | ||
5 | [transport-https_client] | 5 | [transport-https_client] |
6 | 6 | ||
7 | [arm] | 7 | [arm] |
8 | PORT = 4006 | 8 | PORT = 54006 |
9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer1.sock | 9 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer1.sock |
10 | 10 | ||
11 | [statistics] | 11 | [statistics] |
12 | PORT = 4005 | 12 | PORT = 54005 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer1.sock |
14 | 14 | ||
15 | [resolver] | 15 | [resolver] |
16 | PORT = 4004 | 16 | PORT = 54004 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer1.sock |
18 | 18 | ||
19 | [peerinfo] | 19 | [peerinfo] |
20 | PORT = 4003 | 20 | PORT = 54003 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer1.sock |
22 | 22 | ||
23 | [transport] | 23 | [transport] |
24 | PORT = 4002 | 24 | PORT = 54002 |
25 | PLUGINS = https_client | 25 | PLUGINS = https_client |
26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_transport_peer1.sock | 26 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_transport_peer1.sock |
27 | 27 | ||
diff --git a/src/transport/test_quota_compliance_https_peer2.conf b/src/transport/test_quota_compliance_https_peer2.conf index 59ac327d5..8fb8861cd 100644 --- a/src/transport/test_quota_compliance_https_peer2.conf +++ b/src/transport/test_quota_compliance_https_peer2.conf | |||
@@ -1,30 +1,30 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [transport-https_server] | 5 | [transport-https_server] |
6 | PORT = 3001 | 6 | PORT = 53001 |
7 | KEY_FILE = https_key_quota_p2.key | 7 | KEY_FILE = https_key_quota_p2.key |
8 | CERT_FILE = https_cert_qutoa_p2.crt | 8 | CERT_FILE = https_cert_qutoa_p2.crt |
9 | 9 | ||
10 | [arm] | 10 | [arm] |
11 | PORT = 3006 | 11 | PORT = 53006 |
12 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer2.sock | 12 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_arm_peer2.sock |
13 | 13 | ||
14 | [statistics] | 14 | [statistics] |
15 | PORT = 3005 | 15 | PORT = 53005 |
16 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer2.sock | 16 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_statistics_peer2.sock |
17 | 17 | ||
18 | [resolver] | 18 | [resolver] |
19 | PORT = 3004 | 19 | PORT = 53004 |
20 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer2.sock | 20 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_resolver_peer2.sock |
21 | 21 | ||
22 | [peerinfo] | 22 | [peerinfo] |
23 | PORT = 3003 | 23 | PORT = 53003 |
24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer2.sock | 24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_https_peerinfo_peer2.sock |
25 | 25 | ||
26 | [transport] | 26 | [transport] |
27 | PORT = 3002 | 27 | PORT = 53002 |
28 | PLUGINS = https_server | 28 | PLUGINS = https_server |
29 | UNIXPATH = $GNUNET_RUNTIME_DIR/https_transport_peer2.sock | 29 | UNIXPATH = $GNUNET_RUNTIME_DIR/https_transport_peer2.sock |
30 | 30 | ||
diff --git a/src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf b/src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf index cc797c154..0e0cbff24 100644 --- a/src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf +++ b/src/transport/test_quota_compliance_tcp_asymmetric_peer1.conf | |||
@@ -1,31 +1,31 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/quota-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/quota-tcp-p1/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 4094 | 6 | PORT = 54094 |
7 | 7 | ||
8 | [transport-udp] | 8 | [transport-udp] |
9 | PORT = 4094 | 9 | PORT = 54094 |
10 | 10 | ||
11 | [arm] | 11 | [arm] |
12 | PORT = 4087 | 12 | PORT = 54087 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_arm_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_arm_peer1.sock |
14 | 14 | ||
15 | [statistics] | 15 | [statistics] |
16 | PORT = 4088 | 16 | PORT = 54088 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_statistics_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_statistics_peer1.sock |
18 | 18 | ||
19 | [resolver] | 19 | [resolver] |
20 | PORT = 4089 | 20 | PORT = 54089 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_resolver_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_resolver_peer1.sock |
22 | 22 | ||
23 | [peerinfo] | 23 | [peerinfo] |
24 | PORT = 4090 | 24 | PORT = 54090 |
25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_peerinfo_peer1.sock | 25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_peerinfo_peer1.sock |
26 | 26 | ||
27 | [transport] | 27 | [transport] |
28 | PORT = 4091 | 28 | PORT = 54091 |
29 | PLUGINS = tcp | 29 | PLUGINS = tcp |
30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_transport_peer1.sock | 30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_transport_peer1.sock |
31 | 31 | ||
diff --git a/src/transport/test_quota_compliance_tcp_asymmetric_peer2.conf b/src/transport/test_quota_compliance_tcp_asymmetric_peer2.conf index 04c5161e9..e9757b080 100644 --- a/src/transport/test_quota_compliance_tcp_asymmetric_peer2.conf +++ b/src/transport/test_quota_compliance_tcp_asymmetric_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/quota-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/quota-tcp-p2/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12015 | 6 | PORT = 12015 |
diff --git a/src/transport/test_quota_compliance_tcp_peer1.conf b/src/transport/test_quota_compliance_tcp_peer1.conf index cc797c154..0e0cbff24 100644 --- a/src/transport/test_quota_compliance_tcp_peer1.conf +++ b/src/transport/test_quota_compliance_tcp_peer1.conf | |||
@@ -1,31 +1,31 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/quota-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/quota-tcp-p1/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 4094 | 6 | PORT = 54094 |
7 | 7 | ||
8 | [transport-udp] | 8 | [transport-udp] |
9 | PORT = 4094 | 9 | PORT = 54094 |
10 | 10 | ||
11 | [arm] | 11 | [arm] |
12 | PORT = 4087 | 12 | PORT = 54087 |
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_arm_peer1.sock | 13 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_arm_peer1.sock |
14 | 14 | ||
15 | [statistics] | 15 | [statistics] |
16 | PORT = 4088 | 16 | PORT = 54088 |
17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_statistics_peer1.sock | 17 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_statistics_peer1.sock |
18 | 18 | ||
19 | [resolver] | 19 | [resolver] |
20 | PORT = 4089 | 20 | PORT = 54089 |
21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_resolver_peer1.sock | 21 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_resolver_peer1.sock |
22 | 22 | ||
23 | [peerinfo] | 23 | [peerinfo] |
24 | PORT = 4090 | 24 | PORT = 54090 |
25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_peerinfo_peer1.sock | 25 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_peerinfo_peer1.sock |
26 | 26 | ||
27 | [transport] | 27 | [transport] |
28 | PORT = 4091 | 28 | PORT = 54091 |
29 | PLUGINS = tcp | 29 | PLUGINS = tcp |
30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_transport_peer1.sock | 30 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_tcp_transport_peer1.sock |
31 | 31 | ||
diff --git a/src/transport/test_quota_compliance_tcp_peer2.conf b/src/transport/test_quota_compliance_tcp_peer2.conf index 326943504..a7b2cf90b 100644 --- a/src/transport/test_quota_compliance_tcp_peer2.conf +++ b/src/transport/test_quota_compliance_tcp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12015 | 6 | PORT = 12015 |
diff --git a/src/transport/test_quota_compliance_udp_peer1.conf b/src/transport/test_quota_compliance_udp_peer1.conf index 13d417d70..bba75c168 100644 --- a/src/transport/test_quota_compliance_udp_peer1.conf +++ b/src/transport/test_quota_compliance_udp_peer1.conf | |||
@@ -1,29 +1,29 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 4368 | 6 | PORT = 54368 |
7 | MAX_BPS = 50000000 | 7 | MAX_BPS = 50000000 |
8 | 8 | ||
9 | [arm] | 9 | [arm] |
10 | PORT = 4087 | 10 | PORT = 54087 |
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_arm_peer1.sock | 11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_arm_peer1.sock |
12 | 12 | ||
13 | [statistics] | 13 | [statistics] |
14 | PORT = 4088 | 14 | PORT = 54088 |
15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_statistics_peer1.sock | 15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_statistics_peer1.sock |
16 | 16 | ||
17 | [resolver] | 17 | [resolver] |
18 | PORT = 4089 | 18 | PORT = 54089 |
19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_resolver_peer1.sock | 19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_resolver_peer1.sock |
20 | 20 | ||
21 | [peerinfo] | 21 | [peerinfo] |
22 | PORT = 4090 | 22 | PORT = 54090 |
23 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_peerinfo_peer1.sock | 23 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_peerinfo_peer1.sock |
24 | 24 | ||
25 | [transport] | 25 | [transport] |
26 | PORT = 4091 | 26 | PORT = 54091 |
27 | PLUGINS = udp | 27 | PLUGINS = udp |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_transport_peer1.sock | 28 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_transport_peer1.sock |
29 | 29 | ||
diff --git a/src/transport/test_quota_compliance_udp_peer2.conf b/src/transport/test_quota_compliance_udp_peer2.conf index db5f32f0d..1cb04038c 100644 --- a/src/transport/test_quota_compliance_udp_peer2.conf +++ b/src/transport/test_quota_compliance_udp_peer2.conf | |||
@@ -1,29 +1,29 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 3368 | 6 | PORT = 53368 |
7 | MAX_BPS = 50000000 | 7 | MAX_BPS = 50000000 |
8 | 8 | ||
9 | [arm] | 9 | [arm] |
10 | PORT = 3087 | 10 | PORT = 53087 |
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_arm_peer2.sock | 11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_arm_peer2.sock |
12 | 12 | ||
13 | [statistics] | 13 | [statistics] |
14 | PORT = 3088 | 14 | PORT = 53088 |
15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_statistics_peer2.sock | 15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_statistics_peer2.sock |
16 | 16 | ||
17 | [resolver] | 17 | [resolver] |
18 | PORT = 3089 | 18 | PORT = 53089 |
19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_resolver_peer2.sock | 19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_resolver_peer2.sock |
20 | 20 | ||
21 | [peerinfo] | 21 | [peerinfo] |
22 | PORT = 3090 | 22 | PORT = 53090 |
23 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_peerinfo_peer2.sock | 23 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_peerinfo_peer2.sock |
24 | 24 | ||
25 | [transport] | 25 | [transport] |
26 | PORT = 3091 | 26 | PORT = 53091 |
27 | PLUGINS = udp | 27 | PLUGINS = udp |
28 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_transport_peer2.sock | 28 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_udp_transport_peer2.sock |
29 | 29 | ||
diff --git a/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf b/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf index 63beae53c..a8ee6d77a 100644 --- a/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf +++ b/src/transport/test_quota_compliance_unix_asymmetric_peer1.conf | |||
@@ -1,28 +1,28 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 4087 | 6 | PORT = 54087 |
7 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer1.sock | 7 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer1.sock |
8 | 8 | ||
9 | [statistics] | 9 | [statistics] |
10 | PORT = 4088 | 10 | PORT = 54088 |
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer1.sock | 11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer1.sock |
12 | 12 | ||
13 | [resolver] | 13 | [resolver] |
14 | PORT = 4089 | 14 | PORT = 54089 |
15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer1.sock | 15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer1.sock |
16 | 16 | ||
17 | [peerinfo] | 17 | [peerinfo] |
18 | PORT = 4090 | 18 | PORT = 54090 |
19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer1.sock | 19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer1.sock |
20 | 20 | ||
21 | [transport] | 21 | [transport] |
22 | PORT = 4091 | 22 | PORT = 54091 |
23 | PLUGINS = unix | 23 | PLUGINS = unix |
24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer1.sock | 24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer1.sock |
25 | 25 | ||
26 | [transport-unix] | 26 | [transport-unix] |
27 | PORT = 4092 | 27 | PORT = 54092 |
28 | 28 | ||
diff --git a/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf b/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf index 36a55e69c..6edbcac9f 100644 --- a/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf +++ b/src/transport/test_quota_compliance_unix_asymmetric_peer2.conf | |||
@@ -1,28 +1,28 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 3087 | 6 | PORT = 53087 |
7 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer2.sock | 7 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer2.sock |
8 | 8 | ||
9 | [statistics] | 9 | [statistics] |
10 | PORT = 3088 | 10 | PORT = 53088 |
11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer2.sock | 11 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer2.sock |
12 | 12 | ||
13 | [resolver] | 13 | [resolver] |
14 | PORT = 3089 | 14 | PORT = 53089 |
15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer2.sock | 15 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer2.sock |
16 | 16 | ||
17 | [peerinfo] | 17 | [peerinfo] |
18 | PORT = 3090 | 18 | PORT = 53090 |
19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer2.sock | 19 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer2.sock |
20 | 20 | ||
21 | [transport] | 21 | [transport] |
22 | PORT = 3091 | 22 | PORT = 53091 |
23 | PLUGINS = unix | 23 | PLUGINS = unix |
24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer2.sock | 24 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer2.sock |
25 | 25 | ||
26 | [transport-unix] | 26 | [transport-unix] |
27 | PORT = 3368 | 27 | PORT = 53368 |
28 | 28 | ||
diff --git a/src/transport/test_quota_compliance_unix_peer1.conf b/src/transport/test_quota_compliance_unix_peer1.conf index 284a830c5..59c8d6d9e 100644 --- a/src/transport/test_quota_compliance_unix_peer1.conf +++ b/src/transport/test_quota_compliance_unix_peer1.conf | |||
@@ -1,27 +1,27 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer1/ |
4 | 4 | ||
5 | [transport-unix] | 5 | [transport-unix] |
6 | PORT = 12120 | 6 | PORT = 12120 |
7 | 7 | ||
8 | [arm] | 8 | [arm] |
9 | PORT = 4087 | 9 | PORT = 54087 |
10 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer1.sock | 10 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer1.sock |
11 | 11 | ||
12 | [statistics] | 12 | [statistics] |
13 | PORT = 4088 | 13 | PORT = 54088 |
14 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer1.sock | 14 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer1.sock |
15 | 15 | ||
16 | [resolver] | 16 | [resolver] |
17 | PORT = 4089 | 17 | PORT = 54089 |
18 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer1.sock | 18 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer1.sock |
19 | 19 | ||
20 | [peerinfo] | 20 | [peerinfo] |
21 | PORT = 4090 | 21 | PORT = 54090 |
22 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer1.sock | 22 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer1.sock |
23 | 23 | ||
24 | [transport] | 24 | [transport] |
25 | PORT = 4091 | 25 | PORT = 54091 |
26 | PLUGINS = unix | 26 | PLUGINS = unix |
27 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer1.sock | 27 | 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 index 9e10a92f0..8c2f9989e 100644 --- a/src/transport/test_quota_compliance_unix_peer2.conf +++ b/src/transport/test_quota_compliance_unix_peer2.conf | |||
@@ -1,31 +1,31 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test_quota_compliance_peer2 | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test_quota_compliance_peer2 |
4 | 4 | ||
5 | [transport-unix] | 5 | [transport-unix] |
6 | PORT = 12136 | 6 | PORT = 12136 |
7 | 7 | ||
8 | [arm] | 8 | [arm] |
9 | PORT = 3087 | 9 | PORT = 53087 |
10 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer2.sock | 10 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_arm_peer2.sock |
11 | 11 | ||
12 | [statistics] | 12 | [statistics] |
13 | PORT = 3088 | 13 | PORT = 53088 |
14 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer2.sock | 14 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_statistics_peer2.sock |
15 | 15 | ||
16 | [resolver] | 16 | [resolver] |
17 | PORT = 3089 | 17 | PORT = 53089 |
18 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer2.sock | 18 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_resolver_peer2.sock |
19 | 19 | ||
20 | [peerinfo] | 20 | [peerinfo] |
21 | PORT = 3090 | 21 | PORT = 53090 |
22 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer2.sock | 22 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_peerinfo_peer2.sock |
23 | 23 | ||
24 | [transport] | 24 | [transport] |
25 | PORT = 3091 | 25 | PORT = 53091 |
26 | PLUGINS = unix | 26 | PLUGINS = unix |
27 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer2.sock | 27 | UNIXPATH = $GNUNET_RUNTIME_DIR/test_quota_compliance_unix_transport_peer2.sock |
28 | 28 | ||
29 | [transport-unix] | 29 | [transport-unix] |
30 | PORT = 3368 | 30 | PORT = 53368 |
31 | 31 | ||
diff --git a/src/transport/test_quota_compliance_wlan_asymmetric_peer1.conf b/src/transport/test_quota_compliance_wlan_asymmetric_peer1.conf index eb7756f27..78e280b68 100644 --- a/src/transport/test_quota_compliance_wlan_asymmetric_peer1.conf +++ b/src/transport/test_quota_compliance_wlan_asymmetric_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | TESTMODE = 1 | 6 | TESTMODE = 1 |
diff --git a/src/transport/test_quota_compliance_wlan_asymmetric_peer2.conf b/src/transport/test_quota_compliance_wlan_asymmetric_peer2.conf index aafeb09f8..e97ab3f38 100644 --- a/src/transport/test_quota_compliance_wlan_asymmetric_peer2.conf +++ b/src/transport/test_quota_compliance_wlan_asymmetric_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | INTERFACE = mon1 | 6 | INTERFACE = mon1 |
diff --git a/src/transport/test_quota_compliance_wlan_peer1.conf b/src/transport/test_quota_compliance_wlan_peer1.conf index eb7756f27..78e280b68 100644 --- a/src/transport/test_quota_compliance_wlan_peer1.conf +++ b/src/transport/test_quota_compliance_wlan_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | TESTMODE = 1 | 6 | TESTMODE = 1 |
diff --git a/src/transport/test_quota_compliance_wlan_peer2.conf b/src/transport/test_quota_compliance_wlan_peer2.conf index aafeb09f8..e97ab3f38 100644 --- a/src/transport/test_quota_compliance_wlan_peer2.conf +++ b/src/transport/test_quota_compliance_wlan_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | INTERFACE = mon1 | 6 | INTERFACE = mon1 |
diff --git a/src/transport/test_transport_address_switch.c b/src/transport/test_transport_address_switch.c index e076d3501..0414673f4 100644 --- a/src/transport/test_transport_address_switch.c +++ b/src/transport/test_transport_address_switch.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2011, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2011, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_address_switch.c | 19 | * @file transport/test_transport_address_switch.c |
diff --git a/src/transport/test_transport_address_switch_http_peer1.conf b/src/transport/test_transport_address_switch_http_peer1.conf index e361719ec..b48c5f47f 100644 --- a/src/transport/test_transport_address_switch_http_peer1.conf +++ b/src/transport/test_transport_address_switch_http_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [ats] | 5 | [ats] |
6 | UNSPECIFIED_QUOTA_IN = 8 KiB | 6 | UNSPECIFIED_QUOTA_IN = 8 KiB |
diff --git a/src/transport/test_transport_address_switch_http_peer2.conf b/src/transport/test_transport_address_switch_http_peer2.conf index 3c6f4a2a8..be8fb506c 100644 --- a/src/transport/test_transport_address_switch_http_peer2.conf +++ b/src/transport/test_transport_address_switch_http_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [ats] | 5 | [ats] |
6 | UNSPECIFIED_QUOTA_IN = 8 KiB | 6 | UNSPECIFIED_QUOTA_IN = 8 KiB |
diff --git a/src/transport/test_transport_address_switch_https_peer1.conf b/src/transport/test_transport_address_switch_https_peer1.conf index d34dc01f9..1f9210130 100644 --- a/src/transport/test_transport_address_switch_https_peer1.conf +++ b/src/transport/test_transport_address_switch_https_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [ats] | 5 | [ats] |
6 | UNSPECIFIED_QUOTA_IN = 8 KiB | 6 | UNSPECIFIED_QUOTA_IN = 8 KiB |
diff --git a/src/transport/test_transport_address_switch_https_peer2.conf b/src/transport/test_transport_address_switch_https_peer2.conf index 772ff1540..c58839868 100644 --- a/src/transport/test_transport_address_switch_https_peer2.conf +++ b/src/transport/test_transport_address_switch_https_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [ats] | 5 | [ats] |
6 | UNSPECIFIED_QUOTA_IN = 8 KiB | 6 | UNSPECIFIED_QUOTA_IN = 8 KiB |
diff --git a/src/transport/test_transport_address_switch_tcp_peer1.conf b/src/transport/test_transport_address_switch_tcp_peer1.conf index 34248b9e3..cfcbfe41c 100644 --- a/src/transport/test_transport_address_switch_tcp_peer1.conf +++ b/src/transport/test_transport_address_switch_tcp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [ats] | 5 | [ats] |
6 | UNSPECIFIED_QUOTA_IN = 8 KiB | 6 | UNSPECIFIED_QUOTA_IN = 8 KiB |
diff --git a/src/transport/test_transport_address_switch_tcp_peer2.conf b/src/transport/test_transport_address_switch_tcp_peer2.conf index 91a699d76..bda2354b6 100644 --- a/src/transport/test_transport_address_switch_tcp_peer2.conf +++ b/src/transport/test_transport_address_switch_tcp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [ats] | 5 | [ats] |
6 | UNSPECIFIED_QUOTA_IN = 8 KiB | 6 | UNSPECIFIED_QUOTA_IN = 8 KiB |
diff --git a/src/transport/test_transport_address_switch_udp_peer1.conf b/src/transport/test_transport_address_switch_udp_peer1.conf index 69887cf25..bdc3a2253 100644 --- a/src/transport/test_transport_address_switch_udp_peer1.conf +++ b/src/transport/test_transport_address_switch_udp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [ats] | 5 | [ats] |
6 | UNSPECIFIED_QUOTA_IN = 8 KiB | 6 | UNSPECIFIED_QUOTA_IN = 8 KiB |
diff --git a/src/transport/test_transport_address_switch_udp_peer2.conf b/src/transport/test_transport_address_switch_udp_peer2.conf index a0b1d405c..ae6397db4 100644 --- a/src/transport/test_transport_address_switch_udp_peer2.conf +++ b/src/transport/test_transport_address_switch_udp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [ats] | 5 | [ats] |
6 | UNSPECIFIED_QUOTA_IN = 8 KiB | 6 | UNSPECIFIED_QUOTA_IN = 8 KiB |
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 2f55631c3..847b9f56a 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_api.c | 19 | * @file transport/test_transport_api.c |
diff --git a/src/transport/test_transport_api_blacklisting.c b/src/transport/test_transport_api_blacklisting.c index 76780a48a..427240b29 100644 --- a/src/transport/test_transport_api_blacklisting.c +++ b/src/transport/test_transport_api_blacklisting.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2011, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2011, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/test_transport_api_blacklisting_tcp_peer1.conf b/src/transport/test_transport_api_blacklisting_tcp_peer1.conf index 4bfe9b6ca..eabd6b701 100644 --- a/src/transport/test_transport_api_blacklisting_tcp_peer1.conf +++ b/src/transport/test_transport_api_blacklisting_tcp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_blacklisting_tcp_peer2.conf b/src/transport/test_transport_api_blacklisting_tcp_peer2.conf index e68cdbee4..58ce0777f 100644 --- a/src/transport/test_transport_api_blacklisting_tcp_peer2.conf +++ b/src/transport/test_transport_api_blacklisting_tcp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_bluetooth_peer1.conf b/src/transport/test_transport_api_bluetooth_peer1.conf index 12d2ee881..b1209e44b 100644 --- a/src/transport/test_transport_api_bluetooth_peer1.conf +++ b/src/transport/test_transport_api_bluetooth_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci0 | 6 | INTERFACE = hci0 |
diff --git a/src/transport/test_transport_api_bluetooth_peer2.conf b/src/transport/test_transport_api_bluetooth_peer2.conf index b44f7cc53..371a5d3b0 100644 --- a/src/transport/test_transport_api_bluetooth_peer2.conf +++ b/src/transport/test_transport_api_bluetooth_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci1 | 6 | INTERFACE = hci1 |
diff --git a/src/transport/test_transport_api_data.conf b/src/transport/test_transport_api_data.conf index 58b8e17b0..c06235a0a 100644 --- a/src/transport/test_transport_api_data.conf +++ b/src/transport/test_transport_api_data.conf | |||
@@ -2,8 +2,8 @@ | |||
2 | [PATHS] | 2 | [PATHS] |
3 | 3 | ||
4 | [transport-tcp] | 4 | [transport-tcp] |
5 | PORT = 2094 | 5 | PORT = 52094 |
6 | 6 | ||
7 | [transport-udp] | 7 | [transport-udp] |
8 | PORT = 2094 | 8 | PORT = 52094 |
9 | 9 | ||
diff --git a/src/transport/test_transport_api_disconnect.c b/src/transport/test_transport_api_disconnect.c index 870d9e4c2..85bfb7368 100644 --- a/src/transport/test_transport_api_disconnect.c +++ b/src/transport/test_transport_api_disconnect.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_api_disconnect.c | 19 | * @file transport/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 index 72b8006b1..8530ba310 100644 --- a/src/transport/test_transport_api_disconnect_tcp_peer1.conf +++ b/src/transport/test_transport_api_disconnect_tcp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_disconnect_tcp_peer2.conf b/src/transport/test_transport_api_disconnect_tcp_peer2.conf index ba7e5ff24..ce9c2f885 100644 --- a/src/transport/test_transport_api_disconnect_tcp_peer2.conf +++ b/src/transport/test_transport_api_disconnect_tcp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_http_peer1.conf b/src/transport/test_transport_api_http_peer1.conf index de0ff8506..2a622ae02 100644 --- a/src/transport/test_transport_api_http_peer1.conf +++ b/src/transport/test_transport_api_http_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-http-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = http_client | 6 | PLUGINS = http_client |
diff --git a/src/transport/test_transport_api_http_peer2.conf b/src/transport/test_transport_api_http_peer2.conf index 1559c78fd..aca41804b 100644 --- a/src/transport/test_transport_api_http_peer2.conf +++ b/src/transport/test_transport_api_http_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-http-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = http_server | 6 | 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 index ae29d8a29..67640d7bb 100644 --- a/src/transport/test_transport_api_http_reverse_peer1.conf +++ b/src/transport/test_transport_api_http_reverse_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-http-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = http_client | 6 | PLUGINS = http_client |
diff --git a/src/transport/test_transport_api_http_reverse_peer2.conf b/src/transport/test_transport_api_http_reverse_peer2.conf index 136c09008..0e7a2ea05 100644 --- a/src/transport/test_transport_api_http_reverse_peer2.conf +++ b/src/transport/test_transport_api_http_reverse_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-http-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p2/ |
4 | 4 | ||
5 | [transport-http_server] | 5 | [transport-http_server] |
6 | PORT = 8080 | 6 | PORT = 8080 |
diff --git a/src/transport/test_transport_api_https_peer1.conf b/src/transport/test_transport_api_https_peer1.conf index c6a083f37..55d119259 100644 --- a/src/transport/test_transport_api_https_peer1.conf +++ b/src/transport/test_transport_api_https_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-https-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p1/ |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 12105 | 6 | PORT = 12105 |
diff --git a/src/transport/test_transport_api_https_peer2.conf b/src/transport/test_transport_api_https_peer2.conf index 49210651c..3b1d55b0a 100644 --- a/src/transport/test_transport_api_https_peer2.conf +++ b/src/transport/test_transport_api_https_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-https-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p2/ |
4 | 4 | ||
5 | [transport-https_server] | 5 | [transport-https_server] |
6 | EXTERNAL_HOSTNAME = localhost | 6 | EXTERNAL_HOSTNAME = localhost |
diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c index e487748aa..bba695bb5 100644 --- a/src/transport/test_transport_api_limited_sockets.c +++ b/src/transport/test_transport_api_limited_sockets.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010 GNUnet e.V. | 3 | Copyright (C) 2009, 2010 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_api_limited_sockets.c | 19 | * @file transport/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 index 3d30f84ea..e0ad5f847 100644 --- a/src/transport/test_transport_api_limited_sockets_tcp_peer1.conf +++ b/src/transport/test_transport_api_limited_sockets_tcp_peer1.conf | |||
@@ -1,7 +1,7 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | @INLINE@ ../../contrib/no_autostart_above_core.conf | 2 | @INLINE@ ../../contrib/conf/gnunet/no_autostart_above_core.conf |
3 | [PATHS] | 3 | [PATHS] |
4 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 4 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
5 | 5 | ||
6 | [transport] | 6 | [transport] |
7 | PLUGINS = tcp | 7 | 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 index 09781b2a5..bb466abba 100644 --- a/src/transport/test_transport_api_limited_sockets_tcp_peer2.conf +++ b/src/transport/test_transport_api_limited_sockets_tcp_peer2.conf | |||
@@ -1,8 +1,8 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | @INLINE@ ../../contrib/no_autostart_above_core.conf | 2 | @INLINE@ ../../contrib/conf/gnunet/no_autostart_above_core.conf |
3 | 3 | ||
4 | [PATHS] | 4 | [PATHS] |
5 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 5 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
6 | 6 | ||
7 | [transport] | 7 | [transport] |
8 | PLUGINS = tcp | 8 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_manipulation_cfg.c b/src/transport/test_transport_api_manipulation_cfg.c index a2312a872..350dc8eab 100644 --- a/src/transport/test_transport_api_manipulation_cfg.c +++ b/src/transport/test_transport_api_manipulation_cfg.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_api_manipulation_cfg.c | 19 | * @file transport/test_transport_api_manipulation_cfg.c |
@@ -170,6 +168,7 @@ main (int argc, | |||
170 | 168 | ||
171 | ccc = &my_ccc; | 169 | ccc = &my_ccc; |
172 | sc.ccc = ccc; | 170 | sc.ccc = ccc; |
171 | start_request = GNUNET_TIME_absolute_get (); | ||
173 | if (GNUNET_OK != | 172 | if (GNUNET_OK != |
174 | GNUNET_TRANSPORT_TESTING_main (2, | 173 | GNUNET_TRANSPORT_TESTING_main (2, |
175 | &GNUNET_TRANSPORT_TESTING_connect_check, | 174 | &GNUNET_TRANSPORT_TESTING_connect_check, |
diff --git a/src/transport/test_transport_api_manipulation_cfg_peer1.conf b/src/transport/test_transport_api_manipulation_cfg_peer1.conf index e611b1ae9..77cdce2e2 100644 --- a/src/transport/test_transport_api_manipulation_cfg_peer1.conf +++ b/src/transport/test_transport_api_manipulation_cfg_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_manipulation_cfg_peer2.conf b/src/transport/test_transport_api_manipulation_cfg_peer2.conf index 2c0251fa3..9cbaaddef 100644 --- a/src/transport/test_transport_api_manipulation_cfg_peer2.conf +++ b/src/transport/test_transport_api_manipulation_cfg_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_manipulation_recv_tcp.c b/src/transport/test_transport_api_manipulation_recv_tcp.c index 33f86e8a6..40e0b6a4d 100644 --- a/src/transport/test_transport_api_manipulation_recv_tcp.c +++ b/src/transport/test_transport_api_manipulation_recv_tcp.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_api_manipulation_recv_tcp.c | 19 | * @file transport/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 index d75e23e06..9150c7faf 100644 --- a/src/transport/test_transport_api_manipulation_recv_tcp_peer1.conf +++ b/src/transport/test_transport_api_manipulation_recv_tcp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12000 | 6 | PORT = 12000 |
diff --git a/src/transport/test_transport_api_manipulation_recv_tcp_peer2.conf b/src/transport/test_transport_api_manipulation_recv_tcp_peer2.conf index 326943504..a7b2cf90b 100644 --- a/src/transport/test_transport_api_manipulation_recv_tcp_peer2.conf +++ b/src/transport/test_transport_api_manipulation_recv_tcp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12015 | 6 | PORT = 12015 |
diff --git a/src/transport/test_transport_api_manipulation_send_tcp.c b/src/transport/test_transport_api_manipulation_send_tcp.c index 602d4d277..278ec45c5 100644 --- a/src/transport/test_transport_api_manipulation_send_tcp.c +++ b/src/transport/test_transport_api_manipulation_send_tcp.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_api_manipulation_send_tcp.c | 19 | * @file transport/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 index d75e23e06..9150c7faf 100644 --- a/src/transport/test_transport_api_manipulation_send_tcp_peer1.conf +++ b/src/transport/test_transport_api_manipulation_send_tcp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12000 | 6 | PORT = 12000 |
diff --git a/src/transport/test_transport_api_manipulation_send_tcp_peer2.conf b/src/transport/test_transport_api_manipulation_send_tcp_peer2.conf index 326943504..a7b2cf90b 100644 --- a/src/transport/test_transport_api_manipulation_send_tcp_peer2.conf +++ b/src/transport/test_transport_api_manipulation_send_tcp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12015 | 6 | PORT = 12015 |
diff --git a/src/transport/test_transport_api_monitor_peers.c b/src/transport/test_transport_api_monitor_peers.c index 4a0f1a23f..8a01b15a3 100644 --- a/src/transport/test_transport_api_monitor_peers.c +++ b/src/transport/test_transport_api_monitor_peers.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_api_monitor_peers.c | 19 | * @file transport/test_transport_api_monitor_peers.c |
diff --git a/src/transport/test_transport_api_monitor_peers_peer1.conf b/src/transport/test_transport_api_monitor_peers_peer1.conf index a5518c524..bc9eee19b 100644 --- a/src/transport/test_transport_api_monitor_peers_peer1.conf +++ b/src/transport/test_transport_api_monitor_peers_peer1.conf | |||
@@ -1,4 +1,4 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-monitoring-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-monitoring-p1/ |
4 | 4 | ||
diff --git a/src/transport/test_transport_api_monitor_peers_peer2.conf b/src/transport/test_transport_api_monitor_peers_peer2.conf index 248557b39..5225a5a87 100644 --- a/src/transport/test_transport_api_monitor_peers_peer2.conf +++ b/src/transport/test_transport_api_monitor_peers_peer2.conf | |||
@@ -1,5 +1,5 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-monitoring-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-monitoring-p2/ |
4 | 4 | ||
5 | 5 | ||
diff --git a/src/transport/test_transport_api_monitor_validation_peer1.conf b/src/transport/test_transport_api_monitor_validation_peer1.conf index aca9c1e7c..02f7bc2f0 100644 --- a/src/transport/test_transport_api_monitor_validation_peer1.conf +++ b/src/transport/test_transport_api_monitor_validation_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-monitoring-val-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-monitoring-val-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS=tcp | 6 | PLUGINS=tcp |
diff --git a/src/transport/test_transport_api_monitor_validation_peer2.conf b/src/transport/test_transport_api_monitor_validation_peer2.conf index 86dfcbbbc..d4e0874f0 100644 --- a/src/transport/test_transport_api_monitor_validation_peer2.conf +++ b/src/transport/test_transport_api_monitor_validation_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-monitoring-val-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-monitoring-val-p2/ |
4 | 4 | ||
5 | [TRANSPORT] | 5 | [TRANSPORT] |
6 | PLUGINS=tcp | 6 | PLUGINS=tcp |
diff --git a/src/transport/test_transport_api_multi_peer1.conf b/src/transport/test_transport_api_multi_peer1.conf index 87b7610ed..b7cb98777 100644 --- a/src/transport/test_transport_api_multi_peer1.conf +++ b/src/transport/test_transport_api_multi_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-multi-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-multi-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp udp | 6 | PLUGINS = tcp udp |
diff --git a/src/transport/test_transport_api_multi_peer2.conf b/src/transport/test_transport_api_multi_peer2.conf index f6bb59183..f69e0abd9 100644 --- a/src/transport/test_transport_api_multi_peer2.conf +++ b/src/transport/test_transport_api_multi_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-multi-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-multi-p2/ |
4 | 4 | ||
5 | [nat] | 5 | [nat] |
6 | ALLOW_NAT = NO | 6 | ALLOW_NAT = NO |
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index e5ba2831b..c6e77bae0 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_api_reliability.c | 19 | * @file transport/test_transport_api_reliability.c |
@@ -176,6 +174,8 @@ custom_shutdown (void *cls) | |||
176 | 174 | ||
177 | /* Calculcate statistics */ | 175 | /* Calculcate statistics */ |
178 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; | 176 | delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; |
177 | if (0 == delta) | ||
178 | delta = 1; | ||
179 | rate = (1000LL* 1000ll * total_bytes) / (1024 * delta); | 179 | rate = (1000LL* 1000ll * total_bytes) / (1024 * delta); |
180 | FPRINTF (stderr, | 180 | FPRINTF (stderr, |
181 | "\nThroughput was %llu KiBytes/s\n", | 181 | "\nThroughput was %llu KiBytes/s\n", |
diff --git a/src/transport/test_transport_api_reliability_bluetooth_peer1.conf b/src/transport/test_transport_api_reliability_bluetooth_peer1.conf index 0bf419c2d..738255235 100644 --- a/src/transport/test_transport_api_reliability_bluetooth_peer1.conf +++ b/src/transport/test_transport_api_reliability_bluetooth_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci0 | 6 | INTERFACE = hci0 |
diff --git a/src/transport/test_transport_api_reliability_bluetooth_peer2.conf b/src/transport/test_transport_api_reliability_bluetooth_peer2.conf index b60e8e360..9c68b5fbc 100644 --- a/src/transport/test_transport_api_reliability_bluetooth_peer2.conf +++ b/src/transport/test_transport_api_reliability_bluetooth_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci1 | 6 | INTERFACE = hci1 |
diff --git a/src/transport/test_transport_api_reliability_http_peer1.conf b/src/transport/test_transport_api_reliability_http_peer1.conf index a04b6d3d8..a1e5c96ac 100644 --- a/src/transport/test_transport_api_reliability_http_peer1.conf +++ b/src/transport/test_transport_api_reliability_http_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-http-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p1/ |
4 | 4 | ||
5 | [transport-http_client] | 5 | [transport-http_client] |
6 | 6 | ||
diff --git a/src/transport/test_transport_api_reliability_http_peer2.conf b/src/transport/test_transport_api_reliability_http_peer2.conf index 8d85cf7b1..25a554f94 100644 --- a/src/transport/test_transport_api_reliability_http_peer2.conf +++ b/src/transport/test_transport_api_reliability_http_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-http-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p2/ |
4 | 4 | ||
5 | [transport-http_server] | 5 | [transport-http_server] |
6 | PORT = 12090 | 6 | PORT = 12090 |
diff --git a/src/transport/test_transport_api_reliability_http_xhr_peer1.conf b/src/transport/test_transport_api_reliability_http_xhr_peer1.conf index c0cd835a5..ba4101ebe 100644 --- a/src/transport/test_transport_api_reliability_http_xhr_peer1.conf +++ b/src/transport/test_transport_api_reliability_http_xhr_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-http-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p1/ |
4 | 4 | ||
5 | [transport-http_client] | 5 | [transport-http_client] |
6 | EMULATE_XHR = YES | 6 | EMULATE_XHR = YES |
diff --git a/src/transport/test_transport_api_reliability_http_xhr_peer2.conf b/src/transport/test_transport_api_reliability_http_xhr_peer2.conf index 8d85cf7b1..25a554f94 100644 --- a/src/transport/test_transport_api_reliability_http_xhr_peer2.conf +++ b/src/transport/test_transport_api_reliability_http_xhr_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-http-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p2/ |
4 | 4 | ||
5 | [transport-http_server] | 5 | [transport-http_server] |
6 | PORT = 12090 | 6 | PORT = 12090 |
diff --git a/src/transport/test_transport_api_reliability_https_peer1.conf b/src/transport/test_transport_api_reliability_https_peer1.conf index 07f8590a2..1b51da130 100644 --- a/src/transport/test_transport_api_reliability_https_peer1.conf +++ b/src/transport/test_transport_api_reliability_https_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-https-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p1/ |
4 | 4 | ||
5 | [transport-https_client] | 5 | [transport-https_client] |
6 | 6 | ||
diff --git a/src/transport/test_transport_api_reliability_https_peer2.conf b/src/transport/test_transport_api_reliability_https_peer2.conf index 7f7f80778..3dfb87a6d 100644 --- a/src/transport/test_transport_api_reliability_https_peer2.conf +++ b/src/transport/test_transport_api_reliability_https_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-https-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p2/ |
4 | 4 | ||
5 | [transport-https_server] | 5 | [transport-https_server] |
6 | PORT = 12310 | 6 | PORT = 12310 |
diff --git a/src/transport/test_transport_api_reliability_https_xhr_peer1.conf b/src/transport/test_transport_api_reliability_https_xhr_peer1.conf index 614e371da..5d042f2f9 100644 --- a/src/transport/test_transport_api_reliability_https_xhr_peer1.conf +++ b/src/transport/test_transport_api_reliability_https_xhr_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-https-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p1/ |
4 | 4 | ||
5 | [transport-https_client] | 5 | [transport-https_client] |
6 | EMULATE_XHR = YES | 6 | EMULATE_XHR = YES |
diff --git a/src/transport/test_transport_api_reliability_https_xhr_peer2.conf b/src/transport/test_transport_api_reliability_https_xhr_peer2.conf index 7f7f80778..3dfb87a6d 100644 --- a/src/transport/test_transport_api_reliability_https_xhr_peer2.conf +++ b/src/transport/test_transport_api_reliability_https_xhr_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-https-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p2/ |
4 | 4 | ||
5 | [transport-https_server] | 5 | [transport-https_server] |
6 | PORT = 12310 | 6 | PORT = 12310 |
diff --git a/src/transport/test_transport_api_reliability_tcp_nat_peer1.conf b/src/transport/test_transport_api_reliability_tcp_nat_peer1.conf index e3c14dc0b..6a2029b09 100644 --- a/src/transport/test_transport_api_reliability_tcp_nat_peer1.conf +++ b/src/transport/test_transport_api_reliability_tcp_nat_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-reliability-tcp-nat-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-reliability-tcp-nat-p1/ |
4 | 4 | ||
5 | [nat] | 5 | [nat] |
6 | BEHIND_NAT = YES | 6 | BEHIND_NAT = YES |
@@ -12,7 +12,7 @@ PORT = 0 | |||
12 | TIMEOUT = 5 s | 12 | TIMEOUT = 5 s |
13 | 13 | ||
14 | [arm] | 14 | [arm] |
15 | PORT = 1204 | 15 | PORT = 51204 |
16 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock | 16 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock |
17 | 17 | ||
18 | [statistics] | 18 | [statistics] |
diff --git a/src/transport/test_transport_api_reliability_tcp_nat_peer2.conf b/src/transport/test_transport_api_reliability_tcp_nat_peer2.conf index 6a648c41c..2de9026f5 100644 --- a/src/transport/test_transport_api_reliability_tcp_nat_peer2.conf +++ b/src/transport/test_transport_api_reliability_tcp_nat_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-reliability-tcp-nat-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-reliability-tcp-nat-p2/ |
4 | 4 | ||
5 | [nat] | 5 | [nat] |
6 | DISABLEV6 = YES | 6 | DISABLEV6 = YES |
diff --git a/src/transport/test_transport_api_reliability_tcp_peer1.conf b/src/transport/test_transport_api_reliability_tcp_peer1.conf index 297382fcf..305605d63 100644 --- a/src/transport/test_transport_api_reliability_tcp_peer1.conf +++ b/src/transport/test_transport_api_reliability_tcp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12000 | 6 | PORT = 12000 |
diff --git a/src/transport/test_transport_api_reliability_tcp_peer2.conf b/src/transport/test_transport_api_reliability_tcp_peer2.conf index 879223ad9..43bb4ae37 100644 --- a/src/transport/test_transport_api_reliability_tcp_peer2.conf +++ b/src/transport/test_transport_api_reliability_tcp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12015 | 6 | PORT = 12015 |
diff --git a/src/transport/test_transport_api_reliability_udp_peer1.conf b/src/transport/test_transport_api_reliability_udp_peer1.conf index 34e4d7eea..141fb0840 100644 --- a/src/transport/test_transport_api_reliability_udp_peer1.conf +++ b/src/transport/test_transport_api_reliability_udp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-udp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p1/ |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 12040 | 6 | PORT = 12040 |
diff --git a/src/transport/test_transport_api_reliability_udp_peer2.conf b/src/transport/test_transport_api_reliability_udp_peer2.conf index 23eae7862..7523db854 100644 --- a/src/transport/test_transport_api_reliability_udp_peer2.conf +++ b/src/transport/test_transport_api_reliability_udp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-udp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p2/ |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 12050 | 6 | PORT = 12050 |
diff --git a/src/transport/test_transport_api_reliability_unix_peer1.conf b/src/transport/test_transport_api_reliability_unix_peer1.conf index d43ef4a33..e253aad8c 100644 --- a/src/transport/test_transport_api_reliability_unix_peer1.conf +++ b/src/transport/test_transport_api_reliability_unix_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-unix-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p1/ |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 12125 | 6 | PORT = 12125 |
diff --git a/src/transport/test_transport_api_reliability_unix_peer2.conf b/src/transport/test_transport_api_reliability_unix_peer2.conf index f863d4d42..e0df47c07 100644 --- a/src/transport/test_transport_api_reliability_unix_peer2.conf +++ b/src/transport/test_transport_api_reliability_unix_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-unix-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p2/ |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 12135 | 6 | PORT = 12135 |
diff --git a/src/transport/test_transport_api_reliability_wlan_peer1.conf b/src/transport/test_transport_api_reliability_wlan_peer1.conf index 2ad5b3e14..19eb21456 100644 --- a/src/transport/test_transport_api_reliability_wlan_peer1.conf +++ b/src/transport/test_transport_api_reliability_wlan_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | TESTMODE = 1 | 6 | TESTMODE = 1 |
diff --git a/src/transport/test_transport_api_reliability_wlan_peer2.conf b/src/transport/test_transport_api_reliability_wlan_peer2.conf index b52438c21..d5c269b43 100644 --- a/src/transport/test_transport_api_reliability_wlan_peer2.conf +++ b/src/transport/test_transport_api_reliability_wlan_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | INTERFACE = mon1 | 6 | INTERFACE = mon1 |
diff --git a/src/transport/test_transport_api_restart_1peer_peer1.conf b/src/transport/test_transport_api_restart_1peer_peer1.conf index 4bfe9b6ca..eabd6b701 100644 --- a/src/transport/test_transport_api_restart_1peer_peer1.conf +++ b/src/transport/test_transport_api_restart_1peer_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_restart_1peer_peer2.conf b/src/transport/test_transport_api_restart_1peer_peer2.conf index e68cdbee4..58ce0777f 100644 --- a/src/transport/test_transport_api_restart_1peer_peer2.conf +++ b/src/transport/test_transport_api_restart_1peer_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_restart_2peers_peer1.conf b/src/transport/test_transport_api_restart_2peers_peer1.conf index 4bfe9b6ca..eabd6b701 100644 --- a/src/transport/test_transport_api_restart_2peers_peer1.conf +++ b/src/transport/test_transport_api_restart_2peers_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_restart_2peers_peer2.conf b/src/transport/test_transport_api_restart_2peers_peer2.conf index e68cdbee4..58ce0777f 100644 --- a/src/transport/test_transport_api_restart_2peers_peer2.conf +++ b/src/transport/test_transport_api_restart_2peers_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_restart_reconnect.c b/src/transport/test_transport_api_restart_reconnect.c index 477b8b54d..fc0c20233 100644 --- a/src/transport/test_transport_api_restart_reconnect.c +++ b/src/transport/test_transport_api_restart_reconnect.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2015, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2015, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_api_restart_reconnect.c | 19 | * @file transport/test_transport_api_restart_reconnect.c |
diff --git a/src/transport/test_transport_api_slow_ats_peer1.conf b/src/transport/test_transport_api_slow_ats_peer1.conf index 5d50d5375..a96f5e263 100644 --- a/src/transport/test_transport_api_slow_ats_peer1.conf +++ b/src/transport/test_transport_api_slow_ats_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-slow-ats-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-slow-ats-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_slow_ats_peer2.conf b/src/transport/test_transport_api_slow_ats_peer2.conf index 6b67c89d8..3a6ed05d3 100644 --- a/src/transport/test_transport_api_slow_ats_peer2.conf +++ b/src/transport/test_transport_api_slow_ats_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-slow-ats-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-slow-ats-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_tcp_nat_peer1.conf b/src/transport/test_transport_api_tcp_nat_peer1.conf index 946d5e1cb..fb2fcecc6 100644 --- a/src/transport/test_transport_api_tcp_nat_peer1.conf +++ b/src/transport/test_transport_api_tcp_nat_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-nat-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-nat-p1/ |
4 | 4 | ||
5 | [nat] | 5 | [nat] |
6 | BEHIND_NAT = YES | 6 | BEHIND_NAT = YES |
@@ -12,7 +12,7 @@ PORT = 0 | |||
12 | TIMEOUT = 5 s | 12 | TIMEOUT = 5 s |
13 | 13 | ||
14 | [arm] | 14 | [arm] |
15 | PORT = 1204 | 15 | PORT = 51204 |
16 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock | 16 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-p1-service-arm.sock |
17 | 17 | ||
18 | [statistics] | 18 | [statistics] |
diff --git a/src/transport/test_transport_api_tcp_nat_peer2.conf b/src/transport/test_transport_api_tcp_nat_peer2.conf index eae20a8d5..1faefc195 100644 --- a/src/transport/test_transport_api_tcp_nat_peer2.conf +++ b/src/transport/test_transport_api_tcp_nat_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-nat-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-nat-p2/ |
4 | 4 | ||
5 | [nat] | 5 | [nat] |
6 | DISABLEV6 = YES | 6 | DISABLEV6 = YES |
diff --git a/src/transport/test_transport_api_tcp_peer1.conf b/src/transport/test_transport_api_tcp_peer1.conf index 4bfe9b6ca..eabd6b701 100644 --- a/src/transport/test_transport_api_tcp_peer1.conf +++ b/src/transport/test_transport_api_tcp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_tcp_peer2.conf b/src/transport/test_transport_api_tcp_peer2.conf index e68cdbee4..58ce0777f 100644 --- a/src/transport/test_transport_api_tcp_peer2.conf +++ b/src/transport/test_transport_api_tcp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_api_timeout.c b/src/transport/test_transport_api_timeout.c index 042cbebed..0185b690b 100644 --- a/src/transport/test_transport_api_timeout.c +++ b/src/transport/test_transport_api_timeout.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet.x | 2 | This file is part of GNUnet.x |
3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_api_timeout.c | 19 | * @file transport/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 index d63bca939..dcc159e45 100644 --- a/src/transport/test_transport_api_timeout_bluetooth_peer1.conf +++ b/src/transport/test_transport_api_timeout_bluetooth_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci0 | 6 | INTERFACE = hci0 |
diff --git a/src/transport/test_transport_api_timeout_bluetooth_peer2.conf b/src/transport/test_transport_api_timeout_bluetooth_peer2.conf index 4a19cddf5..5cd550d0e 100644 --- a/src/transport/test_transport_api_timeout_bluetooth_peer2.conf +++ b/src/transport/test_transport_api_timeout_bluetooth_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci1 | 6 | INTERFACE = hci1 |
diff --git a/src/transport/test_transport_api_timeout_http_peer1.conf b/src/transport/test_transport_api_timeout_http_peer1.conf index 5811761d2..d7bc59ea3 100644 --- a/src/transport/test_transport_api_timeout_http_peer1.conf +++ b/src/transport/test_transport_api_timeout_http_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-http-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p1/ |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 12085 | 6 | PORT = 12085 |
diff --git a/src/transport/test_transport_api_timeout_http_peer2.conf b/src/transport/test_transport_api_timeout_http_peer2.conf index 934dc8c6c..453c6d0c5 100644 --- a/src/transport/test_transport_api_timeout_http_peer2.conf +++ b/src/transport/test_transport_api_timeout_http_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-http-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-http-p2/ |
4 | 4 | ||
5 | [transport-http_server] | 5 | [transport-http_server] |
6 | PORT = 12090 | 6 | PORT = 12090 |
diff --git a/src/transport/test_transport_api_timeout_https_peer1.conf b/src/transport/test_transport_api_timeout_https_peer1.conf index 8fc2edf2e..c4f96814c 100644 --- a/src/transport/test_transport_api_timeout_https_peer1.conf +++ b/src/transport/test_transport_api_timeout_https_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-https-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p1/ |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 12105 | 6 | PORT = 12105 |
diff --git a/src/transport/test_transport_api_timeout_https_peer2.conf b/src/transport/test_transport_api_timeout_https_peer2.conf index 017aa908e..bfdf0caec 100644 --- a/src/transport/test_transport_api_timeout_https_peer2.conf +++ b/src/transport/test_transport_api_timeout_https_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-https-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-https-p2/ |
4 | 4 | ||
5 | [transport-https_server] | 5 | [transport-https_server] |
6 | PORT = 12110 | 6 | PORT = 12110 |
diff --git a/src/transport/test_transport_api_timeout_tcp_peer1.conf b/src/transport/test_transport_api_timeout_tcp_peer1.conf index 4cdfdcdee..389250bec 100644 --- a/src/transport/test_transport_api_timeout_tcp_peer1.conf +++ b/src/transport/test_transport_api_timeout_tcp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12000 | 6 | PORT = 12000 |
diff --git a/src/transport/test_transport_api_timeout_tcp_peer2.conf b/src/transport/test_transport_api_timeout_tcp_peer2.conf index 2abd5331c..225b8fac2 100644 --- a/src/transport/test_transport_api_timeout_tcp_peer2.conf +++ b/src/transport/test_transport_api_timeout_tcp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [nat] | 5 | [nat] |
6 | ALLOW_NAT = NO | 6 | ALLOW_NAT = NO |
diff --git a/src/transport/test_transport_api_timeout_udp_peer1.conf b/src/transport/test_transport_api_timeout_udp_peer1.conf index efa08fde5..e28e3a2e0 100644 --- a/src/transport/test_transport_api_timeout_udp_peer1.conf +++ b/src/transport/test_transport_api_timeout_udp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-udp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p1/ |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 12040 | 6 | PORT = 12040 |
diff --git a/src/transport/test_transport_api_timeout_udp_peer2.conf b/src/transport/test_transport_api_timeout_udp_peer2.conf index 14618f3b4..434ef4853 100644 --- a/src/transport/test_transport_api_timeout_udp_peer2.conf +++ b/src/transport/test_transport_api_timeout_udp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-udp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p2/ |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 12050 | 6 | PORT = 12050 |
diff --git a/src/transport/test_transport_api_timeout_unix_peer1.conf b/src/transport/test_transport_api_timeout_unix_peer1.conf index d43ef4a33..e253aad8c 100644 --- a/src/transport/test_transport_api_timeout_unix_peer1.conf +++ b/src/transport/test_transport_api_timeout_unix_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-unix-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p1/ |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 12125 | 6 | PORT = 12125 |
diff --git a/src/transport/test_transport_api_timeout_unix_peer2.conf b/src/transport/test_transport_api_timeout_unix_peer2.conf index 9feed6592..bd3fccbb3 100644 --- a/src/transport/test_transport_api_timeout_unix_peer2.conf +++ b/src/transport/test_transport_api_timeout_unix_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-unix-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p2/ |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 12135 | 6 | PORT = 12135 |
diff --git a/src/transport/test_transport_api_timeout_wlan_peer1.conf b/src/transport/test_transport_api_timeout_wlan_peer1.conf index 8b870f1d4..68716d287 100644 --- a/src/transport/test_transport_api_timeout_wlan_peer1.conf +++ b/src/transport/test_transport_api_timeout_wlan_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | INTERFACE = mon0 | 6 | INTERFACE = mon0 |
diff --git a/src/transport/test_transport_api_timeout_wlan_peer2.conf b/src/transport/test_transport_api_timeout_wlan_peer2.conf index c32ce5ced..98bbc6e2b 100644 --- a/src/transport/test_transport_api_timeout_wlan_peer2.conf +++ b/src/transport/test_transport_api_timeout_wlan_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | INTERFACE = mon1 | 6 | INTERFACE = mon1 |
diff --git a/src/transport/test_transport_api_udp_nat_peer1.conf b/src/transport/test_transport_api_udp_nat_peer1.conf index 23f280b5e..7bbcaa628 100644 --- a/src/transport/test_transport_api_udp_nat_peer1.conf +++ b/src/transport/test_transport_api_udp_nat_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-udp-nat-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-nat-p1/ |
4 | 4 | ||
5 | [nat] | 5 | [nat] |
6 | BEHIND_NAT = YES | 6 | BEHIND_NAT = YES |
diff --git a/src/transport/test_transport_api_udp_nat_peer2.conf b/src/transport/test_transport_api_udp_nat_peer2.conf index 702791846..8bdb8c293 100644 --- a/src/transport/test_transport_api_udp_nat_peer2.conf +++ b/src/transport/test_transport_api_udp_nat_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-udp-nat-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-nat-p2/ |
4 | 4 | ||
5 | [nat] | 5 | [nat] |
6 | ALLOW_NAT = YES | 6 | ALLOW_NAT = YES |
diff --git a/src/transport/test_transport_api_udp_peer1.conf b/src/transport/test_transport_api_udp_peer1.conf index 7c1f0d9f9..4684b77f2 100644 --- a/src/transport/test_transport_api_udp_peer1.conf +++ b/src/transport/test_transport_api_udp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-udp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p1/ |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 0 | 6 | PORT = 0 |
diff --git a/src/transport/test_transport_api_udp_peer2.conf b/src/transport/test_transport_api_udp_peer2.conf index ab9b2148f..96706ce49 100644 --- a/src/transport/test_transport_api_udp_peer2.conf +++ b/src/transport/test_transport_api_udp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-udp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p2/ |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 12050 | 6 | PORT = 12050 |
diff --git a/src/transport/test_transport_api_unix_abstract_peer1.conf b/src/transport/test_transport_api_unix_abstract_peer1.conf index aea61113d..103a483b4 100644 --- a/src/transport/test_transport_api_unix_abstract_peer1.conf +++ b/src/transport/test_transport_api_unix_abstract_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-unix-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p1/ |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 12125 | 6 | PORT = 12125 |
diff --git a/src/transport/test_transport_api_unix_abstract_peer2.conf b/src/transport/test_transport_api_unix_abstract_peer2.conf index 3adbd7fd0..c3a5525d9 100644 --- a/src/transport/test_transport_api_unix_abstract_peer2.conf +++ b/src/transport/test_transport_api_unix_abstract_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-unix-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p2/ |
4 | 4 | ||
5 | [arm] | 5 | [arm] |
6 | PORT = 12135 | 6 | PORT = 12135 |
diff --git a/src/transport/test_transport_api_unix_peer1.conf b/src/transport/test_transport_api_unix_peer1.conf index 292756806..005558bcc 100644 --- a/src/transport/test_transport_api_unix_peer1.conf +++ b/src/transport/test_transport_api_unix_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-unix-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = unix | 6 | PLUGINS = unix |
diff --git a/src/transport/test_transport_api_unix_peer2.conf b/src/transport/test_transport_api_unix_peer2.conf index 6da2a2b7c..840ed81c7 100644 --- a/src/transport/test_transport_api_unix_peer2.conf +++ b/src/transport/test_transport_api_unix_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-unix-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-unix-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = unix | 6 | PLUGINS = unix |
diff --git a/src/transport/test_transport_api_unreliability_bluetooth_peer1.conf b/src/transport/test_transport_api_unreliability_bluetooth_peer1.conf index 8f50bf113..3f86ee940 100644 --- a/src/transport/test_transport_api_unreliability_bluetooth_peer1.conf +++ b/src/transport/test_transport_api_unreliability_bluetooth_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p1/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci0 | 6 | INTERFACE = hci0 |
diff --git a/src/transport/test_transport_api_unreliability_bluetooth_peer2.conf b/src/transport/test_transport_api_unreliability_bluetooth_peer2.conf index 1816ec99e..5fc178395 100644 --- a/src/transport/test_transport_api_unreliability_bluetooth_peer2.conf +++ b/src/transport/test_transport_api_unreliability_bluetooth_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-bluetooth-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-bluetooth-p2/ |
4 | 4 | ||
5 | [transport-bluetooth] | 5 | [transport-bluetooth] |
6 | INTERFACE = hci1 | 6 | INTERFACE = hci1 |
diff --git a/src/transport/test_transport_api_unreliability_constant_udp_peer1.conf b/src/transport/test_transport_api_unreliability_constant_udp_peer1.conf index eeee8ee62..9f63c0ced 100644 --- a/src/transport/test_transport_api_unreliability_constant_udp_peer1.conf +++ b/src/transport/test_transport_api_unreliability_constant_udp_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-udp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p1/ |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 12040 | 6 | PORT = 12040 |
diff --git a/src/transport/test_transport_api_unreliability_constant_udp_peer2.conf b/src/transport/test_transport_api_unreliability_constant_udp_peer2.conf index 678642a41..cdf3d7bb4 100644 --- a/src/transport/test_transport_api_unreliability_constant_udp_peer2.conf +++ b/src/transport/test_transport_api_unreliability_constant_udp_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-udp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-udp-p2/ |
4 | 4 | ||
5 | [transport-udp] | 5 | [transport-udp] |
6 | PORT = 12050 | 6 | PORT = 12050 |
diff --git a/src/transport/test_transport_api_unreliability_wlan_peer1.conf b/src/transport/test_transport_api_unreliability_wlan_peer1.conf index eb7756f27..78e280b68 100644 --- a/src/transport/test_transport_api_unreliability_wlan_peer1.conf +++ b/src/transport/test_transport_api_unreliability_wlan_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | TESTMODE = 1 | 6 | TESTMODE = 1 |
diff --git a/src/transport/test_transport_api_unreliability_wlan_peer2.conf b/src/transport/test_transport_api_unreliability_wlan_peer2.conf index aafeb09f8..e97ab3f38 100644 --- a/src/transport/test_transport_api_unreliability_wlan_peer2.conf +++ b/src/transport/test_transport_api_unreliability_wlan_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | INTERFACE = mon1 | 6 | INTERFACE = mon1 |
diff --git a/src/transport/test_transport_api_wlan_peer1.conf b/src/transport/test_transport_api_wlan_peer1.conf index 8b870f1d4..68716d287 100644 --- a/src/transport/test_transport_api_wlan_peer1.conf +++ b/src/transport/test_transport_api_wlan_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p1/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | INTERFACE = mon0 | 6 | INTERFACE = mon0 |
diff --git a/src/transport/test_transport_api_wlan_peer2.conf b/src/transport/test_transport_api_wlan_peer2.conf index c32ce5ced..98bbc6e2b 100644 --- a/src/transport/test_transport_api_wlan_peer2.conf +++ b/src/transport/test_transport_api_wlan_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-wlan-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-wlan-p2/ |
4 | 4 | ||
5 | [transport-wlan] | 5 | [transport-wlan] |
6 | INTERFACE = mon1 | 6 | INTERFACE = mon1 |
diff --git a/src/transport/test_transport_blacklisting.c b/src/transport/test_transport_blacklisting.c index e5de8f148..6871d01b1 100644 --- a/src/transport/test_transport_blacklisting.c +++ b/src/transport/test_transport_blacklisting.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2011 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2011 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/test_transport_blacklisting_cfg_blp_peer1_full.conf b/src/transport/test_transport_blacklisting_cfg_blp_peer1_full.conf index 3f2742c91..c8a5bf0d4 100644 --- a/src/transport/test_transport_blacklisting_cfg_blp_peer1_full.conf +++ b/src/transport/test_transport_blacklisting_cfg_blp_peer1_full.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12000 | 6 | PORT = 12000 |
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 index bd0108b9b..30b82aebf 100644 --- a/src/transport/test_transport_blacklisting_cfg_blp_peer1_multiple_plugins.conf +++ b/src/transport/test_transport_blacklisting_cfg_blp_peer1_multiple_plugins.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp udp | 6 | PLUGINS = tcp udp |
diff --git a/src/transport/test_transport_blacklisting_cfg_blp_peer1_plugin.conf b/src/transport/test_transport_blacklisting_cfg_blp_peer1_plugin.conf index 6261fa7a1..12c11252e 100644 --- a/src/transport/test_transport_blacklisting_cfg_blp_peer1_plugin.conf +++ b/src/transport/test_transport_blacklisting_cfg_blp_peer1_plugin.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = 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 index cfcc2a24a..4b449bed8 100644 --- a/src/transport/test_transport_blacklisting_cfg_blp_peer2_full.conf +++ b/src/transport/test_transport_blacklisting_cfg_blp_peer2_full.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
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 index 5f54b7321..690eb3b76 100644 --- a/src/transport/test_transport_blacklisting_cfg_blp_peer2_multiple_plugins.conf +++ b/src/transport/test_transport_blacklisting_cfg_blp_peer2_multiple_plugins.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp udp | 6 | PLUGINS = tcp udp |
diff --git a/src/transport/test_transport_blacklisting_cfg_blp_peer2_plugin.conf b/src/transport/test_transport_blacklisting_cfg_blp_peer2_plugin.conf index 98a5e787f..00d3343e8 100644 --- a/src/transport/test_transport_blacklisting_cfg_blp_peer2_plugin.conf +++ b/src/transport/test_transport_blacklisting_cfg_blp_peer2_plugin.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport] | 5 | [transport] |
6 | PLUGINS = tcp | 6 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_blacklisting_cfg_peer1.conf b/src/transport/test_transport_blacklisting_cfg_peer1.conf index d75e23e06..9150c7faf 100644 --- a/src/transport/test_transport_blacklisting_cfg_peer1.conf +++ b/src/transport/test_transport_blacklisting_cfg_peer1.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | 1 | @INLINE@ template_cfg_peer1.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p1/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12000 | 6 | PORT = 12000 |
diff --git a/src/transport/test_transport_blacklisting_cfg_peer2.conf b/src/transport/test_transport_blacklisting_cfg_peer2.conf index 879223ad9..43bb4ae37 100644 --- a/src/transport/test_transport_blacklisting_cfg_peer2.conf +++ b/src/transport/test_transport_blacklisting_cfg_peer2.conf | |||
@@ -1,6 +1,6 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | 1 | @INLINE@ template_cfg_peer2.conf |
2 | [PATHS] | 2 | [PATHS] |
3 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
4 | 4 | ||
5 | [transport-tcp] | 5 | [transport-tcp] |
6 | PORT = 12015 | 6 | PORT = 12015 |
diff --git a/src/transport/test_transport_defaults.conf b/src/transport/test_transport_defaults.conf index 95a57c954..3f38eeab7 100644 --- a/src/transport/test_transport_defaults.conf +++ b/src/transport/test_transport_defaults.conf | |||
@@ -1,7 +1,7 @@ | |||
1 | @INLINE@ ../../contrib/no_forcestart.conf | 1 | @INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf |
2 | 2 | ||
3 | [PATHS] | 3 | [PATHS] |
4 | GNUNET_TEST_HOME = /tmp/test-transport-api/ | 4 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport-api/ |
5 | 5 | ||
6 | [transport-tcp] | 6 | [transport-tcp] |
7 | TIMEOUT = 300 s | 7 | TIMEOUT = 300 s |
diff --git a/src/transport/test_transport_test_transport_address_switch_tcp_peer1.conf b/src/transport/test_transport_test_transport_address_switch_tcp_peer1.conf index 4a550402d..920e8d199 100644 --- a/src/transport/test_transport_test_transport_address_switch_tcp_peer1.conf +++ b/src/transport/test_transport_test_transport_address_switch_tcp_peer1.conf | |||
@@ -20,7 +20,7 @@ BLUETOOTH_QUOTA_IN = 8 KiB | |||
20 | BLUETOOTH_QUOTA_OUT = 8 KiB | 20 | BLUETOOTH_QUOTA_OUT = 8 KiB |
21 | 21 | ||
22 | [PATHS] | 22 | [PATHS] |
23 | GNUNET_TEST_HOME = /tmp/test-transport/quota-tcp-p1/ | 23 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/quota-tcp-p1/ |
24 | 24 | ||
25 | [transport] | 25 | [transport] |
26 | PLUGINS = tcp | 26 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_test_transport_address_switch_tcp_peer2.conf b/src/transport/test_transport_test_transport_address_switch_tcp_peer2.conf index 927c35c56..6855cd00d 100644 --- a/src/transport/test_transport_test_transport_address_switch_tcp_peer2.conf +++ b/src/transport/test_transport_test_transport_address_switch_tcp_peer2.conf | |||
@@ -21,7 +21,7 @@ BLUETOOTH_QUOTA_OUT = 8 KiB | |||
21 | 21 | ||
22 | 22 | ||
23 | [PATHS] | 23 | [PATHS] |
24 | GNUNET_TEST_HOME = /tmp/test-transport/api-tcp-p2/ | 24 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ |
25 | 25 | ||
26 | [transport] | 26 | [transport] |
27 | PLUGINS = tcp | 27 | PLUGINS = tcp |
diff --git a/src/transport/test_transport_testing_restart.c b/src/transport/test_transport_testing_restart.c index 06275055d..0afa08fd0 100644 --- a/src/transport/test_transport_testing_restart.c +++ b/src/transport/test_transport_testing_restart.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_testing_restart.c | 19 | * @file transport/test_transport_testing_restart.c |
diff --git a/src/transport/test_transport_testing_startstop.c b/src/transport/test_transport_testing_startstop.c index 931e922c4..d307f8722 100644 --- a/src/transport/test_transport_testing_startstop.c +++ b/src/transport/test_transport_testing_startstop.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. | 3 | Copyright (C) 2009, 2010, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/test_transport_testing_startstop.c | 19 | * @file transport/test_transport_testing_startstop.c |
diff --git a/src/transport/transport-testing-filenames.c b/src/transport/transport-testing-filenames.c index 0f8076b41..ac42388fb 100644 --- a/src/transport/transport-testing-filenames.c +++ b/src/transport/transport-testing-filenames.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V. | 3 | Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport-testing-filenames.c | 19 | * @file transport-testing-filenames.c |
diff --git a/src/transport/transport-testing-loggers.c b/src/transport/transport-testing-loggers.c index 0ebb07d74..4feba1d42 100644 --- a/src/transport/transport-testing-loggers.c +++ b/src/transport/transport-testing-loggers.c | |||
@@ -3,20 +3,18 @@ | |||
3 | This file is part of GNUnet. | 3 | This file is part of GNUnet. |
4 | Copyright (C) 2016 GNUnet e.V. | 4 | Copyright (C) 2016 GNUnet e.V. |
5 | 5 | ||
6 | GNUnet is free software; you can redistribute it and/or modify | 6 | GNUnet is free software: you can redistribute it and/or modify it |
7 | it under the terms of the GNU General Public License as published | 7 | under the terms of the GNU Affero General Public License as published |
8 | by the Free Software Foundation; either version 3, or (at your | 8 | by the Free Software Foundation, either version 3 of the License, |
9 | option) any later version. | 9 | or (at your option) any later version. |
10 | 10 | ||
11 | GNUnet is distributed in the hope that it will be useful, but | 11 | GNUnet is distributed in the hope that it will be useful, but |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | General Public License for more details. | 14 | Affero General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU Affero General Public License |
17 | along with GNUnet; see the file COPYING. If not, write to the | 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | Boston, MA 02110-1301, USA. | ||
20 | */ | 18 | */ |
21 | /** | 19 | /** |
22 | * @file transport-testing-loggers.c | 20 | * @file transport-testing-loggers.c |
diff --git a/src/transport/transport-testing-main.c b/src/transport/transport-testing-main.c index 81a66e113..1fa4b2731 100644 --- a/src/transport/transport-testing-main.c +++ b/src/transport/transport-testing-main.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2016 GNUnet e.V. | 3 | Copyright (C) 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport-testing-main.c | 19 | * @file transport-testing-main.c |
diff --git a/src/transport/transport-testing-send.c b/src/transport/transport-testing-send.c index 24858353e..8dac9453e 100644 --- a/src/transport/transport-testing-send.c +++ b/src/transport/transport-testing-send.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2016 GNUnet e.V. | 3 | Copyright (C) 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport-testing-send.c | 19 | * @file transport-testing-send.c |
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index 68cda3bd7..e3d4b7a9b 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V. | 3 | Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport-testing.c | 19 | * @file transport-testing.c |
diff --git a/src/transport/transport-testing.h b/src/transport/transport-testing.h index cb5ad319c..a4cfd89f6 100644 --- a/src/transport/transport-testing.h +++ b/src/transport/transport-testing.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V. | 3 | Copyright (C) 2006, 2009, 2015, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/transport.conf.in b/src/transport/transport.conf.in index 2c99af000..c6b207ad7 100644 --- a/src/transport/transport.conf.in +++ b/src/transport/transport.conf.in | |||
@@ -1,5 +1,5 @@ | |||
1 | [transport] | 1 | [transport] |
2 | AUTOSTART = @AUTOSTART@ | 2 | START_ON_DEMAND = @START_ON_DEMAND@ |
3 | @JAVAPORT@PORT = 2091 | 3 | @JAVAPORT@PORT = 2091 |
4 | HOSTNAME = localhost | 4 | HOSTNAME = localhost |
5 | BINARY = gnunet-service-transport | 5 | BINARY = gnunet-service-transport |
@@ -9,7 +9,8 @@ BINARY = gnunet-service-transport | |||
9 | NEIGHBOUR_LIMIT = 50 | 9 | NEIGHBOUR_LIMIT = 50 |
10 | ACCEPT_FROM = 127.0.0.1; | 10 | ACCEPT_FROM = 127.0.0.1; |
11 | ACCEPT_FROM6 = ::1; | 11 | ACCEPT_FROM6 = ::1; |
12 | PLUGINS = tcp udp | 12 | # TCP is the only transport plugin known to work "reliably" |
13 | PLUGINS = tcp | ||
13 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport.sock | 14 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport.sock |
14 | BLACKLIST_FILE = $GNUNET_CONFIG_HOME/transport/blacklist | 15 | BLACKLIST_FILE = $GNUNET_CONFIG_HOME/transport/blacklist |
15 | UNIX_MATCH_UID = NO | 16 | UNIX_MATCH_UID = NO |
@@ -68,6 +69,38 @@ MAX_CONNECTIONS = 128 | |||
68 | TCP_STEALTH = NO | 69 | TCP_STEALTH = NO |
69 | 70 | ||
70 | 71 | ||
72 | |||
73 | [transport-xt] | ||
74 | # Use 0 to ONLY advertise as a peer behind NAT (no port binding) | ||
75 | PORT = 2087 | ||
76 | |||
77 | # Obsolete option, to be replaced by HOLE_EXTERNAL (soon) | ||
78 | ADVERTISED_PORT = 2087 | ||
79 | |||
80 | # If we have a manually punched NAT, what is the external IP and port? | ||
81 | # Can use DNS names for DynDNS-based detection of external IP. | ||
82 | # Can use IPv6 addresses ([fefc::]:PORT). | ||
83 | # Use "AUTO" for the hostname to automatically detect external IP. | ||
84 | # Do not set if NAT is not manually punched. | ||
85 | # HOLE_EXTERNAL = AUTO:2087 | ||
86 | |||
87 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | ||
88 | |||
89 | # Maximum number of open TCP connections allowed | ||
90 | MAX_CONNECTIONS = 128 | ||
91 | |||
92 | TIMEOUT = 5 s | ||
93 | # ACCEPT_FROM = | ||
94 | # ACCEPT_FROM6 = | ||
95 | # REJECT_FROM = | ||
96 | # REJECT_FROM6 = | ||
97 | # BINDTO = | ||
98 | MAX_CONNECTIONS = 128 | ||
99 | |||
100 | # Enable TCP stealth? | ||
101 | TCP_STEALTH = NO | ||
102 | |||
103 | |||
71 | [transport-udp] | 104 | [transport-udp] |
72 | # Use PORT = 0 to autodetect a port available | 105 | # Use PORT = 0 to autodetect a port available |
73 | PORT = 2086 | 106 | PORT = 2086 |
@@ -90,6 +123,11 @@ TESTING_IGNORE_KEYS = ACCEPT_FROM; | |||
90 | # HOLE_EXTERNAL = AUTO:2086 | 123 | # HOLE_EXTERNAL = AUTO:2086 |
91 | 124 | ||
92 | 125 | ||
126 | [transport-xu] | ||
127 | # Use PORT = 0 to autodetect a port available | ||
128 | PORT = 2087 | ||
129 | |||
130 | |||
93 | [transport-http_client] | 131 | [transport-http_client] |
94 | MAX_CONNECTIONS = 128 | 132 | MAX_CONNECTIONS = 128 |
95 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 133 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
diff --git a/src/transport/transport.h b/src/transport/transport.h index 17e4f3c21..75726e462 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2014 GNUnet e.V. | 3 | Copyright (C) 2009-2014 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c index 902764a8f..258bf19c9 100644 --- a/src/transport/transport_api_address_to_string.c +++ b/src/transport/transport_api_address_to_string.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2014, 2016 GNUnet e.V. | 3 | Copyright (C) 2009-2014, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /** | 18 | /** |
21 | * @file transport/transport_api_address_to_string.c | 19 | * @file transport/transport_api_address_to_string.c |
diff --git a/src/transport/transport_api_blacklist.c b/src/transport/transport_api_blacklist.c index 7b1bf526e..87fdce724 100644 --- a/src/transport/transport_api_blacklist.c +++ b/src/transport/transport_api_blacklist.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010-2014, 2016 GNUnet e.V. | 3 | Copyright (C) 2010-2014, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/transport_api_core.c b/src/transport/transport_api_core.c index 9c29d4908..b7edc3cc1 100644 --- a/src/transport/transport_api_core.c +++ b/src/transport/transport_api_core.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2013, 2016 GNUnet e.V. | 3 | Copyright (C) 2009-2013, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/transport_api_hello_get.c b/src/transport/transport_api_hello_get.c index c53dd7a9a..183135458 100644 --- a/src/transport/transport_api_hello_get.c +++ b/src/transport/transport_api_hello_get.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2013, 2016 GNUnet e.V. | 3 | Copyright (C) 2009-2013, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/transport_api_manipulation.c b/src/transport/transport_api_manipulation.c index fd5849a7e..e7ecd2e42 100644 --- a/src/transport/transport_api_manipulation.c +++ b/src/transport/transport_api_manipulation.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2013, 2016 GNUnet e.V. | 3 | Copyright (C) 2009-2013, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/transport_api_monitor_peers.c b/src/transport/transport_api_monitor_peers.c index 38e6e0d7c..c48a0e4bb 100644 --- a/src/transport/transport_api_monitor_peers.c +++ b/src/transport/transport_api_monitor_peers.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2014, 2016 GNUnet e.V. | 3 | Copyright (C) 2009-2014, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/transport_api_monitor_plugins.c b/src/transport/transport_api_monitor_plugins.c index e81664c41..c349144aa 100644 --- a/src/transport/transport_api_monitor_plugins.c +++ b/src/transport/transport_api_monitor_plugins.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2014, 2016 GNUnet e.V. | 3 | Copyright (C) 2014, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |
diff --git a/src/transport/transport_api_offer_hello.c b/src/transport/transport_api_offer_hello.c index e1dca14e3..b976a0272 100644 --- a/src/transport/transport_api_offer_hello.c +++ b/src/transport/transport_api_offer_hello.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2013, 2016 GNUnet e.V. | 3 | Copyright (C) 2009-2013, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | 18 | ||
21 | /** | 19 | /** |