From 4ef7a6973707d2e5588372861197f7068737e765 Mon Sep 17 00:00:00 2001 From: Christian Fuchs Date: Tue, 17 Jun 2014 10:28:40 +0000 Subject: [PATCH] - renamed NAT's failure code to status code - updated status code descriptions - added NAT library function to convert status codes to strings --- src/include/gnunet_nat_lib.h | 41 ++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h index ebedc4ba4..b8822a94b 100644 --- a/src/include/gnunet_nat_lib.h +++ b/src/include/gnunet_nat_lib.h @@ -73,7 +73,7 @@ struct GNUNET_NAT_Handle; /** * Error Types for the NAT subsystem (which can then later be converted/resolved to a string) */ -enum GNUNET_NAT_FailureCode +enum GNUNET_NAT_StatusCode { /** * Just the default @@ -81,17 +81,22 @@ enum GNUNET_NAT_FailureCode GNUNET_NAT_ERROR_SUCCESS = GNUNET_OK, /** - * `external-ip' command not found + * IPC Failure */ GNUNET_NAT_ERROR_IPC_FAILURE, /** - * `external-ip' command not found + * Failure in network subsystem, check permissions + */ + GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR, + + /** + * test timed out */ GNUNET_NAT_ERROR_TIMEOUT, /** - * `external-ip' command not found + * detected that we are offline */ GNUNET_NAT_ERROR_NOT_ONLINE, @@ -121,12 +126,12 @@ enum GNUNET_NAT_FailureCode GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND, /** - * `external-ip' command not found + * Failed to run `external-ip` command */ - GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_EXECUTEABLE, + GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED, /** - * `external-ip' command not found + * `external-ip' command output invalid */ GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID, @@ -155,6 +160,11 @@ enum GNUNET_NAT_FailureCode */ GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT, + /** + * NAT test failed to initiate + */ + GNUNET_NAT_ERROR_NAT_REGISTER_FAILED, + /** * */ @@ -168,6 +178,15 @@ enum GNUNET_NAT_FailureCode }; +/** + * Converts enum GNUNET_NAT_StatusCode to string + * + * @param err error code to resolve to a string + * @return point to a static string containing the error code + */ +const char * +GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err); + /** * Attempt to enable port redirection and detect public IP address * contacting UPnP or NAT-PMP routers on the local network. Use addr @@ -258,7 +277,7 @@ struct GNUNET_NAT_Test; * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code */ typedef void (*GNUNET_NAT_TestCallback) (void *cls, - enum GNUNET_NAT_FailureCode result); + enum GNUNET_NAT_StatusCode result); /** @@ -302,7 +321,7 @@ GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst); */ typedef void (*GNUNET_NAT_IPCallback) (void *cls, const struct in_addr *addr, - enum GNUNET_NAT_FailureCode result); + enum GNUNET_NAT_StatusCode result); @@ -357,7 +376,7 @@ typedef void int add_remove, const struct sockaddr *addr, socklen_t addrlen, - enum GNUNET_NAT_FailureCode result); + enum GNUNET_NAT_StatusCode result); /** @@ -409,7 +428,7 @@ struct GNUNET_NAT_AutoHandle; typedef void (*GNUNET_NAT_AutoResultCallback)(void *cls, const struct GNUNET_CONFIGURATION_Handle *diff, - enum GNUNET_NAT_FailureCode result); + enum GNUNET_NAT_StatusCode result); /** -- 2.25.1