[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master 21/40] Create dirserv.h



Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date: Thu, 22 Jul 2010 12:09:49 +0200
Subject: Create dirserv.h
Commit: 7d4c027fb064b6163fb4b74fc1b3f86fff1335c9

---
 src/or/config.c          |    1 +
 src/or/connection.c      |    1 +
 src/or/connection_edge.c |    1 +
 src/or/connection_or.c   |    1 +
 src/or/control.c         |    1 +
 src/or/directory.c       |    1 +
 src/or/dirserv.c         |    1 +
 src/or/dirserv.h         |  133 ++++++++++++++++++++++++++++++++++++++++++++++
 src/or/dirvote.c         |    1 +
 src/or/main.c            |    1 +
 src/or/networkstatus.c   |    1 +
 src/or/or.h              |  112 --------------------------------------
 src/or/policies.c        |    1 +
 src/or/router.c          |    1 +
 src/or/routerlist.c      |    1 +
 src/or/routerparse.c     |    1 +
 src/or/routerparse.h     |   93 ++++++++++++++++++++++++++++++++
 src/test/test_dir.c      |    1 +
 18 files changed, 241 insertions(+), 112 deletions(-)
 create mode 100644 src/or/dirserv.h
 create mode 100644 src/or/routerparse.h

diff --git a/src/or/config.c b/src/or/config.c
index 3f18984..884a059 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -19,6 +19,7 @@
 #include "connection_edge.h"
 #include "control.h"
 #include "cpuworker.h"
+#include "dirserv.h"
 #include "geoip.h"
 #include "rendclient.h"
 #include "rendservice.h"
diff --git a/src/or/connection.c b/src/or/connection.c
index f415783..522b5ff 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -22,6 +22,7 @@
 #include "control.h"
 #include "cpuworker.h"
 #include "directory.h"
+#include "dirserv.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "rendclient.h"
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 023c8ae..44c48c6 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -19,6 +19,7 @@
 #include "connection_or.h"
 #include "control.h"
 #include "dnsserv.h"
+#include "dirserv.h"
 #include "rendclient.h"
 #include "rendcommon.h"
 #include "rendservice.h"
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 213653f..b3b3cf0 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -18,6 +18,7 @@
 #include "connection.h"
 #include "connection_or.h"
 #include "control.h"
+#include "dirserv.h"
 #include "geoip.h"
 #include "router.h"
 #include "routerlist.h"
diff --git a/src/or/control.c b/src/or/control.c
index e90134a..9ad6dfd 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -20,6 +20,7 @@
 #include "connection_edge.h"
 #include "control.h"
 #include "directory.h"
+#include "dirserv.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "router.h"
diff --git a/src/or/directory.c b/src/or/directory.c
index 41b2794..10d6ae7 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -11,6 +11,7 @@
 #include "connection_edge.h"
 #include "control.h"
 #include "directory.h"
+#include "dirserv.h"
 #include "geoip.h"
 #include "rendclient.h"
 #include "rendcommon.h"
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 5eea9ce..0a39b5d 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -11,6 +11,7 @@
 #include "connection_or.h"
 #include "control.h"
 #include "directory.h"
+#include "dirserv.h"
 #include "router.h"
 #include "routerlist.h"
 
