new operation queue for limiting overlay connects
[oweals/gnunet.git] / src / transport / plugin_transport_http_common.h
index 075573d7aef4630a7beea16a5d63f1803d8d9f4c..85793ce7fa19a420553cf092a506c7a17a05c4f0 100644 (file)
 #include "platform.h"
 #include "gnunet_common.h"
 
-#if 0
-GNUNET_NETWORK_STRUCT_BEGIN
 /**
- * HTTP addresses including a full URI
+ * Timeout values for testing
  */
-struct HttpAddress
-{
-  /**
-   * Address following
-   */
-  char *address GNUNET_PACKED;
-};
-GNUNET_NETWORK_STRUCT_END
+#define TESTING GNUNET_NO
+
+#if TESTING
+
+#define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
+#define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
+#define CLIENT_SESSION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 7)
+#define SERVER_SESSION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 7)
+#define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG
+
+#else
+
+#define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
+#define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
+#define CLIENT_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT
+#define SERVER_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT
+#define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG
+
 #endif
 
 /**
@@ -113,6 +121,20 @@ http_common_address_from_socket (const char *protocol,
                                  const struct sockaddr *addr,
                                  socklen_t addrlen);
 
+/**
+ * Create a socketaddr from a HTTP address
+ *
+ * @param addr sockaddr * address
+ * @param addrlen length of the address
+ * @param res the result:
+ * GNUNET_SYSERR, invalid input,
+ * GNUNET_YES: could convert to ip,
+ * GNUNET_NO: valid input but could not convert to ip (hostname?)
+ * @return the string
+ */
+struct sockaddr *
+http_common_socket_from_address (const void *addr, size_t addrlen, int *res);
+
 /**
  * Get the length of an address
  *