Tor
0.4.7.0-alpha-dev
|
Header file for hibernate.c. More...
#include "lib/testsupport/testsupport.h"
Go to the source code of this file.
Functions | |
int | accounting_parse_options (const or_options_t *options, int validate_only) |
int | accounting_is_enabled (const or_options_t *options) |
int | accounting_get_interval_length (void) |
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) |
int | we_are_hibernating (void) |
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) |
bool | accounting_tor_is_dormant (void) |
Header file for hibernate.c.
Definition in file hibernate.h.
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.
Definition at line 331 of file hibernate.c.
Referenced by record_num_bytes_transferred_impl().
void accounting_free_all | ( | void | ) |
Free all resources held by the accounting module
Definition at line 1254 of file hibernate.c.
time_t accounting_get_end_time | ( | void | ) |
Return the time at which the current accounting interval will end.
Definition at line 322 of file hibernate.c.
int accounting_get_interval_length | ( | void | ) |
If accounting is enabled, return how long (in seconds) this interval lasts.
Definition at line 315 of file hibernate.c.
Referenced by router_should_be_dirserver().
int accounting_is_enabled | ( | const or_options_t * | options | ) |
If we want to manage the accounting system and potentially hibernate, return 1, else return 0.
Definition at line 305 of file hibernate.c.
Referenced by record_num_bytes_transferred_impl(), router_should_be_dirserver(), second_elapsed_callback(), and tor_cleanup().
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.
Definition at line 190 of file hibernate.c.
Referenced by options_act_relay_accounting().
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.
Definition at line 705 of file hibernate.c.
Referenced by accounting_run_housekeeping(), and tor_cleanup().
void accounting_run_housekeeping | ( | time_t | now | ) |
Invoked once per second. Checks whether it is time to hibernate, record bandwidth used, etc.
Definition at line 585 of file hibernate.c.
Referenced by second_elapsed_callback(), and wakeup_event_callback().
void configure_accounting | ( | time_t | now | ) |
Initialize the accounting subsystem.
Definition at line 430 of file hibernate.c.
Referenced by accounting_run_housekeeping().
void consider_hibernation | ( | time_t | now | ) |
Consider our environment and decide if it's time to start/stop hibernating.
Definition at line 1098 of file hibernate.c.
Referenced by second_elapsed_callback(), and wakeup_event_callback().
uint64_t get_accounting_bytes | ( | void | ) |
Return the relevant number of bytes sent/received this interval based on the set AccountingRule
Definition at line 478 of file hibernate.c.
Referenced by hibernate_hard_limit_reached().
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.
Definition at line 1170 of file hibernate.c.
void hibernate_begin_shutdown | ( | void | ) |
A wrapper around hibernate_begin, for when we get SIGINT.
Definition at line 927 of file hibernate.c.
int we_are_fully_hibernating | ( | void | ) |
Return true iff we are currently fully hibernating – that is, if we are in a state where we expect to handle no network activity at all.
Definition at line 947 of file hibernate.c.
Referenced by net_is_completely_disabled().
int we_are_hibernating | ( | void | ) |
Return true iff we are currently hibernating – that is, if we are in any non-live state.
Definition at line 937 of file hibernate.c.
Referenced by check_descriptor_bandwidth_changed(), log_heartbeat(), net_is_disabled(), and router_build_fresh_unsigned_routerinfo().