Merge remote branch 'sebastian/bug1035' into maint-0.2.2
[tor/rransom.git] / src / or / rephist.h
blob5f6b9f9b45b883eab081cde5be03bb21a73f15a7
1 /* Copyright (c) 2001 Matej Pfajfar.
2 * Copyright (c) 2001-2004, Roger Dingledine.
3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4 * Copyright (c) 2007-2011, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
7 /**
8 * \file rephist.h
9 * \brief Header file for rephist.c.
10 **/
12 #ifndef _TOR_REPHIST_H
13 #define _TOR_REPHIST_H
15 void rep_hist_init(void);
16 void rep_hist_note_connect_failed(const char* nickname, time_t when);
17 void rep_hist_note_connect_succeeded(const char* nickname, time_t when);
18 void rep_hist_note_disconnect(const char* nickname, time_t when);
19 void rep_hist_note_connection_died(const char* nickname, time_t when);
20 void rep_hist_note_extend_succeeded(const char *from_name,
21 const char *to_name);
22 void rep_hist_note_extend_failed(const char *from_name, const char *to_name);
23 void rep_hist_dump_stats(time_t now, int severity);
24 void rep_hist_note_bytes_read(size_t num_bytes, time_t when);
25 void rep_hist_note_bytes_written(size_t num_bytes, time_t when);
27 void rep_hist_note_dir_bytes_read(size_t num_bytes, time_t when);
28 void rep_hist_note_dir_bytes_written(size_t num_bytes, time_t when);
30 int rep_hist_bandwidth_assess(void);
31 char *rep_hist_get_bandwidth_lines(void);
32 void rep_hist_update_state(or_state_t *state);
33 int rep_hist_load_state(or_state_t *state, char **err);
34 void rep_history_clean(time_t before);
36 void rep_hist_note_router_reachable(const char *id, const tor_addr_t *at_addr,
37 uint16_t at_port, time_t when);
38 void rep_hist_note_router_unreachable(const char *id, time_t when);
39 int rep_hist_record_mtbf_data(time_t now, int missing_means_down);
40 int rep_hist_load_mtbf_data(time_t now);
42 time_t rep_hist_downrate_old_runs(time_t now);
43 double rep_hist_get_stability(const char *id, time_t when);
44 double rep_hist_get_weighted_fractional_uptime(const char *id, time_t when);
45 long rep_hist_get_weighted_time_known(const char *id, time_t when);
46 int rep_hist_have_measured_enough_stability(void);
47 const char *rep_hist_get_router_stability_doc(time_t now);
49 void rep_hist_note_used_port(time_t now, uint16_t port);
50 smartlist_t *rep_hist_get_predicted_ports(time_t now);
51 void rep_hist_note_used_resolve(time_t now);
52 void rep_hist_note_used_internal(time_t now, int need_uptime,
53 int need_capacity);
54 int rep_hist_get_predicted_internal(time_t now, int *need_uptime,
55 int *need_capacity);
57 int any_predicted_circuits(time_t now);
58 int rep_hist_circbuilding_dormant(time_t now);
60 void note_crypto_pk_op(pk_op_t operation);
61 void dump_pk_ops(int severity);
63 void rep_hist_free_all(void);
65 void rep_hist_exit_stats_init(time_t now);
66 void rep_hist_reset_exit_stats(time_t now);
67 void rep_hist_exit_stats_term(void);
68 char *rep_hist_format_exit_stats(time_t now);
69 time_t rep_hist_exit_stats_write(time_t now);
70 void rep_hist_note_exit_bytes(uint16_t port, size_t num_written,
71 size_t num_read);
72 void rep_hist_note_exit_stream_opened(uint16_t port);
74 void rep_hist_buffer_stats_init(time_t now);
75 void rep_hist_buffer_stats_add_circ(circuit_t *circ,
76 time_t end_of_interval);
77 time_t rep_hist_buffer_stats_write(time_t now);
78 void rep_hist_buffer_stats_term(void);
80 #endif