diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-05-19 12:03:26 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-05-19 12:03:26 +0000 |
commit | 7528bcf5a5af0d90c06aeab964e5c6471900ae06 (patch) | |
tree | 24d181f1ae50e2cca9a2dcd49e90278e0a4389d7 /src/nat/nat.c | |
parent | 26c076220f09adcbb79ba296985b78deeb53dd9a (diff) | |
download | gnunet-7528bcf5a5af0d90c06aeab964e5c6471900ae06.tar.gz gnunet-7528bcf5a5af0d90c06aeab964e5c6471900ae06.zip |
- 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
Diffstat (limited to 'src/nat/nat.c')
-rw-r--r-- | src/nat/nat.c | 26 |
1 files changed, 13 insertions, 13 deletions
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, | |||
1011 | * the previous (now invalid) one | 1011 | * the previous (now invalid) one |
1012 | * @param addr either the previous or the new public IP address | 1012 | * @param addr either the previous or the new public IP address |
1013 | * @param addrlen actual lenght of @a addr | 1013 | * @param addrlen actual lenght of @a addr |
1014 | * @param emsg NULL on success, otherwise an error message | 1014 | * @param ret GNUNET_NAT_ERROR_SUCCESS on success, otherwise an error code |
1015 | */ | 1015 | */ |
1016 | static void | 1016 | static void |
1017 | upnp_add (void *cls, | 1017 | upnp_add (void *cls, |
1018 | int add_remove, | 1018 | int add_remove, |
1019 | const struct sockaddr *addr, | 1019 | const struct sockaddr *addr, |
1020 | socklen_t addrlen, | 1020 | socklen_t addrlen, |
1021 | const char *emsg) | 1021 | enum GNUNET_NAT_FailureCode ret) |
1022 | { | 1022 | { |
1023 | struct GNUNET_NAT_Handle *h = cls; | 1023 | struct GNUNET_NAT_Handle *h = cls; |
1024 | struct LocalAddressList *pos; | 1024 | struct LocalAddressList *pos; |
1025 | struct LocalAddressList *next; | 1025 | struct LocalAddressList *next; |
1026 | 1026 | ||
1027 | 1027 | ||
1028 | if (GNUNET_NAT_ERROR_SUCCESS != ret) | ||
1029 | { | ||
1030 | /* Error while running upnp client */ | ||
1031 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1032 | _("Error while running upnp client:\n")); | ||
1033 | |||
1034 | //FIXME: convert error code to string | ||
1035 | |||
1036 | return; | ||
1037 | } | ||
1038 | |||
1028 | if (GNUNET_YES == add_remove) | 1039 | if (GNUNET_YES == add_remove) |
1029 | { | 1040 | { |
1030 | add_to_address_list (h, LAL_UPNP, addr, addrlen); | 1041 | add_to_address_list (h, LAL_UPNP, addr, addrlen); |
@@ -1053,17 +1064,6 @@ upnp_add (void *cls, | |||
1053 | GNUNET_a2s(addr, addrlen)); | 1064 | GNUNET_a2s(addr, addrlen)); |
1054 | GNUNET_break (0); | 1065 | GNUNET_break (0); |
1055 | } | 1066 | } |
1056 | else if (GNUNET_SYSERR == add_remove) | ||
1057 | { | ||
1058 | /* Error while running upnp client */ | ||
1059 | if (NULL != emsg) | ||
1060 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1061 | _("Error while running upnp client: `%s'\n"), emsg); | ||
1062 | else | ||
1063 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1064 | _("Error while running upnp client \n")); | ||
1065 | return; | ||
1066 | } | ||
1067 | else | 1067 | else |
1068 | { | 1068 | { |
1069 | 1069 | ||