aboutsummaryrefslogtreecommitdiff
path: root/src/nat
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-07-01 10:38:08 +0000
committerChristian Grothoff <christian@grothoff.org>2011-07-01 10:38:08 +0000
commit34679adf5a4d083ddd39da805e7509429fed7f45 (patch)
tree239e80ae7083771dcfc484edc68d846471a11ba5 /src/nat
parentc3cc0ccbc05fb74d7c744dd3482e8cbb5726315b (diff)
downloadgnunet-34679adf5a4d083ddd39da805e7509429fed7f45.tar.gz
gnunet-34679adf5a4d083ddd39da805e7509429fed7f45.zip
draft for NAT_test API
Diffstat (limited to 'src/nat')
-rw-r--r--src/nat/Makefile.am2
-rw-r--r--src/nat/gnunet-nat-server.c1
-rw-r--r--src/nat/nat_test.c78
3 files changed, 79 insertions, 2 deletions
diff --git a/src/nat/Makefile.am b/src/nat/Makefile.am
index 75798a252..7b738df4e 100644
--- a/src/nat/Makefile.am
+++ b/src/nat/Makefile.am
@@ -43,7 +43,7 @@ endif
43lib_LTLIBRARIES = libgnunetnat.la 43lib_LTLIBRARIES = libgnunetnat.la
44 44
45libgnunetnat_la_SOURCES = \ 45libgnunetnat_la_SOURCES = \
46 nat.c 46 nat.c nat_test.c nat.h
47 47
48libgnunetnat_la_LIBADD = \ 48libgnunetnat_la_LIBADD = \
49 $(top_builddir)/src/util/libgnunetutil.la \ 49 $(top_builddir)/src/util/libgnunetutil.la \
diff --git a/src/nat/gnunet-nat-server.c b/src/nat/gnunet-nat-server.c
index ae831db08..f2508a94a 100644
--- a/src/nat/gnunet-nat-server.c
+++ b/src/nat/gnunet-nat-server.c
@@ -22,7 +22,6 @@
22 * @file src/nat/gnunet-nat-server.c 22 * @file src/nat/gnunet-nat-server.c
23 * @brief Daemon to run on 'gnunet.org' to help test NAT traversal code 23 * @brief Daemon to run on 'gnunet.org' to help test NAT traversal code
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 *
26 */ 25 */
27#include "platform.h" 26#include "platform.h"
28#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c
new file mode 100644
index 000000000..f31c5059d
--- /dev/null
+++ b/src/nat/nat_test.c
@@ -0,0 +1,78 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 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 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file nat/nat_test.c
23 * @brief functions to test if the NAT configuration is successful at achieving NAT traversal (with the help of a gnunet-nat-server)
24 * @author Christian Grothoff
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_nat_lib.h"
29#include "nat.h"
30
31
32/**
33 * Handle to a NAT test.
34 */
35struct GNUNET_NAT_Test
36{
37 GNUNET_NAT_TestCallback report;
38
39 void *report_cls;
40};
41
42
43/**
44 * Start testing if NAT traversal works using the
45 * given configuration (IPv4-only).
46 *
47 * @param cfg configuration for the NAT traversal
48 * @param is_tcp GNUNET_YES to test TCP, GNUNET_NO to test UDP
49 * @param bnd_port port to bind to
50 * @param adv_port externally advertised port to use
51 * @param report function to call with the result of the test
52 * @param report_cls closure for report
53 * @return handle to cancel NAT test
54 */
55struct GNUNET_NAT_Test *
56GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
57 int is_tcp,
58 uint16_t bnd_port,
59 uint16_t adv_port,
60 GNUNET_NAT_TestCallback report,
61 void *report_cls)
62{
63 return NULL;
64}
65
66
67/**
68 * Stop an active NAT test.
69 *
70 * @param tst test to stop.
71 */
72void
73GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst)
74{
75 GNUNET_free (tst);
76}
77
78/* end of nat_test.c */