tor  master
Data Structures | Macros | Typedefs | Enumerations | Functions
scheduler.h File Reference

Header file for scheduler*.c. More...

#include "or.h"
#include "channel.h"
#include "testsupport.h"
Include dependency graph for scheduler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  scheduler_s
 

Macros

#define KIST_SCHED_RUN_INTERVAL_DEFAULT   10
 
#define KIST_SCHED_RUN_INTERVAL_MIN   0
 
#define KIST_SCHED_RUN_INTERVAL_MAX   100
 

Typedefs

typedef struct scheduler_s scheduler_t
 

Enumerations

enum  scheduler_types_t { SCHEDULER_NONE = -1, SCHEDULER_VANILLA = 1, SCHEDULER_KIST = 2, SCHEDULER_KIST_LITE = 3 }
 

Functions

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.

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.

Function Documentation

◆ scheduler_channel_wants_writes()

void scheduler_channel_wants_writes ( channel_t chan)

Mark a channel as ready to accept writes

Here is the call graph for this function:

◆ 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.

◆ 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.

◆ scheduler_notify_networkstatus_changed()

void scheduler_notify_networkstatus_changed ( void  )

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