aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_scheduler_lib.h
diff options
context:
space:
mode:
authorNils Durner <durner@gnunet.org>2009-08-23 22:11:49 +0000
committerNils Durner <durner@gnunet.org>2009-08-23 22:11:49 +0000
commit2518cfc0a86865ebe4d0550e0013ed52a494231b (patch)
treee9a130b782597e18bcff24a9fdab6e5c6aae1f9c /src/include/gnunet_scheduler_lib.h
parent2ae973618f3b51fa9bbf5532eaa1352cafc24ecc (diff)
downloadgnunet-2518cfc0a86865ebe4d0550e0013ed52a494231b.tar.gz
gnunet-2518cfc0a86865ebe4d0550e0013ed52a494231b.zip
low level network API
Diffstat (limited to 'src/include/gnunet_scheduler_lib.h')
-rw-r--r--src/include/gnunet_scheduler_lib.h84
1 files changed, 75 insertions, 9 deletions
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h
index d4013e630..86f709ed6 100644
--- a/src/include/gnunet_scheduler_lib.h
+++ b/src/include/gnunet_scheduler_lib.h
@@ -35,15 +35,15 @@ extern "C"
35#endif 35#endif
36#endif 36#endif
37 37
38#include "gnunet_time_lib.h"
39 38
39#include "gnunet_time_lib.h"
40#include "gnunet_network_lib.h"
40 41
41/** 42/**
42 * Opaque handle for the scheduling service. 43 * Opaque handle for the scheduling service.
43 */ 44 */
44struct GNUNET_SCHEDULER_Handle; 45struct GNUNET_SCHEDULER_Handle;
45 46
46
47/** 47/**
48 * Opaque reference to a task. 48 * Opaque reference to a task.
49 */ 49 */
@@ -173,14 +173,14 @@ struct GNUNET_SCHEDULER_TaskContext
173 * note that additional bits may be set 173 * note that additional bits may be set
174 * that were not in the original request 174 * that were not in the original request
175 */ 175 */
176 const fd_set *read_ready; 176 const struct GNUNET_NETWORK_FDSet *read_ready;
177 177
178 /** 178 /**
179 * Set of file descriptors ready for writing; 179 * Set of file descriptors ready for writing;
180 * note that additional bits may be set 180 * note that additional bits may be set
181 * that were not in the original request. 181 * that were not in the original request.
182 */ 182 */
183 const fd_set *write_ready; 183 const struct GNUNET_NETWORK_FDSet *write_ready;
184 184
185}; 185};
186 186
@@ -345,12 +345,78 @@ GNUNET_SCHEDULER_add_delayed (struct GNUNET_SCHEDULER_Handle *sched,
345 * only valid until "main" is started! 345 * only valid until "main" is started!
346 */ 346 */
347GNUNET_SCHEDULER_TaskIdentifier 347GNUNET_SCHEDULER_TaskIdentifier
348GNUNET_SCHEDULER_add_read (struct GNUNET_SCHEDULER_Handle *sched, 348GNUNET_SCHEDULER_add_read_net (struct GNUNET_SCHEDULER_Handle *sched,
349 int run_on_shutdown,
350 enum GNUNET_SCHEDULER_Priority prio,
351 GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
352 struct GNUNET_TIME_Relative delay,
353 struct GNUNET_NETWORK_Descriptor *rfd, GNUNET_SCHEDULER_Task main, void *cls);
354
355
356/**
357 * Schedule a new task to be run with a specified delay or when the
358 * specified file descriptor is ready for writing. The delay can be
359 * used as a timeout on the socket being ready. The task will be
360 * scheduled for execution once either the delay has expired or the
361 * socket operation is ready.
362 *
363 * @param sched scheduler to use
364 * @param run_on_shutdown run on shutdown? Set this
365 * argument to GNUNET_NO to skip this task if
366 * the user requested process termination.
367 * @param prio how important is this task?
368 * @param prerequisite_task run this task after the task with the given
369 * task identifier completes (and any of our other
370 * conditions, such as delay, read or write-readyness
371 * are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any dependency
372 * on completion of other tasks.
373 * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever"
374 * @param wfd write file-descriptor
375 * @param main main function of the task
376 * @param cls closure of task
377 * @return unique task identifier for the job
378 * only valid until "main" is started!
379 */
380GNUNET_SCHEDULER_TaskIdentifier
381GNUNET_SCHEDULER_add_write_net (struct GNUNET_SCHEDULER_Handle *sched,
382 int run_on_shutdown,
383 enum GNUNET_SCHEDULER_Priority prio,
384 GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
385 struct GNUNET_TIME_Relative delay,
386 struct GNUNET_NETWORK_Descriptor *wfd, GNUNET_SCHEDULER_Task main, void *cls);
387
388
389/**
390 * Schedule a new task to be run with a specified delay or when the
391 * specified file descriptor is ready for reading. The delay can be
392 * used as a timeout on the socket being ready. The task will be
393 * scheduled for execution once either the delay has expired or the
394 * socket operation is ready.
395 *
396 * @param sched scheduler to use
397 * @param run_on_shutdown run on shutdown? Set this
398 * argument to GNUNET_NO to skip this task if
399 * the user requested process termination.
400 * @param prio how important is this task?
401 * @param prerequisite_task run this task after the task with the given
402 * task identifier completes (and any of our other
403 * conditions, such as delay, read or write-readyness
404 * are satisfied). Use GNUNET_SCHEDULER_NO_TASK to not have any dependency
405 * on completion of other tasks.
406 * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for "forever"
407 * @param rfd read file-descriptor
408 * @param main main function of the task
409 * @param cls closure of task
410 * @return unique task identifier for the job
411 * only valid until "main" is started!
412 */
413GNUNET_SCHEDULER_TaskIdentifier
414GNUNET_SCHEDULER_add_read_file (struct GNUNET_SCHEDULER_Handle *sched,
349 int run_on_shutdown, 415 int run_on_shutdown,
350 enum GNUNET_SCHEDULER_Priority prio, 416 enum GNUNET_SCHEDULER_Priority prio,
351 GNUNET_SCHEDULER_TaskIdentifier prerequisite_task, 417 GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
352 struct GNUNET_TIME_Relative delay, 418 struct GNUNET_TIME_Relative delay,
353 int rfd, GNUNET_SCHEDULER_Task main, void *cls); 419 struct GNUNET_DISK_FileHandle *rfd, GNUNET_SCHEDULER_Task main, void *cls);
354 420
355 421
356/** 422/**
@@ -378,12 +444,12 @@ GNUNET_SCHEDULER_add_read (struct GNUNET_SCHEDULER_Handle *sched,
378 * only valid until "main" is started! 444 * only valid until "main" is started!
379 */ 445 */
380GNUNET_SCHEDULER_TaskIdentifier 446GNUNET_SCHEDULER_TaskIdentifier
381GNUNET_SCHEDULER_add_write (struct GNUNET_SCHEDULER_Handle *sched, 447GNUNET_SCHEDULER_add_write_file (struct GNUNET_SCHEDULER_Handle *sched,
382 int run_on_shutdown, 448 int run_on_shutdown,
383 enum GNUNET_SCHEDULER_Priority prio, 449 enum GNUNET_SCHEDULER_Priority prio,
384 GNUNET_SCHEDULER_TaskIdentifier prerequisite_task, 450 GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
385 struct GNUNET_TIME_Relative delay, 451 struct GNUNET_TIME_Relative delay,
386 int wfd, GNUNET_SCHEDULER_Task main, void *cls); 452 struct GNUNET_DISK_FileHandle *wfd, GNUNET_SCHEDULER_Task main, void *cls);
387 453
388 454
389/** 455/**
@@ -429,7 +495,7 @@ GNUNET_SCHEDULER_add_select (struct GNUNET_SCHEDULER_Handle *sched,
429 GNUNET_SCHEDULER_TaskIdentifier 495 GNUNET_SCHEDULER_TaskIdentifier
430 prerequisite_task, 496 prerequisite_task,
431 struct GNUNET_TIME_Relative delay, 497 struct GNUNET_TIME_Relative delay,
432 int nfds, const fd_set * rs, const fd_set * ws, 498 const struct GNUNET_NETWORK_FDSet * rs, const struct GNUNET_NETWORK_FDSet * ws,
433 GNUNET_SCHEDULER_Task main, void *cls); 499 GNUNET_SCHEDULER_Task main, void *cls);
434 500
435#if 0 /* keep Emacsens' auto-indent happy */ 501#if 0 /* keep Emacsens' auto-indent happy */