[or-cvs] [tor/master 34/40] Create rephist.h
nickm at torproject.org
nickm at torproject.org
Fri Jul 30 01:56:58 UTC 2010
Author: Sebastian Hahn <sebastian at torproject.org>
Date: Fri, 23 Jul 2010 22:57:20 +0200
Subject: Create rephist.h
Commit: df9d42cef56c856db44c22cd3e2eb2a6e2ff1e4c
---
src/or/circuitbuild.c | 1 +
src/or/circuitlist.c | 1 +
src/or/circuituse.c | 1 +
src/or/config.c | 1 +
src/or/connection.c | 1 +
src/or/connection_edge.c | 1 +
src/or/connection_or.c | 1 +
src/or/directory.c | 1 +
src/or/dirserv.c | 1 +
src/or/dirvote.c | 1 +
src/or/main.c | 1 +
src/or/onion.c | 1 +
src/or/or.h | 62 ------------------------------------
src/or/rendclient.c | 1 +
src/or/rendcommon.c | 1 +
src/or/rendmid.c | 1 +
src/or/rendservice.c | 1 +
src/or/rephist.c | 1 +
src/or/rephist.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++
src/or/router.c | 1 +
src/or/routerlist.c | 1 +
src/or/routerparse.c | 1 +
src/test/test.c | 1 +
23 files changed, 100 insertions(+), 62 deletions(-)
create mode 100644 src/or/rephist.h
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index b78845f..fc3dbda 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -26,6 +26,7 @@
#include "onion.h"
#include "policies.h"
#include "relay.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
#include "crypto.h"
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index df4aec7..c581365 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -23,6 +23,7 @@
#include "relay.h"
#include "rendclient.h"
#include "rendcommon.h"
+#include "rephist.h"
#include "routerlist.h"
#include "ht.h"
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index b13e558..a3f10a8 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -21,6 +21,7 @@
#include "rendclient.h"
#include "rendcommon.h"
#include "rendservice.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/config.c b/src/or/config.c
index 4fdf32e..a4e4f89 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -30,6 +30,7 @@
#include "relay.h"
#include "rendclient.h"
#include "rendservice.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
#ifdef MS_WINDOWS
diff --git a/src/or/connection.c b/src/or/connection.c
index d9aa1cf..02acd97 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -32,6 +32,7 @@
#include "relay.h"
#include "rendclient.h"
#include "rendcommon.h"
+#include "rephist.h"
#include "router.h"
static connection_t *connection_create_listener(
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 83ba230..7522368 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -29,6 +29,7 @@
#include "rendclient.h"
#include "rendcommon.h"
#include "rendservice.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index bf19503..405df15 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -24,6 +24,7 @@
#include "networkstatus.h"
#include "reasons.h"
#include "relay.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/directory.c b/src/or/directory.c
index 1c13cbd..c1e68bf 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -19,6 +19,7 @@
#include "policies.h"
#include "rendclient.h"
#include "rendcommon.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 38fc8f1..397a0c8 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -17,6 +17,7 @@
#include "microdesc.h"
#include "networkstatus.h"
#include "policies.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index 7873e49..2448a6a 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -12,6 +12,7 @@
#include "microdesc.h"
#include "networkstatus.h"
#include "policies.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/main.c b/src/or/main.c
index e202a10..92c60e7 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -40,6 +40,7 @@
#include "rendclient.h"
#include "rendcommon.h"
#include "rendservice.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
#ifdef USE_DMALLOC
diff --git a/src/or/onion.c b/src/or/onion.c
index 1612d38..ebc3583 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -14,6 +14,7 @@
#include "circuitlist.h"
#include "config.h"
#include "onion.h"
+#include "rephist.h"
/** Type for a linked list of circuits that are waiting for a free CPU worker
* to process a waiting onion handshake. */
diff --git a/src/or/or.h b/src/or/or.h
index 3e7fe23..f51da60 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3311,51 +3311,6 @@ typedef enum {
/********************************* rephist.c ***************************/
-void rep_hist_init(void);
-void rep_hist_note_connect_failed(const char* nickname, time_t when);
-void rep_hist_note_connect_succeeded(const char* nickname, time_t when);
-void rep_hist_note_disconnect(const char* nickname, time_t when);
-void rep_hist_note_connection_died(const char* nickname, time_t when);
-void rep_hist_note_extend_succeeded(const char *from_name,
- const char *to_name);
-void rep_hist_note_extend_failed(const char *from_name, const char *to_name);
-void rep_hist_dump_stats(time_t now, int severity);
-void rep_hist_note_bytes_read(size_t num_bytes, time_t when);
-void rep_hist_note_bytes_written(size_t num_bytes, time_t when);
-void rep_hist_note_exit_bytes_read(uint16_t port, size_t num_bytes);
-void rep_hist_note_exit_bytes_written(uint16_t port, size_t num_bytes);
-void rep_hist_note_exit_stream_opened(uint16_t port);
-void rep_hist_exit_stats_init(time_t now);
-void rep_hist_exit_stats_write(time_t now);
-int rep_hist_bandwidth_assess(void);
-char *rep_hist_get_bandwidth_lines(int for_extrainfo);
-void rep_hist_update_state(or_state_t *state);
-int rep_hist_load_state(or_state_t *state, char **err);
-void rep_history_clean(time_t before);
-
-void rep_hist_note_router_reachable(const char *id, time_t when);
-void rep_hist_note_router_unreachable(const char *id, time_t when);
-int rep_hist_record_mtbf_data(time_t now, int missing_means_down);
-int rep_hist_load_mtbf_data(time_t now);
-
-time_t rep_hist_downrate_old_runs(time_t now);
-double rep_hist_get_stability(const char *id, time_t when);
-double rep_hist_get_weighted_fractional_uptime(const char *id, time_t when);
-long rep_hist_get_weighted_time_known(const char *id, time_t when);
-int rep_hist_have_measured_enough_stability(void);
-const char *rep_hist_get_router_stability_doc(time_t now);
-
-void rep_hist_note_used_port(time_t now, uint16_t port);
-smartlist_t *rep_hist_get_predicted_ports(time_t now);
-void rep_hist_note_used_resolve(time_t now);
-void rep_hist_note_used_internal(time_t now, int need_uptime,
- int need_capacity);
-int rep_hist_get_predicted_internal(time_t now, int *need_uptime,
- int *need_capacity);
-
-int any_predicted_circuits(time_t now);
-int rep_hist_circbuilding_dormant(time_t now);
-
/** Possible public/private key operations in Tor: used to keep track of where
* we're spending our time. */
typedef enum {
@@ -3365,23 +3320,6 @@ typedef enum {
TLS_HANDSHAKE_C, TLS_HANDSHAKE_S,
REND_CLIENT, REND_MID, REND_SERVER,
} pk_op_t;
-void note_crypto_pk_op(pk_op_t operation);
-void dump_pk_ops(int severity);
-
-void rep_hist_free_all(void);
-
-/* for hidden service usage statistics */
-void hs_usage_note_publish_total(const char *service_id, time_t now);
-void hs_usage_note_publish_novel(const char *service_id, time_t now);
-void hs_usage_note_fetch_total(const char *service_id, time_t now);
-void hs_usage_note_fetch_successful(const char *service_id, time_t now);
-void hs_usage_write_statistics_to_file(time_t now);
-void hs_usage_free_all(void);
-
-void rep_hist_buffer_stats_init(time_t now);
-void rep_hist_buffer_stats_add_circ(circuit_t *circ,
- time_t end_of_interval);
-void rep_hist_buffer_stats_write(time_t now);
/********************************* rendcommon.c ***************************/
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 166d38d..0377f12 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -19,6 +19,7 @@
#include "relay.h"
#include "rendclient.h"
#include "rendcommon.h"
+#include "rephist.h"
#include "routerlist.h"
/** Called when we've established a circuit to an introduction point:
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index fc43f11..8a4de3c 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -15,6 +15,7 @@
#include "rendcommon.h"
#include "rendmid.h"
#include "rendservice.h"
+#include "rephist.h"
#include "routerlist.h"
/** Return 0 if one and two are the same service ids, else -1 or 1 */
diff --git a/src/or/rendmid.c b/src/or/rendmid.c
index 48cb10f..d392f8e 100644
--- a/src/or/rendmid.c
+++ b/src/or/rendmid.c
@@ -12,6 +12,7 @@
#include "config.h"
#include "relay.h"
#include "rendmid.h"
+#include "rephist.h"
/** Respond to an ESTABLISH_INTRO cell by checking the signed data and
* setting the circuit's purpose and service pk digest.
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 2c1c8cf..f7ab60d 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -19,6 +19,7 @@
#include "rendservice.h"
#include "router.h"
#include "relay.h"
+#include "rephist.h"
#include "routerlist.h"
static origin_circuit_t *find_intro_circuit(rend_intro_point_t *intro,
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 88ba83e..a419f31 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -13,6 +13,7 @@
#include "circuitlist.h"
#include "circuituse.h"
#include "config.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
#include "ht.h"
diff --git a/src/or/rephist.h b/src/or/rephist.h
new file mode 100644
index 0000000..1720c9a
--- /dev/null
+++ b/src/or/rephist.h
@@ -0,0 +1,79 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2010, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file rephist.h
+ * \brief Header file for rephist functions
+ **/
+
+#ifndef _TOR_REPHIST_H
+#define _TOR_REPHIST_H
+
+void rep_hist_init(void);
+void rep_hist_note_connect_failed(const char* nickname, time_t when);
+void rep_hist_note_connect_succeeded(const char* nickname, time_t when);
+void rep_hist_note_disconnect(const char* nickname, time_t when);
+void rep_hist_note_connection_died(const char* nickname, time_t when);
+void rep_hist_note_extend_succeeded(const char *from_name,
+ const char *to_name);
+void rep_hist_note_extend_failed(const char *from_name, const char *to_name);
+void rep_hist_dump_stats(time_t now, int severity);
+void rep_hist_note_bytes_read(size_t num_bytes, time_t when);
+void rep_hist_note_bytes_written(size_t num_bytes, time_t when);
+void rep_hist_note_exit_bytes_read(uint16_t port, size_t num_bytes);
+void rep_hist_note_exit_bytes_written(uint16_t port, size_t num_bytes);
+void rep_hist_note_exit_stream_opened(uint16_t port);
+void rep_hist_exit_stats_init(time_t now);
+void rep_hist_exit_stats_write(time_t now);
+int rep_hist_bandwidth_assess(void);
+char *rep_hist_get_bandwidth_lines(int for_extrainfo);
+void rep_hist_update_state(or_state_t *state);
+int rep_hist_load_state(or_state_t *state, char **err);
+void rep_history_clean(time_t before);
+
+void rep_hist_note_router_reachable(const char *id, time_t when);
+void rep_hist_note_router_unreachable(const char *id, time_t when);
+int rep_hist_record_mtbf_data(time_t now, int missing_means_down);
+int rep_hist_load_mtbf_data(time_t now);
+
+time_t rep_hist_downrate_old_runs(time_t now);
+double rep_hist_get_stability(const char *id, time_t when);
+double rep_hist_get_weighted_fractional_uptime(const char *id, time_t when);
+long rep_hist_get_weighted_time_known(const char *id, time_t when);
+int rep_hist_have_measured_enough_stability(void);
+const char *rep_hist_get_router_stability_doc(time_t now);
+
+void rep_hist_note_used_port(time_t now, uint16_t port);
+smartlist_t *rep_hist_get_predicted_ports(time_t now);
+void rep_hist_note_used_resolve(time_t now);
+void rep_hist_note_used_internal(time_t now, int need_uptime,
+ int need_capacity);
+int rep_hist_get_predicted_internal(time_t now, int *need_uptime,
+ int *need_capacity);
+
+int any_predicted_circuits(time_t now);
+int rep_hist_circbuilding_dormant(time_t now);
+
+void note_crypto_pk_op(pk_op_t operation);
+void dump_pk_ops(int severity);
+
+void rep_hist_free_all(void);
+
+/* for hidden service usage statistics */
+void hs_usage_note_publish_total(const char *service_id, time_t now);
+void hs_usage_note_publish_novel(const char *service_id, time_t now);
+void hs_usage_note_fetch_total(const char *service_id, time_t now);
+void hs_usage_note_fetch_successful(const char *service_id, time_t now);
+void hs_usage_write_statistics_to_file(time_t now);
+void hs_usage_free_all(void);
+
+void rep_hist_buffer_stats_init(time_t now);
+void rep_hist_buffer_stats_add_circ(circuit_t *circ,
+ time_t end_of_interval);
+void rep_hist_buffer_stats_write(time_t now);
+
+#endif
+
diff --git a/src/or/router.c b/src/or/router.c
index bf42566..36e2d26 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -20,6 +20,7 @@
#include "main.h"
#include "policies.h"
#include "relay.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 1fb3dbc..7f47e71 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -26,6 +26,7 @@
#include "policies.h"
#include "rendcommon.h"
#include "rendservice.h"
+#include "rephist.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 0662fd3..88fbdbf 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -20,6 +20,7 @@
#include "memarea.h"
#include "microdesc.h"
#include "networkstatus.h"
+#include "rephist.h"
#undef log
#include <math.h>
diff --git a/src/test/test.c b/src/test/test.c
index b5c908a..8bb694d 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -55,6 +55,7 @@ double fabs(double x);
#include "memarea.h"
#include "onion.h"
#include "policies.h"
+#include "rephist.h"
#ifdef USE_DMALLOC
#include <dmalloc.h>
--
1.7.1
More information about the tor-commits
mailing list