draft for NAT_test API
[oweals/gnunet.git] / src / nat / nat_test.c
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  */
35 struct 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  */
55 struct GNUNET_NAT_Test *
56 GNUNET_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  */
72 void
73 GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst)
74 {
75   GNUNET_free (tst);
76 }
77
78 /* end of nat_test.c */