2 This file is part of GNUnet
3 (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file transport/plugin_transport_http.h
23 * @brief http transport service plugin
24 * @author Matthias Wachs
28 #include "gnunet_common.h"
29 #include "gnunet_constants.h"
30 #include "gnunet_protocols.h"
31 #include "gnunet_connection_lib.h"
32 #include "gnunet_service_lib.h"
33 #include "gnunet_statistics_service.h"
34 #include "gnunet_transport_service.h"
35 #include "gnunet_resolver_service.h"
36 #include "gnunet_server_lib.h"
37 #include "gnunet_container_lib.h"
38 #include "gnunet_transport_plugin.h"
39 #include "gnunet_os_lib.h"
40 #include "gnunet_nat_lib.h"
41 #include "microhttpd.h"
42 #include <curl/curl.h>
45 #define DEBUG_HTTP GNUNET_YES
46 #define VERBOSE_SERVER GNUNET_YES
47 #define VERBOSE_CLIENT GNUNET_YES
50 #define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_https_init
51 #define LIBGNUNET_PLUGIN_TRANSPORT_DONE libgnunet_plugin_transport_https_done
53 #define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_http_init
54 #define LIBGNUNET_PLUGIN_TRANSPORT_DONE libgnunet_plugin_transport_http_done
58 #define HTTP_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
61 * Encapsulation of all of the state of the plugin.
68 struct GNUNET_TRANSPORT_PluginEnvironment *env;
71 * List of open sessions.
78 * NAT handle & address management
80 struct GNUNET_NAT_Handle *nat;
85 struct IPv4HttpAddressWrapper *ipv4_addr_head;
90 struct IPv4HttpAddressWrapper *ipv4_addr_tail;
95 struct IPv6HttpAddressWrapper *ipv6_addr_head;
100 struct IPv6HttpAddressWrapper *ipv6_addr_tail;
103 /* Plugin configuration */
127 struct MHD_Daemon *server_v4;
128 GNUNET_SCHEDULER_TaskIdentifier server_v4_task;
130 struct MHD_Daemon *server_v6;
131 GNUNET_SCHEDULER_TaskIdentifier server_v6_task;
146 GNUNET_SCHEDULER_TaskIdentifier client_perform_task;
151 * Session handle for connections.
157 * Stored in a linked list.
159 struct Session *next;
162 * Stored in a linked list.
164 struct Session *prev;
167 * Pointer to the global plugin struct.
169 struct Plugin *plugin;
172 * The client (used to identify this connection)
177 * Continuation function to call once the transmission buffer
178 * has again space available. NULL if there is no
179 * continuation to call.
181 GNUNET_TRANSPORT_TransmitContinuation transmit_cont;
189 * Closure for transmit_cont.
191 void *transmit_cont_cls;
194 * To whom are we talking to (set to our identity
195 * if we are still waiting for the welcome message)
197 struct GNUNET_PeerIdentity target;
200 * At what time did we reset last_received last?
202 //struct GNUNET_TIME_Absolute last_quota_update;
205 * How many bytes have we received since the "last_quota_update"
208 //uint64_t last_received;
211 * Number of bytes per ms that this peer is allowed
226 http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen);
229 client_disconnect (struct Session *s);
232 client_connect (struct Session *s);
235 client_send (struct Session *s, const char *msgbuf, size_t msgbuf_size);
238 client_start (struct Plugin *plugin);
241 client_stop (struct Plugin *plugin);
244 server_disconnect (struct Session *s);
247 server_send (struct Session *s, const char *msgbuf, size_t msgbuf_size);
250 server_start (struct Plugin *plugin);
253 server_stop (struct Plugin *plugin);
256 notify_session_end (void *cls,
257 const struct GNUNET_PeerIdentity *
258 peer, struct Session * s);
260 /* end of plugin_transport_http.h */