diff options
Diffstat (limited to 'src/transport/plugin_transport_http_common.h')
-rw-r--r-- | src/transport/plugin_transport_http_common.h | 96 |
1 files changed, 54 insertions, 42 deletions
diff --git a/src/transport/plugin_transport_http_common.h b/src/transport/plugin_transport_http_common.h index 6aaf663a1..299dc0e68 100644 --- a/src/transport/plugin_transport_http_common.h +++ b/src/transport/plugin_transport_http_common.h | |||
@@ -33,10 +33,14 @@ | |||
33 | #define TESTING GNUNET_NO | 33 | #define TESTING GNUNET_NO |
34 | 34 | ||
35 | #if TESTING | 35 | #if TESTING |
36 | #define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3) | 36 | #define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply ( \ |
37 | #define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 3) | 37 | GNUNET_TIME_UNIT_SECONDS, 3) |
38 | #define HTTP_CLIENT_SESSION_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 7) | 38 | #define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply ( \ |
39 | #define SERVER_SESSION_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 7) | 39 | GNUNET_TIME_UNIT_SECONDS, 3) |
40 | #define HTTP_CLIENT_SESSION_TIMEOUT GNUNET_TIME_relative_multiply ( \ | ||
41 | GNUNET_TIME_UNIT_SECONDS, 7) | ||
42 | #define SERVER_SESSION_TIMEOUT GNUNET_TIME_relative_multiply ( \ | ||
43 | GNUNET_TIME_UNIT_SECONDS, 7) | ||
40 | #define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG | 44 | #define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG |
41 | 45 | ||
42 | #else | 46 | #else |
@@ -47,8 +51,10 @@ | |||
47 | #define PROTOCOL "http" | 51 | #define PROTOCOL "http" |
48 | #endif | 52 | #endif |
49 | 53 | ||
50 | #define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 15) | 54 | #define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply ( \ |
51 | #define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 15) | 55 | GNUNET_TIME_UNIT_SECONDS, 15) |
56 | #define HTTP_CLIENT_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply ( \ | ||
57 | GNUNET_TIME_UNIT_SECONDS, 15) | ||
52 | #define HTTP_CLIENT_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT | 58 | #define HTTP_CLIENT_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT |
53 | #define HTTP_SERVER_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT | 59 | #define HTTP_SERVER_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT |
54 | #define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG | 60 | #define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG |
@@ -61,7 +67,8 @@ | |||
61 | /** | 67 | /** |
62 | * Bits in the `options` field of HTTP addresses. | 68 | * Bits in the `options` field of HTTP addresses. |
63 | */ | 69 | */ |
64 | enum HttpAddressOptions { | 70 | enum HttpAddressOptions |
71 | { | ||
65 | /** | 72 | /** |
66 | * No bits set. | 73 | * No bits set. |
67 | */ | 74 | */ |
@@ -86,7 +93,8 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
86 | /** | 93 | /** |
87 | * HttpAddress | 94 | * HttpAddress |
88 | */ | 95 | */ |
89 | struct HttpAddress { | 96 | struct HttpAddress |
97 | { | ||
90 | /** | 98 | /** |
91 | * Address options | 99 | * Address options |
92 | * see `enum HttpAddressOptions` | 100 | * see `enum HttpAddressOptions` |
@@ -104,7 +112,8 @@ GNUNET_NETWORK_STRUCT_END | |||
104 | /** | 112 | /** |
105 | * Representation of HTTP URL split into its components. | 113 | * Representation of HTTP URL split into its components. |
106 | */ | 114 | */ |
107 | struct SplittedHTTPAddress { | 115 | struct SplittedHTTPAddress |
116 | { | ||
108 | char *protocol; | 117 | char *protocol; |
109 | char *host; | 118 | char *host; |
110 | char *path; | 119 | char *path; |
@@ -117,7 +126,7 @@ struct SplittedHTTPAddress { | |||
117 | * and path components. | 126 | * and path components. |
118 | */ | 127 | */ |
119 | struct SplittedHTTPAddress * | 128 | struct SplittedHTTPAddress * |
120 | http_split_address(const char *addr); | 129 | http_split_address (const char *addr); |
121 | 130 | ||
122 | 131 | ||
123 | /** | 132 | /** |
@@ -135,14 +144,15 @@ http_split_address(const char *addr); | |||
135 | * @param asc_cls closure for @a asc | 144 | * @param asc_cls closure for @a asc |
136 | */ | 145 | */ |
137 | void | 146 | void |
138 | http_common_plugin_address_pretty_printer(void *cls, | 147 | http_common_plugin_address_pretty_printer (void *cls, |
139 | const char *type, | 148 | const char *type, |
140 | const void *addr, | 149 | const void *addr, |
141 | size_t addrlen, | 150 | size_t addrlen, |
142 | int numeric, | 151 | int numeric, |
143 | struct GNUNET_TIME_Relative timeout, | 152 | struct GNUNET_TIME_Relative timeout, |
144 | GNUNET_TRANSPORT_AddressStringCallback asc, | 153 | GNUNET_TRANSPORT_AddressStringCallback |
145 | void *asc_cls); | 154 | asc, |
155 | void *asc_cls); | ||
146 | 156 | ||
147 | 157 | ||
148 | /** | 158 | /** |
@@ -157,9 +167,9 @@ http_common_plugin_address_pretty_printer(void *cls, | |||
157 | * @return string representing the same address | 167 | * @return string representing the same address |
158 | */ | 168 | */ |
159 | const char * | 169 | const char * |
160 | http_common_plugin_address_to_string(const char *plugin, | 170 | http_common_plugin_address_to_string (const char *plugin, |
161 | const void *addr, | 171 | const void *addr, |
162 | size_t addrlen); | 172 | size_t addrlen); |
163 | 173 | ||
164 | 174 | ||
165 | /** | 175 | /** |
@@ -175,11 +185,11 @@ http_common_plugin_address_to_string(const char *plugin, | |||
175 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | 185 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
176 | */ | 186 | */ |
177 | int | 187 | int |
178 | http_common_plugin_string_to_address(void *cls, | 188 | http_common_plugin_string_to_address (void *cls, |
179 | const char *addr, | 189 | const char *addr, |
180 | uint16_t addrlen, | 190 | uint16_t addrlen, |
181 | void **buf, | 191 | void **buf, |
182 | size_t *added); | 192 | size_t *added); |
183 | 193 | ||
184 | 194 | ||
185 | /** | 195 | /** |
@@ -191,9 +201,9 @@ http_common_plugin_string_to_address(void *cls, | |||
191 | * @return the string | 201 | * @return the string |
192 | */ | 202 | */ |
193 | struct HttpAddress * | 203 | struct HttpAddress * |
194 | http_common_address_from_socket(const char *protocol, | 204 | http_common_address_from_socket (const char *protocol, |
195 | const struct sockaddr *addr, | 205 | const struct sockaddr *addr, |
196 | socklen_t addrlen); | 206 | socklen_t addrlen); |
197 | 207 | ||
198 | 208 | ||
199 | /** | 209 | /** |
@@ -208,15 +218,15 @@ http_common_address_from_socket(const char *protocol, | |||
208 | * @return the string | 218 | * @return the string |
209 | */ | 219 | */ |
210 | struct sockaddr * | 220 | struct sockaddr * |
211 | http_common_socket_from_address(const void *addr, | 221 | http_common_socket_from_address (const void *addr, |
212 | size_t addrlen, | 222 | size_t addrlen, |
213 | int *res); | 223 | int *res); |
214 | 224 | ||
215 | 225 | ||
216 | const char * | 226 | const char * |
217 | http_common_plugin_address_to_url(void *cls, | 227 | http_common_plugin_address_to_url (void *cls, |
218 | const void *addr, | 228 | const void *addr, |
219 | size_t addrlen); | 229 | size_t addrlen); |
220 | 230 | ||
221 | 231 | ||
222 | /** | 232 | /** |
@@ -226,7 +236,7 @@ http_common_plugin_address_to_url(void *cls, | |||
226 | * @return the size | 236 | * @return the size |
227 | */ | 237 | */ |
228 | size_t | 238 | size_t |
229 | http_common_address_get_size(const struct HttpAddress * addr); | 239 | http_common_address_get_size (const struct HttpAddress *addr); |
230 | 240 | ||
231 | 241 | ||
232 | /** | 242 | /** |
@@ -239,10 +249,10 @@ http_common_address_get_size(const struct HttpAddress * addr); | |||
239 | * @return #GNUNET_YES if equal, #GNUNET_NO else | 249 | * @return #GNUNET_YES if equal, #GNUNET_NO else |
240 | */ | 250 | */ |
241 | size_t | 251 | size_t |
242 | http_common_cmp_addresses(const void *addr1, | 252 | http_common_cmp_addresses (const void *addr1, |
243 | size_t addrlen1, | 253 | size_t addrlen1, |
244 | const void *addr2, | 254 | const void *addr2, |
245 | size_t addrlen2); | 255 | size_t addrlen2); |
246 | 256 | ||
247 | 257 | ||
248 | /** | 258 | /** |
@@ -253,8 +263,10 @@ http_common_cmp_addresses(const void *addr1, | |||
253 | * @return the network type | 263 | * @return the network type |
254 | */ | 264 | */ |
255 | enum GNUNET_NetworkType | 265 | enum GNUNET_NetworkType |
256 | http_common_get_network_for_address(struct GNUNET_TRANSPORT_PluginEnvironment *env, | 266 | http_common_get_network_for_address (struct |
257 | const struct GNUNET_HELLO_Address *address); | 267 | GNUNET_TRANSPORT_PluginEnvironment *env, |
268 | const struct | ||
269 | GNUNET_HELLO_Address *address); | ||
258 | 270 | ||
259 | 271 | ||
260 | /* end of plugin_transport_http_common.h */ | 272 | /* end of plugin_transport_http_common.h */ |