GNUnet  0.10.x
plugin_transport_http_common.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2002-2014 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your 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  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
26 #include "platform.h"
27 #include "gnunet_common.h"
29 
33 #define TESTING GNUNET_NO
34 
35 #if TESTING
36 #define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3)
37 #define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3)
38 #define HTTP_CLIENT_SESSION_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 7)
39 #define SERVER_SESSION_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 7)
40 #define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG
41 
42 #else
43 
44 #if BUILD_HTTPS
45 #define PROTOCOL "https"
46 #else
47 #define PROTOCOL "http"
48 #endif
49 
50 #define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 15)
51 #define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 15)
52 #define HTTP_CLIENT_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT
53 #define HTTP_SERVER_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT
54 #define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG
55 
56 #endif
57 
58 #define HTTP_DEFAULT_PORT 80
59 #define HTTPS_DEFAULT_PORT 443
60 
69 
76 
81 };
82 
83 
85 
89 struct HttpAddress {
95 
99  uint32_t urlen GNUNET_PACKED;
100 };
101 
103 
108  char *protocol;
109  char *host;
110  char *path;
111  int port;
112 };
113 
114 
119 struct SplittedHTTPAddress *
120 http_split_address(const char *addr);
121 
122 
137 void
139  const char *type,
140  const void *addr,
141  size_t addrlen,
142  int numeric,
145  void *asc_cls);
146 
147 
159 const char *
161  const void *addr,
162  size_t addrlen);
163 
164 
177 int
179  const char *addr,
180  uint16_t addrlen,
181  void **buf,
182  size_t *added);
183 
184 
193 struct HttpAddress *
194 http_common_address_from_socket(const char *protocol,
195  const struct sockaddr *addr,
196  socklen_t addrlen);
197 
198 
210 struct sockaddr *
212  size_t addrlen,
213  int *res);
214 
215 
216 const char *
218  const void *addr,
219  size_t addrlen);
220 
221 
228 size_t
230 
231 
241 size_t
242 http_common_cmp_addresses(const void *addr1,
243  size_t addrlen1,
244  const void *addr2,
245  size_t addrlen2);
246 
247 
257  const struct GNUNET_HELLO_Address *address);
258 
259 
260 /* end of plugin_transport_http_common.h */
uint32_t options
Address options see enum HttpAddressOptions
const char * http_common_plugin_address_to_url(void *cls, const void *addr, size_t addrlen)
FIXME.
size_t http_common_address_get_size(const struct HttpAddress *addr)
Get the length of an address.
static int numeric
Option -n.
GNUNET_NetworkType
Types of networks (with separate quotas) we support.
Definition: gnunet_nt_lib.h:35
#define GNUNET_NETWORK_STRUCT_BEGIN
Define as empty, GNUNET_PACKED should suffice, but this won&#39;t work on W32.
size_t http_common_cmp_addresses(const void *addr1, size_t addrlen1, const void *addr2, size_t addrlen2)
Compare addr1 to addr2.
int http_common_plugin_string_to_address(void *cls, const char *addr, uint16_t addrlen, void **buf, size_t *added)
Function called to convert a string address to a binary address.
struct HttpAddress * http_common_address_from_socket(const char *protocol, const struct sockaddr *addr, socklen_t addrlen)
Create a HTTP address from a socketaddr.
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition: gnunet-arm.c:114
Representation of HTTP URL split into its components.
void(* GNUNET_TRANSPORT_AddressStringCallback)(void *cls, const char *address, int res)
Function called by the pretty printer for the resolved address for each human-readable address obtain...
The transport service will pass a pointer to a struct of this type as the first and only argument to ...
void * addr
Address following.
static char buf[2048]
struct sockaddr * http_common_socket_from_address(const void *addr, size_t addrlen, int *res)
Create a socketaddr from a HTTP address.
void http_common_plugin_address_pretty_printer(void *cls, const char *type, const void *addr, size_t addrlen, int numeric, struct GNUNET_TIME_Relative timeout, GNUNET_TRANSPORT_AddressStringCallback asc, void *asc_cls)
Convert the transports address to a nice, human-readable format.
static int res
uint32_t urlen
Length of URL located after struct.
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
const char * http_common_plugin_address_to_string(const char *plugin, const void *addr, size_t addrlen)
Function called for a quick conversion of the binary address to a numeric address.
enum GNUNET_NetworkType http_common_get_network_for_address(struct GNUNET_TRANSPORT_PluginEnvironment *env, const struct GNUNET_HELLO_Address *address)
Function obtain the network type for an address.
Enable TCP Stealth-style port knocking.
#define GNUNET_NETWORK_STRUCT_END
Define as empty, GNUNET_PACKED should suffice, but this won&#39;t work on W32;.
#define GNUNET_PACKED
gcc-ism to get packed structs.
An address for communicating with a peer.
HttpAddressOptions
Bits in the options field of HTTP addresses.
Verify X509 server certificate, it should be valid.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
static char * address
GNS address for this phone.
HTTP addresses including a full URI.
struct SplittedHTTPAddress * http_split_address(const char *addr)
Split an HTTP address into protocol, hostname, port and path components.
Time for relative time used by GNUnet, in microseconds.