Back to index

tor  0.2.3.18-rc
rephist.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_REPHIST_H
00013 #define _TOR_REPHIST_H
00014 
00015 void rep_hist_init(void);
00016 void rep_hist_note_connect_failed(const char* nickname, time_t when);
00017 void rep_hist_note_connect_succeeded(const char* nickname, time_t when);
00018 void rep_hist_note_disconnect(const char* nickname, time_t when);
00019 void rep_hist_note_connection_died(const char* nickname, time_t when);
00020 void rep_hist_note_extend_succeeded(const char *from_name,
00021                                     const char *to_name);
00022 void rep_hist_note_extend_failed(const char *from_name, const char *to_name);
00023 void rep_hist_dump_stats(time_t now, int severity);
00024 void rep_hist_note_bytes_read(size_t num_bytes, time_t when);
00025 void rep_hist_note_bytes_written(size_t num_bytes, time_t when);
00026 
00027 void rep_hist_note_dir_bytes_read(size_t num_bytes, time_t when);
00028 void rep_hist_note_dir_bytes_written(size_t num_bytes, time_t when);
00029 
00030 int rep_hist_bandwidth_assess(void);
00031 char *rep_hist_get_bandwidth_lines(void);
00032 void rep_hist_update_state(or_state_t *state);
00033 int rep_hist_load_state(or_state_t *state, char **err);
00034 void rep_history_clean(time_t before);
00035 
00036 void rep_hist_note_router_reachable(const char *id, const tor_addr_t *at_addr,
00037                                     const uint16_t at_port, time_t when);
00038 void rep_hist_note_router_unreachable(const char *id, time_t when);
00039 int rep_hist_record_mtbf_data(time_t now, int missing_means_down);
00040 int rep_hist_load_mtbf_data(time_t now);
00041 
00042 time_t rep_hist_downrate_old_runs(time_t now);
00043 long rep_hist_get_uptime(const char *id, time_t when);
00044 double rep_hist_get_stability(const char *id, time_t when);
00045 double rep_hist_get_weighted_fractional_uptime(const char *id, time_t when);
00046 long rep_hist_get_weighted_time_known(const char *id, time_t when);
00047 int rep_hist_have_measured_enough_stability(void);
00048 const char *rep_hist_get_router_stability_doc(time_t now);
00049 
00050 void rep_hist_note_used_port(time_t now, uint16_t port);
00051 smartlist_t *rep_hist_get_predicted_ports(time_t now);
00052 void rep_hist_remove_predicted_ports(const smartlist_t *rmv_ports);
00053 void rep_hist_note_used_resolve(time_t now);
00054 void rep_hist_note_used_internal(time_t now, int need_uptime,
00055                                  int need_capacity);
00056 int rep_hist_get_predicted_internal(time_t now, int *need_uptime,
00057                                     int *need_capacity);
00058 
00059 int any_predicted_circuits(time_t now);
00060 int rep_hist_circbuilding_dormant(time_t now);
00061 
00062 void note_crypto_pk_op(pk_op_t operation);
00063 void dump_pk_ops(int severity);
00064 
00065 void rep_hist_free_all(void);
00066 
00067 void rep_hist_exit_stats_init(time_t now);
00068 void rep_hist_reset_exit_stats(time_t now);
00069 void rep_hist_exit_stats_term(void);
00070 char *rep_hist_format_exit_stats(time_t now);
00071 time_t rep_hist_exit_stats_write(time_t now);
00072 void rep_hist_note_exit_bytes(uint16_t port, size_t num_written,
00073                               size_t num_read);
00074 void rep_hist_note_exit_stream_opened(uint16_t port);
00075 
00076 void rep_hist_buffer_stats_init(time_t now);
00077 void rep_hist_buffer_stats_add_circ(circuit_t *circ,
00078                                     time_t end_of_interval);
00079 time_t rep_hist_buffer_stats_write(time_t now);
00080 void rep_hist_buffer_stats_term(void);
00081 void rep_hist_add_buffer_stats(double mean_num_cells_in_queue,
00082      double mean_time_cells_in_queue, uint32_t processed_cells);
00083 char *rep_hist_format_buffer_stats(time_t now);
00084 void rep_hist_reset_buffer_stats(time_t now);
00085 
00086 void rep_hist_desc_stats_init(time_t now);
00087 void rep_hist_note_desc_served(const char * desc);
00088 void rep_hist_desc_stats_term(void);
00089 time_t rep_hist_desc_stats_write(time_t now);
00090 
00091 void rep_hist_conn_stats_init(time_t now);
00092 void rep_hist_note_or_conn_bytes(uint64_t conn_id, size_t num_read,
00093                                  size_t num_written, time_t when);
00094 void rep_hist_reset_conn_stats(time_t now);
00095 char *rep_hist_format_conn_stats(time_t now);
00096 time_t rep_hist_conn_stats_write(time_t now);
00097 void rep_hist_conn_stats_term(void);
00098 
00099 #endif
00100