aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-08-22 13:41:23 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-08-22 13:41:23 +0000
commit802a9598bed7f149466072f6e6834559bab2cd2e (patch)
treefc2e6c81d202299b45725831966af818428d05d8 /src/transport
parent014487cd170b00d258264cc86392b8d91bdf0616 (diff)
downloadgnunet-802a9598bed7f149466072f6e6834559bab2cd2e.tar.gz
gnunet-802a9598bed7f149466072f6e6834559bab2cd2e.zip
changes
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/Makefile.am8
-rw-r--r--src/transport/plugin_transport_http_client.c143
-rw-r--r--src/transport/plugin_transport_http_common.c99
-rw-r--r--src/transport/plugin_transport_http_common.h85
-rw-r--r--src/transport/plugin_transport_http_server.c180
-rw-r--r--src/transport/test_transport_api_http_reverse_proxy.conf9
6 files changed, 332 insertions, 192 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 7fad31afb..66331db92 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -229,7 +229,7 @@ libgnunet_plugin_transport_unix_la_LDFLAGS = \
229 229
230 230
231libgnunet_plugin_transport_http_client_la_SOURCES = \ 231libgnunet_plugin_transport_http_client_la_SOURCES = \
232 plugin_transport_http_client.c 232 plugin_transport_http_client.c plugin_transport_http_common.c
233libgnunet_plugin_transport_http_client_la_LIBADD = \ 233libgnunet_plugin_transport_http_client_la_LIBADD = \
234 $(top_builddir)/src/hello/libgnunethello.la \ 234 $(top_builddir)/src/hello/libgnunethello.la \
235 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 235 $(top_builddir)/src/statistics/libgnunetstatistics.la \
@@ -246,7 +246,7 @@ libgnunet_plugin_transport_http_client_la_CPPFLAGS = \
246 246
247 247
248libgnunet_plugin_transport_http_server_la_SOURCES = \ 248libgnunet_plugin_transport_http_server_la_SOURCES = \
249 plugin_transport_http_server.c 249 plugin_transport_http_server.c plugin_transport_http_common.c
250libgnunet_plugin_transport_http_server_la_LIBADD = \ 250libgnunet_plugin_transport_http_server_la_LIBADD = \
251 $(top_builddir)/src/hello/libgnunethello.la \ 251 $(top_builddir)/src/hello/libgnunethello.la \
252 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 252 $(top_builddir)/src/statistics/libgnunetstatistics.la \
@@ -260,7 +260,7 @@ libgnunet_plugin_transport_http_server_la_CFLAGS = \
260 $(CFLAGS) 260 $(CFLAGS)
261 261
262libgnunet_plugin_transport_https_client_la_SOURCES = \ 262libgnunet_plugin_transport_https_client_la_SOURCES = \
263 plugin_transport_http_client.c 263 plugin_transport_http_client.c plugin_transport_http_common.c
264libgnunet_plugin_transport_https_client_la_LIBADD = \ 264libgnunet_plugin_transport_https_client_la_LIBADD = \
265 $(top_builddir)/src/hello/libgnunethello.la \ 265 $(top_builddir)/src/hello/libgnunethello.la \
266 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 266 $(top_builddir)/src/statistics/libgnunetstatistics.la \
@@ -277,7 +277,7 @@ libgnunet_plugin_transport_https_client_la_CPPFLAGS = \
277 277
278 278
279libgnunet_plugin_transport_https_server_la_SOURCES = \ 279libgnunet_plugin_transport_https_server_la_SOURCES = \
280 plugin_transport_http_server.c 280 plugin_transport_http_server.c plugin_transport_http_common.c
281libgnunet_plugin_transport_https_server_la_LIBADD = \ 281libgnunet_plugin_transport_https_server_la_LIBADD = \
282 $(top_builddir)/src/hello/libgnunethello.la \ 282 $(top_builddir)/src/hello/libgnunethello.la \
283 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 283 $(top_builddir)/src/statistics/libgnunetstatistics.la \
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index c2dda5efc..e2967745e 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -41,6 +41,9 @@
41#include "gnunet_statistics_service.h" 41#include "gnunet_statistics_service.h"
42#include "gnunet_transport_service.h" 42#include "gnunet_transport_service.h"
43#include "gnunet_transport_plugin.h" 43#include "gnunet_transport_plugin.h"
44#include "plugin_transport_http_common.h"
45#include <curl/curl.h>
46
44 47
45#define DEBUG_TEMPLATE GNUNET_EXTRA_LOGGING 48#define DEBUG_TEMPLATE GNUNET_EXTRA_LOGGING
46 49
@@ -126,10 +129,39 @@ struct HTTP_Client_Plugin
126 struct GNUNET_TRANSPORT_PluginEnvironment *env; 129 struct GNUNET_TRANSPORT_PluginEnvironment *env;
127 130
128 /** 131 /**
129 * List of open sessions. 132 * Linked list head of open sessions.
133 */
134 struct Session *head;
135
136 /**
137 * Linked list tail of open sessions.
138 */
139 struct Session *tail;
140
141 /**
142 * Plugin name
143 */
144 char *name;
145
146 /**
147 * Protocol
148 */
149 char *protocol;
150
151 /**
152 * use IPv6
153 */
154 uint16_t use_ipv6;
155
156 /**
157 * use IPv4
130 */ 158 */
131 struct Session *sessions; 159 uint16_t use_ipv4;
132 160
161 /**
162 * cURL Multihandle
163 */
164 CURLM *curl_multi_handle;
133}; 165};
134 166
135 167
@@ -195,33 +227,32 @@ http_client_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *targ
195 // FIXME 227 // FIXME
196} 228}
197 229
198
199/**
200 * Convert the transports address to a nice, human-readable
201 * format.
202 *
203 * @param cls closure
204 * @param type name of the transport that generated the address
205 * @param addr one of the addresses of the host, NULL for the last address
206 * the specific address format depends on the transport
207 * @param addrlen length of the address
208 * @param numeric should (IP) addresses be displayed in numeric form?
209 * @param timeout after how long should we give up?
210 * @param asc function to call on each string
211 * @param asc_cls closure for asc
212 */
213static void 230static void
214http_client_plugin_address_pretty_printer (void *cls, const char *type, 231client_stop (struct HTTP_Client_Plugin *plugin)
215 const void *addr, size_t addrlen,
216 int numeric,
217 struct GNUNET_TIME_Relative timeout,
218 GNUNET_TRANSPORT_AddressStringCallback
219 asc, void *asc_cls)
220{ 232{
221 asc (asc_cls, NULL); 233 if (NULL != plugin->curl_multi_handle)
234 {
235 curl_multi_cleanup (plugin->curl_multi_handle);
236 plugin->curl_multi_handle = NULL;
237 }
238 curl_global_cleanup ();
222} 239}
223 240
224 241static int
242client_start (struct HTTP_Client_Plugin *plugin)
243{
244 curl_global_init (CURL_GLOBAL_ALL);
245 plugin->curl_multi_handle = curl_multi_init ();
246
247 if (NULL == plugin->curl_multi_handle)
248 {
249 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
250 _("Could not initialize curl multi handle, failed to start %s plugin!\n"),
251 plugin->name);
252 return GNUNET_SYSERR;
253 }
254 return GNUNET_OK;
255}
225 256
226/** 257/**
227 * Another peer has suggested an address for this 258 * Another peer has suggested an address for this
@@ -240,31 +271,25 @@ http_client_plugin_address_suggested (void *cls, const void *addr, size_t addrle
240{ 271{
241 /* struct Plugin *plugin = cls; */ 272 /* struct Plugin *plugin = cls; */
242 273
243 /* check if the address is plausible; if so, 274 /* A HTTP/S client does not have any valid address so:*/
244 * add it to our list! */ 275 return GNUNET_NO;
245 return GNUNET_OK;
246} 276}
247 277
248
249/** 278/**
250 * Function called for a quick conversion of the binary address to 279 * Exit point from the plugin.
251 * a numeric address. Note that the caller must not free the
252 * address and that the next call to this function is allowed
253 * to override the address again.
254 *
255 * @param cls closure
256 * @param addr binary address
257 * @param addrlen length of the address
258 * @return string representing the same address
259 */ 280 */
260static const char * 281void *
261http_client_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) 282LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls)
262{ 283{
263 GNUNET_break (0); 284 struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
264 return NULL; 285 struct HTTP_Client_Plugin *plugin = api->cls;
265}
266 286
287 client_stop (plugin);
267 288
289 GNUNET_free (plugin);
290 GNUNET_free (api);
291 return NULL;
292}
268 293
269 294
270/** 295/**
@@ -283,25 +308,27 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
283 api->cls = plugin; 308 api->cls = plugin;
284 api->send = &http_client_plugin_send; 309 api->send = &http_client_plugin_send;
285 api->disconnect = &http_client_plugin_disconnect; 310 api->disconnect = &http_client_plugin_disconnect;
286 api->address_pretty_printer = &http_client_plugin_address_pretty_printer;
287 api->check_address = &http_client_plugin_address_suggested; 311 api->check_address = &http_client_plugin_address_suggested;
288 api->address_to_string = &http_client_plugin_address_to_string;
289 return api;
290}
291 312
313 api->address_to_string = &http_common_plugin_address_to_string;
314 api->string_to_address = &http_common_plugin_string_to_address;
315 api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
292 316
293/** 317#if BUILD_HTTPS
294 * Exit point from the plugin. 318 plugin->name = "transport-https_client";
295 */ 319 plugin->protocol = "https";
296void * 320#else
297LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) 321 plugin->name = "transport-http_client";
298{ 322 plugin->protocol = "http";
299 struct GNUNET_TRANSPORT_PluginFunctions *api = cls; 323#endif
300 struct HTTP_Client_Plugin *plugin = api->cls;
301 324
302 GNUNET_free (plugin); 325 /* Start client */
303 GNUNET_free (api); 326 if (GNUNET_SYSERR == client_start (plugin))
304 return NULL; 327 {
328 LIBGNUNET_PLUGIN_TRANSPORT_DONE (api);
329 return NULL;
330 }
331 return api;
305} 332}
306 333
307/* end of plugin_transport_http_client.c */ 334/* end of plugin_transport_http_client.c */
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c
new file mode 100644
index 000000000..b1bf7b0de
--- /dev/null
+++ b/src/transport/plugin_transport_http_common.c
@@ -0,0 +1,99 @@
1/*
2 This file is part of GNUnet
3 (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19*/
20
21/**
22 * @file transport/plugin_transport_http_common.c
23 * @brief functionality shared by http client and server transport service plugin
24 * @author Matthias Wachs
25 */
26
27#include "platform.h"
28#include "gnunet_common.h"
29#include "gnunet_transport_plugin.h"
30
31/**
32 * Convert the transports address to a nice, human-readable
33 * format.
34 *
35 * @param cls closure
36 * @param type name of the transport that generated the address
37 * @param addr one of the addresses of the host, NULL for the last address
38 * the specific address format depends on the transport
39 * @param addrlen length of the address
40 * @param numeric should (IP) addresses be displayed in numeric form?
41 * @param timeout after how long should we give up?
42 * @param asc function to call on each string
43 * @param asc_cls closure for asc
44 */
45void
46http_common_plugin_address_pretty_printer (void *cls, const char *type,
47 const void *addr, size_t addrlen,
48 int numeric,
49 struct GNUNET_TIME_Relative timeout,
50 GNUNET_TRANSPORT_AddressStringCallback
51 asc, void *asc_cls)
52{
53 GNUNET_break (0);
54 asc (asc_cls, NULL);
55}
56
57
58/**
59 * Function called for a quick conversion of the binary address to
60 * a numeric address. Note that the caller must not free the
61 * address and that the next call to this function is allowed
62 * to override the address again.
63 *
64 * @param cls closure
65 * @param addr binary address
66 * @param addrlen length of the address
67 * @return string representing the same address
68 */
69const char *
70http_common_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
71{
72 GNUNET_break (0);
73 return NULL;
74}
75
76/**
77 * Function called to convert a string address to
78 * a binary address.
79 *
80 * @param cls closure ('struct Plugin*')
81 * @param addr string address
82 * @param addrlen length of the address
83 * @param buf location to store the buffer
84 * If the function returns GNUNET_SYSERR, its contents are undefined.
85 * @param added length of created address
86 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
87 */
88int
89http_common_plugin_string_to_address (void *cls,
90 const char *addr,
91 uint16_t addrlen,
92 void **buf,
93 size_t *added)
94{
95 GNUNET_break (0);
96 return GNUNET_SYSERR;
97}
98
99/* end of plugin_transport_http_common.c */
diff --git a/src/transport/plugin_transport_http_common.h b/src/transport/plugin_transport_http_common.h
new file mode 100644
index 000000000..b29801d24
--- /dev/null
+++ b/src/transport/plugin_transport_http_common.h
@@ -0,0 +1,85 @@
1/*
2 This file is part of GNUnet
3 (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19*/
20
21/**
22 * @file transport/plugin_transport_http_common.c
23 * @brief functionality shared by http client and server transport service plugin
24 * @author Matthias Wachs
25 */
26
27#include "platform.h"
28#include "gnunet_common.h"
29
30/**
31 * Convert the transports address to a nice, human-readable
32 * format.
33 *
34 * @param cls closure
35 * @param type name of the transport that generated the address
36 * @param addr one of the addresses of the host, NULL for the last address
37 * the specific address format depends on the transport
38 * @param addrlen length of the address
39 * @param numeric should (IP) addresses be displayed in numeric form?
40 * @param timeout after how long should we give up?
41 * @param asc function to call on each string
42 * @param asc_cls closure for asc
43 */
44void
45http_common_plugin_address_pretty_printer (void *cls, const char *type,
46 const void *addr, size_t addrlen,
47 int numeric,
48 struct GNUNET_TIME_Relative timeout,
49 GNUNET_TRANSPORT_AddressStringCallback
50 asc, void *asc_cls);
51
52/**
53 * Function called for a quick conversion of the binary address to
54 * a numeric address. Note that the caller must not free the
55 * address and that the next call to this function is allowed
56 * to override the address again.
57 *
58 * @param cls closure
59 * @param addr binary address
60 * @param addrlen length of the address
61 * @return string representing the same address
62 */
63const char *
64http_common_plugin_address_to_string (void *cls, const void *addr, size_t addrlen);
65
66/**
67 * Function called to convert a string address to
68 * a binary address.
69 *
70 * @param cls closure ('struct Plugin*')
71 * @param addr string address
72 * @param addrlen length of the address
73 * @param buf location to store the buffer
74 * If the function returns GNUNET_SYSERR, its contents are undefined.
75 * @param added length of created address
76 * @return GNUNET_OK on success, GNUNET_SYSERR on failure
77 */
78int
79http_common_plugin_string_to_address (void *cls,
80 const char *addr,
81 uint16_t addrlen,
82 void **buf,
83 size_t *added);
84
85/* end of plugin_transport_http_common.c */
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index b19762c3f..e8bd43c2f 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -35,6 +35,7 @@
35 35
36#include "gnunet_container_lib.h" 36#include "gnunet_container_lib.h"
37#include "gnunet_nat_lib.h" 37#include "gnunet_nat_lib.h"
38#include "plugin_transport_http_common.h"
38#include "microhttpd.h" 39#include "microhttpd.h"
39 40
40#if BUILD_HTTPS 41#if BUILD_HTTPS
@@ -59,12 +60,6 @@ struct Plugin;
59struct Session 60struct Session
60{ 61{
61 /** 62 /**
62 * To whom are we talking to (set to our identity
63 * if we are still waiting for the welcome message)
64 */
65 struct GNUNET_PeerIdentity target;
66
67 /**
68 * Stored in a linked list. 63 * Stored in a linked list.
69 */ 64 */
70 struct Session *next; 65 struct Session *next;
@@ -75,43 +70,15 @@ struct Session
75 struct Session *prev; 70 struct Session *prev;
76 71
77 /** 72 /**
78 * Pointer to the global plugin struct. 73 * To whom are we talking to (set to our identity
79 */ 74 * if we are still waiting for the welcome message)
80 struct HTTP_Server_Plugin *plugin;
81
82 /**
83 * The client (used to identify this connection)
84 */
85 /* void *client; */
86
87 /**
88 * Continuation function to call once the transmission buffer
89 * has again space available. NULL if there is no
90 * continuation to call.
91 */
92 GNUNET_TRANSPORT_TransmitContinuation transmit_cont;
93
94 /**
95 * Closure for transmit_cont.
96 */
97 void *transmit_cont_cls;
98
99 /**
100 * At what time did we reset last_received last?
101 */
102 struct GNUNET_TIME_Absolute last_quota_update;
103
104 /**
105 * How many bytes have we received since the "last_quota_update"
106 * timestamp?
107 */ 75 */
108 uint64_t last_received; 76 struct GNUNET_PeerIdentity target;
109 77
110 /** 78 /**
111 * Number of bytes per ms that this peer is allowed 79 * Pointer to the global plugin struct.
112 * to send to us.
113 */ 80 */
114 uint32_t quota; 81 struct HTTP_Server_Plugin *plugin;
115 82
116 /** 83 /**
117 * next pointer for double linked list 84 * next pointer for double linked list
@@ -129,10 +96,6 @@ struct Session
129 struct GNUNET_SERVER_MessageStreamTokenizer *msg_tk; 96 struct GNUNET_SERVER_MessageStreamTokenizer *msg_tk;
130 97
131 /** 98 /**
132 * Server handles
133 */
134
135 /**
136 * Client send handle 99 * Client send handle
137 */ 100 */
138 struct ServerConnection *server_recv; 101 struct ServerConnection *server_recv;
@@ -146,12 +109,6 @@ struct Session
146 * Address 109 * Address
147 */ 110 */
148 void *addr; 111 void *addr;
149
150 /**
151 * Address length
152 */
153 size_t addrlen;
154
155}; 112};
156 113
157/** 114/**
@@ -165,39 +122,30 @@ struct HTTP_Server_Plugin
165 struct GNUNET_TRANSPORT_PluginEnvironment *env; 122 struct GNUNET_TRANSPORT_PluginEnvironment *env;
166 123
167 /** 124 /**
168 * Linked list of open sessions. 125 * Linked list head of open sessions.
169 */ 126 */
170 127
171 struct Session *head; 128 struct Session *head;
172 129
130 /**
131 * Linked list tail of open sessions.
132 */
173 struct Session *tail; 133 struct Session *tail;
174 134
175
176 char *name;
177 char *protocol;
178 char *external_hostname;
179
180 /** 135 /**
181 * libCurl TLS crypto init string, can be set to enhance performance 136 * Plugin name
182 *
183 * Example:
184 *
185 * Use RC4-128 instead of AES:
186 * NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL
187 *
188 */ 137 */
189 char *crypto_init; 138 char *name;
190 139
191 /** 140 /**
192 * TLS key 141 * Protocol
193 */ 142 */
194 char *key; 143 char *protocol;
195 144
196 /** 145 /**
197 * TLS certificate 146 * External address
198 */ 147 */
199 char *cert; 148 char *external_hostname;
200
201 149
202 /** 150 /**
203 * Maximum number of sockets the plugin can use 151 * Maximum number of sockets the plugin can use
@@ -248,6 +196,15 @@ struct HTTP_Server_Plugin
248 struct GNUNET_NAT_Handle *nat; 196 struct GNUNET_NAT_Handle *nat;
249 197
250 /** 198 /**
199 * Server semi connections
200 * A full session consists of 2 semi-connections: send and receive
201 * If not both directions are established the server keeps this sessions here
202 */
203 struct Session *server_semi_head;
204
205 struct Session *server_semi_tail;
206
207 /**
251 * List of own addresses 208 * List of own addresses
252 */ 209 */
253 210
@@ -291,26 +248,39 @@ struct HTTP_Server_Plugin
291 */ 248 */
292 int server_v6_immediately; 249 int server_v6_immediately;
293 250
294
295 /** 251 /**
296 * Server semi connections 252 * MHD IPv4 daemon
297 * A full session consists of 2 semi-connections: send and receive
298 * If not both directions are established the server keeps this sessions here
299 */ 253 */
300 struct Session *server_semi_head; 254 struct MHD_Daemon *server_v4;
301 255
302 struct Session *server_semi_tail; 256 /**
257 * MHD IPv4 daemon
258 */
259 struct MHD_Daemon *server_v6;
303 260
261#if BUILD_HTTPS
262 /**
263 * Crypto related
264 *
265 * Example:
266 *
267 * Use RC4-128 instead of AES:
268 * NONE:+VERS-TLS1.0:+ARCFOUR-128:+SHA1:+RSA:+COMP-NULL
269 *
270 */
271 char *crypto_init;
304 272
305 /** 273 /**
306 * MHD IPv4 daemon 274 * TLS key
307 */ 275 */
308 struct MHD_Daemon *server_v4; 276 char *key;
309 277
310 /** 278 /**
311 * MHD IPv4 daemon 279 * TLS certificate
312 */ 280 */
313 struct MHD_Daemon *server_v6; 281 char *cert;
282#endif
283
314}; 284};
315 285
316GNUNET_NETWORK_STRUCT_BEGIN 286GNUNET_NETWORK_STRUCT_BEGIN
@@ -461,33 +431,6 @@ http_server_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *targ
461 431
462 432
463/** 433/**
464 * Convert the transports address to a nice, human-readable
465 * format.
466 *
467 * @param cls closure
468 * @param type name of the transport that generated the address
469 * @param addr one of the addresses of the host, NULL for the last address
470 * the specific address format depends on the transport
471 * @param addrlen length of the address
472 * @param numeric should (IP) addresses be displayed in numeric form?
473 * @param timeout after how long should we give up?
474 * @param asc function to call on each string
475 * @param asc_cls closure for asc
476 */
477static void
478http_server_plugin_address_pretty_printer (void *cls, const char *type,
479 const void *addr, size_t addrlen,
480 int numeric,
481 struct GNUNET_TIME_Relative timeout,
482 GNUNET_TRANSPORT_AddressStringCallback
483 asc, void *asc_cls)
484{
485 asc (asc_cls, NULL);
486}
487
488
489
490/**
491 * Another peer has suggested an address for this 434 * Another peer has suggested an address for this
492 * peer and transport plugin. Check that this could be a valid 435 * peer and transport plugin. Check that this could be a valid
493 * address. If so, consider adding it to the list 436 * address. If so, consider adding it to the list
@@ -511,25 +454,6 @@ http_server_plugin_address_suggested (void *cls, const void *addr, size_t addrle
511 454
512 455
513/** 456/**
514 * Function called for a quick conversion of the binary address to
515 * a numeric address. Note that the caller must not free the
516 * address and that the next call to this function is allowed
517 * to override the address again.
518 *
519 * @param cls closure
520 * @param addr binary address
521 * @param addrlen length of the address
522 * @return string representing the same address
523 */
524static const char *
525http_server_plugin_address_to_string (void *cls, const void *addr, size_t addrlen)
526{
527 GNUNET_break (0);
528 return NULL;
529}
530
531
532/**
533 * Deleting the session 457 * Deleting the session
534 * Must not be used afterwards 458 * Must not be used afterwards
535 */ 459 */
@@ -594,7 +518,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
594 const char *upload_data, size_t * upload_data_size, 518 const char *upload_data, size_t * upload_data_size,
595 void **httpSessionCache) 519 void **httpSessionCache)
596{ 520{
597 GNUNET_break (0); 521 /* FIXME SPLIT */
598 return MHD_NO; 522 return MHD_NO;
599} 523}
600 524
@@ -602,6 +526,7 @@ static void
602server_disconnect_cb (void *cls, struct MHD_Connection *connection, 526server_disconnect_cb (void *cls, struct MHD_Connection *connection,
603 void **httpSessionCache) 527 void **httpSessionCache)
604{ 528{
529 /* FIXME SPLIT */
605 GNUNET_break (0); 530 GNUNET_break (0);
606} 531}
607 532
@@ -1787,9 +1712,10 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
1787 api->cls = plugin; 1712 api->cls = plugin;
1788 api->send = &http_server_plugin_send; 1713 api->send = &http_server_plugin_send;
1789 api->disconnect = &http_server_plugin_disconnect; 1714 api->disconnect = &http_server_plugin_disconnect;
1790 api->address_pretty_printer = &http_server_plugin_address_pretty_printer;
1791 api->check_address = &http_server_plugin_address_suggested; 1715 api->check_address = &http_server_plugin_address_suggested;
1792 api->address_to_string = &http_server_plugin_address_to_string; 1716 api->address_to_string = &http_common_plugin_address_to_string;
1717 api->string_to_address = &http_common_plugin_string_to_address;
1718 api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
1793 1719
1794#if BUILD_HTTPS 1720#if BUILD_HTTPS
1795 plugin->name = "transport-https_server"; 1721 plugin->name = "transport-https_server";
diff --git a/src/transport/test_transport_api_http_reverse_proxy.conf b/src/transport/test_transport_api_http_reverse_proxy.conf
index 08ee02c2e..699a0745f 100644
--- a/src/transport/test_transport_api_http_reverse_proxy.conf
+++ b/src/transport/test_transport_api_http_reverse_proxy.conf
@@ -9,10 +9,13 @@ DEFAULTCONFIG = test_transport_api_http_reverse_proxy.conf
9[transport-http_server] 9[transport-http_server]
10PORT = 12080 10PORT = 12080
11EXTERNAL_HOSTNAME = fulcrum.net.in.tum.de:12080/peer 11EXTERNAL_HOSTNAME = fulcrum.net.in.tum.de:12080/peer
12#USE_IPV4 = YES 12USE_IPV4 = NO
13#USE_IPV6 = YES 13#USE_IPV6 = YES
14#BINDTO = 127.0.0.1 14#BINDTO = 127.0.0.1
15#BINDTO6 = ::1 15BINDTO6 = ::1
16
17[transport-https_server]
18PORT = 12090
16 19
17[arm] 20[arm]
18PORT = 12085 21PORT = 12085
@@ -34,7 +37,7 @@ UNIXPATH = /tmp/gnunet-p1-service-peerinfo.sock
34[transport] 37[transport]
35#DEBUG = YES 38#DEBUG = YES
36PORT = 12081 39PORT = 12081
37PLUGINS = http_server 40PLUGINS = https_client
38# http_client 41# http_client
39#BINARY = .libs/gnunet-service-transport 42#BINARY = .libs/gnunet-service-transport
40UNIXPATH = /tmp/gnunet-p1-service-transport.sock 43UNIXPATH = /tmp/gnunet-p1-service-transport.sock