summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-11-08 14:27:36 -0500
committerNick Mathewson <nickm@torproject.org>2011-05-05 20:54:11 -0400
commit6e58575767929b696035bc8385705ea3aa8b6838 (patch)
treeb2e917b147b275800a4e38efa16fe82f456c1e2c /src/or
parentba1143e4680c9f41c1c2040a1181c522c9bb8e8d (diff)
downloadtor-6e58575767929b696035bc8385705ea3aa8b6838.tar.gz
tor-6e58575767929b696035bc8385705ea3aa8b6838.zip
Automated rename from authority_type_t to dirinfo_type_t
We were already overloading this type to mean "a directory that can serve us X" in addition to "a directory that is an authority for X."
Diffstat (limited to 'src/or')
-rw-r--r--src/or/config.c12
-rw-r--r--src/or/directory.c8
-rw-r--r--src/or/directory.h4
-rw-r--r--src/or/dirserv.c2
-rw-r--r--src/or/or.h6
-rw-r--r--src/or/router.c4
-rw-r--r--src/or/routerlist.c18
-rw-r--r--src/or/routerlist.h10
8 files changed, 32 insertions, 32 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 9636f7f90c..da842da319 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -561,7 +561,7 @@ static void config_register_addressmaps(or_options_t *options);
static int parse_bridge_line(const char *line, int validate_only);
static int parse_dir_server_line(const char *line,
- authority_type_t required_type,
+ dirinfo_type_t required_type,
int validate_only);
static int validate_data_directory(or_options_t *options);
static int write_configuration_file(const char *fname, or_options_t *options);
@@ -801,7 +801,7 @@ escaped_safe_str(const char *address)
/** Add the default directory authorities directly into the trusted dir list,
* but only add them insofar as they share bits with <b>type</b>. */
static void
-add_default_trusted_dir_authorities(authority_type_t type)
+add_default_trusted_dir_authorities(dirinfo_type_t type)
{
int i;
const char *dirservers[] = {
@@ -915,7 +915,7 @@ consider_adding_dir_authorities(or_options_t *options,
if (!options->DirServers) {
/* then we may want some of the defaults */
- authority_type_t type = NO_AUTHORITY;
+ dirinfo_type_t type = NO_AUTHORITY;
if (!options->AlternateBridgeAuthority)
type |= BRIDGE_AUTHORITY;
if (!options->AlternateDirAuthority)
@@ -2848,7 +2848,7 @@ static int
compute_publishserverdescriptor(or_options_t *options)
{
smartlist_t *list = options->PublishServerDescriptor;
- authority_type_t *auth = &options->_PublishServerDescriptor;
+ dirinfo_type_t *auth = &options->_PublishServerDescriptor;
*auth = NO_AUTHORITY;
if (!list) /* empty list, answer is none */
return 0;
@@ -4552,7 +4552,7 @@ parse_bridge_line(const char *line, int validate_only)
* bits it's missing) as a valid authority. Return 0 on success,
* or -1 if the line isn't well-formed or if we can't add it. */
static int
-parse_dir_server_line(const char *line, authority_type_t required_type,
+parse_dir_server_line(const char *line, dirinfo_type_t required_type,
int validate_only)
{
smartlist_t *items = NULL;
@@ -4561,7 +4561,7 @@ parse_dir_server_line(const char *line, authority_type_t required_type,
uint16_t dir_port = 0, or_port = 0;
char digest[DIGEST_LEN];
char v3_digest[DIGEST_LEN];
- authority_type_t type = V2_AUTHORITY;
+ dirinfo_type_t type = V2_AUTHORITY;
int is_not_hidserv_authority = 0, is_not_v2_authority = 0;
items = smartlist_create();
diff --git a/src/or/directory.c b/src/or/directory.c
index 33ebf5263d..3effd37ca4 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -149,7 +149,7 @@ purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose)
/** Return a newly allocated string describing <b>auth</b>. */
char *
-authority_type_to_string(authority_type_t auth)
+dirinfo_type_to_string(dirinfo_type_t auth)
{
char *result;
smartlist_t *lst = smartlist_create();
@@ -280,7 +280,7 @@ directories_have_accepted_server_descriptor(void)
*/
void
directory_post_to_dirservers(uint8_t dir_purpose, uint8_t router_purpose,
- authority_type_t type,
+ dirinfo_type_t type,
const char *payload,
size_t payload_len, size_t extrainfo_len)
{
@@ -328,7 +328,7 @@ directory_post_to_dirservers(uint8_t dir_purpose, uint8_t router_purpose,
NULL, payload, upload_len, 0);
} SMARTLIST_FOREACH_END(ds);
if (!found) {
- char *s = authority_type_to_string(type);
+ char *s = dirinfo_type_to_string(type);
log_warn(LD_DIR, "Publishing server descriptor to directory authorities "
"of type '%s', but no authorities of that type listed!", s);
tor_free(s);
@@ -349,7 +349,7 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
or_options_t *options = get_options();
int prefer_authority = directory_fetches_from_authorities(options);
int get_via_tor = purpose_needs_anonymity(dir_purpose, router_purpose);
- authority_type_t type;
+ dirinfo_type_t type;
time_t if_modified_since = 0;
/* FFFF we could break this switch into its own function, and call
diff --git a/src/or/directory.h b/src/or/directory.h
index e078575503..9f4c31d9f7 100644
--- a/src/or/directory.h
+++ b/src/or/directory.h
@@ -13,9 +13,9 @@
#define _TOR_DIRECTORY_H
int directories_have_accepted_server_descriptor(void);
-char *authority_type_to_string(authority_type_t auth);
+char *dirinfo_type_to_string(dirinfo_type_t auth);
void directory_post_to_dirservers(uint8_t dir_purpose, uint8_t router_purpose,
- authority_type_t type, const char *payload,
+ dirinfo_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,
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 276f61c430..c42c4fec5c 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1552,7 +1552,7 @@ dirserv_pick_cached_dir_obj(cached_dir_t *cache_src,
cached_dir_t *auth_src,
time_t dirty, cached_dir_t *(*regenerate)(void),
const char *name,
- authority_type_t auth_type)
+ dirinfo_type_t auth_type)
{
or_options_t *options = get_options();
int authority = (auth_type == V1_AUTHORITY && authdir_mode_v1(options)) ||
diff --git a/src/or/or.h b/src/or/or.h
index 0becc3cdac..62054a3020 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2107,7 +2107,7 @@ typedef enum {
BRIDGE_AUTHORITY = 1 << 4,
/** Serves extrainfo documents. (XXX Not precisely an authority type)*/
EXTRAINFO_CACHE = 1 << 5,
-} authority_type_t;
+} dirinfo_type_t;
#define CRYPT_PATH_MAGIC 0x70127012u
@@ -2642,7 +2642,7 @@ typedef struct {
* "v1", "v2", "v3", "bridge", or "". */
smartlist_t *PublishServerDescriptor;
/** An authority type, derived from PublishServerDescriptor. */
- authority_type_t _PublishServerDescriptor;
+ dirinfo_type_t _PublishServerDescriptor;
/** Boolean: do we publish hidden service descriptors to the HS auths? */
int PublishHidServDescriptors;
int FetchServerDescriptors; /**< Do we fetch server descriptors as normal? */
@@ -3648,7 +3648,7 @@ typedef struct trusted_dir_server_t {
unsigned int has_accepted_serverdesc:1;
/** What kind of authority is this? (Bitfield.) */
- authority_type_t type;
+ dirinfo_type_t type;
download_status_t v2_ns_dl_status; /**< Status of downloading this server's
* v2 network status. */
diff --git a/src/or/router.c b/src/or/router.c
index 6ecfb86296..5f51935884 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -497,7 +497,7 @@ init_keys(void)
char v3_digest[20];
char *cp;
or_options_t *options = get_options();
- authority_type_t type;
+ dirinfo_type_t type;
time_t now = time(NULL);
trusted_dir_server_t *ds;
int v3_digest_set = 0;
@@ -1195,7 +1195,7 @@ router_upload_dir_desc_to_dirservers(int force)
extrainfo_t *ei;
char *msg;
size_t desc_len, extra_len = 0, total_len;
- authority_type_t auth = get_options()->_PublishServerDescriptor;
+ dirinfo_type_t auth = get_options()->_PublishServerDescriptor;
ri = router_get_my_routerinfo();
if (!ri) {
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index aa7ada99d6..39ff6e0848 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -40,9 +40,9 @@
/* static function prototypes */
static const routerstatus_t *router_pick_directory_server_impl(
- authority_type_t auth, int flags);
+ dirinfo_type_t auth, int flags);
static const routerstatus_t *router_pick_trusteddirserver_impl(
- authority_type_t auth, int flags, int *n_busy_out);
+ dirinfo_type_t auth, int flags, int *n_busy_out);
static void mark_all_trusteddirservers_up(void);
static int router_nickname_matches(const routerinfo_t *router,
const char *nickname);
@@ -109,7 +109,7 @@ static uint64_t sl_last_total_weighted_bw = 0,
/** Return the number of directory authorities whose type matches some bit set
* in <b>type</b> */
int
-get_n_authorities(authority_type_t type)
+get_n_authorities(dirinfo_type_t type)
{
int n = 0;
if (!trusted_dir_servers)
@@ -931,7 +931,7 @@ router_get_trusted_dir_servers(void)
* servers that have returned 503 recently.
*/
const routerstatus_t *
-router_pick_directory_server(authority_type_t type, int flags)
+router_pick_directory_server(dirinfo_type_t type, int flags)
{
const routerstatus_t *choice;
if (get_options()->PreferTunneledDirConns)
@@ -1037,7 +1037,7 @@ trusteddirserver_get_by_v3_auth_digest(const char *digest)
* router_pick_directory_server.
*/
const routerstatus_t *
-router_pick_trusteddirserver(authority_type_t type, int flags)
+router_pick_trusteddirserver(dirinfo_type_t type, int flags)
{
const routerstatus_t *choice;
int busy = 0;
@@ -1073,7 +1073,7 @@ router_pick_trusteddirserver(authority_type_t type, int flags)
* that we can use with BEGINDIR.
*/
static const routerstatus_t *
-router_pick_directory_server_impl(authority_type_t type, int flags)
+router_pick_directory_server_impl(dirinfo_type_t type, int flags)
{
or_options_t *options = get_options();
const node_t *result;
@@ -1192,7 +1192,7 @@ router_pick_directory_server_impl(authority_type_t type, int flags)
* are as for router_pick_directory_server_impl().
*/
static const routerstatus_t *
-router_pick_trusteddirserver_impl(authority_type_t type, int flags,
+router_pick_trusteddirserver_impl(dirinfo_type_t type, int flags,
int *n_busy_out)
{
or_options_t *options = get_options();
@@ -2459,7 +2459,7 @@ router_digest_version_as_new_as(const char *digest, const char *cutoff)
* trusted directory matching at least one bit of <b>type</b>. If <b>type</b>
* is zero, any authority is okay. */
int
-router_digest_is_trusted_dir_type(const char *digest, authority_type_t type)
+router_digest_is_trusted_dir_type(const char *digest, dirinfo_type_t type)
{
if (!trusted_dir_servers)
return 0;
@@ -4049,7 +4049,7 @@ trusted_dir_server_t *
add_trusted_dir_server(const char *nickname, const char *address,
uint16_t dir_port, uint16_t or_port,
const char *digest, const char *v3_auth_digest,
- authority_type_t type)
+ dirinfo_type_t type)
{
trusted_dir_server_t *ent;
uint32_t a;
diff --git a/src/or/routerlist.h b/src/or/routerlist.h
index 794fc0c9d8..987fdf25d3 100644
--- a/src/or/routerlist.h
+++ b/src/or/routerlist.h
@@ -11,7 +11,7 @@
#ifndef _TOR_ROUTERLIST_H
#define _TOR_ROUTERLIST_H
-int get_n_authorities(authority_type_t type);
+int get_n_authorities(dirinfo_type_t type);
int trusted_dirs_reload_certs(void);
int trusted_dirs_load_certs_from_string(const char *contents, int from_store,
int flush);
@@ -27,11 +27,11 @@ int router_reload_router_list(void);
int authority_cert_dl_looks_uncertain(const char *id_digest);
smartlist_t *router_get_trusted_dir_servers(void);
-const routerstatus_t *router_pick_directory_server(authority_type_t type,
+const routerstatus_t *router_pick_directory_server(dirinfo_type_t type,
int flags);
trusted_dir_server_t *router_get_trusteddirserver_by_digest(const char *d);
trusted_dir_server_t *trusteddirserver_get_by_v3_auth_digest(const char *d);
-const routerstatus_t *router_pick_trusteddirserver(authority_type_t type,
+const routerstatus_t *router_pick_trusteddirserver(dirinfo_type_t type,
int flags);
int router_get_my_share_of_directory_requests(double *v2_share_out,
double *v3_share_out);
@@ -58,7 +58,7 @@ const routerinfo_t *router_get_by_nickname(const char *nickname,
int warn_if_unnamed);
int router_digest_version_as_new_as(const char *digest, const char *cutoff);
int router_digest_is_trusted_dir_type(const char *digest,
- authority_type_t type);
+ dirinfo_type_t type);
#define router_digest_is_trusted_dir(d) \
router_digest_is_trusted_dir_type((d), NO_AUTHORITY)
@@ -138,7 +138,7 @@ trusted_dir_server_t *add_trusted_dir_server(const char *nickname,
const char *address,
uint16_t dir_port, uint16_t or_port,
const char *digest, const char *v3_auth_digest,
- authority_type_t type);
+ dirinfo_type_t type);
void authority_cert_free(authority_cert_t *cert);
void clear_trusted_dir_servers(void);
int any_trusted_dir_is_v1_authority(void);