aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_nat_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-07 16:03:59 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-07 16:03:59 +0100
commitc6bf6b89b5c1556590eadc3d64676d2f023e6da4 (patch)
treedbc378b6ac024e73972b0ac0015b60b3f3ca5c5f /src/include/gnunet_nat_service.h
parent5c59b1796e462b468321ce1200eb4a6972340cce (diff)
make sure nat-auto code uses NAT_AUTO prefix
Diffstat (limited to 'src/include/gnunet_nat_service.h')
-rw-r--r--src/include/gnunet_nat_service.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/include/gnunet_nat_service.h b/src/include/gnunet_nat_service.h
index 94f8a8555f..e758452073 100644
--- a/src/include/gnunet_nat_service.h
+++ b/src/include/gnunet_nat_service.h
@@ -425,6 +425,58 @@ GNUNET_NAT_stun_handle_packet (struct GNUNET_NAT_Handle *nh,
size_t data_size);
+/**
+ * Handle to a request given to the resolver. Can be used to cancel
+ * the request prior to the timeout or successful execution. Also
+ * used to track our internal state for the request.
+ */
+struct GNUNET_NAT_STUN_Handle;
+
+
+/**
+ * Function called to report success or failure for
+ * NAT configuration test.
+ *
+ * @param cls closure
+ * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code
+ */
+typedef void
+(*GNUNET_NAT_TestCallback) (void *cls,
+ enum GNUNET_NAT_StatusCode result);
+
+
+/**
+ * Make Generic STUN request. Sends a generic stun request to the
+ * server specified using the specified socket. If we do this,
+ * we need to watch for possible responses and call
+ * #GNUNET_NAT_stun_handle_packet() on incoming packets.
+ *
+ * @param server the address of the stun server
+ * @param port port of the stun server, in host byte order
+ * @param sock the socket used to send the request, must be a
+ * UDP socket
+ * @param cb callback in case of error
+ * @param cb_cls closure for @a cb
+ * @return NULL on error
+ */
+struct GNUNET_NAT_STUN_Handle *
+GNUNET_NAT_stun_make_request (const char *server,
+ uint16_t port,
+ struct GNUNET_NETWORK_Handle *sock,
+ GNUNET_NAT_TestCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel active STUN request. Frees associated resources
+ * and ensures that the callback is no longer invoked.
+ *
+ * @param rh request to cancel
+ */
+void
+GNUNET_NAT_stun_make_request_cancel (struct GNUNET_NAT_STUN_Handle *rh);
+
+
#endif
/** @} */ /* end of group */