diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-22 15:16:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-22 15:16:35 +0000 |
commit | 407dd6df75e93a6708d3b92dfa004df10275c82c (patch) | |
tree | bb52aa31f63ace94a1af3dc99c2e6766e1f8d1a2 /src/include/gnunet_server_lib.h | |
parent | ed6d5356ddf784c8a8ba2fb19c51a25bc2d709c9 (diff) | |
download | gnunet-407dd6df75e93a6708d3b92dfa004df10275c82c.tar.gz gnunet-407dd6df75e93a6708d3b92dfa004df10275c82c.zip |
server API clean up
Diffstat (limited to 'src/include/gnunet_server_lib.h')
-rw-r--r-- | src/include/gnunet_server_lib.h | 134 |
1 files changed, 1 insertions, 133 deletions
diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h index 070d254ad..c3d11eae1 100644 --- a/src/include/gnunet_server_lib.h +++ b/src/include/gnunet_server_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2009 Christian Grothoff (and other contributing authors) | 3 | (C) 2009, 2010 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 |
@@ -253,120 +253,6 @@ struct GNUNET_SERVER_Client *GNUNET_SERVER_connect_socket (struct | |||
253 | 253 | ||
254 | 254 | ||
255 | /** | 255 | /** |
256 | * Receive data from the given connection. This function should call | ||
257 | * "receiver" asynchronously using the scheduler. It must return | ||
258 | * "immediately". | ||
259 | * | ||
260 | * @param cls closure | ||
261 | * @param sched scheduler to use | ||
262 | * @param max maximum number of bytes to read | ||
263 | * @param timeout maximum amount of time to wait (use -1 for "forever") | ||
264 | * @param receiver function to call with received data | ||
265 | * @param receiver_cls closure for receiver | ||
266 | */ | ||
267 | typedef void | ||
268 | (*GNUNET_SERVER_ReceiveCallback) (void *cls, | ||
269 | size_t max, | ||
270 | struct GNUNET_TIME_Relative timeout, | ||
271 | GNUNET_CONNECTION_Receiver | ||
272 | receiver, void *receiver_cls); | ||
273 | |||
274 | |||
275 | /** | ||
276 | * Cancel receive request. | ||
277 | * | ||
278 | * @param cls closure | ||
279 | */ | ||
280 | typedef void (*GNUNET_SERVER_ReceiveCancelCallback) (void *cls); | ||
281 | |||
282 | |||
283 | /** | ||
284 | * Notify us when the connection is ready to transmit size bytes. | ||
285 | * | ||
286 | * @param cls closure | ||
287 | * @param size number of bytes to be ready for sending | ||
288 | * @param timeout after how long should we give up (and call | ||
289 | * notify with buf NULL and size 0)? | ||
290 | * @param notify function to call | ||
291 | * @param notify_cls closure for notify | ||
292 | * @return a handle that can be used to cancel | ||
293 | * the transmission request or NULL if | ||
294 | * queueing a transmission request failed | ||
295 | */ | ||
296 | typedef void *(*GNUNET_SERVER_TransmitReadyCallback) (void *cls, | ||
297 | size_t size, | ||
298 | struct | ||
299 | GNUNET_TIME_Relative | ||
300 | timeout, | ||
301 | GNUNET_CONNECTION_TransmitReadyNotify | ||
302 | notify, | ||
303 | void *notify_cls); | ||
304 | |||
305 | |||
306 | /** | ||
307 | * Cancel an earlier transmit notification request. | ||
308 | * | ||
309 | * @param cls closure | ||
310 | * @param ctx handle that was returned by the TransmitReadyCallback | ||
311 | */ | ||
312 | typedef void (*GNUNET_SERVER_TransmitReadyCancelCallback) (void *cls, | ||
313 | void *ctx); | ||
314 | |||
315 | |||
316 | /** | ||
317 | * Check if connection is still valid (no fatal errors have happened so far). | ||
318 | * | ||
319 | * @param cls closure | ||
320 | * @return GNUNET_YES if valid, GNUNET_NO otherwise | ||
321 | */ | ||
322 | typedef int (*GNUNET_SERVER_CheckCallback) (void *cls); | ||
323 | |||
324 | |||
325 | /** | ||
326 | * Destroy this connection (free resources). | ||
327 | * | ||
328 | * @param cls closure | ||
329 | * @param persist when connection is closed, "leak" socket | ||
330 | */ | ||
331 | typedef void (*GNUNET_SERVER_DestroyCallback) (void *cls, int persist); | ||
332 | |||
333 | |||
334 | /** | ||
335 | * Add an arbitrary connection to the set of handles managed by this | ||
336 | * server. This can be used if a sending and receiving does not | ||
337 | * really go over the network (internal transmission) or for servers | ||
338 | * using UDP. | ||
339 | * | ||
340 | * @param server the server to use | ||
341 | * @param chandle opaque handle for the connection | ||
342 | * @param creceive receive function for the connection | ||
343 | * @param ccancel cancel receive function for the connection | ||
344 | * @param cnotify transmit notification function for the connection | ||
345 | * @param cnotify_cancel transmit notification cancellation function for the connection | ||
346 | * @param ccheck function to test if the connection is still up | ||
347 | * @param cdestroy function to close and free the connection | ||
348 | * @return the client handle (client should call | ||
349 | * "client_drop" on the return value eventually) | ||
350 | */ | ||
351 | struct GNUNET_SERVER_Client *GNUNET_SERVER_connect_callback (struct | ||
352 | GNUNET_SERVER_Handle | ||
353 | *server, | ||
354 | void *chandle, | ||
355 | GNUNET_SERVER_ReceiveCallback | ||
356 | creceive, | ||
357 | GNUNET_SERVER_ReceiveCancelCallback | ||
358 | ccancel, | ||
359 | GNUNET_SERVER_TransmitReadyCallback | ||
360 | cnotify, | ||
361 | GNUNET_SERVER_TransmitReadyCancelCallback | ||
362 | cnotify_cancel, | ||
363 | GNUNET_SERVER_CheckCallback | ||
364 | ccheck, | ||
365 | GNUNET_SERVER_DestroyCallback | ||
366 | cdestroy); | ||
367 | |||
368 | |||
369 | /** | ||
370 | * Notify the server that the given client handle should | 256 | * Notify the server that the given client handle should |
371 | * be kept (keeps the connection up if possible, increments | 257 | * be kept (keeps the connection up if possible, increments |
372 | * the internal reference counter). | 258 | * the internal reference counter). |
@@ -671,24 +557,6 @@ GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst, | |||
671 | 557 | ||
672 | 558 | ||
673 | /** | 559 | /** |
674 | * Read incoming data into the receive buffer and call the | ||
675 | * callback for all complete messages. | ||
676 | * | ||
677 | * @param mst tokenizer to use | ||
678 | * @param sock socket to read from (must be ready according to select) | ||
679 | * @param purge should any excess bytes in the buffer be discarded | ||
680 | * (i.e. for packet-based services like UDP) | ||
681 | * @return GNUNET_NO if the data stream is corrupt | ||
682 | * GNUNET_SYSERR if the data stream is corrupt beyond repair | ||
683 | */ | ||
684 | int | ||
685 | GNUNET_SERVER_mst_read (struct GNUNET_SERVER_MessageStreamTokenizer *mst, | ||
686 | const char *buf, | ||
687 | size_t size, | ||
688 | int purge); | ||
689 | |||
690 | |||
691 | /** | ||
692 | * Destroys a tokenizer. | 560 | * Destroys a tokenizer. |
693 | * | 561 | * |
694 | * @param mst tokenizer to destroy | 562 | * @param mst tokenizer to destroy |