tor  master
Functions
hibernate.h File Reference

Header file for hibernate.c. More...

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

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)
 

Detailed Description

Header file for hibernate.c.

Function Documentation

◆ accounting_add_bytes()

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.

◆ accounting_free_all()

void accounting_free_all ( void  )

Free all resources held by the accounting module

◆ accounting_get_interval_length()

int accounting_get_interval_length ( void  )

If accounting is enabled, return how long (in seconds) this interval lasts.

◆ accounting_parse_options()

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.

◆ accounting_record_bandwidth_usage()

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.

Here is the caller graph for this function:

◆ accounting_run_housekeeping()

void accounting_run_housekeeping ( time_t  now)

Invoked once per second. Checks whether it is time to hibernate, record bandwidth used, etc.

◆ configure_accounting()

void configure_accounting ( time_t  now)

Initialize the accounting subsystem.

◆ consider_hibernation()

void consider_hibernation ( time_t  now)

Consider our environment and decide if it's time to start/stop hibernating.

◆ get_accounting_bytes()

uint64_t get_accounting_bytes ( void  )

Return the relevant number of bytes sent/received this interval based on the set AccountingRule

◆ getinfo_helper_accounting()

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.

◆ hibernate_begin_shutdown()

void hibernate_begin_shutdown ( void  )

A wrapper around hibernate_begin, for when we get SIGINT.