diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-07-01 10:38:08 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-07-01 10:38:08 +0000 |
commit | 34679adf5a4d083ddd39da805e7509429fed7f45 (patch) | |
tree | 239e80ae7083771dcfc484edc68d846471a11ba5 /src/include | |
parent | c3cc0ccbc05fb74d7c744dd3482e8cbb5726315b (diff) | |
download | gnunet-34679adf5a4d083ddd39da805e7509429fed7f45.tar.gz gnunet-34679adf5a4d083ddd39da805e7509429fed7f45.zip |
draft for NAT_test API
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_nat_lib.h | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h index 9550bb1e3..07f6ca5e8 100644 --- a/src/include/gnunet_nat_lib.h +++ b/src/include/gnunet_nat_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2007, 2008, 2009, 2010 Christian Grothoff (and other contributing authors) | 3 | (C) 2007, 2008, 2009, 2010, 2011 Christian Grothoff (and other contributing authors) |
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 |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -138,6 +138,54 @@ GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, | |||
138 | void | 138 | void |
139 | GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h); | 139 | GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h); |
140 | 140 | ||
141 | |||
142 | /** | ||
143 | * Handle to a NAT test. | ||
144 | */ | ||
145 | struct GNUNET_NAT_Test; | ||
146 | |||
147 | /** | ||
148 | * Function called to report success or failure for | ||
149 | * NAT configuration test. | ||
150 | * | ||
151 | * @param cls closure | ||
152 | * @param success GNUNET_OK on success, GNUNET_NO on failure, | ||
153 | * GNUNET_SYSERR if the test could not be | ||
154 | * properly started (internal failure) | ||
155 | */ | ||
156 | typedef void (*GNUNET_NAT_TestCallback)(void *cls, | ||
157 | int success); | ||
158 | |||
159 | /** | ||
160 | * Start testing if NAT traversal works using the | ||
161 | * given configuration (IPv4-only). | ||
162 | * | ||
163 | * @param cfg configuration for the NAT traversal | ||
164 | * @param is_tcp GNUNET_YES to test TCP, GNUNET_NO to test UDP | ||
165 | * @param bnd_port port to bind to | ||
166 | * @param adv_port externally advertised port to use | ||
167 | * @param report function to call with the result of the test | ||
168 | * @param report_cls closure for report | ||
169 | * @return handle to cancel NAT test | ||
170 | */ | ||
171 | struct GNUNET_NAT_Test * | ||
172 | GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
173 | int is_tcp, | ||
174 | uint16_t bnd_port, | ||
175 | uint16_t adv_port, | ||
176 | GNUNET_NAT_TestCallback report, | ||
177 | void *report_cls); | ||
178 | |||
179 | |||
180 | /** | ||
181 | * Stop an active NAT test. | ||
182 | * | ||
183 | * @param tst test to stop. | ||
184 | */ | ||
185 | void | ||
186 | GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst); | ||
187 | |||
188 | |||
141 | #endif | 189 | #endif |
142 | 190 | ||
143 | /* end of gnunet_nat_lib.h */ | 191 | /* end of gnunet_nat_lib.h */ |