aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_nat_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_nat_lib.h')
-rw-r--r--src/include/gnunet_nat_lib.h50
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,
455void 458void
456GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah); 459GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah);
457 460
461/**
462 * Handle for active STUN Requests.
463 */
464struct 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 */
477typedef void
478(*GNUNET_NAT_stun_RequestCallback)(void *cls,
479 enum GNUNET_NAT_StatusCode result);
458 480
459struct 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 */
472struct GNUNET_NAT_StunRequestHandle * 494struct GNUNET_NAT_STUN_Handle *
473GNUNET_NAT_stun_make_request(char * server, int port, struct GNUNET_NETWORK_Handle * sock); 495GNUNET_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
489int 513int
490GNUNET_NAT_stun_handle_packet(const uint8_t *data, size_t len,struct sockaddr_in *arg); 514GNUNET_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 */
526int
527GNUNET_NAT_try_decode_stun_packet(void *cls, const uint8_t *data, size_t len);
528
529
492 530
493#endif 531#endif
494 532