tor
master
|
Header file for hibernate.c. More...
#include "testsupport.h"
Go to the source code of this file.
Functions | |
int | accounting_parse_options (const or_options_t *options, int validate_only) |
MOCK_DECL (int, accounting_is_enabled,(const or_options_t *options)) | |
int | accounting_get_interval_length (void) |
MOCK_DECL (time_t, accounting_get_end_time,(void)) | |
void | configure_accounting (time_t now) |
uint64_t | get_accounting_bytes (void) |
void | accounting_run_housekeeping (time_t now) |
void | accounting_add_bytes (size_t n_read, size_t n_written, int seconds) |
int | accounting_record_bandwidth_usage (time_t now, or_state_t *state) |
void | hibernate_begin_shutdown (void) |
MOCK_DECL (int, we_are_hibernating,(void)) | |
MOCK_DECL (int, we_are_fully_hibernating,(void)) | |
void | consider_hibernation (time_t now) |
int | getinfo_helper_accounting (control_connection_t *conn, const char *question, char **answer, const char **errmsg) |
uint64_t | get_accounting_max_total (void) |
void | accounting_free_all (void) |
Header file for hibernate.c.
void accounting_add_bytes | ( | size_t | n_read, |
size_t | n_written, | ||
int | seconds | ||
) |
Called from connection.c to tell us that seconds seconds have passed, n_read bytes have been read, and n_written bytes have been written.
void accounting_free_all | ( | void | ) |
Free all resources held by the accounting module
int accounting_get_interval_length | ( | void | ) |
If accounting is enabled, return how long (in seconds) this interval lasts.
int accounting_parse_options | ( | const or_options_t * | options, |
int | validate_only | ||
) |
Configure accounting start/end time settings based on options->AccountingStart. Return 0 on success, -1 on failure. If validate_only is true, do not change the current settings.
int accounting_record_bandwidth_usage | ( | time_t | now, |
or_state_t * | state | ||
) |
Save all our bandwidth tracking information to disk. Return 0 on success, -1 on failure.
void accounting_run_housekeeping | ( | time_t | now | ) |
Invoked once per second. Checks whether it is time to hibernate, record bandwidth used, etc.
void configure_accounting | ( | time_t | now | ) |
Initialize the accounting subsystem.
void consider_hibernation | ( | time_t | now | ) |
Consider our environment and decide if it's time to start/stop hibernating.
uint64_t get_accounting_bytes | ( | void | ) |
Return the relevant number of bytes sent/received this interval based on the set AccountingRule
int getinfo_helper_accounting | ( | control_connection_t * | conn, |
const char * | question, | ||
char ** | answer, | ||
const char ** | errmsg | ||
) |
Helper function: called when we get a GETINFO request for an accounting-related key on the control connection conn. If we can answer the request for question, then set *answer to a newly allocated string holding the result. Otherwise, set *answer to NULL.
void hibernate_begin_shutdown | ( | void | ) |
A wrapper around hibernate_begin, for when we get SIGINT.