diff options
-rw-r--r-- | src/include/gnunet_nat_lib.h | 41 |
1 files 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; | |||
73 | /** | 73 | /** |
74 | * Error Types for the NAT subsystem (which can then later be converted/resolved to a string) | 74 | * Error Types for the NAT subsystem (which can then later be converted/resolved to a string) |
75 | */ | 75 | */ |
76 | enum GNUNET_NAT_FailureCode | 76 | enum GNUNET_NAT_StatusCode |
77 | { | 77 | { |
78 | /** | 78 | /** |
79 | * Just the default | 79 | * Just the default |
@@ -81,17 +81,22 @@ enum GNUNET_NAT_FailureCode | |||
81 | GNUNET_NAT_ERROR_SUCCESS = GNUNET_OK, | 81 | GNUNET_NAT_ERROR_SUCCESS = GNUNET_OK, |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * `external-ip' command not found | 84 | * IPC Failure |
85 | */ | 85 | */ |
86 | GNUNET_NAT_ERROR_IPC_FAILURE, | 86 | GNUNET_NAT_ERROR_IPC_FAILURE, |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * `external-ip' command not found | 89 | * Failure in network subsystem, check permissions |
90 | */ | ||
91 | GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR, | ||
92 | |||
93 | /** | ||
94 | * test timed out | ||
90 | */ | 95 | */ |
91 | GNUNET_NAT_ERROR_TIMEOUT, | 96 | GNUNET_NAT_ERROR_TIMEOUT, |
92 | 97 | ||
93 | /** | 98 | /** |
94 | * `external-ip' command not found | 99 | * detected that we are offline |
95 | */ | 100 | */ |
96 | GNUNET_NAT_ERROR_NOT_ONLINE, | 101 | GNUNET_NAT_ERROR_NOT_ONLINE, |
97 | 102 | ||
@@ -121,12 +126,12 @@ enum GNUNET_NAT_FailureCode | |||
121 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND, | 126 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND, |
122 | 127 | ||
123 | /** | 128 | /** |
124 | * `external-ip' command not found | 129 | * Failed to run `external-ip` command |
125 | */ | 130 | */ |
126 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_EXECUTEABLE, | 131 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED, |
127 | 132 | ||
128 | /** | 133 | /** |
129 | * `external-ip' command not found | 134 | * `external-ip' command output invalid |
130 | */ | 135 | */ |
131 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID, | 136 | GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID, |
132 | 137 | ||
@@ -156,6 +161,11 @@ enum GNUNET_NAT_FailureCode | |||
156 | GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT, | 161 | GNUNET_NAT_ERROR_NAT_TEST_TIMEOUT, |
157 | 162 | ||
158 | /** | 163 | /** |
164 | * NAT test failed to initiate | ||
165 | */ | ||
166 | GNUNET_NAT_ERROR_NAT_REGISTER_FAILED, | ||
167 | |||
168 | /** | ||
159 | * | 169 | * |
160 | */ | 170 | */ |
161 | GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND, | 171 | GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND, |
@@ -169,6 +179,15 @@ enum GNUNET_NAT_FailureCode | |||
169 | 179 | ||
170 | 180 | ||
171 | /** | 181 | /** |
182 | * Converts enum GNUNET_NAT_StatusCode to string | ||
183 | * | ||
184 | * @param err error code to resolve to a string | ||
185 | * @return point to a static string containing the error code | ||
186 | */ | ||
187 | const char * | ||
188 | GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err); | ||
189 | |||
190 | /** | ||
172 | * Attempt to enable port redirection and detect public IP address | 191 | * Attempt to enable port redirection and detect public IP address |
173 | * contacting UPnP or NAT-PMP routers on the local network. Use addr | 192 | * contacting UPnP or NAT-PMP routers on the local network. Use addr |
174 | * to specify to which of the local host's addresses should the | 193 | * to specify to which of the local host's addresses should the |
@@ -258,7 +277,7 @@ struct GNUNET_NAT_Test; | |||
258 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | 277 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code |
259 | */ | 278 | */ |
260 | typedef void (*GNUNET_NAT_TestCallback) (void *cls, | 279 | typedef void (*GNUNET_NAT_TestCallback) (void *cls, |
261 | enum GNUNET_NAT_FailureCode result); | 280 | enum GNUNET_NAT_StatusCode result); |
262 | 281 | ||
263 | 282 | ||
264 | /** | 283 | /** |
@@ -302,7 +321,7 @@ GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst); | |||
302 | */ | 321 | */ |
303 | typedef void (*GNUNET_NAT_IPCallback) (void *cls, | 322 | typedef void (*GNUNET_NAT_IPCallback) (void *cls, |
304 | const struct in_addr *addr, | 323 | const struct in_addr *addr, |
305 | enum GNUNET_NAT_FailureCode result); | 324 | enum GNUNET_NAT_StatusCode result); |
306 | 325 | ||
307 | 326 | ||
308 | 327 | ||
@@ -357,7 +376,7 @@ typedef void | |||
357 | int add_remove, | 376 | int add_remove, |
358 | const struct sockaddr *addr, | 377 | const struct sockaddr *addr, |
359 | socklen_t addrlen, | 378 | socklen_t addrlen, |
360 | enum GNUNET_NAT_FailureCode result); | 379 | enum GNUNET_NAT_StatusCode result); |
361 | 380 | ||
362 | 381 | ||
363 | /** | 382 | /** |
@@ -409,7 +428,7 @@ struct GNUNET_NAT_AutoHandle; | |||
409 | typedef void | 428 | typedef void |
410 | (*GNUNET_NAT_AutoResultCallback)(void *cls, | 429 | (*GNUNET_NAT_AutoResultCallback)(void *cls, |
411 | const struct GNUNET_CONFIGURATION_Handle *diff, | 430 | const struct GNUNET_CONFIGURATION_Handle *diff, |
412 | enum GNUNET_NAT_FailureCode result); | 431 | enum GNUNET_NAT_StatusCode result); |
413 | 432 | ||
414 | 433 | ||
415 | /** | 434 | /** |