[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [tor/master 20/40] Create directory.h
Author: Sebastian Hahn <sebastian@xxxxxxxxxxxxxx>
Date: Thu, 22 Jul 2010 11:54:50 +0200
Subject: Create directory.h
Commit: bec1c838ca96b69d69b3c275b4703fa539c8c106
---
src/or/circuitbuild.c | 1 +
src/or/connection.c | 1 +
src/or/control.c | 1 +
src/or/directory.c | 1 +
src/or/directory.h | 108 ++++++++++++++++++++++++++++++++++++++++++++++++
src/or/dirserv.c | 1 +
src/or/dirvote.c | 1 +
src/or/main.c | 1 +
src/or/networkstatus.c | 1 +
src/or/or.h | 90 ----------------------------------------
src/or/rendclient.c | 1 +
src/or/rendservice.c | 1 +
src/or/router.c | 1 +
src/or/routerlist.c | 1 +
src/test/test_dir.c | 1 +
15 files changed, 121 insertions(+), 90 deletions(-)
create mode 100644 src/or/directory.h
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index a675d7d..1a189ca 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -20,6 +20,7 @@
#include "connection_edge.h"
#include "connection_or.h"
#include "control.h"
+#include "directory.h"
#include "router.h"
#include "routerlist.h"
#include "crypto.h"
diff --git a/src/or/connection.c b/src/or/connection.c
index ac8123c..f415783 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -21,6 +21,7 @@
#include "connection_or.h"
#include "control.h"
#include "cpuworker.h"
+#include "directory.h"
#include "dnsserv.h"
#include "geoip.h"
#include "rendclient.h"
diff --git a/src/or/control.c b/src/or/control.c
index 77ca085..e90134a 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -19,6 +19,7 @@
#include "connection.h"
#include "connection_edge.h"
#include "control.h"
+#include "directory.h"
#include "dnsserv.h"
#include "geoip.h"
#include "router.h"
diff --git a/src/or/directory.c b/src/or/directory.c
index 5fdae43..41b2794 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -10,6 +10,7 @@
#include "connection.h"
#include "connection_edge.h"
#include "control.h"
+#include "directory.h"
#include "geoip.h"
#include "rendclient.h"
#include "rendcommon.h"
diff --git a/src/or/directory.h b/src/or/directory.h
new file mode 100644
index 0000000..36b4cf2
--- /dev/null
+++ b/src/or/directory.h
@@ -0,0 +1,108 @@
+/* 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 directory.h
+ * \brief Header file for directory.c.
+ **/
+
+#ifndef _TOR_DIRECTORY_H
+#define _TOR_DIRECTORY_H
+
+int directories_have_accepted_server_descriptor(void);
+char *authority_type_to_string(authority_type_t auth);
+void directory_post_to_dirservers(uint8_t dir_purpose, uint8_t router_purpose,
+ authority_type_t type, const char *payload,
+ size_t payload_len, size_t extrainfo_len);
+void directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
+ const char *resource,
+ int pds_flags);
+void directory_get_from_all_authorities(uint8_t dir_purpose,
+ uint8_t router_purpose,
+ const char *resource);
+void directory_initiate_command_routerstatus(routerstatus_t *status,
+ uint8_t dir_purpose,
+ uint8_t router_purpose,
+ int anonymized_connection,
+ const char *resource,
+ const char *payload,
+ size_t payload_len,
+ time_t if_modified_since);
+void directory_initiate_command_routerstatus_rend(routerstatus_t *status,
+ uint8_t dir_purpose,
+ uint8_t router_purpose,
+ int anonymized_connection,
+ const char *resource,
+ const char *payload,
+ size_t payload_len,
+ time_t if_modified_since,
+ const rend_data_t *rend_query);
+
+int parse_http_response(const char *headers, int *code, time_t *date,
+ compress_method_t *compression, char **response);
+
+int connection_dir_is_encrypted(dir_connection_t *conn);
+int connection_dir_reached_eof(dir_connection_t *conn);
+int connection_dir_process_inbuf(dir_connection_t *conn);
+int connection_dir_finished_flushing(dir_connection_t *conn);
+int connection_dir_finished_connecting(dir_connection_t *conn);
+void connection_dir_request_failed(dir_connection_t *conn);
+void directory_initiate_command(const char *address, const tor_addr_t *addr,
+ uint16_t or_port, uint16_t dir_port,
+ int supports_conditional_consensus,
+ int supports_begindir, const char *digest,
+ uint8_t dir_purpose, uint8_t router_purpose,
+ int anonymized_connection,
+ const char *resource,
+ const char *payload, size_t payload_len,
+ time_t if_modified_since);
+
+#define DSR_HEX (1<<0)
+#define DSR_BASE64 (1<<1)
+#define DSR_DIGEST256 (1<<2)
+#define DSR_SORT_UNIQ (1<<3)
+int dir_split_resource_into_fingerprints(const char *resource,
+ smartlist_t *fp_out, int *compressed_out,
+ int flags);
+
+int dir_split_resource_into_fingerprint_pairs(const char *res,
+ smartlist_t *pairs_out);
+char *directory_dump_request_log(void);
+void note_request(const char *key, size_t bytes);
+int router_supports_extrainfo(const char *identity_digest, int is_authority);
+
+time_t download_status_increment_failure(download_status_t *dls,
+ int status_code, const char *item,
+ int server, time_t now);
+/** Increment the failure count of the download_status_t <b>dls</b>, with
+ * the optional status code <b>sc</b>. */
+#define download_status_failed(dls, sc) \
+ download_status_increment_failure((dls), (sc), NULL, \
+ get_options()->DirPort, time(NULL))
+
+void download_status_reset(download_status_t *dls);
+static int download_status_is_ready(download_status_t *dls, time_t now,
+ int max_failures);
+/** Return true iff, as of <b>now</b>, the resource tracked by <b>dls</b> is
+ * ready to get its download reattempted. */
+static INLINE int
+download_status_is_ready(download_status_t *dls, time_t now,
+ int max_failures)
+{
+ return (dls->n_download_failures <= max_failures
+ && dls->next_attempt_at <= now);
+}
+
+static void download_status_mark_impossible(download_status_t *dl);
+/** Mark <b>dl</b> as never downloadable. */
+static INLINE void
+download_status_mark_impossible(download_status_t *dl)
+{
+ dl->n_download_failures = IMPOSSIBLE_TO_DOWNLOAD;
+}
+
+#endif
+
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 8042338..5eea9ce 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -10,6 +10,7 @@
#include "connection.h"
#include "connection_or.h"
#include "control.h"
+#include "directory.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index 6e6bf8d..f24a91f 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -6,6 +6,7 @@
#define DIRVOTE_PRIVATE
#include "or.h"
#include "config.h"
+#include "directory.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/main.c b/src/or/main.c
index 46ab044..4bd815a 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -23,6 +23,7 @@
#include "connection_or.h"
#include "control.h"
#include "cpuworker.h"
+#include "directory.h"
#include "dnsserv.h"
#include "geoip.h"
#include "rendclient.h"
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 2177497..799d21f 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -15,6 +15,7 @@
#include "config.h"
#include "connection.h"
#include "control.h"
+#include "directory.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/or.h b/src/or/or.h
index f38567f..58339b2 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3166,101 +3166,11 @@ typedef enum {
/********************************* directory.c ***************************/
-int directories_have_accepted_server_descriptor(void);
-char *authority_type_to_string(authority_type_t auth);
-void directory_post_to_dirservers(uint8_t dir_purpose, uint8_t router_purpose,
- authority_type_t type, const char *payload,
- size_t payload_len, size_t extrainfo_len);
-void directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
- const char *resource,
- int pds_flags);
-void directory_get_from_all_authorities(uint8_t dir_purpose,
- uint8_t router_purpose,
- const char *resource);
-void directory_initiate_command_routerstatus(routerstatus_t *status,
- uint8_t dir_purpose,
- uint8_t router_purpose,
- int anonymized_connection,
- const char *resource,
- const char *payload,
- size_t payload_len,
- time_t if_modified_since);
-void directory_initiate_command_routerstatus_rend(routerstatus_t *status,
- uint8_t dir_purpose,
- uint8_t router_purpose,
- int anonymized_connection,
- const char *resource,
- const char *payload,
- size_t payload_len,
- time_t if_modified_since,
- const rend_data_t *rend_query);
-
-int parse_http_response(const char *headers, int *code, time_t *date,
- compress_method_t *compression, char **response);
-
-int connection_dir_is_encrypted(dir_connection_t *conn);
-int connection_dir_reached_eof(dir_connection_t *conn);
-int connection_dir_process_inbuf(dir_connection_t *conn);
-int connection_dir_finished_flushing(dir_connection_t *conn);
-int connection_dir_finished_connecting(dir_connection_t *conn);
-void connection_dir_request_failed(dir_connection_t *conn);
-void directory_initiate_command(const char *address, const tor_addr_t *addr,
- uint16_t or_port, uint16_t dir_port,
- int supports_conditional_consensus,
- int supports_begindir, const char *digest,
- uint8_t dir_purpose, uint8_t router_purpose,
- int anonymized_connection,
- const char *resource,
- const char *payload, size_t payload_len,
- time_t if_modified_since);
-
-#define DSR_HEX (1<<0)
-#define DSR_BASE64 (1<<1)
-#define DSR_DIGEST256 (1<<2)
-#define DSR_SORT_UNIQ (1<<3)
-int dir_split_resource_into_fingerprints(const char *resource,
- smartlist_t *fp_out, int *compressed_out,
- int flags);
/** A pair of digests created by dir_split_resource_info_fingerprint_pairs() */
typedef struct {
char first[DIGEST_LEN];
char second[DIGEST_LEN];
} fp_pair_t;
-int dir_split_resource_into_fingerprint_pairs(const char *res,
- smartlist_t *pairs_out);
-char *directory_dump_request_log(void);
-void note_request(const char *key, size_t bytes);
-int router_supports_extrainfo(const char *identity_digest, int is_authority);
-
-time_t download_status_increment_failure(download_status_t *dls,
- int status_code, const char *item,
- int server, time_t now);
-/** Increment the failure count of the download_status_t <b>dls</b>, with
- * the optional status code <b>sc</b>. */
-#define download_status_failed(dls, sc) \
- download_status_increment_failure((dls), (sc), NULL, \
- get_options()->DirPort, time(NULL))
-
-void download_status_reset(download_status_t *dls);
-static int download_status_is_ready(download_status_t *dls, time_t now,
- int max_failures);
-/** Return true iff, as of <b>now</b>, the resource tracked by <b>dls</b> is
- * ready to get its download reattempted. */
-static INLINE int
-download_status_is_ready(download_status_t *dls, time_t now,
- int max_failures)
-{
- return (dls->n_download_failures <= max_failures
- && dls->next_attempt_at <= now);
-}
-
-static void download_status_mark_impossible(download_status_t *dl);
-/** Mark <b>dl</b> as never downloadable. */
-static INLINE void
-download_status_mark_impossible(download_status_t *dl)
-{
- dl->n_download_failures = IMPOSSIBLE_TO_DOWNLOAD;
-}
/********************************* dirserv.c ***************************/
/** Maximum length of an exit policy summary. */
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 3665eb1..92d43bc 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -14,6 +14,7 @@
#include "config.h"
#include "connection.h"
#include "connection_edge.h"
+#include "directory.h"
#include "rendclient.h"
#include "rendcommon.h"
#include "routerlist.h"
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index a7ed200..5d72ef8 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -12,6 +12,7 @@
#include "circuitlist.h"
#include "circuituse.h"
#include "config.h"
+#include "directory.h"
#include "rendclient.h"
#include "rendcommon.h"
#include "rendservice.h"
diff --git a/src/or/router.c b/src/or/router.c
index 722bb4d..8dd7ef8 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -12,6 +12,7 @@
#include "config.h"
#include "connection.h"
#include "control.h"
+#include "directory.h"
#include "geoip.h"
#include "router.h"
#include "routerlist.h"
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index a284152..ca5d75d 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -16,6 +16,7 @@
#include "config.h"
#include "connection.h"
#include "control.h"
+#include "directory.h"
#include "geoip.h"
#include "rendcommon.h"
#include "rendservice.h"
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 5ea09d0..e01da14 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -8,6 +8,7 @@
#define DIRVOTE_PRIVATE
#define ROUTER_PRIVATE
#include "or.h"
+#include "directory.h"
#include "router.h"
#include "routerlist.h"
#include "test.h"
--
1.7.1