From 7528bcf5a5af0d90c06aeab964e5c6471900ae06 Mon Sep 17 00:00:00 2001 From: Christian Fuchs Date: Mon, 19 May 2014 12:03:26 +0000 Subject: - updated NAT callback function defintion to no longer carry around strings, - NAT lib now uses error-code enums to signal success and errors - reworked related code to return errorcodes - added and updated a missing doxygen documention - todo next: testcases --- src/nat/nat.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/nat/nat.c') diff --git a/src/nat/nat.c b/src/nat/nat.c index 039544d57..670ae6a27 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c @@ -1011,20 +1011,31 @@ resolve_dns (void *cls, * the previous (now invalid) one * @param addr either the previous or the new public IP address * @param addrlen actual lenght of @a addr - * @param emsg NULL on success, otherwise an error message + * @param ret GNUNET_NAT_ERROR_SUCCESS on success, otherwise an error code */ static void upnp_add (void *cls, int add_remove, const struct sockaddr *addr, socklen_t addrlen, - const char *emsg) + enum GNUNET_NAT_FailureCode ret) { struct GNUNET_NAT_Handle *h = cls; struct LocalAddressList *pos; struct LocalAddressList *next; + if (GNUNET_NAT_ERROR_SUCCESS != ret) + { + /* Error while running upnp client */ + LOG (GNUNET_ERROR_TYPE_ERROR, + _("Error while running upnp client:\n")); + + //FIXME: convert error code to string + + return; + } + if (GNUNET_YES == add_remove) { add_to_address_list (h, LAL_UPNP, addr, addrlen); @@ -1053,17 +1064,6 @@ upnp_add (void *cls, GNUNET_a2s(addr, addrlen)); GNUNET_break (0); } - else if (GNUNET_SYSERR == add_remove) - { - /* Error while running upnp client */ - if (NULL != emsg) - LOG (GNUNET_ERROR_TYPE_ERROR, - _("Error while running upnp client: `%s'\n"), emsg); - else - LOG (GNUNET_ERROR_TYPE_ERROR, - _("Error while running upnp client \n")); - return; - } else { -- cgit v1.2.3