Data Structures | Macros | Typedefs | Enumerations | Functions
scheduler.h File Reference
#include "core/or/or.h"
#include "core/or/channel.h"
#include "lib/testsupport/testsupport.h"

Go to the source code of this file.

Data Structures

struct  scheduler_s




typedef struct scheduler_s scheduler_t




void scheduler_init (void)
void scheduler_free_all (void)
void scheduler_conf_changed (void)
void scheduler_notify_networkstatus_changed (void)
 MOCK_DECL (void, scheduler_release_channel,(channel_t *chan))
void scheduler_channel_wants_writes (channel_t *chan)
 MOCK_DECL (void, scheduler_channel_doesnt_want_writes,(channel_t *chan))
 MOCK_DECL (void, scheduler_channel_has_waiting_cells,(channel_t *chan))

Detailed Description

Header file for scheduler*.c.

Definition in file scheduler.h.

Typedef Documentation

◆ scheduler_t

typedef struct scheduler_s scheduler_t

A scheduler implementation is a collection of function pointers. If you would like to add a new scheduler called foo, create scheduler_foo.c, implement at least the mandatory ones, and implement get_foo_scheduler() that returns a complete scheduler_t for your foo scheduler. See scheduler_kist.c for an example.

These function pointers SHOULD NOT be used anywhere outside of the scheduling source files. The rest of Tor should communicate with the scheduling system through the functions near the bottom of this file, and those functions will call into the current scheduler implementation as necessary.

If your scheduler doesn't need to implement something (for example: it doesn't create any state for itself, thus it has nothing to free when Tor is shutting down), then set that function pointer to NULL.

Enumeration Type Documentation

◆ scheduler_types_t

Scheduler type, we build an ordered list with those values from the parsed strings in Schedulers. The reason to do such a thing is so we can quickly and without parsing strings select the scheduler at anytime.

Definition at line 19 of file scheduler.h.

Function Documentation

◆ scheduler_channel_wants_writes()

void scheduler_channel_wants_writes ( channel_t chan)

◆ scheduler_conf_changed()

void scheduler_conf_changed ( void  )

This is how the scheduling system is notified of Tor's configuration changing. For example: a SIGHUP was issued.

Definition at line 453 of file scheduler.c.

References set_scheduler(), and the_scheduler.

◆ scheduler_free_all()

void scheduler_free_all ( void  )

Free everything scheduling-related from main.c. Note this is only called when Tor is shutting down, while scheduler_t->free_all() is called both when Tor is shutting down and when we are switching schedulers.

Definition at line 485 of file scheduler.c.

◆ scheduler_notify_networkstatus_changed()

void scheduler_notify_networkstatus_changed ( void  )

Whenever we get a new consensus, this function is called.

Definition at line 468 of file scheduler.c.

References set_scheduler(), and the_scheduler.