diff options
author | Bruno Cabral <bcabral@uw.edu> | 2015-07-18 19:15:51 +0000 |
---|---|---|
committer | Bruno Cabral <bcabral@uw.edu> | 2015-07-18 19:15:51 +0000 |
commit | faf6cdf7e592414f041d486bf620967817485435 (patch) | |
tree | d5707ff9ca5dee5846d9592094c39a6a73ec77e6 /src/include/gnunet_nat_lib.h | |
parent | 6fc671e8b19c77baca0cefee1eee5dea722f5d2c (diff) | |
download | gnunet-faf6cdf7e592414f041d486bf620967817485435.tar.gz gnunet-faf6cdf7e592414f041d486bf620967817485435.zip |
Get STUN to work with UDP plugin
Diffstat (limited to 'src/include/gnunet_nat_lib.h')
-rw-r--r-- | src/include/gnunet_nat_lib.h | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h index 7a8343d28..6c4362c90 100644 --- a/src/include/gnunet_nat_lib.h +++ b/src/include/gnunet_nat_lib.h | |||
@@ -170,6 +170,8 @@ enum GNUNET_NAT_StatusCode | |||
170 | */ | 170 | */ |
171 | GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND, | 171 | GNUNET_NAT_ERROR_HELPER_NAT_CLIENT_NOT_FOUND, |
172 | 172 | ||
173 | |||
174 | |||
173 | /** | 175 | /** |
174 | * | 176 | * |
175 | */ | 177 | */ |
@@ -217,7 +219,8 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
217 | const socklen_t *addrlens, | 219 | const socklen_t *addrlens, |
218 | GNUNET_NAT_AddressCallback address_callback, | 220 | GNUNET_NAT_AddressCallback address_callback, |
219 | GNUNET_NAT_ReversalCallback reversal_callback, | 221 | GNUNET_NAT_ReversalCallback reversal_callback, |
220 | void *callback_cls); | 222 | void *callback_cls, |
223 | struct GNUNET_NETWORK_Handle* sock ); | ||
221 | 224 | ||
222 | 225 | ||
223 | /** | 226 | /** |
@@ -455,22 +458,43 @@ GNUNET_NAT_autoconfig_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
455 | void | 458 | void |
456 | GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah); | 459 | GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah); |
457 | 460 | ||
461 | /** | ||
462 | * Handle for active STUN Requests. | ||
463 | */ | ||
464 | struct GNUNET_NAT_STUN_Handle; | ||
465 | |||
466 | |||
467 | |||
468 | |||
469 | /** | ||
470 | * Function called with the result from NAT request. | ||
471 | * | ||
472 | * @param cls closure | ||
473 | * @param diff minimal suggested changes to the original configuration | ||
474 | * to make it work (as best as we can) | ||
475 | * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code | ||
476 | */ | ||
477 | typedef void | ||
478 | (*GNUNET_NAT_stun_RequestCallback)(void *cls, | ||
479 | enum GNUNET_NAT_StatusCode result); | ||
458 | 480 | ||
459 | struct GNUNET_NAT_StunRequestHandle; | ||
460 | 481 | ||
461 | /** | 482 | /** |
462 | * Make Generic STUN request and | 483 | * Make Generic STUN request and |
463 | * Send a generic stun request to the server specified using the specified socket. | 484 | * Send a generic stun request to the server specified using the specified socket. |
464 | * possibly waiting for a reply and filling the 'reply' field with | 485 | * possibly waiting for a reply and filling the 'reply' field with |
465 | * the externally visible address. | 486 | * the externally visible address. |
466 | *c | 487 | * |
488 | |||
467 | * @param server, the address of the stun server | 489 | * @param server, the address of the stun server |
468 | * @param port, port of the stun server | 490 | * @param port, port of the stun server |
469 | * @param sock the socket used to send the request | 491 | * @param sock the socket used to send the request |
470 | * @return GNUNET_NAT_StunRequestHandle on success, NULL on error. | 492 | * @return GNUNET_NAT_STUN_Handle on success, NULL on error. |
471 | */ | 493 | */ |
472 | struct GNUNET_NAT_StunRequestHandle * | 494 | struct GNUNET_NAT_STUN_Handle * |
473 | GNUNET_NAT_stun_make_request(char * server, int port, struct GNUNET_NETWORK_Handle * sock); | 495 | GNUNET_NAT_stun_make_request(char * server, int port, |
496 | struct GNUNET_NETWORK_Handle * sock, GNUNET_NAT_stun_RequestCallback cb, | ||
497 | void *cb_cls); | ||
474 | 498 | ||
475 | 499 | ||
476 | /** | 500 | /** |
@@ -489,6 +513,20 @@ GNUNET_NAT_stun_make_request(char * server, int port, struct GNUNET_NETWORK_Hand | |||
489 | int | 513 | int |
490 | GNUNET_NAT_stun_handle_packet(const uint8_t *data, size_t len,struct sockaddr_in *arg); | 514 | GNUNET_NAT_stun_handle_packet(const uint8_t *data, size_t len,struct sockaddr_in *arg); |
491 | 515 | ||
516 | /** | ||
517 | * CHECK if is a valid STUN packet sending to GNUNET_NAT_stun_handle_packet | ||
518 | * | ||
519 | * @param cls, NAT callback | ||
520 | * @param data, pointer where we will set the type | ||
521 | * @param len, pointer where we will set the type | ||
522 | * @param st, pointer where we will set the type | ||
523 | * | ||
524 | * @return, 0 on IGNORE, -1 if the packet is invalid ( not a stun packet) | ||
525 | */ | ||
526 | int | ||
527 | GNUNET_NAT_try_decode_stun_packet(void *cls, const uint8_t *data, size_t len); | ||
528 | |||
529 | |||
492 | 530 | ||
493 | #endif | 531 | #endif |
494 | 532 | ||