summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-12-01 04:58:53 +0000
committerRoger Dingledine <arma@torproject.org>2007-12-01 04:58:53 +0000
commitf8df8d791e4a58ab65d8903a0522b4cfa55cc163 (patch)
tree1fbc2c52fb8d95a0c638da65792609c50d253e5a /src/or/dirserv.c
parent6d49465b691046efb0ffa2c7e89898cdd35ee192 (diff)
downloadtor-f8df8d791e4a58ab65d8903a0522b4cfa55cc163.tar.gz
tor-f8df8d791e4a58ab65d8903a0522b4cfa55cc163.zip
start to refactor dirserver_mode()
svn:r12621
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index bc76d27212..3b4c8e2382 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1056,6 +1056,50 @@ dirserv_dump_directory_to_string(char **dir_out,
return -1;
}
+/********************************************************************/
+
+/* A set of functions to answer questions about how we'd like to behave
+ * as a directory cache/client. */
+
+/** Return 1 if we want to keep descriptors, networkstatuses, etc around
+ * and serve them to others, or 0 otherwise.
+ * Also causes us to fetch new networkstatuses, descriptors, etc on the
+ * "mirror" schedule rather than the "client" schedule.
+ */
+int
+directory_caches_dir_info(or_options_t *options)
+{
+ return options->DirPort != 0;
+}
+
+/** Return 1 if we fetch our directory material directly from the
+ * authorities, rather than some other cache. */
+int
+directory_fetches_from_authorities(or_options_t *options)
+{
+ return server_mode(options) && options->DirPort != 0;
+}
+
+/** Return 1 if we want to allow remote people to ask us directory
+ * requests via the "begin_dir" interface, which doesn't require
+ * having any separate port open. */
+int
+directory_permits_begindir_requests(or_options_t *options)
+{
+ return options->DirPort != 0;
+}
+
+/** Return 1 if we want to allow controllers to ask us directory
+ * requests via the controller interface, which doesn't require
+ * having any separate port open. */
+int
+directory_permits_controller_requests(or_options_t *options)
+{
+ return options->DirPort != 0;
+}
+
+/********************************************************************/
+
/* Used only by non-v1-auth dirservers: The v1 directory and
* runningrouters we'll serve when requested. */
static cached_dir_t *cached_directory = NULL;