aboutsummaryrefslogtreecommitdiff
path: root/src/nat/nat_test.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-11-29 14:03:19 +0000
committerChristian Grothoff <christian@grothoff.org>2013-11-29 14:03:19 +0000
commit8b49aa786f78ccb6dc29ab84db4f12a81ea456fe (patch)
tree333857feacd0f093e6c19bb9c5f87b83a85e261f /src/nat/nat_test.c
parent8b7a07dbd006f4a47d60f6b16e2d8ce18b53dcae (diff)
downloadgnunet-8b49aa786f78ccb6dc29ab84db4f12a81ea456fe.tar.gz
gnunet-8b49aa786f78ccb6dc29ab84db4f12a81ea456fe.zip
-doxygen
Diffstat (limited to 'src/nat/nat_test.c')
-rw-r--r--src/nat/nat_test.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c
index 387a68d8f..0cbb8abe5 100644
--- a/src/nat/nat_test.c
+++ b/src/nat/nat_test.c
@@ -104,7 +104,7 @@ struct GNUNET_NAT_Test
104 GNUNET_NAT_TestCallback report; 104 GNUNET_NAT_TestCallback report;
105 105
106 /** 106 /**
107 * Closure for 'report'. 107 * Closure for @e report.
108 */ 108 */
109 void *report_cls; 109 void *report_cls;
110 110
@@ -162,15 +162,17 @@ struct GNUNET_NAT_Test
162 162
163 163
164/** 164/**
165 * Function called from GNUNET_NAT_register whenever someone asks us 165 * Function called from #GNUNET_NAT_register whenever someone asks us
166 * to do connection reversal. 166 * to do connection reversal.
167 * 167 *
168 * @param cls closure, our 'struct GNUNET_NAT_Handle' 168 * @param cls closure, our `struct GNUNET_NAT_Handle`
169 * @param addr public IP address of the other peer 169 * @param addr public IP address of the other peer
170 * @param addrlen actual lenght of the address 170 * @param addrlen actual lenght of the address
171 */ 171 */
172static void 172static void
173reversal_cb (void *cls, const struct sockaddr *addr, socklen_t addrlen) 173reversal_cb (void *cls,
174 const struct sockaddr *addr,
175 socklen_t addrlen)
174{ 176{
175 struct GNUNET_NAT_Test *h = cls; 177 struct GNUNET_NAT_Test *h = cls;
176 const struct sockaddr_in *sa; 178 const struct sockaddr_in *sa;
@@ -300,13 +302,15 @@ do_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
300 * Address-callback, used to send message to gnunet-nat-server. 302 * Address-callback, used to send message to gnunet-nat-server.
301 * 303 *
302 * @param cls closure 304 * @param cls closure
303 * @param add_remove GNUNET_YES to mean the new public IP address, GNUNET_NO to mean 305 * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean
304 * the previous (now invalid) one 306 * the previous (now invalid) one
305 * @param addr either the previous or the new public IP address 307 * @param addr either the previous or the new public IP address
306 * @param addrlen actual lenght of the address 308 * @param addrlen actual lenght of the address
307 */ 309 */
308static void 310static void
309addr_cb (void *cls, int add_remove, const struct sockaddr *addr, 311addr_cb (void *cls,
312 int add_remove,
313 const struct sockaddr *addr,
310 socklen_t addrlen) 314 socklen_t addrlen)
311{ 315{
312 struct GNUNET_NAT_Test *h = cls; 316 struct GNUNET_NAT_Test *h = cls;
@@ -357,7 +361,7 @@ addr_cb (void *cls, int add_remove, const struct sockaddr *addr,
357 * given configuration (IPv4-only). 361 * given configuration (IPv4-only).
358 * 362 *
359 * @param cfg configuration for the NAT traversal 363 * @param cfg configuration for the NAT traversal
360 * @param is_tcp GNUNET_YES to test TCP, GNUNET_NO to test UDP 364 * @param is_tcp #GNUNET_YES to test TCP, #GNUNET_NO to test UDP
361 * @param bnd_port port to bind to, 0 for connection reversal 365 * @param bnd_port port to bind to, 0 for connection reversal
362 * @param adv_port externally advertised port to use 366 * @param adv_port externally advertised port to use
363 * @param report function to call with the result of the test 367 * @param report function to call with the result of the test
@@ -381,7 +385,7 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
381 sa.sin_len = sizeof (sa); 385 sa.sin_len = sizeof (sa);
382#endif 386#endif
383 387
384 ret = GNUNET_malloc (sizeof (struct GNUNET_NAT_Test)); 388 ret = GNUNET_new (struct GNUNET_NAT_Test);
385 ret->cfg = cfg; 389 ret->cfg = cfg;
386 ret->is_tcp = is_tcp; 390 ret->is_tcp = is_tcp;
387 ret->data = bnd_port; 391 ret->data = bnd_port;
@@ -407,8 +411,7 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
407 sizeof (sa)))) 411 sizeof (sa))))
408 { 412 {
409 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 413 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
410 _ 414 _("Failed to create listen socket bound to `%s' for NAT test: %s\n"),
411 ("Failed to create listen socket bound to `%s' for NAT test: %s\n"),
412 GNUNET_a2s ((const struct sockaddr *) &sa, sizeof (sa)), 415 GNUNET_a2s ((const struct sockaddr *) &sa, sizeof (sa)),
413 STRERROR (errno)); 416 STRERROR (errno));
414 if (NULL != ret->lsock) 417 if (NULL != ret->lsock)