9 #ifndef TOR_SCHEDULER_H
10 #define TOR_SCHEDULER_H
21 SCHEDULER_VANILLA = 1,
23 SCHEDULER_KIST_LITE = 3,
58 void (*free_all)(void);
63 void (*schedule)(void);
83 void (*on_new_consensus)(void);
89 void (*on_channel_free)(
const channel_t *);
95 void (*on_new_options)(void);
105 #define KIST_SCHED_RUN_INTERVAL_DEFAULT 10
107 #define KIST_SCHED_RUN_INTERVAL_MIN 0
109 #define KIST_SCHED_RUN_INTERVAL_MAX 100
118 void scheduler_init(
void);
139 #ifdef SCHEDULER_PRIVATE
151 #define SCHED_BUG(cond, chan) \
152 (PREDICT_UNLIKELY(cond) ? \
153 ((BUG(cond)) ? (scheduler_bug_occurred(chan), 1) : 0) : 0)
155 void scheduler_bug_occurred(
const channel_t *chan);
159 (
const void *c1_v,
const void *c2_v));
163 #ifdef TOR_UNIT_TESTS
167 void scheduler_touch_channel(
channel_t *chan);
174 #ifdef SCHEDULER_KIST_PRIVATE
178 typedef struct socket_table_ent_t {
179 HT_ENTRY(socket_table_ent_t) node;
190 } socket_table_ent_t;
192 typedef HT_HEAD(outbuf_table_s, outbuf_table_ent_t) outbuf_table_t;
194 MOCK_DECL(
int, channel_should_write_to_kernel,
195 (outbuf_table_t *table,
channel_t *chan));
197 MOCK_DECL(
void, update_socket_info_impl, (socket_table_ent_t *ent));
199 int scheduler_can_use_kist(
void);
200 void scheduler_kist_set_full_mode(
void);
201 void scheduler_kist_set_lite_mode(
void);
203 int kist_scheduler_run_interval(
void);
205 #ifdef TOR_UNIT_TESTS
206 extern int32_t sched_run_interval;
Header file for channel.c.
typedef HT_HEAD(hs_service_ht, hs_service_t) hs_service_ht
Master header file for Tor-specific functionality.
void scheduler_ev_active(void)
int scheduler_compare_channels(const void *c1_v, const void *c2_v)
void scheduler_set_channel_state(channel_t *chan, int new_state)
smartlist_t * get_channels_pending(void)
void scheduler_ev_add(const struct timeval *next_run)
const char * get_scheduler_state_string(int scheduler_state)
STATIC struct mainloop_event_t * run_sched_ev
STATIC const scheduler_t * the_scheduler
STATIC smartlist_t * channels_pending
void scheduler_notify_networkstatus_changed(void)
void scheduler_conf_changed(void)
void scheduler_free_all(void)
void scheduler_channel_doesnt_want_writes(channel_t *chan)
void scheduler_channel_wants_writes(channel_t *chan)
void scheduler_channel_has_waiting_cells(channel_t *chan)
Macros to implement mocking and selective exposure for the test code.
#define MOCK_DECL(rv, funcname, arglist)