diff --git a/src/or/dirserv.h b/src/or/dirserv.h
new file mode 100644
index 0000000..fc5a554
--- /dev/null
+++ b/src/or/dirserv.h
@@ -0,0 +1,133 @@
+/* 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 dirserv.h
+ * \brief Header file for dirserv.c.
+ **/
+
+#ifndef _TOR_DIRSERV_H
+#define _TOR_DIRSERV_H
+
+/** Maximum length of an exit policy summary. */
+#define MAX_EXITPOLICY_SUMMARY_LEN 1000
+
+/** Maximum allowable length of a version line in a networkstatus. */
+#define MAX_V_LINE_LEN 128
+/** Length of "r Authority BadDirectory BadExit Exit Fast Guard HSDir Named
+ * Running Stable Unnamed V2Dir Valid\n". */
+#define MAX_FLAG_LINE_LEN 96
+/** Length of "w" line for weighting.  Currently at most
+ * "w Bandwidth=<uint32t> Measured=<uint32t>\n" */
+#define MAX_WEIGHT_LINE_LEN (12+10+10+10+1)
+/** Maximum length of an exit policy summary line. */
+#define MAX_POLICY_LINE_LEN (3+MAX_EXITPOLICY_SUMMARY_LEN)
+/** Amount of space to allocate for each entry: r, s, and v lines. */
+#define RS_ENTRY_LEN                                                    \
+  ( /* first line */                                                    \
+   MAX_NICKNAME_LEN+BASE64_DIGEST_LEN*2+ISO_TIME_LEN+INET_NTOA_BUF_LEN+ \
+   5*2 /* ports */ + 10 /* punctuation */ +                             \
+   /* second line */                                                    \
+   MAX_FLAG_LINE_LEN +                                                  \
+   /* weight line */                                                    \
+   MAX_WEIGHT_LINE_LEN +                                                \
+   /* p line. */                                                        \
+   MAX_POLICY_LINE_LEN +                                                \
+   /* v line. */                                                        \
+   MAX_V_LINE_LEN                                                       \
+   )
+
+#define UNNAMED_ROUTER_NICKNAME "Unnamed"
+
+int connection_dirserv_flushed_some(dir_connection_t *conn);
+
+int dirserv_add_own_fingerprint(const char *nickname, crypto_pk_env_t *pk);
+int dirserv_load_fingerprint_file(void);
+void dirserv_free_fingerprint_list(void);
+const char *dirserv_get_nickname_by_digest(const char *digest);
+enum was_router_added_t dirserv_add_multiple_descriptors(
+                                     const char *desc, uint8_t purpose,
+                                     const char *source,
+                                     const char **msg);
+enum was_router_added_t dirserv_add_descriptor(routerinfo_t *ri,
+                                               const char **msg,
+                                               const char *source);
+void dirserv_free_descriptors(void);
+void dirserv_set_router_is_running(routerinfo_t *router, time_t now);
+int list_server_status_v1(smartlist_t *routers, char **router_status_out,
+                          int for_controller);
+int dirserv_dump_directory_to_string(char **dir_out,
+                                     crypto_pk_env_t *private_key);
+
+int directory_fetches_from_authorities(or_options_t *options);
+int directory_fetches_dir_info_early(or_options_t *options);
+int directory_fetches_dir_info_later(or_options_t *options);
+int directory_caches_v2_dir_info(or_options_t *options);
+#define directory_caches_v1_dir_info(o) directory_caches_v2_dir_info(o)
+int directory_caches_dir_info(or_options_t *options);
+int directory_permits_begindir_requests(or_options_t *options);
+int directory_permits_controller_requests(or_options_t *options);
+int directory_too_idle_to_fetch_descriptors(or_options_t *options, time_t now);
+
+void directory_set_dirty(void);
+cached_dir_t *dirserv_get_directory(void);
+cached_dir_t *dirserv_get_runningrouters(void);
+cached_dir_t *dirserv_get_consensus(const char *flavor_name);
+void dirserv_set_cached_directory(const char *directory, time_t when,
+                                  int is_running_routers);
+void dirserv_set_cached_networkstatus_v2(const char *directory,
+                                         const char *identity,
+                                         time_t published);
+void dirserv_set_cached_consensus_networkstatus(const char *consensus,
+                                                const char *flavor_name,
+                                                const digests_t *digests,
+                                                time_t published);
+void dirserv_clear_old_networkstatuses(time_t cutoff);
+void dirserv_clear_old_v1_info(time_t now);
+void dirserv_get_networkstatus_v2(smartlist_t *result, const char *key);
+void dirserv_get_networkstatus_v2_fingerprints(smartlist_t *result,
+                                               const char *key);
+int dirserv_get_routerdesc_fingerprints(smartlist_t *fps_out, const char *key,
+                                        const char **msg,
+                                        int for_unencrypted_conn,
+                                        int is_extrainfo);
+int dirserv_get_routerdescs(smartlist_t *descs_out, const char *key,
+                            const char **msg);
+void dirserv_orconn_tls_done(const char *address,
+                             uint16_t or_port,
+                             const char *digest_rcvd,
+                             int as_advertised);
+void dirserv_single_reachability_test(time_t now, routerinfo_t *router);
+void dirserv_test_reachability(time_t now);
+int authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
+                                   int complain);
+int dirserv_would_reject_router(routerstatus_t *rs);
+int dirserv_remove_old_statuses(smartlist_t *fps, time_t cutoff);
+int dirserv_have_any_serverdesc(smartlist_t *fps, int spool_src);
+int dirserv_have_any_microdesc(const smartlist_t *fps);
+size_t dirserv_estimate_data_size(smartlist_t *fps, int is_serverdescs,
+                                  int compressed);
+size_t dirserv_estimate_microdesc_size(const smartlist_t *fps, int compressed);
+
+int routerstatus_format_entry(char *buf, size_t buf_len,
+                              routerstatus_t *rs, const char *platform,
+                              routerstatus_format_type_t format);
+void dirserv_free_all(void);
+void cached_dir_decref(cached_dir_t *d);
+cached_dir_t *new_cached_dir(char *s, time_t published);
+
+#ifdef DIRSERV_PRIVATE
+int measured_bw_line_parse(measured_bw_line_t *out, const char *line);
+
+int measured_bw_line_apply(measured_bw_line_t *parsed_line,
+                           smartlist_t *routerstatuses);
+#endif
+
+int dirserv_read_measured_bandwidths(const char *from_file,
+                                     smartlist_t *routerstatuses);
+
+#endif
+
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index f24a91f..a013c50 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -7,6 +7,7 @@
 #include "or.h"
 #include "config.h"
 #include "directory.h"
