scheduler.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* * Copyright (c) 2013-2016, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /**
  4. * \file scheduler.h
  5. * \brief Header file for scheduler.c
  6. **/
  7. #ifndef TOR_SCHEDULER_H
  8. #define TOR_SCHEDULER_H
  9. #include "or.h"
  10. #include "channel.h"
  11. #include "testsupport.h"
  12. /* Global-visibility scheduler functions */
  13. /* Set up and shut down the scheduler from main.c */
  14. void scheduler_free_all(void);
  15. void scheduler_init(void);
  16. MOCK_DECL(void, scheduler_run, (void));
  17. /* Mark channels as having cells or wanting/not wanting writes */
  18. MOCK_DECL(void,scheduler_channel_doesnt_want_writes,(channel_t *chan));
  19. MOCK_DECL(void,scheduler_channel_has_waiting_cells,(channel_t *chan));
  20. void scheduler_channel_wants_writes(channel_t *chan);
  21. /* Notify the scheduler of a channel being closed */
  22. MOCK_DECL(void,scheduler_release_channel,(channel_t *chan));
  23. /* Notify scheduler of queue size adjustments */
  24. void scheduler_adjust_queue_size(channel_t *chan, int dir, uint64_t adj);
  25. /* Notify scheduler that a channel's queue position may have changed */
  26. void scheduler_touch_channel(channel_t *chan);
  27. /* Adjust the watermarks from config file*/
  28. void scheduler_set_watermarks(uint32_t lo, uint32_t hi, uint32_t max_flush);
  29. /* Things only scheduler.c and its test suite should see */
  30. #ifdef SCHEDULER_PRIVATE_
  31. MOCK_DECL(STATIC int, scheduler_compare_channels,
  32. (const void *c1_v, const void *c2_v));
  33. STATIC uint64_t scheduler_get_queue_heuristic(void);
  34. STATIC void scheduler_update_queue_heuristic(time_t now);
  35. #endif
  36. #endif /* !defined(TOR_SCHEDULER_H) */