2013-08-25 17:45:07 +02:00
|
|
|
/* * Copyright (c) 2013, The Tor Project, Inc. */
|
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file scheduler.h
|
|
|
|
* \brief Header file for scheduler.c
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef TOR_SCHEDULER_H
|
|
|
|
#define TOR_SCHEDULER_H
|
|
|
|
|
|
|
|
#include "or.h"
|
|
|
|
#include "channel.h"
|
2013-12-13 15:27:00 +01:00
|
|
|
#include "testsupport.h"
|
2013-08-25 17:45:07 +02:00
|
|
|
|
|
|
|
/* Global-visibility scheduler functions */
|
|
|
|
|
|
|
|
/* Set up and shut down the scheduler from main.c */
|
|
|
|
void scheduler_free_all(void);
|
|
|
|
void scheduler_init(void);
|
|
|
|
void scheduler_run(void);
|
|
|
|
|
|
|
|
/* Mark channels as having cells or wanting/not wanting writes */
|
2013-12-19 00:31:54 +01:00
|
|
|
MOCK_DECL(void,scheduler_channel_doesnt_want_writes,(channel_t *chan));
|
2014-01-21 11:49:21 +01:00
|
|
|
MOCK_DECL(void,scheduler_channel_has_waiting_cells,(channel_t *chan));
|
2013-08-25 17:45:07 +02:00
|
|
|
void scheduler_channel_wants_writes(channel_t *chan);
|
|
|
|
|
|
|
|
/* Notify the scheduler of a channel being closed */
|
2013-12-13 15:27:00 +01:00
|
|
|
MOCK_DECL(void,scheduler_release_channel,(channel_t *chan));
|
2013-08-25 17:45:07 +02:00
|
|
|
|
2013-11-14 13:45:47 +01:00
|
|
|
/* Notify scheduler of queue size adjustments */
|
|
|
|
void scheduler_adjust_queue_size(channel_t *chan, char dir, uint64_t adj);
|
|
|
|
|
2013-12-12 13:29:45 +01:00
|
|
|
/* Notify scheduler that a channel's queue position may have changed */
|
|
|
|
void scheduler_touch_channel(channel_t *chan);
|
|
|
|
|
2014-01-24 06:13:26 +01:00
|
|
|
/* Things only scheduler.c and its test suite should see */
|
|
|
|
|
|
|
|
#ifdef SCHEDULER_PRIVATE_
|
|
|
|
STATIC uint64_t scheduler_get_queue_heuristic(void);
|
|
|
|
STATIC void scheduler_update_queue_heuristic(time_t now);
|
|
|
|
#endif
|
|
|
|
|
2013-08-25 17:45:07 +02:00
|
|
|
#endif /* !defined(TOR_SCHEDULER_H) */
|
|
|
|
|