Merge remote-tracking branch 'karsten/task-18460-2' into maint-0.2.8
[tor.git] / src / or / scheduler.h
blob94a44a0aa3c7edc55f656fcfdb58b94a83891c43
1 /* * Copyright (c) 2013-2016, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
4 /**
5 * \file scheduler.h
6 * \brief Header file for scheduler.c
7 **/
9 #ifndef TOR_SCHEDULER_H
10 #define TOR_SCHEDULER_H
12 #include "or.h"
13 #include "channel.h"
14 #include "testsupport.h"
16 /* Global-visibility scheduler functions */
18 /* Set up and shut down the scheduler from main.c */
19 void scheduler_free_all(void);
20 void scheduler_init(void);
21 MOCK_DECL(void, scheduler_run, (void));
23 /* Mark channels as having cells or wanting/not wanting writes */
24 MOCK_DECL(void,scheduler_channel_doesnt_want_writes,(channel_t *chan));
25 MOCK_DECL(void,scheduler_channel_has_waiting_cells,(channel_t *chan));
26 void scheduler_channel_wants_writes(channel_t *chan);
28 /* Notify the scheduler of a channel being closed */
29 MOCK_DECL(void,scheduler_release_channel,(channel_t *chan));
31 /* Notify scheduler of queue size adjustments */
32 void scheduler_adjust_queue_size(channel_t *chan, int dir, uint64_t adj);
34 /* Notify scheduler that a channel's queue position may have changed */
35 void scheduler_touch_channel(channel_t *chan);
37 /* Adjust the watermarks from config file*/
38 void scheduler_set_watermarks(uint32_t lo, uint32_t hi, uint32_t max_flush);
40 /* Things only scheduler.c and its test suite should see */
42 #ifdef SCHEDULER_PRIVATE_
43 MOCK_DECL(STATIC int, scheduler_compare_channels,
44 (const void *c1_v, const void *c2_v));
45 STATIC uint64_t scheduler_get_queue_heuristic(void);
46 STATIC void scheduler_update_queue_heuristic(time_t now);
47 #endif
49 #endif /* !defined(TOR_SCHEDULER_H) */