Back to index

tor  0.2.3.18-rc
hibernate.h
Go to the documentation of this file.
00001 /* Copyright (c) 2001 Matej Pfajfar.
00002  * Copyright (c) 2001-2004, Roger Dingledine.
00003  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
00004  * Copyright (c) 2007-2012, The Tor Project, Inc. */
00005 /* See LICENSE for licensing information */
00006 
00012 #ifndef _TOR_HIBERNATE_H
00013 #define _TOR_HIBERNATE_H
00014 
00015 int accounting_parse_options(const or_options_t *options, int validate_only);
00016 int accounting_is_enabled(const or_options_t *options);
00017 int accounting_get_interval_length(void);
00018 void configure_accounting(time_t now);
00019 void accounting_run_housekeeping(time_t now);
00020 void accounting_add_bytes(size_t n_read, size_t n_written, int seconds);
00021 int accounting_record_bandwidth_usage(time_t now, or_state_t *state);
00022 void hibernate_begin_shutdown(void);
00023 int we_are_hibernating(void);
00024 void consider_hibernation(time_t now);
00025 int getinfo_helper_accounting(control_connection_t *conn,
00026                               const char *question, char **answer,
00027                               const char **errmsg);
00028 
00029 #ifdef HIBERNATE_PRIVATE
00030 
00031 typedef enum {
00033   HIBERNATE_STATE_LIVE=1,
00036   HIBERNATE_STATE_EXITING=2,
00039   HIBERNATE_STATE_LOWBANDWIDTH=3,
00042   HIBERNATE_STATE_DORMANT=4,
00045   HIBERNATE_STATE_INITIAL=5
00046 } hibernate_state_t;
00047 
00048 void hibernate_set_state_for_testing_(hibernate_state_t newstate);
00049 #endif
00050 
00051 #endif
00052