aboutsummaryrefslogtreecommitdiff
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.h86
1 files changed, 49 insertions, 37 deletions
diff --git a/src/transport/plugin_transport_http_common.h b/src/transport/plugin_transport_http_common.h
index 33a5b38f5..473516502 100644
--- a/src/transport/plugin_transport_http_common.h
+++ b/src/transport/plugin_transport_http_common.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Christian Grothoff (and other contributing authors) 3 (C) 2002-2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
@@ -61,8 +61,8 @@
61 61
62enum HTTP_OPTIONS 62enum HTTP_OPTIONS
63{ 63{
64 HTTP_OPTIONS_NONE = 0, 64 HTTP_OPTIONS_NONE = 0,
65 HTTP_OPTIONS_VERIFY_CERTIFICATE = 1 65 HTTP_OPTIONS_VERIFY_CERTIFICATE = 1
66}; 66};
67 67
68 68
@@ -73,16 +73,15 @@ GNUNET_NETWORK_STRUCT_BEGIN
73 */ 73 */
74struct HttpAddress 74struct HttpAddress
75{ 75{
76 /** 76 /**
77 * Address options 77 * Address options
78 */ 78 */
79 uint32_t options; 79 uint32_t options;
80 80
81 /** 81 /**
82 * Length of URL located after struct 82 * Length of URL located after struct
83 * 83 */
84 */ 84 uint32_t urlen;
85 uint32_t urlen;
86}; 85};
87 86
88GNUNET_NETWORK_STRUCT_END 87GNUNET_NETWORK_STRUCT_END
@@ -104,15 +103,16 @@ http_split_address (const char * addr);
104 * @param numeric should (IP) addresses be displayed in numeric form? 103 * @param numeric should (IP) addresses be displayed in numeric form?
105 * @param timeout after how long should we give up? 104 * @param timeout after how long should we give up?
106 * @param asc function to call on each string 105 * @param asc function to call on each string
107 * @param asc_cls closure for asc 106 * @param asc_cls closure for @a asc
108 */ 107 */
109void 108void
110http_common_plugin_address_pretty_printer (void *cls, const char *type, 109http_common_plugin_address_pretty_printer (void *cls, const char *type,
111 const void *addr, size_t addrlen, 110 const void *addr, size_t addrlen,
112 int numeric, 111 int numeric,
113 struct GNUNET_TIME_Relative timeout, 112 struct GNUNET_TIME_Relative timeout,
114 GNUNET_TRANSPORT_AddressStringCallback 113 GNUNET_TRANSPORT_AddressStringCallback
115 asc, void *asc_cls); 114 asc, void *asc_cls);
115
116 116
117/** 117/**
118 * Function called for a quick conversion of the binary address to 118 * Function called for a quick conversion of the binary address to
@@ -128,21 +128,22 @@ http_common_plugin_address_pretty_printer (void *cls, const char *type,
128 */ 128 */
129const char * 129const char *
130http_common_plugin_address_to_string (void *cls, 130http_common_plugin_address_to_string (void *cls,
131 char *plugin, 131 const char *plugin,
132 const void *addr, 132 const void *addr,
133 size_t addrlen); 133 size_t addrlen);
134 134
135
135/** 136/**
136 * Function called to convert a string address to 137 * Function called to convert a string address to
137 * a binary address. 138 * a binary address.
138 * 139 *
139 * @param cls closure ('struct Plugin*') 140 * @param cls closure (`struct Plugin*`)
140 * @param addr string address 141 * @param addr string address
141 * @param addrlen length of the address 142 * @param addrlen length of the address
142 * @param buf location to store the buffer 143 * @param buf location to store the buffer
143 * If the function returns GNUNET_SYSERR, its contents are undefined. 144 * If the function returns #GNUNET_SYSERR, its contents are undefined.
144 * @param added length of created address 145 * @param added length of created address
145 * @return GNUNET_OK on success, GNUNET_SYSERR on failure 146 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
146 */ 147 */
147int 148int
148http_common_plugin_string_to_address (void *cls, 149http_common_plugin_string_to_address (void *cls,
@@ -156,31 +157,38 @@ http_common_plugin_string_to_address (void *cls,
156 * Create a HTTP address from a socketaddr 157 * Create a HTTP address from a socketaddr
157 * 158 *
158 * @param protocol protocol 159 * @param protocol protocol
159 * @param addr sockaddr * address 160 * @param addr `sockaddr *` address
160 * @param addrlen length of the address 161 * @param addrlen length of the @a addr
161 * @return the string 162 * @return the string
162 */ 163 */
163struct HttpAddress * 164struct HttpAddress *
164http_common_address_from_socket (const char *protocol, 165http_common_address_from_socket (const char *protocol,
165 const struct sockaddr *addr, 166 const struct sockaddr *addr,
166 socklen_t addrlen); 167 socklen_t addrlen);
168
167 169
168/** 170/**
169 * Create a socketaddr from a HTTP address 171 * Create a socketaddr from a HTTP address
170 * 172 *
171 * @param addr sockaddr * address 173 * @param addr a `sockaddr *` address
172 * @param addrlen length of the address 174 * @param addrlen length of the @a addr
173 * @param res the result: 175 * @param res the result:
174 * GNUNET_SYSERR, invalid input, 176 * #GNUNET_SYSERR, invalid input,
175 * GNUNET_YES: could convert to ip, 177 * #GNUNET_YES: could convert to ip,
176 * GNUNET_NO: valid input but could not convert to ip (hostname?) 178 * #GNUNET_NO: valid input but could not convert to ip (hostname?)
177 * @return the string 179 * @return the string
178 */ 180 */
179struct sockaddr * 181struct sockaddr *
180http_common_socket_from_address (const void *addr, size_t addrlen, int *res); 182http_common_socket_from_address (const void *addr,
183 size_t addrlen,
184 int *res);
185
181 186
182const char * 187const char *
183http_common_plugin_address_to_url (void *cls, const void *addr, size_t addrlen); 188http_common_plugin_address_to_url (void *cls,
189 const void *addr,
190 size_t addrlen);
191
184 192
185/** 193/**
186 * Get the length of an address 194 * Get the length of an address
@@ -199,8 +207,12 @@ http_common_address_get_size (const struct HttpAddress * addr);
199 * @param addrlen1 address 1 length 207 * @param addrlen1 address 1 length
200 * @param addr2 address2 208 * @param addr2 address2
201 * @param addrlen2 address 2 length 209 * @param addrlen2 address 2 length
202 * @return GNUNET_YES if equal, GNUNET_NO else 210 * @return #GNUNET_YES if equal, #GNUNET_NO else
203 */ 211 */
204size_t 212size_t
205http_common_cmp_addresses (const void *addr1, size_t addrlen1, const void *addr2, size_t addrlen2); 213http_common_cmp_addresses (const void *addr1,
206/* end of plugin_transport_http_common.c */ 214 size_t addrlen1,
215 const void *addr2,
216 size_t addrlen2);
217
218/* end of plugin_transport_http_common.h */