diff options
Diffstat (limited to 'src/include/gnunet_connection_lib.h')
-rw-r--r-- | src/include/gnunet_connection_lib.h | 103 |
1 files changed, 50 insertions, 53 deletions
diff --git a/src/include/gnunet_connection_lib.h b/src/include/gnunet_connection_lib.h index af10c5966..f7a6e5078 100644 --- a/src/include/gnunet_connection_lib.h +++ b/src/include/gnunet_connection_lib.h | |||
@@ -111,7 +111,8 @@ typedef void (*GNUNET_CONNECTION_Receiver) (void *cls, const void *buf, | |||
111 | * | 111 | * |
112 | * @param sock the connection to set persistent | 112 | * @param sock the connection to set persistent |
113 | */ | 113 | */ |
114 | void GNUNET_CONNECTION_persist_ (struct GNUNET_CONNECTION_Handle *sock); | 114 | void |
115 | GNUNET_CONNECTION_persist_ (struct GNUNET_CONNECTION_Handle *sock); | ||
115 | 116 | ||
116 | /** | 117 | /** |
117 | * Disable the "CORK" feature for communication with the given socket, | 118 | * Disable the "CORK" feature for communication with the given socket, |
@@ -124,7 +125,8 @@ void GNUNET_CONNECTION_persist_ (struct GNUNET_CONNECTION_Handle *sock); | |||
124 | * @param sock the connection to make flushing and blocking | 125 | * @param sock the connection to make flushing and blocking |
125 | * @return GNUNET_OK on success | 126 | * @return GNUNET_OK on success |
126 | */ | 127 | */ |
127 | int GNUNET_CONNECTION_disable_corking (struct GNUNET_CONNECTION_Handle *sock); | 128 | int |
129 | GNUNET_CONNECTION_disable_corking (struct GNUNET_CONNECTION_Handle *sock); | ||
128 | 130 | ||
129 | 131 | ||
130 | /** | 132 | /** |
@@ -135,9 +137,8 @@ int GNUNET_CONNECTION_disable_corking (struct GNUNET_CONNECTION_Handle *sock); | |||
135 | * @param osSocket existing socket to box | 137 | * @param osSocket existing socket to box |
136 | * @return the boxed socket handle | 138 | * @return the boxed socket handle |
137 | */ | 139 | */ |
138 | struct GNUNET_CONNECTION_Handle *GNUNET_CONNECTION_create_from_existing (struct | 140 | struct GNUNET_CONNECTION_Handle * |
139 | GNUNET_NETWORK_Handle | 141 | GNUNET_CONNECTION_create_from_existing (struct GNUNET_NETWORK_Handle *osSocket); |
140 | *osSocket); | ||
141 | 142 | ||
142 | 143 | ||
143 | /** | 144 | /** |
@@ -149,10 +150,10 @@ struct GNUNET_CONNECTION_Handle *GNUNET_CONNECTION_create_from_existing (struct | |||
149 | * @param lsock listen socket | 150 | * @param lsock listen socket |
150 | * @return the socket handle, NULL on error (for example, access refused) | 151 | * @return the socket handle, NULL on error (for example, access refused) |
151 | */ | 152 | */ |
152 | struct GNUNET_CONNECTION_Handle | 153 | struct GNUNET_CONNECTION_Handle * |
153 | *GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access, | 154 | GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access, |
154 | void *access_cls, | 155 | void *access_cls, |
155 | struct GNUNET_NETWORK_Handle *lsock); | 156 | struct GNUNET_NETWORK_Handle *lsock); |
156 | 157 | ||
157 | 158 | ||
158 | /** | 159 | /** |
@@ -165,15 +166,10 @@ struct GNUNET_CONNECTION_Handle | |||
165 | * @param port port to connect to | 166 | * @param port port to connect to |
166 | * @return the socket handle | 167 | * @return the socket handle |
167 | */ | 168 | */ |
168 | struct GNUNET_CONNECTION_Handle *GNUNET_CONNECTION_create_from_connect (const | 169 | struct GNUNET_CONNECTION_Handle * |
169 | struct | 170 | GNUNET_CONNECTION_create_from_connect (const struct GNUNET_CONFIGURATION_Handle |
170 | GNUNET_CONFIGURATION_Handle | 171 | *cfg, const char *hostname, |
171 | *cfg, | 172 | uint16_t port); |
172 | const | ||
173 | char | ||
174 | *hostname, | ||
175 | uint16_t | ||
176 | port); | ||
177 | 173 | ||
178 | 174 | ||
179 | /** | 175 | /** |
@@ -185,11 +181,10 @@ struct GNUNET_CONNECTION_Handle *GNUNET_CONNECTION_create_from_connect (const | |||
185 | * @param unixpath path to connect to) | 181 | * @param unixpath path to connect to) |
186 | * @return the socket handle, NULL on systems without UNIX support | 182 | * @return the socket handle, NULL on systems without UNIX support |
187 | */ | 183 | */ |
188 | struct GNUNET_CONNECTION_Handle | 184 | struct GNUNET_CONNECTION_Handle * |
189 | *GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct | 185 | GNUNET_CONNECTION_create_from_connect_to_unixpath (const struct |
190 | GNUNET_CONFIGURATION_Handle | 186 | GNUNET_CONFIGURATION_Handle |
191 | *cfg, | 187 | *cfg, const char *unixpath); |
192 | const char *unixpath); | ||
193 | 188 | ||
194 | 189 | ||
195 | 190 | ||
@@ -204,14 +199,10 @@ struct GNUNET_CONNECTION_Handle | |||
204 | * @param addrlen length of server address | 199 | * @param addrlen length of server address |
205 | * @return the socket handle | 200 | * @return the socket handle |
206 | */ | 201 | */ |
207 | struct GNUNET_CONNECTION_Handle *GNUNET_CONNECTION_create_from_sockaddr (int | 202 | struct GNUNET_CONNECTION_Handle * |
208 | af_family, | 203 | GNUNET_CONNECTION_create_from_sockaddr (int af_family, |
209 | const | 204 | const struct sockaddr *serv_addr, |
210 | struct | 205 | socklen_t addrlen); |
211 | sockaddr | ||
212 | *serv_addr, | ||
213 | socklen_t | ||
214 | addrlen); | ||
215 | 206 | ||
216 | /** | 207 | /** |
217 | * Check if socket is valid (no fatal errors have happened so far). | 208 | * Check if socket is valid (no fatal errors have happened so far). |
@@ -221,7 +212,8 @@ struct GNUNET_CONNECTION_Handle *GNUNET_CONNECTION_create_from_sockaddr (int | |||
221 | * @param sock socket to check | 212 | * @param sock socket to check |
222 | * @return GNUNET_YES if valid, GNUNET_NO otherwise | 213 | * @return GNUNET_YES if valid, GNUNET_NO otherwise |
223 | */ | 214 | */ |
224 | int GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle *sock); | 215 | int |
216 | GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle *sock); | ||
225 | 217 | ||
226 | 218 | ||
227 | /** | 219 | /** |
@@ -232,8 +224,9 @@ int GNUNET_CONNECTION_check (struct GNUNET_CONNECTION_Handle *sock); | |||
232 | * @param addrlen where to store the length of the address | 224 | * @param addrlen where to store the length of the address |
233 | * @return GNUNET_OK on success | 225 | * @return GNUNET_OK on success |
234 | */ | 226 | */ |
235 | int GNUNET_CONNECTION_get_address (struct GNUNET_CONNECTION_Handle *sock, | 227 | int |
236 | void **addr, size_t * addrlen); | 228 | GNUNET_CONNECTION_get_address (struct GNUNET_CONNECTION_Handle *sock, |
229 | void **addr, size_t * addrlen); | ||
237 | 230 | ||
238 | 231 | ||
239 | /** | 232 | /** |
@@ -249,8 +242,9 @@ int GNUNET_CONNECTION_get_address (struct GNUNET_CONNECTION_Handle *sock, | |||
249 | * read from the application; all other transmissions should be | 242 | * read from the application; all other transmissions should be |
250 | * aborted using 'GNUNET_CONNECTION_notify_transmit_ready_cancel'). | 243 | * aborted using 'GNUNET_CONNECTION_notify_transmit_ready_cancel'). |
251 | */ | 244 | */ |
252 | void GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock, | 245 | void |
253 | int finish_pending_write); | 246 | GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock, |
247 | int finish_pending_write); | ||
254 | 248 | ||
255 | 249 | ||
256 | /** | 250 | /** |
@@ -266,10 +260,11 @@ void GNUNET_CONNECTION_destroy (struct GNUNET_CONNECTION_Handle *sock, | |||
266 | * @param receiver function to call with received data | 260 | * @param receiver function to call with received data |
267 | * @param receiver_cls closure for receiver | 261 | * @param receiver_cls closure for receiver |
268 | */ | 262 | */ |
269 | void GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *sock, | 263 | void |
270 | size_t max, struct GNUNET_TIME_Relative timeout, | 264 | GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *sock, size_t max, |
271 | GNUNET_CONNECTION_Receiver receiver, | 265 | struct GNUNET_TIME_Relative timeout, |
272 | void *receiver_cls); | 266 | GNUNET_CONNECTION_Receiver receiver, |
267 | void *receiver_cls); | ||
273 | 268 | ||
274 | 269 | ||
275 | /** | 270 | /** |
@@ -280,7 +275,8 @@ void GNUNET_CONNECTION_receive (struct GNUNET_CONNECTION_Handle *sock, | |||
280 | * @param sock socket handle | 275 | * @param sock socket handle |
281 | * @return closure of the original receiver callback closure | 276 | * @return closure of the original receiver callback closure |
282 | */ | 277 | */ |
283 | void *GNUNET_CONNECTION_receive_cancel (struct GNUNET_CONNECTION_Handle *sock); | 278 | void * |
279 | GNUNET_CONNECTION_receive_cancel (struct GNUNET_CONNECTION_Handle *sock); | ||
284 | 280 | ||
285 | 281 | ||
286 | /** | 282 | /** |
@@ -333,13 +329,12 @@ struct GNUNET_CONNECTION_TransmitHandle; | |||
333 | * @return non-NULL if the notify callback was queued, | 329 | * @return non-NULL if the notify callback was queued, |
334 | * NULL if we are already going to notify someone else (busy) | 330 | * NULL if we are already going to notify someone else (busy) |
335 | */ | 331 | */ |
336 | struct GNUNET_CONNECTION_TransmitHandle | 332 | struct GNUNET_CONNECTION_TransmitHandle * |
337 | *GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle | 333 | GNUNET_CONNECTION_notify_transmit_ready (struct GNUNET_CONNECTION_Handle *sock, |
338 | *sock, size_t size, | 334 | size_t size, |
339 | struct GNUNET_TIME_Relative | 335 | struct GNUNET_TIME_Relative timeout, |
340 | timeout, | 336 | GNUNET_CONNECTION_TransmitReadyNotify |
341 | GNUNET_CONNECTION_TransmitReadyNotify | 337 | notify, void *notify_cls); |
342 | notify, void *notify_cls); | ||
343 | 338 | ||
344 | 339 | ||
345 | /** | 340 | /** |
@@ -348,9 +343,10 @@ struct GNUNET_CONNECTION_TransmitHandle | |||
348 | * | 343 | * |
349 | * @param h handle for notification to cancel | 344 | * @param h handle for notification to cancel |
350 | */ | 345 | */ |
351 | void GNUNET_CONNECTION_notify_transmit_ready_cancel (struct | 346 | void |
352 | GNUNET_CONNECTION_TransmitHandle | 347 | GNUNET_CONNECTION_notify_transmit_ready_cancel (struct |
353 | *h); | 348 | GNUNET_CONNECTION_TransmitHandle |
349 | *h); | ||
354 | 350 | ||
355 | 351 | ||
356 | /** | 352 | /** |
@@ -359,8 +355,9 @@ void GNUNET_CONNECTION_notify_transmit_ready_cancel (struct | |||
359 | * @param sock socket handle | 355 | * @param sock socket handle |
360 | * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default | 356 | * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default |
361 | */ | 357 | */ |
362 | void GNUNET_CONNECTION_ignore_shutdown (struct GNUNET_CONNECTION_Handle *sock, | 358 | void |
363 | int do_ignore); | 359 | GNUNET_CONNECTION_ignore_shutdown (struct GNUNET_CONNECTION_Handle *sock, |
360 | int do_ignore); | ||
364 | 361 | ||
365 | 362 | ||
366 | #if 0 /* keep Emacsens' auto-indent happy */ | 363 | #if 0 /* keep Emacsens' auto-indent happy */ |