+#include "dirserv.h"
 #include "router.h"
 #include "routerlist.h"
 
diff --git a/src/or/main.c b/src/or/main.c
index 4bd815a..89a8eac 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -24,6 +24,7 @@
 #include "control.h"
 #include "cpuworker.h"
 #include "directory.h"
+#include "dirserv.h"
 #include "dnsserv.h"
 #include "geoip.h"
 #include "rendclient.h"
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 799d21f..96c7687 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -16,6 +16,7 @@
 #include "connection.h"
 #include "control.h"
 #include "directory.h"
+#include "dirserv.h"
 #include "router.h"
 #include "routerlist.h"
 
diff --git a/src/or/or.h b/src/or/or.h
index 58339b2..47a0a90 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3173,115 +3173,10 @@ typedef struct {
 } fp_pair_t;
 
 /********************************* dirserv.c ***************************/
-/** Maximum length of an exit policy summary. */
-#define MAX_EXITPOLICY_SUMMARY_LEN 1000
-
-/** Maximum allowable length of a version line in a networkstatus. */
-#define MAX_V_LINE_LEN 128
-/** Length of "r Authority BadDirectory BadExit Exit Fast Guard HSDir Named
- * Running Stable Unnamed V2Dir Valid\n". */
-#define MAX_FLAG_LINE_LEN 96
-/** Length of "w" line for weighting.  Currently at most
- * "w Bandwidth=<uint32t> Measured=<uint32t>\n" */
-#define MAX_WEIGHT_LINE_LEN (12+10+10+10+1)
-/** Maximum length of an exit policy summary line. */
-#define MAX_POLICY_LINE_LEN (3+MAX_EXITPOLICY_SUMMARY_LEN)
-/** Amount of space to allocate for each entry: r, s, and v lines. */
-#define RS_ENTRY_LEN                                                    \
-  ( /* first line */                                                    \
-   MAX_NICKNAME_LEN+BASE64_DIGEST_LEN*2+ISO_TIME_LEN+INET_NTOA_BUF_LEN+ \
-   5*2 /* ports */ + 10 /* punctuation */ +                             \
-   /* second line */                                                    \
-   MAX_FLAG_LINE_LEN +                                                  \
-   /* weight line */                                                    \
-   MAX_WEIGHT_LINE_LEN +                                                \
-   /* p line. */                                                        \
-   MAX_POLICY_LINE_LEN +                                                \
-   /* v line. */                                                        \
-   MAX_V_LINE_LEN                                                       \
-   )
-#define UNNAMED_ROUTER_NICKNAME "Unnamed"
-
-int connection_dirserv_flushed_some(dir_connection_t *conn);
-
-int dirserv_add_own_fingerprint(const char *nickname, crypto_pk_env_t *pk);
-int dirserv_load_fingerprint_file(void);
-void dirserv_free_fingerprint_list(void);
-const char *dirserv_get_nickname_by_digest(const char *digest);
-enum was_router_added_t dirserv_add_multiple_descriptors(
-                                     const char *desc, uint8_t purpose,
-                                     const char *source,
-                                     const char **msg);
-enum was_router_added_t dirserv_add_descriptor(routerinfo_t *ri,
-                                               const char **msg,
-                                               const char *source);
-void dirserv_free_descriptors(void);
-void dirserv_set_router_is_running(routerinfo_t *router, time_t now);
-int list_server_status_v1(smartlist_t *routers, char **router_status_out,
-                          int for_controller);
-int dirserv_dump_directory_to_string(char **dir_out,
-                                     crypto_pk_env_t *private_key);
-
-int directory_fetches_from_authorities(or_options_t *options);
-int directory_fetches_dir_info_early(or_options_t *options);
-int directory_fetches_dir_info_later(or_options_t *options);
-int directory_caches_v2_dir_info(or_options_t *options);
-#define directory_caches_v1_dir_info(o) directory_caches_v2_dir_info(o)
-int directory_caches_dir_info(or_options_t *options);
-int directory_permits_begindir_requests(or_options_t *options);
-int directory_permits_controller_requests(or_options_t *options);
-int directory_too_idle_to_fetch_descriptors(or_options_t *options, time_t now);
-
-void directory_set_dirty(void);
-cached_dir_t *dirserv_get_directory(void);
-cached_dir_t *dirserv_get_runningrouters(void);
-cached_dir_t *dirserv_get_consensus(const char *flavor_name);
-void dirserv_set_cached_directory(const char *directory, time_t when,
-                                  int is_running_routers);
-void dirserv_set_cached_networkstatus_v2(const char *directory,
-                                         const char *identity,
-                                         time_t published);
-void dirserv_set_cached_consensus_networkstatus(const char *consensus,
-                                                const char *flavor_name,
-                                                const digests_t *digests,
-                                                time_t published);
-void dirserv_clear_old_networkstatuses(time_t cutoff);
-void dirserv_clear_old_v1_info(time_t now);
-void dirserv_get_networkstatus_v2(smartlist_t *result, const char *key);
-void dirserv_get_networkstatus_v2_fingerprints(smartlist_t *result,
-                                               const char *key);
-int dirserv_get_routerdesc_fingerprints(smartlist_t *fps_out, const char *key,
-                                        const char **msg,
-                                        int for_unencrypted_conn,
-                                        int is_extrainfo);
-int dirserv_get_routerdescs(smartlist_t *descs_out, const char *key,
-                            const char **msg);
-void dirserv_orconn_tls_done(const char *address,
-                             uint16_t or_port,
-                             const char *digest_rcvd,
-                             int as_advertised);
-void dirserv_single_reachability_test(time_t now, routerinfo_t *router);
-void dirserv_test_reachability(time_t now);
-int authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
-                                   int complain);
-int dirserv_would_reject_router(routerstatus_t *rs);
-int dirserv_remove_old_statuses(smartlist_t *fps, time_t cutoff);
-int dirserv_have_any_serverdesc(smartlist_t *fps, int spool_src);
-int dirserv_have_any_microdesc(const smartlist_t *fps);
-size_t dirserv_estimate_data_size(smartlist_t *fps, int is_serverdescs,
-                                  int compressed);
-size_t dirserv_estimate_microdesc_size(const smartlist_t *fps, int compressed);
-
 typedef enum {
   NS_V2, NS_V3_CONSENSUS, NS_V3_VOTE, NS_CONTROL_PORT,
   NS_V3_CONSENSUS_MICRODESC
 } routerstatus_format_type_t;
