diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-06-24 10:18:59 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-06-24 10:18:59 +0000 |
commit | f24861f1b06362d683841e07bde180f34f738a10 (patch) | |
tree | 61e134e99a44ec623a0c71576b892a1d01def2b6 /src/nat | |
parent | 76c3b55cd2589f3376635c9a8f3b0a6f2421ca7a (diff) | |
download | gnunet-f24861f1b06362d683841e07bde180f34f738a10.tar.gz gnunet-f24861f1b06362d683841e07bde180f34f738a10.zip |
- added more debug messages to status2string
- added remaining functionality to GNUNET_NAT_test_stop
Diffstat (limited to 'src/nat')
-rw-r--r-- | src/nat/nat.c | 52 | ||||
-rw-r--r-- | src/nat/nat_test.c | 10 |
2 files changed, 52 insertions, 10 deletions
diff --git a/src/nat/nat.c b/src/nat/nat.c index 61ca5eab7..85d069e07 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c | |||
@@ -1560,22 +1560,60 @@ GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *h, | |||
1560 | return GNUNET_NO; | 1560 | return GNUNET_NO; |
1561 | } | 1561 | } |
1562 | 1562 | ||
1563 | |||
1564 | /** | 1563 | /** |
1565 | * Converts enum GNUNET_NAT_StatusCode to a string | 1564 | * Converts enum GNUNET_NAT_StatusCode to a string |
1566 | * | 1565 | * |
1567 | * @param err error code to resolve to a string | 1566 | * @param err error code to resolve to a string |
1568 | * @return point to a static string containing the error code | 1567 | * @return pointer to a static string containing the error code |
1569 | */ | 1568 | */ |
1570 | const char * | 1569 | const char * |
1571 | GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err){ | 1570 | GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err) |
1572 | switch (err){ | 1571 | { |
1572 | switch (err) | ||
1573 | { | ||
1573 | case GNUNET_NAT_ERROR_SUCCESS: | 1574 | case GNUNET_NAT_ERROR_SUCCESS: |
1574 | return _("Operation Successful"); | 1575 | return _ ("Operation Successful"); |
1575 | 1576 | case GNUNET_NAT_ERROR_IPC_FAILURE: | |
1577 | return _ ("Internal Failure (IPC, ...)"); | ||
1578 | case GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR: | ||
1579 | return _ ("Failure in network subsystem, check permissions."); | ||
1580 | case GNUNET_NAT_ERROR_TIMEOUT: | ||
1581 | return _ ("Encountered timeout while performing operation"); | ||
1582 | case GNUNET_NAT_ERROR_NOT_ONLINE: | ||
1583 | return _ ("detected that we are offline"); | ||
1584 | case GNUNET_NAT_ERROR_UPNPC_NOT_FOUND: | ||
1585 | return _ ("`upnpc` command not found"); | ||
1586 | case GNUNET_NAT_ERROR_UPNPC_FAILED: | ||
1587 | return _ ("Failed to run `upnpc` command"); | ||
1588 | case GNUNET_NAT_ERROR_UPNPC_TIMEOUT: | ||
1589 | return _ ("`upnpc' command took too long, process killed"); | ||
1590 | case GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED: | ||
1591 | return _ ("`upnpc' command failed to establish port mapping"); | ||
1592 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND: | ||
1593 | return _ ("`external-ip' command not found"); | ||
1594 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED: | ||
1595 | return _ ("Failed to run `external-ip` command"); | ||
1596 | case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID: | ||
1597 | return _ ("`external-ip' command output invalid"); | ||
1598 | case GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID: | ||
1599 | return _ ("no valid address was returned by `external-ip'"); | ||
1600 | case GNUNET_NAT_ERROR_NO_VALID_IF_IP_COMBO: | ||
1601 | return _ ("Could not determine interface with internal/local network address"); | ||
1602 | case GNUNET_NAT_ERROR_HELPER_NAT_SERVER_NOT_FOUND: | ||
1603 | return _ ("No functioning gnunet-helper-nat-server installation found"); | ||
1604 | case GNUNET_NAT_ERROR_NAT_TEST_START_FAILED: | ||
1605 | return _ ("NAT test could not be initialized"); | ||
1606 | case GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT: | ||
1607 | return _ ("NAT test timeout reached"); | ||
1608 | case GNUNET_NAT_ERROR_NAT_REGISTER_FAILED: | ||
1609 | return _ ("could not register NAT"); | ||
1610 | case GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND: | ||
1611 | return _ ("No working gnunet-helper-nat-client installation found"); | ||
1612 | /* case: | ||
1613 | return _ ("");*/ | ||
1576 | default: | 1614 | default: |
1577 | return "unknown status code"; | 1615 | return "unknown status code"; |
1578 | } | 1616 | } |
1579 | } | 1617 | } |
1580 | 1618 | ||
1581 | /* end of nat.c */ | 1619 | /* end of nat.c */ |
diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c index 860c51b26..90f06be5c 100644 --- a/src/nat/nat_test.c +++ b/src/nat/nat_test.c | |||
@@ -406,7 +406,7 @@ do_timeout (void *cls, | |||
406 | * @param timeout delay after which the test should be aborted | 406 | * @param timeout delay after which the test should be aborted |
407 | * @param report function to call with the result of the test | 407 | * @param report function to call with the result of the test |
408 | * @param report_cls closure for @a report | 408 | * @param report_cls closure for @a report |
409 | * @return handle to cancel NAT test or NULL. The error is indicated through the report callback | 409 | * @return handle to cancel NAT test or NULL. The error is always indicated via the report callback |
410 | */ | 410 | */ |
411 | struct GNUNET_NAT_Test * | 411 | struct GNUNET_NAT_Test * |
412 | GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 412 | GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
@@ -489,10 +489,14 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
489 | { | 489 | { |
490 | LOG (GNUNET_ERROR_TYPE_ERROR, | 490 | LOG (GNUNET_ERROR_TYPE_ERROR, |
491 | _("NAT test failed to start NAT library\n")); | 491 | _("NAT test failed to start NAT library\n")); |
492 | if (GNUNET_SCHEDULER_NO_TASK != nh->ltask) | 492 | if (GNUNET_SCHEDULER_NO_TASK != nh->ltask){ |
493 | GNUNET_SCHEDULER_cancel (nh->ltask); | 493 | GNUNET_SCHEDULER_cancel (nh->ltask); |
494 | if (NULL != nh->lsock) | 494 | nh->ltask = GNUNET_SCHEDULER_NO_TASK; |
495 | } | ||
496 | if (NULL != nh->lsock){ | ||
495 | GNUNET_NETWORK_socket_close (nh->lsock); | 497 | GNUNET_NETWORK_socket_close (nh->lsock); |
498 | nh->lsock = NULL; | ||
499 | } | ||
496 | nh->status = GNUNET_NAT_ERROR_NAT_REGISTER_FAILED; | 500 | nh->status = GNUNET_NAT_ERROR_NAT_REGISTER_FAILED; |
497 | nh->ttask = GNUNET_SCHEDULER_add_now (&do_timeout, nh); | 501 | nh->ttask = GNUNET_SCHEDULER_add_now (&do_timeout, nh); |
498 | return NULL; | 502 | return NULL; |