diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-13 19:32:02 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-13 19:32:02 +0000 |
commit | e00e6a9687028f1e7a31ede8d413ecc981d6bf64 (patch) | |
tree | 5e49dcddec8eea244bde7dfc6926ab8b3114b0c6 /src/nat/nat_test.c | |
parent | f8013637fe0f9ec3b0d00fc81960321c56fc0f19 (diff) | |
download | gnunet-e00e6a9687028f1e7a31ede8d413ecc981d6bf64.tar.gz gnunet-e00e6a9687028f1e7a31ede8d413ecc981d6bf64.zip |
-doxygen, indentation, fixing comments
Diffstat (limited to 'src/nat/nat_test.c')
-rw-r--r-- | src/nat/nat_test.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c index 0cbb8abe5..c7de96d2f 100644 --- a/src/nat/nat_test.c +++ b/src/nat/nat_test.c | |||
@@ -195,7 +195,7 @@ reversal_cb (void *cls, | |||
195 | * Activity on our incoming socket. Read data from the | 195 | * Activity on our incoming socket. Read data from the |
196 | * incoming connection. | 196 | * incoming connection. |
197 | * | 197 | * |
198 | * @param cls the 'struct NatActivity' | 198 | * @param cls the `struct GNUNET_NAT_Test` |
199 | * @param tc scheduler context | 199 | * @param tc scheduler context |
200 | */ | 200 | */ |
201 | static void | 201 | static void |
@@ -205,7 +205,8 @@ do_udp_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
205 | uint16_t data; | 205 | uint16_t data; |
206 | 206 | ||
207 | tst->ltask = | 207 | tst->ltask = |
208 | GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, tst->lsock, | 208 | GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, |
209 | tst->lsock, | ||
209 | &do_udp_read, tst); | 210 | &do_udp_read, tst); |
210 | if ((NULL != tc->write_ready) && | 211 | if ((NULL != tc->write_ready) && |
211 | (GNUNET_NETWORK_fdset_isset (tc->read_ready, tst->lsock)) && | 212 | (GNUNET_NETWORK_fdset_isset (tc->read_ready, tst->lsock)) && |
@@ -228,11 +229,12 @@ do_udp_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
228 | * Activity on our incoming socket. Read data from the | 229 | * Activity on our incoming socket. Read data from the |
229 | * incoming connection. | 230 | * incoming connection. |
230 | * | 231 | * |
231 | * @param cls the 'struct NatActivity' | 232 | * @param cls the `struct NatActivity` |
232 | * @param tc scheduler context | 233 | * @param tc scheduler context |
233 | */ | 234 | */ |
234 | static void | 235 | static void |
235 | do_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 236 | do_read (void *cls, |
237 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
236 | { | 238 | { |
237 | struct NatActivity *na = cls; | 239 | struct NatActivity *na = cls; |
238 | struct GNUNET_NAT_Test *tst; | 240 | struct GNUNET_NAT_Test *tst; |
@@ -264,11 +266,12 @@ do_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
264 | * Activity on our listen socket. Accept the | 266 | * Activity on our listen socket. Accept the |
265 | * incoming connection. | 267 | * incoming connection. |
266 | * | 268 | * |
267 | * @param cls the 'struct GNUNET_NAT_Test' | 269 | * @param cls the `struct GNUNET_NAT_Test` |
268 | * @param tc scheduler context | 270 | * @param tc scheduler context |
269 | */ | 271 | */ |
270 | static void | 272 | static void |
271 | do_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 273 | do_accept (void *cls, |
274 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
272 | { | 275 | { |
273 | struct GNUNET_NAT_Test *tst = cls; | 276 | struct GNUNET_NAT_Test *tst = cls; |
274 | struct GNUNET_NETWORK_Handle *s; | 277 | struct GNUNET_NETWORK_Handle *s; |
@@ -288,7 +291,7 @@ do_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
288 | } | 291 | } |
289 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 292 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
290 | "Got an inbound connection, waiting for data\n"); | 293 | "Got an inbound connection, waiting for data\n"); |
291 | wl = GNUNET_malloc (sizeof (struct NatActivity)); | 294 | wl = GNUNET_new (struct NatActivity); |
292 | wl->sock = s; | 295 | wl->sock = s; |
293 | wl->h = tst; | 296 | wl->h = tst; |
294 | wl->rtask = | 297 | wl->rtask = |
@@ -305,7 +308,7 @@ do_accept (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
305 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean | 308 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean |
306 | * the previous (now invalid) one | 309 | * the previous (now invalid) one |
307 | * @param addr either the previous or the new public IP address | 310 | * @param addr either the previous or the new public IP address |
308 | * @param addrlen actual lenght of the address | 311 | * @param addrlen actual length of the @a addr |
309 | */ | 312 | */ |
310 | static void | 313 | static void |
311 | addr_cb (void *cls, | 314 | addr_cb (void *cls, |
@@ -345,7 +348,7 @@ addr_cb (void *cls, | |||
345 | _("Failed to connect to `gnunet-nat-server'\n")); | 348 | _("Failed to connect to `gnunet-nat-server'\n")); |
346 | return; | 349 | return; |
347 | } | 350 | } |
348 | ca = GNUNET_malloc (sizeof (struct ClientActivity)); | 351 | ca = GNUNET_new (struct ClientActivity); |
349 | ca->client = client; | 352 | ca->client = client; |
350 | GNUNET_CONTAINER_DLL_insert (h->ca_head, h->ca_tail, ca); | 353 | GNUNET_CONTAINER_DLL_insert (h->ca_head, h->ca_tail, ca); |
351 | GNUNET_break (GNUNET_OK == | 354 | GNUNET_break (GNUNET_OK == |
@@ -365,13 +368,16 @@ addr_cb (void *cls, | |||
365 | * @param bnd_port port to bind to, 0 for connection reversal | 368 | * @param bnd_port port to bind to, 0 for connection reversal |
366 | * @param adv_port externally advertised port to use | 369 | * @param adv_port externally advertised port to use |
367 | * @param report function to call with the result of the test | 370 | * @param report function to call with the result of the test |
368 | * @param report_cls closure for report | 371 | * @param report_cls closure for @a report |
369 | * @return handle to cancel NAT test | 372 | * @return handle to cancel NAT test |
370 | */ | 373 | */ |
371 | struct GNUNET_NAT_Test * | 374 | struct GNUNET_NAT_Test * |
372 | GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 375 | GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
373 | int is_tcp, uint16_t bnd_port, uint16_t adv_port, | 376 | int is_tcp, |
374 | GNUNET_NAT_TestCallback report, void *report_cls) | 377 | uint16_t bnd_port, |
378 | uint16_t adv_port, | ||
379 | GNUNET_NAT_TestCallback report, | ||
380 | void *report_cls) | ||
375 | { | 381 | { |
376 | struct GNUNET_NAT_Test *ret; | 382 | struct GNUNET_NAT_Test *ret; |
377 | struct sockaddr_in sa; | 383 | struct sockaddr_in sa; |