-int routerstatus_format_entry(char *buf, size_t buf_len,
-                              routerstatus_t *rs, const char *platform,
-                              routerstatus_format_type_t format);
-void dirserv_free_all(void);
-void cached_dir_decref(cached_dir_t *d);
-cached_dir_t *new_cached_dir(char *s, time_t published);
 
 #ifdef DIRSERV_PRIVATE
 typedef struct measured_bw_line_t {
@@ -3290,15 +3185,8 @@ typedef struct measured_bw_line_t {
   long int bw;
 } measured_bw_line_t;
 
-int measured_bw_line_parse(measured_bw_line_t *out, const char *line);
-
-int measured_bw_line_apply(measured_bw_line_t *parsed_line,
-                           smartlist_t *routerstatuses);
 #endif
 
-int dirserv_read_measured_bandwidths(const char *from_file,
-                                     smartlist_t *routerstatuses);
-
 /********************************* dirvote.c ************************/
 
 /** Lowest allowable value for VoteSeconds. */
diff --git a/src/or/policies.c b/src/or/policies.c
index 8866b57..72eb168 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -10,6 +10,7 @@
 
 #include "or.h"
 #include "config.h"
+#include "dirserv.h"
 #include "ht.h"
 
 /** Policy that addresses for incoming SOCKS connections must match. */
diff --git a/src/or/router.c b/src/or/router.c
index 8dd7ef8..a424bf5 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -13,6 +13,7 @@
 #include "connection.h"
 #include "control.h"
 #include "directory.h"
+#include "dirserv.h"
 #include "geoip.h"
 #include "router.h"
 #include "routerlist.h"
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index ca5d75d..f8c8bad 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -17,6 +17,7 @@
 #include "connection.h"
 #include "control.h"
 #include "directory.h"
+#include "dirserv.h"
 #include "geoip.h"
 #include "rendcommon.h"
 #include "rendservice.h"
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index b406a1c..304509c 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -11,6 +11,7 @@
 
 #include "or.h"
 #include "config.h"
+#include "dirserv.h"
 #include "rendcommon.h"
 #include "router.h"
 #include "routerlist.h"
diff --git a/src/or/routerparse.h b/src/or/routerparse.h
new file mode 100644
index 0000000..e615636
--- /dev/null
+++ b/src/or/routerparse.h
@@ -0,0 +1,93 @@
+/* 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 geoip.h
+ * \brief Header file for geoip functions
+ **/
+
+#ifndef _TOR_GEOIP_H
+#define _TOR_GEOIP_H
+
+#define MAX_STATUS_TAG_LEN 32
+
+int router_get_router_hash(const char *s, size_t s_len, char *digest);
+int router_get_dir_hash(const char *s, char *digest);
+int router_get_runningrouters_hash(const char *s, char *digest);
+int router_get_networkstatus_v2_hash(const char *s, char *digest);
+int router_get_networkstatus_v3_hash(const char *s, char *digest,
+                                     digest_algorithm_t algorithm);
+int router_get_networkstatus_v3_hashes(const char *s, digests_t *digests);
+int router_get_extrainfo_hash(const char *s, char *digest);
+int router_append_dirobj_signature(char *buf, size_t buf_len,
+                                   const char *digest,
+                                   size_t digest_len,
+                                   crypto_pk_env_t *private_key);
+int router_parse_list_from_string(const char **s, const char *eos,
+                                  smartlist_t *dest,
+                                  saved_location_t saved_location,
+                                  int is_extrainfo,
+                                  int allow_annotations,
+                                  const char *prepend_annotations);
+int router_parse_routerlist_from_directory(const char *s,
+                                           routerlist_t **dest,
+                                           crypto_pk_env_t *pkey,
+                                           int check_version,
+                                           int write_to_cache);
+int router_parse_runningrouters(const char *str);
+int router_parse_directory(const char *str);
+
+routerinfo_t *router_parse_entry_from_string(const char *s, const char *end,
+                                             int cache_copy,
+                                             int allow_annotations,
+                                             const char *prepend_annotations);
+extrainfo_t *extrainfo_parse_entry_from_string(const char *s, const char *end,
+                         int cache_copy, struct digest_ri_map_t *routermap);
+addr_policy_t *router_parse_addr_policy_item_from_string(const char *s,
+                                                  int assume_action);
+version_status_t tor_version_is_obsolete(const char *myversion,
+                                         const char *versionlist);
+int tor_version_parse(const char *s, tor_version_t *out);
+int tor_version_as_new_as(const char *platform, const char *cutoff);
+int tor_version_compare(tor_version_t *a, tor_version_t *b);
+void sort_version_list(smartlist_t *lst, int remove_duplicates);
+void assert_addr_policy_ok(smartlist_t *t);
+void dump_distinct_digest_count(int severity);
+
+int compare_routerstatus_entries(const void **_a, const void **_b);
+networkstatus_v2_t *networkstatus_v2_parse_from_string(const char *s);
+int networkstatus_verify_bw_weights(networkstatus_t *ns);
+networkstatus_t *networkstatus_parse_vote_from_string(const char *s,
+                                                 const char **eos_out,
+                                                 networkstatus_type_t ns_type);
+ns_detached_signatures_t *networkstatus_parse_detached_signatures(
+                                          const char *s, const char *eos);
+
+smartlist_t *microdescs_parse_from_string(const char *s, const char *eos,
+                                          int allow_annotations,
+                                          int copy_body);
+
+authority_cert_t *authority_cert_parse_from_string(const char *s,
+                                                   const char **end_of_string);
+int rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out,
+                                     char *desc_id_out,
+                                     char **intro_points_encrypted_out,
+                                     size_t *intro_points_encrypted_size_out,
+                                     size_t *encoded_size_out,
+                                     const char **next_out, const char *desc);
+int rend_decrypt_introduction_points(char **ipos_decrypted,
+                                     size_t *ipos_decrypted_size,
+                                     const char *descriptor_cookie,
+                                     const char *ipos_encrypted,
+                                     size_t ipos_encrypted_size);
+int rend_parse_introduction_points(rend_service_descriptor_t *parsed,
+                                   const char *intro_points_encoded,
+                                   size_t intro_points_encoded_size);
+int rend_parse_client_keys(strmap_t *parsed_clients, const char *str);
+
+void tor_gettimeofday_cache_clear(void);
+
+#endif
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index e01da14..0379811 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -9,6 +9,7 @@
 #define ROUTER_PRIVATE
 #include "or.h"
 #include "directory.h"
+#include "dirserv.h"
 #include "router.h"
 #include "routerlist.h"
 #include "test.h"
-- 
1.7.1