r17909@catbus: nickm | 2008-02-05 14:48:22 -0500

As planned, rename networkstatus_vote_t to networkstatus_t, now that v3 networkstatuses are working and standard and v2 networkstatuses are obsolete.


svn:r13383
This commit is contained in:
Nick Mathewson 2008-02-05 21:39:29 +00:00
parent a51deb9a9c
commit c8a689c9e8
11 changed files with 93 additions and 95 deletions

View File

@ -1684,7 +1684,7 @@ getinfo_helper_events(control_connection_t *control_conn,
check_whether_dirport_reachable() ? 1 : 0);
} else if (!strcmpstart(question, "status/version/")) {
int is_server = server_mode(get_options());
networkstatus_vote_t *c = networkstatus_get_latest_consensus();
networkstatus_t *c = networkstatus_get_latest_consensus();
version_status_t status;
const char *recommended;
if (c) {

View File

@ -323,7 +323,7 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
}
if (DIR_PURPOSE_FETCH_CONSENSUS) {
networkstatus_vote_t *v = networkstatus_get_latest_consensus();
networkstatus_t *v = networkstatus_get_latest_consensus();
if (v)
if_modified_since = v->valid_after + 180;
}
@ -2272,7 +2272,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
else
request_type = "/tor/status/?";
} else {
networkstatus_vote_t *v = networkstatus_get_latest_consensus();
networkstatus_t *v = networkstatus_get_latest_consensus();
time_t now = time(NULL);
smartlist_add(dir_fps, tor_memdup("\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0", 20));

View File

@ -2105,14 +2105,14 @@ router_clear_status_flags(routerinfo_t *router)
* information is not accurate. */
#define DIRSERV_TIME_TO_GET_REACHABILITY_INFO (30*60)
/** Return a new networkstatus_vote_t* containing our current opinion. (For v3
/** Return a new networkstatus_t* containing our current opinion. (For v3
* authorities) */
networkstatus_vote_t *
networkstatus_t *
dirserv_generate_networkstatus_vote_obj(crypto_pk_env_t *private_key,
authority_cert_t *cert)
{
or_options_t *options = get_options();
networkstatus_vote_t *v3_out = NULL;
networkstatus_t *v3_out = NULL;
uint32_t addr;
char *hostname = NULL, *client_versions = NULL, *server_versions = NULL;
const char *contact;
@ -2206,14 +2206,14 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_env_t *private_key,
smartlist_free(routers);
digestmap_free(omit_as_sybil, NULL);
v3_out = tor_malloc_zero(sizeof(networkstatus_vote_t));
v3_out = tor_malloc_zero(sizeof(networkstatus_t));
v3_out->is_vote = 1;
dirvote_get_preferred_voting_intervals(&timing);
v3_out->published = now;
{
char tbuf[ISO_TIME_LEN+1];
networkstatus_vote_t *current_consensus =
networkstatus_t *current_consensus =
networkstatus_get_live_consensus(now);
time_t last_consensus_interval; /* only used to pick a valid_after */
if (current_consensus)

View File

@ -34,7 +34,7 @@ static int dirvote_publish_consensus(void);
* For v3 authorities. */
char *
format_networkstatus_vote(crypto_pk_env_t *private_signing_key,
networkstatus_vote_t *v3_ns)
networkstatus_t *v3_ns)
{
/** Longest status flag name that we generate. */
#define LONGEST_STATUS_FLAG_NAME_LEN 9
@ -188,7 +188,7 @@ format_networkstatus_vote(crypto_pk_env_t *private_signing_key,
}
{
networkstatus_vote_t *v;
networkstatus_t *v;
if (!(v = networkstatus_parse_vote_from_string(status, NULL, 1))) {
log_err(LD_BUG,"Generated a networkstatus vote we couldn't parse: "
"<<%s>>", status);
@ -213,7 +213,7 @@ format_networkstatus_vote(crypto_pk_env_t *private_signing_key,
/** Given a vote <b>vote</b> (not a consensus!), return its associated
* networkstatus_voter_info_t. */
static networkstatus_voter_info_t *
get_voter(const networkstatus_vote_t *vote)
get_voter(const networkstatus_t *vote)
{
tor_assert(vote);
tor_assert(vote->is_vote);
@ -222,12 +222,12 @@ get_voter(const networkstatus_vote_t *vote)
return smartlist_get(vote->voters, 0);
}
/** Helper for sorting networkstatus_vote_t votes (not consensuses) by the
/** Helper for sorting networkstatus_t votes (not consensuses) by the
* hash of their voters' identity digests. */
static int
_compare_votes_by_authority_id(const void **_a, const void **_b)
{
const networkstatus_vote_t *a = *_a, *b = *_b;
const networkstatus_t *a = *_a, *b = *_b;
return memcmp(get_voter(a)->identity_digest,
get_voter(b)->identity_digest, DIGEST_LEN);
}
@ -396,7 +396,7 @@ compute_consensus_method(smartlist_t *votes)
int min = (smartlist_len(votes) * 2) / 3;
int n_ok;
int result;
SMARTLIST_FOREACH(votes, networkstatus_vote_t *, vote,
SMARTLIST_FOREACH(votes, networkstatus_t *, vote,
{
tor_assert(vote->supported_methods);
smartlist_add_all(tmp, vote->supported_methods);
@ -428,7 +428,7 @@ consensus_method_is_supported(int method)
return (method >= 1) && (method <= 2);
}
/** Given a list of vote networkstatus_vote_t in <b>votes</b>, our public
/** Given a list of vote networkstatus_t in <b>votes</b>, our public
* authority <b>identity_key</b>, our private authority <b>signing_key</b>,
* and the number of <b>total_authorities</b> that we believe exist in our
* voting quorum, generate the text of a new v3 consensus vote, and return the
@ -482,7 +482,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
smartlist_t *combined_client_versions = smartlist_create();
smartlist_t *combined_server_versions = smartlist_create();
int j;
SMARTLIST_FOREACH(votes, networkstatus_vote_t *, v,
SMARTLIST_FOREACH(votes, networkstatus_t *, v,
{
tor_assert(v->is_vote);
va_times[v_sl_idx] = v->valid_after;
@ -590,7 +590,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
/* Sort the votes. */
smartlist_sort(votes, _compare_votes_by_authority_id);
/* Add the authority sections. */
SMARTLIST_FOREACH(votes, networkstatus_vote_t *, v,
SMARTLIST_FOREACH(votes, networkstatus_t *, v,
{
char buf[1024];
struct in_addr in;
@ -658,7 +658,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
chosen_unnamed_idx = smartlist_string_pos(flags, "Unnamed");
/* Build the flag index. */
SMARTLIST_FOREACH(votes, networkstatus_vote_t *, v,
SMARTLIST_FOREACH(votes, networkstatus_t *, v,
{
flag_map[v_sl_idx] = tor_malloc_zero(
sizeof(int)*smartlist_len(v->known_flags));
@ -679,7 +679,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
/* Named and Unnamed get treated specially */
if (consensus_method >= 2) {
SMARTLIST_FOREACH(votes, networkstatus_vote_t *, v,
SMARTLIST_FOREACH(votes, networkstatus_t *, v,
{
uint64_t nf;
if (named_flag[v_sl_idx]<0)
@ -703,7 +703,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
}
});
});
SMARTLIST_FOREACH(votes, networkstatus_vote_t *, v,
SMARTLIST_FOREACH(votes, networkstatus_t *, v,
{
uint64_t uf;
if (unnamed_flag[v_sl_idx]<0)
@ -744,7 +744,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
char buf[256];
/* Of the next-to-be-considered digest in each voter, which is first? */
SMARTLIST_FOREACH(votes, networkstatus_vote_t *, v, {
SMARTLIST_FOREACH(votes, networkstatus_t *, v, {
if (index[v_sl_idx] < size[v_sl_idx]) {
rs = smartlist_get(v->routerstatus_list, index[v_sl_idx]);
if (!lowest_id ||
@ -761,7 +761,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
smartlist_clear(versions);
/* Okay, go through all the entries for this digest. */
SMARTLIST_FOREACH(votes, networkstatus_vote_t *, v, {
SMARTLIST_FOREACH(votes, networkstatus_t *, v, {
if (index[v_sl_idx] >= size[v_sl_idx])
continue; /* out of entries. */
rs = smartlist_get(v->routerstatus_list, index[v_sl_idx]);
@ -924,7 +924,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
smartlist_free(chunks);
{
networkstatus_vote_t *c;
networkstatus_t *c;
if (!(c = networkstatus_parse_vote_from_string(result, NULL, 0))) {
log_err(LD_BUG,"Generated a networkstatus consensus we couldn't "
"parse.");
@ -946,7 +946,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
* changed, or -1 if the document signed by <b>sigs</b> isn't the same
* document as <b>target</b>. */
int
networkstatus_add_detached_signatures(networkstatus_vote_t *target,
networkstatus_add_detached_signatures(networkstatus_t *target,
ns_detached_signatures_t *sigs,
const char **msg_out)
{
@ -1035,7 +1035,7 @@ networkstatus_add_detached_signatures(networkstatus_vote_t *target,
/** Return a newly allocated string holding the detached-signatures document
* corresponding to the signatures on <b>consensus</b>. */
char *
networkstatus_get_detached_signatures(networkstatus_vote_t *consensus)
networkstatus_get_detached_signatures(networkstatus_t *consensus)
{
smartlist_t *elements;
char buf[4096];
@ -1220,7 +1220,7 @@ dirvote_recalculate_timing(or_options_t *options, time_t now)
int interval, vote_delay, dist_delay;
time_t start;
time_t end;
networkstatus_vote_t *consensus;
networkstatus_t *consensus;
if (!authdir_mode_v3(options))
return;
@ -1315,12 +1315,12 @@ dirvote_act(or_options_t *options, time_t now)
}
}
/** A vote networkstatus_vote_t and its unparsed body: held around so we can
/** A vote networkstatus_t and its unparsed body: held around so we can
* use it to generate a consensus (at voting_ends) and so we can serve it to
* other authorities that might want it. */
typedef struct pending_vote_t {
cached_dir_t *vote_body;
networkstatus_vote_t *vote;
networkstatus_t *vote;
} pending_vote_t;
/** List of pending_vote_t for the current vote. Before we've used them to
@ -1336,7 +1336,7 @@ static char *pending_consensus_body = NULL;
* building. */
static char *pending_consensus_signatures = NULL;
/** The parsed in-progress consensus document. */
static networkstatus_vote_t *pending_consensus = NULL;
static networkstatus_t *pending_consensus = NULL;
/** List of ns_detached_signatures_t: hold signatures that get posted to us
* before we have generated the consensus on our own. */
static smartlist_t *pending_consensus_signature_list = NULL;
@ -1348,7 +1348,7 @@ dirvote_perform_vote(void)
{
crypto_pk_env_t *key = get_my_v3_authority_signing_key();
authority_cert_t *cert = get_my_v3_authority_cert();
networkstatus_vote_t *ns;
networkstatus_t *ns;
char *contents;
pending_vote_t *pending_vote;
@ -1507,7 +1507,7 @@ list_v3_auth_ids(void)
pending_vote_t *
dirvote_add_vote(const char *vote_body, const char **msg_out, int *status_out)
{
networkstatus_vote_t *vote;
networkstatus_t *vote;
networkstatus_voter_info_t *vi;
trusted_dir_server_t *ds;
pending_vote_t *pending_vote = NULL;
@ -1664,7 +1664,7 @@ dirvote_compute_consensus(void)
int n_votes, n_voters;
smartlist_t *votes = NULL;
char *consensus_body = NULL, *signatures = NULL;
networkstatus_vote_t *consensus = NULL;
networkstatus_t *consensus = NULL;
authority_cert_t *my_cert;
if (!pending_vote_list)
@ -1813,7 +1813,7 @@ dirvote_add_signatures_to_pending_consensus(
{
ns_detached_signatures_t *sigs =
networkstatus_parse_detached_signatures(new_detached, NULL);
networkstatus_vote_t *v = networkstatus_parse_vote_from_string(
networkstatus_t *v = networkstatus_parse_vote_from_string(
pending_consensus_body, NULL, 0);
tor_assert(sigs);
ns_detached_signatures_free(sigs);

View File

@ -936,7 +936,7 @@ run_scheduled_events(time_t now)
/* 1f. Check whether our networkstatus has expired.
*/
if (time_to_check_for_expired_networkstatus < now) {
networkstatus_vote_t *ns = networkstatus_get_latest_consensus();
networkstatus_t *ns = networkstatus_get_latest_consensus();
/*XXXX020 this value needs to be the same as REASONABLY_LIVE_TIME in
* networkstatus_get_reasonably_live_consensus(), but that value is way
* way too high. Arma: is the bridge issue there resolved yet? -NM */

View File

@ -33,11 +33,11 @@ static strmap_t *named_server_map = NULL;
static strmap_t *unnamed_server_map = NULL;
/** Most recently received and validated v3 consensus network status. */
static networkstatus_vote_t *current_consensus = NULL;
static networkstatus_t *current_consensus = NULL;
/** A v3 consensus networkstatus that we've received, but which we don't
* have enough certificates to be happy about. */
static networkstatus_vote_t *consensus_waiting_for_certs = NULL;
static networkstatus_t *consensus_waiting_for_certs = NULL;
static char *consensus_waiting_for_certs_body = NULL;
static time_t consensus_waiting_for_certs_set_at = 0;
static int consensus_waiting_for_certs_dl_failed = 0;
@ -263,7 +263,7 @@ networkstatus_v2_free(networkstatus_v2_t *ns)
/** Clear all storage held in <b>ns</b>. */
void
networkstatus_vote_free(networkstatus_vote_t *ns)
networkstatus_vote_free(networkstatus_t *ns)
{
if (!ns)
return;
@ -317,7 +317,7 @@ networkstatus_vote_free(networkstatus_vote_t *ns)
* is <b>identity</b>, or NULL if no such voter is associated with
* <b>vote</b>. */
networkstatus_voter_info_t *
networkstatus_get_voter_by_id(networkstatus_vote_t *vote,
networkstatus_get_voter_by_id(networkstatus_t *vote,
const char *identity)
{
if (!vote || !vote->voters)
@ -334,7 +334,7 @@ networkstatus_get_voter_by_id(networkstatus_vote_t *vote,
* <b>voter</b>, and return 0. */
/* (private; exposed for testing.) */
int
networkstatus_check_voter_signature(networkstatus_vote_t *consensus,
networkstatus_check_voter_signature(networkstatus_t *consensus,
networkstatus_voter_info_t *voter,
authority_cert_t *cert)
{
@ -370,7 +370,7 @@ networkstatus_check_voter_signature(networkstatus_vote_t *consensus,
* about every problem; if warn is at least 1, warn only if we can't get
* enough signatures; if warn is negative, log nothing at all. */
int
networkstatus_check_consensus_signature(networkstatus_vote_t *consensus,
networkstatus_check_consensus_signature(networkstatus_t *consensus,
int warn)
{
int n_good = 0;
@ -777,7 +777,7 @@ networkstatus_v2_find_entry(networkstatus_v2_t *ns, const char *digest)
/** Return the entry in <b>ns</b> for the identity digest <b>digest</b>, or
* NULL if none was found. */
routerstatus_t *
networkstatus_vote_find_entry(networkstatus_vote_t *ns, const char *digest)
networkstatus_vote_find_entry(networkstatus_t *ns, const char *digest)
{
return smartlist_bsearch(ns->routerstatus_list, digest,
_compare_digest_to_routerstatus_entry);
@ -786,7 +786,7 @@ networkstatus_vote_find_entry(networkstatus_vote_t *ns, const char *digest)
/*XXXX020 make this static once functions are moved into this file. */
/** DOCDOC */
int
networkstatus_vote_find_entry_idx(networkstatus_vote_t *ns,
networkstatus_vote_find_entry_idx(networkstatus_t *ns,
const char *digest, int *found_out)
{
return smartlist_bsearch_idx(ns->routerstatus_list, digest,
@ -1079,7 +1079,7 @@ void
update_consensus_networkstatus_fetch_time(time_t now)
{
or_options_t *options = get_options();
networkstatus_vote_t *c = networkstatus_get_live_consensus(now);
networkstatus_t *c = networkstatus_get_live_consensus(now);
if (c) {
long dl_interval;
long interval = c->fresh_until - c->valid_after;
@ -1184,7 +1184,7 @@ networkstatus_v2_get_by_digest(const char *digest)
/** Return the most recent consensus that we have downloaded, or NULL if we
* don't have one. */
networkstatus_vote_t *
networkstatus_t *
networkstatus_get_latest_consensus(void)
{
return current_consensus;
@ -1192,7 +1192,7 @@ networkstatus_get_latest_consensus(void)
/** Return the most recent consensus that we have downloaded, or NULL if it is
* no longer live. */
networkstatus_vote_t *
networkstatus_t *
networkstatus_get_live_consensus(time_t now)
{
if (current_consensus &&
@ -1206,7 +1206,7 @@ networkstatus_get_live_consensus(time_t now)
/* XXXX020 remove this in favor of get_live_consensus. But actually,
* leave something like it for bridge users, who need to not totally
* lose if they spend a while fetching a new consensus. */
networkstatus_vote_t *
networkstatus_t *
networkstatus_get_reasonably_live_consensus(time_t now)
{
#define REASONABLY_LIVE_TIME (24*60*60)
@ -1253,8 +1253,8 @@ routerstatus_has_changed(const routerstatus_t *a, const routerstatus_t *b)
/** Notify controllers of any router status entries that changed between
* <b>old_c</b> and <b>new_c</b>. */
static void
notify_control_networkstatus_changed(const networkstatus_vote_t *old_c,
const networkstatus_vote_t *new_c)
notify_control_networkstatus_changed(const networkstatus_t *old_c,
const networkstatus_t *new_c)
{
int idx = 0;
int old_remain = old_c && smartlist_len(old_c->routerstatus_list);
@ -1292,8 +1292,8 @@ notify_control_networkstatus_changed(const networkstatus_vote_t *old_c,
/** Copy all the ancillary information (like router download status and so on)
* from <b>old_c</b> to <b>new_c</b>. */
static void
networkstatus_copy_old_consensus_info(networkstatus_vote_t *new_c,
const networkstatus_vote_t *old_c)
networkstatus_copy_old_consensus_info(networkstatus_t *new_c,
const networkstatus_t *old_c)
{
int idx = 0;
const routerstatus_t *rs_old;
@ -1344,7 +1344,7 @@ networkstatus_copy_old_consensus_info(networkstatus_vote_t *new_c,
int
networkstatus_set_current_consensus(const char *consensus, unsigned flags)
{
networkstatus_vote_t *c;
networkstatus_t *c;
int r, result = -1;
time_t now = time(NULL);
char *unverified_fname = NULL, *consensus_fname = NULL;
@ -1526,7 +1526,7 @@ routers_update_all_from_networkstatus(time_t now, int dir_version)
{
routerinfo_t *me;
routerlist_t *rl = router_get_routerlist();
networkstatus_vote_t *consensus = networkstatus_get_live_consensus(now);
networkstatus_t *consensus = networkstatus_get_live_consensus(now);
or_options_t *options = get_options();
if (networkstatus_v2_list_has_changed)
@ -1675,7 +1675,7 @@ routers_update_status_from_consensus_networkstatus(smartlist_t *routers,
or_options_t *options = get_options();
int authdir = authdir_mode_v2(options) || authdir_mode_v3(options);
int namingdir = authdir && options->NamingAuthoritativeDir;
networkstatus_vote_t *ns = current_consensus;
networkstatus_t *ns = current_consensus;
int idx;
if (!ns || !smartlist_len(ns->routerstatus_list))
return;
@ -1751,7 +1751,7 @@ routers_update_status_from_consensus_networkstatus(smartlist_t *routers,
void
signed_descs_update_status_from_consensus_networkstatus(smartlist_t *descs)
{
networkstatus_vote_t *ns = current_consensus;
networkstatus_t *ns = current_consensus;
if (!ns)
return;

View File

@ -1436,7 +1436,7 @@ typedef struct vote_routerstatus_t {
routerstatus_t status; /**< Underlying 'status' object for this router.
* Flags are redundant. */
uint64_t flags; /**< Bit-field for all recognized flags; index into
* networkstatus_vote_t.known_flags. */
* networkstatus_t.known_flags. */
char *version; /**< The version that the authority says this router is
* running. */
} vote_routerstatus_t;
@ -1463,11 +1463,9 @@ typedef struct networkstatus_voter_info_t {
* the sig, and we know it's bad. */
} networkstatus_voter_info_t;
/** A common structure to hold a v2 network status vote, or a v2 network
/** A common structure to hold a v3 network status vote, or a v3 network
* status consensus. */
/* XXXX020 rename to networkstatus_t once it replaces networkstatus_t in
* functionality. */
typedef struct networkstatus_vote_t {
typedef struct networkstatus_t {
int is_vote; /**< True if this is a vote; false if it is a consensus. */
time_t published; /**< Vote only: Tiem when vote was written. */
time_t valid_after; /**< Time after which this vote or consensus applies. */
@ -1514,10 +1512,10 @@ typedef struct networkstatus_vote_t {
/** If present, a map from descriptor digest to elements of
* routerstatus_list. */
digestmap_t *desc_digest_map;
} networkstatus_vote_t;
} networkstatus_t;
/** A set of signatures for a networkstatus consensus. All fields are as for
* networkstatus_vote_t. */
* networkstatus_t. */
typedef struct ns_detached_signatures_t {
time_t valid_after;
time_t fresh_until;
@ -3142,10 +3140,10 @@ char *networkstatus_compute_consensus(smartlist_t *votes,
int total_authorities,
crypto_pk_env_t *identity_key,
crypto_pk_env_t *signing_key);
int networkstatus_add_detached_signatures(networkstatus_vote_t *target,
int networkstatus_add_detached_signatures(networkstatus_t *target,
ns_detached_signatures_t *sigs,
const char **msg_out);
char *networkstatus_get_detached_signatures(networkstatus_vote_t *consensus);
char *networkstatus_get_detached_signatures(networkstatus_t *consensus);
void ns_detached_signatures_free(ns_detached_signatures_t *s);
/* cert manipulation */
@ -3184,14 +3182,14 @@ void set_routerstatus_from_routerinfo(routerstatus_t *rs,
int naming, int exits_can_be_guards,
int listbadexits, int listbaddirs);
void router_clear_status_flags(routerinfo_t *ri);
networkstatus_vote_t *
networkstatus_t *
dirserv_generate_networkstatus_vote_obj(crypto_pk_env_t *private_key,
authority_cert_t *cert);
#ifdef DIRVOTE_PRIVATE
char *
format_networkstatus_vote(crypto_pk_env_t *private_key,
networkstatus_vote_t *v3_ns);
networkstatus_t *v3_ns);
#endif
/********************************* dns.c ***************************/
@ -3324,13 +3322,13 @@ int router_reload_v2_networkstatus(void);
int router_reload_consensus_networkstatus(void);
void routerstatus_free(routerstatus_t *rs);
void networkstatus_v2_free(networkstatus_v2_t *ns);
void networkstatus_vote_free(networkstatus_vote_t *ns);
void networkstatus_vote_free(networkstatus_t *ns);
networkstatus_voter_info_t *networkstatus_get_voter_by_id(
networkstatus_vote_t *vote,
networkstatus_t *vote,
const char *identity);
int networkstatus_check_consensus_signature(networkstatus_vote_t *consensus,
int networkstatus_check_consensus_signature(networkstatus_t *consensus,
int warn);
int networkstatus_check_voter_signature(networkstatus_vote_t *consensus,
int networkstatus_check_voter_signature(networkstatus_t *consensus,
networkstatus_voter_info_t *voter,
authority_cert_t *cert);
char *networkstatus_get_cache_filename(const char *identity_digest);
@ -3340,9 +3338,9 @@ int router_set_networkstatus_v2(const char *s, time_t arrived_at,
void networkstatus_v2_list_clean(time_t now);
routerstatus_t *networkstatus_v2_find_entry(networkstatus_v2_t *ns,
const char *digest);
routerstatus_t *networkstatus_vote_find_entry(networkstatus_vote_t *ns,
routerstatus_t *networkstatus_vote_find_entry(networkstatus_t *ns,
const char *digest);
int networkstatus_vote_find_entry_idx(networkstatus_vote_t *ns,
int networkstatus_vote_find_entry_idx(networkstatus_t *ns,
const char *digest, int *found_out);
const smartlist_t *networkstatus_get_v2_list(void);
download_status_t *router_get_dl_status_by_descriptor_digest(const char *d);
@ -3359,9 +3357,9 @@ int should_delay_dir_fetches(or_options_t *options);
void update_networkstatus_downloads(time_t now);
void update_certificate_downloads(time_t now);
networkstatus_v2_t *networkstatus_v2_get_by_digest(const char *digest);
networkstatus_vote_t *networkstatus_get_latest_consensus(void);
networkstatus_vote_t *networkstatus_get_live_consensus(time_t now);
networkstatus_vote_t *networkstatus_get_reasonably_live_consensus(time_t now);
networkstatus_t *networkstatus_get_latest_consensus(void);
networkstatus_t *networkstatus_get_live_consensus(time_t now);
networkstatus_t *networkstatus_get_reasonably_live_consensus(time_t now);
#define NSSET_FROM_CACHE 1
#define NSSET_WAS_WAITING_FOR_CERTS 2
#define NSSET_DONT_DOWNLOAD_CERTS 4
@ -3844,7 +3842,7 @@ authority_cert_t *authority_cert_get_by_digests(const char *id_digest,
const char *sk_digest);
void authority_cert_get_all(smartlist_t *certs_out);
void authority_cert_dl_failed(const char *id_digest, int status);
void authority_certs_fetch_missing(networkstatus_vote_t *status, time_t now);
void authority_certs_fetch_missing(networkstatus_t *status, time_t now);
int router_reload_router_list(void);
smartlist_t *router_get_trusted_dir_servers(void);
@ -4016,7 +4014,7 @@ void assert_addr_policy_ok(smartlist_t *t);
void dump_distinct_digest_count(int severity);
networkstatus_v2_t *networkstatus_v2_parse_from_string(const char *s);
networkstatus_vote_t *networkstatus_parse_vote_from_string(const char *s,
networkstatus_t *networkstatus_parse_vote_from_string(const char *s,
const char **eos_out,
int is_vote);
ns_detached_signatures_t *networkstatus_parse_detached_signatures(

View File

@ -1123,7 +1123,7 @@ upload_service_descriptor(rend_service_t *service)
/* Upload v2 descriptor? */
if (service->descriptor_version == 2 &&
get_options()->PublishHidServDescriptors) {
networkstatus_vote_t *c = networkstatus_get_latest_consensus();
networkstatus_t *c = networkstatus_get_latest_consensus();
if (c && smartlist_len(c->routerstatus_list) > 0) {
int seconds_valid;
smartlist_t *descs = smartlist_create();

View File

@ -366,7 +366,7 @@ authority_cert_dl_failed(const char *id_digest, int status)
* already have.
**/
void
authority_certs_fetch_missing(networkstatus_vote_t *status, time_t now)
authority_certs_fetch_missing(networkstatus_t *status, time_t now)
{
digestmap_t *pending;
smartlist_t *missing_digests;
@ -924,7 +924,7 @@ router_pick_directory_server_impl(authority_type_t type, int flags)
smartlist_t *trusted_direct, *trusted_tunnel;
smartlist_t *overloaded_direct, *overloaded_tunnel;
time_t now = time(NULL);
const networkstatus_vote_t *consensus = networkstatus_get_latest_consensus();
const networkstatus_t *consensus = networkstatus_get_latest_consensus();
int requireother = ! (flags & PDS_ALLOW_SELF);
int fascistfirewall = ! (flags & PDS_IGNORE_FASCISTFIREWALL);
int prefer_tunnel = (flags & _PDS_PREFER_TUNNELED_DIR_CONNS);
@ -2695,7 +2695,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
int authdir = authdir_mode_handles_descs(get_options(), router->purpose);
int authdir_believes_valid = 0;
routerinfo_t *old_router;
networkstatus_vote_t *consensus = networkstatus_get_latest_consensus();
networkstatus_t *consensus = networkstatus_get_latest_consensus();
const smartlist_t *networkstatus_v2_list = networkstatus_get_v2_list();
int in_consensus = 0;
@ -2992,7 +2992,7 @@ routerlist_remove_old_routers(void)
signed_descriptor_t *sd;
digestmap_t *retain;
int caches = directory_caches_dir_info(get_options());
const networkstatus_vote_t *consensus = networkstatus_get_latest_consensus();
const networkstatus_t *consensus = networkstatus_get_latest_consensus();
const smartlist_t *networkstatus_v2_list = networkstatus_get_v2_list();
trusted_dirs_remove_old_certs();
@ -3308,7 +3308,7 @@ static int
signed_desc_digest_is_recognized(signed_descriptor_t *desc)
{
routerstatus_t *rs;
networkstatus_vote_t *consensus = networkstatus_get_latest_consensus();
networkstatus_t *consensus = networkstatus_get_latest_consensus();
int caches = directory_caches_dir_info(get_options());
const smartlist_t *networkstatus_v2_list = networkstatus_get_v2_list();
@ -3848,7 +3848,7 @@ update_consensus_router_descriptor_downloads(time_t now)
smartlist_t *no_longer_old = smartlist_create();
smartlist_t *downloadable = smartlist_create();
int authdir = authdir_mode(options);
networkstatus_vote_t *consensus =
networkstatus_t *consensus =
networkstatus_get_reasonably_live_consensus(now);
int n_delayed=0, n_have=0, n_would_reject=0, n_wouldnt_use=0,
n_inprogress=0, n_in_oldrouters=0;
@ -4075,7 +4075,7 @@ update_router_have_minimum_dir_info(void)
time_t now = time(NULL);
int res;
or_options_t *options = get_options();
const networkstatus_vote_t *consensus =
const networkstatus_t *consensus =
networkstatus_get_reasonably_live_consensus(now);
if (!consensus) {
@ -4487,7 +4487,7 @@ hid_serv_get_responsible_directories(smartlist_t *responsible_dirs,
const char *id)
{
int start, found, n_added = 0, i;
networkstatus_vote_t *c = networkstatus_get_latest_consensus();
networkstatus_t *c = networkstatus_get_latest_consensus();
if (!c || !smartlist_len(c->routerstatus_list)) {
log_warn(LD_REND, "We don't have a consensus, so we can't perform v2 "
"rendezvous operations.");
@ -4519,7 +4519,7 @@ int
hid_serv_acting_as_directory(void)
{
routerinfo_t *me = router_get_my_routerinfo();
networkstatus_vote_t *c;
networkstatus_t *c;
routerstatus_t *rs;
if (!me)
return 0;

View File

@ -341,7 +341,7 @@ static token_rule_t ipo_token_table[] = {
END_OF_TABLE
};
static token_rule_t networkstatus_vote_token_table[] = {
static token_rule_t networkstatus_token_table[] = {
T1("network-status-version", K_NETWORK_STATUS_VERSION,
GE(1), NO_OBJ ),
T1("vote-status", K_VOTE_STATUS, GE(1), NO_OBJ ),
@ -1605,7 +1605,7 @@ find_start_of_next_routerstatus(const char *s)
**/
static routerstatus_t *
routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens,
networkstatus_vote_t *vote,
networkstatus_t *vote,
vote_routerstatus_t *vote_rs,
int consensus_method)
{
@ -1950,14 +1950,14 @@ networkstatus_v2_parse_from_string(const char *s)
/** Parse a v3 networkstatus vote (if <b>is_vote</b> is true) or a v3
* networkstatus consensus (if <b>is_vote</b> is false) from <b>s</b>, and
* return the result. Return NULL on failure. */
networkstatus_vote_t *
networkstatus_t *
networkstatus_parse_vote_from_string(const char *s, const char **eos_out,
int is_vote)
{
smartlist_t *tokens = smartlist_create();
smartlist_t *rs_tokens = NULL, *footer_tokens = NULL;
networkstatus_voter_info_t *voter = NULL;
networkstatus_vote_t *ns = NULL;
networkstatus_t *ns = NULL;
char ns_digest[DIGEST_LEN];
const char *cert, *end_of_header, *end_of_footer;
directory_token_t *tok;
@ -1972,13 +1972,13 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out,
end_of_header = find_start_of_next_routerstatus(s);
if (tokenize_string(s, end_of_header, tokens,
is_vote ? networkstatus_vote_token_table :
is_vote ? networkstatus_token_table :
networkstatus_consensus_token_table, 0)) {
log_warn(LD_DIR, "Error tokenizing network-status vote header.");
goto err;
}
ns = tor_malloc_zero(sizeof(networkstatus_vote_t));
ns = tor_malloc_zero(sizeof(networkstatus_t));
memcpy(ns->networkstatus_digest, ns_digest, DIGEST_LEN);
if (is_vote) {

View File

@ -2513,7 +2513,7 @@ test_v3_networkstatus(void)
time_t now = time(NULL);
networkstatus_voter_info_t *voter;
networkstatus_vote_t *vote, *v1, *v2, *v3, *con;
networkstatus_t *vote, *v1, *v2, *v3, *con;
vote_routerstatus_t *vrs;
routerstatus_t *rs;
char *v1_text, *v2_text, *v3_text, *consensus_text, *cp;
@ -2543,7 +2543,7 @@ test_v3_networkstatus(void)
/*
* Set up a vote; generate it; try to parse it.
*/
vote = tor_malloc_zero(sizeof(networkstatus_vote_t));
vote = tor_malloc_zero(sizeof(networkstatus_t));
vote->is_vote = 1;
vote->published = now;
vote->valid_after = now+1000;
@ -2840,7 +2840,7 @@ test_v3_networkstatus(void)
{
char *consensus_text2, *consensus_text3;
networkstatus_vote_t *con2, *con3;
networkstatus_t *con2, *con3;
char *detached_text1, *detached_text2;
ns_detached_signatures_t *dsig1, *dsig2;
const char *msg=NULL;