summaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport_http_common.h')
-rw-r--r--src/transport/plugin_transport_http_common.h91
1 files changed, 44 insertions, 47 deletions
diff --git a/src/transport/plugin_transport_http_common.h b/src/transport/plugin_transport_http_common.h
index 0410be8e9..6aaf663a1 100644
--- a/src/transport/plugin_transport_http_common.h
+++ b/src/transport/plugin_transport_http_common.h
@@ -11,12 +11,12 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20/** 20/**
21 * @file transport/plugin_transport_http_common.c 21 * @file transport/plugin_transport_http_common.c
22 * @brief functionality shared by http client and server transport service plugin 22 * @brief functionality shared by http client and server transport service plugin
@@ -33,10 +33,10 @@
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(GNUNET_TIME_UNIT_SECONDS, 3)
37#define HTTP_CLIENT_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) 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) 39#define SERVER_SESSION_TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 7)
40#define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG 40#define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG
41 41
42#else 42#else
@@ -47,8 +47,8 @@
47#define PROTOCOL "http" 47#define PROTOCOL "http"
48#endif 48#endif
49 49
50#define HTTP_SERVER_NOT_VALIDATED_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15) 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) 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 52#define HTTP_CLIENT_SESSION_TIMEOUT GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT
53#define HTTP_SERVER_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 54#define TIMEOUT_LOG GNUNET_ERROR_TYPE_DEBUG
@@ -61,8 +61,7 @@
61/** 61/**
62 * Bits in the `options` field of HTTP addresses. 62 * Bits in the `options` field of HTTP addresses.
63 */ 63 */
64enum HttpAddressOptions 64enum HttpAddressOptions {
65{
66 /** 65 /**
67 * No bits set. 66 * No bits set.
68 */ 67 */
@@ -87,8 +86,7 @@ GNUNET_NETWORK_STRUCT_BEGIN
87/** 86/**
88 * HttpAddress 87 * HttpAddress
89 */ 88 */
90struct HttpAddress 89struct HttpAddress {
91{
92 /** 90 /**
93 * Address options 91 * Address options
94 * see `enum HttpAddressOptions` 92 * see `enum HttpAddressOptions`
@@ -106,8 +104,7 @@ GNUNET_NETWORK_STRUCT_END
106/** 104/**
107 * Representation of HTTP URL split into its components. 105 * Representation of HTTP URL split into its components.
108 */ 106 */
109struct SplittedHTTPAddress 107struct SplittedHTTPAddress {
110{
111 char *protocol; 108 char *protocol;
112 char *host; 109 char *host;
113 char *path; 110 char *path;
@@ -120,7 +117,7 @@ struct SplittedHTTPAddress
120 * and path components. 117 * and path components.
121 */ 118 */
122struct SplittedHTTPAddress * 119struct SplittedHTTPAddress *
123http_split_address (const char *addr); 120http_split_address(const char *addr);
124 121
125 122
126/** 123/**
@@ -138,14 +135,14 @@ http_split_address (const char *addr);
138 * @param asc_cls closure for @a asc 135 * @param asc_cls closure for @a asc
139 */ 136 */
140void 137void
141http_common_plugin_address_pretty_printer (void *cls, 138http_common_plugin_address_pretty_printer(void *cls,
142 const char *type, 139 const char *type,
143 const void *addr, 140 const void *addr,
144 size_t addrlen, 141 size_t addrlen,
145 int numeric, 142 int numeric,
146 struct GNUNET_TIME_Relative timeout, 143 struct GNUNET_TIME_Relative timeout,
147 GNUNET_TRANSPORT_AddressStringCallback asc, 144 GNUNET_TRANSPORT_AddressStringCallback asc,
148 void *asc_cls); 145 void *asc_cls);
149 146
150 147
151/** 148/**
@@ -160,9 +157,9 @@ http_common_plugin_address_pretty_printer (void *cls,
160 * @return string representing the same address 157 * @return string representing the same address
161 */ 158 */
162const char * 159const char *
163http_common_plugin_address_to_string (const char *plugin, 160http_common_plugin_address_to_string(const char *plugin,
164 const void *addr, 161 const void *addr,
165 size_t addrlen); 162 size_t addrlen);
166 163
167 164
168/** 165/**
@@ -178,11 +175,11 @@ http_common_plugin_address_to_string (const char *plugin,
178 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 175 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
179 */ 176 */
180int 177int
181http_common_plugin_string_to_address (void *cls, 178http_common_plugin_string_to_address(void *cls,
182 const char *addr, 179 const char *addr,
183 uint16_t addrlen, 180 uint16_t addrlen,
184 void **buf, 181 void **buf,
185 size_t *added); 182 size_t *added);
186 183
187 184
188/** 185/**
@@ -194,9 +191,9 @@ http_common_plugin_string_to_address (void *cls,
194 * @return the string 191 * @return the string
195 */ 192 */
196struct HttpAddress * 193struct HttpAddress *
197http_common_address_from_socket (const char *protocol, 194http_common_address_from_socket(const char *protocol,
198 const struct sockaddr *addr, 195 const struct sockaddr *addr,
199 socklen_t addrlen); 196 socklen_t addrlen);
200 197
201 198
202/** 199/**
@@ -211,15 +208,15 @@ http_common_address_from_socket (const char *protocol,
211 * @return the string 208 * @return the string
212 */ 209 */
213struct sockaddr * 210struct sockaddr *
214http_common_socket_from_address (const void *addr, 211http_common_socket_from_address(const void *addr,
215 size_t addrlen, 212 size_t addrlen,
216 int *res); 213 int *res);
217 214
218 215
219const char * 216const char *
220http_common_plugin_address_to_url (void *cls, 217http_common_plugin_address_to_url(void *cls,
221 const void *addr, 218 const void *addr,
222 size_t addrlen); 219 size_t addrlen);
223 220
224 221
225/** 222/**
@@ -229,7 +226,7 @@ http_common_plugin_address_to_url (void *cls,
229 * @return the size 226 * @return the size
230 */ 227 */
231size_t 228size_t
232http_common_address_get_size (const struct HttpAddress * addr); 229http_common_address_get_size(const struct HttpAddress * addr);
233 230
234 231
235/** 232/**
@@ -242,10 +239,10 @@ http_common_address_get_size (const struct HttpAddress * addr);
242 * @return #GNUNET_YES if equal, #GNUNET_NO else 239 * @return #GNUNET_YES if equal, #GNUNET_NO else
243 */ 240 */
244size_t 241size_t
245http_common_cmp_addresses (const void *addr1, 242http_common_cmp_addresses(const void *addr1,
246 size_t addrlen1, 243 size_t addrlen1,
247 const void *addr2, 244 const void *addr2,
248 size_t addrlen2); 245 size_t addrlen2);
249 246
250 247
251/** 248/**
@@ -256,8 +253,8 @@ http_common_cmp_addresses (const void *addr1,
256 * @return the network type 253 * @return the network type
257 */ 254 */
258enum GNUNET_NetworkType 255enum GNUNET_NetworkType
259http_common_get_network_for_address (struct GNUNET_TRANSPORT_PluginEnvironment *env, 256http_common_get_network_for_address(struct GNUNET_TRANSPORT_PluginEnvironment *env,
260 const struct GNUNET_HELLO_Address *address); 257 const struct GNUNET_HELLO_Address *address);
261 258
262 259
263/* end of plugin_transport_http_common.h */ 260/* end of plugin_transport_http_common.h */