Tor 0.4.9.13
Loading...
Searching...
No Matches
dirvote.h File Reference

Header file for dirvote.c. More...

Go to the source code of this file.

Macros

#define MIN_VOTE_SECONDS   2
 
#define MIN_VOTE_SECONDS_TESTING   2
 
#define MIN_DIST_SECONDS   2
 
#define MIN_DIST_SECONDS_TESTING   2
 
#define MIN_VOTE_INTERVAL   300
 
#define MIN_VOTE_INTERVAL_TESTING    (((MIN_VOTE_SECONDS_TESTING)+(MIN_DIST_SECONDS_TESTING)+1)*2)
 
#define MIN_VOTE_INTERVAL_TESTING_INITIAL    ((MIN_VOTE_SECONDS_TESTING)+(MIN_DIST_SECONDS_TESTING)+1)
 
#define MIN_SUPPORTED_CONSENSUS_METHOD   32
 
#define MAX_SUPPORTED_CONSENSUS_METHOD   36
 
#define MIN_METHOD_TO_SUPPRESS_MD_PUBLISHED   33
 
#define MIN_METHOD_TO_OMIT_PACKAGE_FINGERPRINTS   34
 
#define MIN_METHOD_FOR_FAMILY_IDS   35
 
#define MIN_METHOD_TO_PERMIT_ABSENT_TAP_KEYS   36
 
#define DEFAULT_MAX_UNMEASURED_BW_KB   20
 
#define DGV_BY_ID   1
 
#define DGV_INCLUDE_PENDING   2
 
#define DGV_INCLUDE_PREVIOUS   4
 
#define MAX_BW_FILE_HEADERS_LINE_LEN   1024
 

Functions

static time_t dirvote_act (const or_options_t *options, time_t now)
 
static void dirvote_free_all (void)
 
static void dirvote_parse_sr_commits (networkstatus_t *ns, const smartlist_t *tokens)
 
static void dirvote_clear_commits (networkstatus_t *ns)
 
static void dirvote_dirreq_get_status_vote (const char *url, smartlist_t *items, smartlist_t *dir_items)
 
static struct pending_vote_t * dirvote_add_vote (const char *vote_body, time_t time_posted, const char *where_from, const char **msg_out, int *status_out)
 
static int dirvote_add_signatures (const char *detached_signatures_body, const char *source, const char **msg_out)
 
const char * dirvote_get_pending_consensus (consensus_flavor_t flav)
 
uint32_t dirserv_get_bandwidth_for_router_kb (const routerinfo_t *ri)
 
const char * dirvote_get_pending_detached_signatures (void)
 
const cached_dir_t * dirvote_get_vote (const char *fp, int flags)
 
networkstatus_t * dirserv_generate_networkstatus_vote_obj (crypto_pk_t *private_key, authority_cert_t *cert)
 
vote_microdesc_hash_t * dirvote_format_all_microdesc_vote_lines (const routerinfo_t *ri, time_t now, smartlist_t *microdescriptors_out)
 

Variables

const char DIRVOTE_UNIVERSAL_FLAGS []
 
const char DIRVOTE_OPTIONAL_FLAGS []
 

Detailed Description

Header file for dirvote.c.

Definition in file dirvote.h.

Macro Definition Documentation

◆ DEFAULT_MAX_UNMEASURED_BW_KB

#define DEFAULT_MAX_UNMEASURED_BW_KB   20

Default bandwidth to clip unmeasured bandwidths to using method >= MIN_METHOD_TO_CLIP_UNMEASURED_BW. (This is not a consensus method; do not get confused with the above macros.)

Definition at line 86 of file dirvote.h.

Referenced by networkstatus_compute_consensus().

◆ DGV_BY_ID

#define DGV_BY_ID   1

Definition at line 89 of file dirvote.h.

◆ DGV_INCLUDE_PENDING

#define DGV_INCLUDE_PENDING   2

Definition at line 90 of file dirvote.h.

◆ DGV_INCLUDE_PREVIOUS

#define DGV_INCLUDE_PREVIOUS   4

Definition at line 91 of file dirvote.h.

◆ MAX_BW_FILE_HEADERS_LINE_LEN

#define MAX_BW_FILE_HEADERS_LINE_LEN   1024

Maximum size of a line in a vote.

Definition at line 94 of file dirvote.h.

Referenced by format_networkstatus_vote().

◆ MAX_SUPPORTED_CONSENSUS_METHOD

#define MAX_SUPPORTED_CONSENSUS_METHOD   36

The highest consensus method that we currently support.

Definition at line 56 of file dirvote.h.

Referenced by consensus_method_is_supported(), format_networkstatus_vote(), and networkstatus_compute_consensus().

◆ MIN_DIST_SECONDS

#define MIN_DIST_SECONDS   2

Lowest allowable value for DistSeconds.

Definition at line 32 of file dirvote.h.

Referenced by networkstatus_compute_consensus(), networkstatus_parse_vote_from_string(), and options_validate_dirauth_schedule().

◆ MIN_DIST_SECONDS_TESTING

#define MIN_DIST_SECONDS_TESTING   2

Lowest allowable value for DistSeconds when TestingTorNetwork is 1

Definition at line 34 of file dirvote.h.

Referenced by options_validate_dirauth_schedule(), and options_validate_dirauth_testing().

◆ MIN_METHOD_FOR_FAMILY_IDS

#define MIN_METHOD_FOR_FAMILY_IDS   35

Lowest supported consensus method for which we include family-ids in microdescs.

Definition at line 74 of file dirvote.h.

Referenced by dirvote_create_microdescriptor(), and warn_about_family_id_config().

◆ MIN_METHOD_TO_OMIT_PACKAGE_FINGERPRINTS

#define MIN_METHOD_TO_OMIT_PACKAGE_FINGERPRINTS   34

Lowest (supported) consensus method for which we do not include any "package" lines.

Definition at line 68 of file dirvote.h.

Referenced by networkstatus_compute_consensus().

◆ MIN_METHOD_TO_PERMIT_ABSENT_TAP_KEYS

#define MIN_METHOD_TO_PERMIT_ABSENT_TAP_KEYS   36

Lowest supported consensus method for which we will generate microdescriptors without TAP keys when the corresponding router descriptors have no TAP keys.

Definition at line 81 of file dirvote.h.

Referenced by consensus_method_is_supported(), and dirvote_create_microdescriptor().

◆ MIN_METHOD_TO_SUPPRESS_MD_PUBLISHED

#define MIN_METHOD_TO_SUPPRESS_MD_PUBLISHED   33

Lowest consensus method for which we suppress the published time in microdescriptor consensuses.

Definition at line 62 of file dirvote.h.

Referenced by networkstatus_compute_consensus().

◆ MIN_SUPPORTED_CONSENSUS_METHOD

#define MIN_SUPPORTED_CONSENSUS_METHOD   32

The lowest consensus method that we currently support.

Definition at line 53 of file dirvote.h.

Referenced by consensus_method_is_supported(), and format_networkstatus_vote().

◆ MIN_VOTE_INTERVAL

#define MIN_VOTE_INTERVAL   300

Lowest allowable voting interval.

Definition at line 37 of file dirvote.h.

Referenced by networkstatus_compute_consensus(), networkstatus_parse_vote_from_string(), and options_validate_dirauth_schedule().

◆ MIN_VOTE_INTERVAL_TESTING

#define MIN_VOTE_INTERVAL_TESTING    (((MIN_VOTE_SECONDS_TESTING)+(MIN_DIST_SECONDS_TESTING)+1)*2)

Lowest allowable voting interval when TestingTorNetwork is 1: Voting Interval can be: 10, 12, 15, 18, 20, 24, 25, 30, 36, 40, 45, 50, 60, ... Testing Initial Voting Interval can be: 5, 6, 8, 9, or any of the possible values for Voting Interval, as they both need to evenly divide 30 minutes. If clock desynchronisation is an issue, use an interval of at least: 18 * drift in seconds, to allow for a clock slop factor

Definition at line 46 of file dirvote.h.

Referenced by networkstatus_compute_consensus(), networkstatus_parse_vote_from_string(), and options_validate_dirauth_schedule().

◆ MIN_VOTE_INTERVAL_TESTING_INITIAL

#define MIN_VOTE_INTERVAL_TESTING_INITIAL    ((MIN_VOTE_SECONDS_TESTING)+(MIN_DIST_SECONDS_TESTING)+1)

Definition at line 49 of file dirvote.h.

◆ MIN_VOTE_SECONDS

#define MIN_VOTE_SECONDS   2

Lowest allowable value for VoteSeconds.

Definition at line 27 of file dirvote.h.

Referenced by networkstatus_compute_consensus(), networkstatus_parse_vote_from_string(), and options_validate_dirauth_schedule().

◆ MIN_VOTE_SECONDS_TESTING

#define MIN_VOTE_SECONDS_TESTING   2

Lowest allowable value for VoteSeconds when TestingTorNetwork is 1

Definition at line 29 of file dirvote.h.

Referenced by options_validate_dirauth_schedule(), and options_validate_dirauth_testing().

Function Documentation

◆ dirserv_generate_networkstatus_vote_obj()

networkstatus_t * dirserv_generate_networkstatus_vote_obj ( crypto_pk_t * private_key,
authority_cert_t * cert )

Return a new networkstatus_t* containing our current opinion. (For v3 authorities)

Definition at line 4655 of file dirvote.c.

Referenced by dirvote_perform_vote().

◆ dirserv_get_bandwidth_for_router_kb()

uint32_t dirserv_get_bandwidth_for_router_kb ( const routerinfo_t * ri)

Get the best estimate of a router's bandwidth for dirauth purposes, preferring measured to advertised values if available.

Definition at line 4280 of file dirvote.c.

Referenced by compare_routerinfo_usefulness().

◆ dirvote_act()

static time_t dirvote_act ( const or_options_t * options,
time_t now )
inlinestatic

Definition at line 131 of file dirvote.h.

◆ dirvote_add_signatures()

static int dirvote_add_signatures ( const char * detached_signatures_body,
const char * source,
const char ** msg_out )
inlinestatic

Definition at line 186 of file dirvote.h.

◆ dirvote_add_vote()

static struct pending_vote_t * dirvote_add_vote ( const char * vote_body,
time_t time_posted,
const char * where_from,
const char ** msg_out,
int * status_out )
inlinestatic

Definition at line 166 of file dirvote.h.

◆ dirvote_clear_commits()

static void dirvote_clear_commits ( networkstatus_t * ns)
inlinestatic

Definition at line 151 of file dirvote.h.

◆ dirvote_dirreq_get_status_vote()

static void dirvote_dirreq_get_status_vote ( const char * url,
smartlist_t * items,
smartlist_t * dir_items )
inlinestatic

Definition at line 157 of file dirvote.h.

◆ dirvote_format_all_microdesc_vote_lines()

vote_microdesc_hash_t * dirvote_format_all_microdesc_vote_lines ( const routerinfo_t * ri,
time_t now,
smartlist_t * microdescriptors_out )

Generate and return a linked list of all the lines that should appear to describe a router's microdescriptor versions in a directory vote. Add the generated microdescriptors to microdescriptors_out.

Definition at line 4080 of file dirvote.c.

Referenced by dirserv_generate_networkstatus_vote_obj().

◆ dirvote_free_all()

static void dirvote_free_all ( void )
inlinestatic

Definition at line 139 of file dirvote.h.

◆ dirvote_get_pending_consensus()

const char * dirvote_get_pending_consensus ( consensus_flavor_t flav)

Return the body of the consensus that we're currently trying to build.

Definition at line 3848 of file dirvote.c.

◆ dirvote_get_pending_detached_signatures()

const char * dirvote_get_pending_detached_signatures ( void )

Return the signatures that we know for the consensus that we're currently trying to build.

Definition at line 3857 of file dirvote.c.

◆ dirvote_get_vote()

const cached_dir_t * dirvote_get_vote ( const char * fp,
int flags )

Return a given vote specified by fp. If by_id, return the vote for the authority with the v3 authority identity key digest fp; if by_id is false, return the vote whose digest is fp. If fp is NULL, return our own vote. If include_previous is false, do not consider any votes for a consensus that's already been built. If include_pending is false, do not consider any votes for the consensus that's in progress. May return NULL if we have no vote for the authority in question.

Definition at line 3871 of file dirvote.c.

Referenced by dirvote_fetch_missing_votes().

◆ dirvote_parse_sr_commits()

static void dirvote_parse_sr_commits ( networkstatus_t * ns,
const smartlist_t * tokens )
inlinestatic

Definition at line 144 of file dirvote.h.

Variable Documentation

◆ DIRVOTE_OPTIONAL_FLAGS

const char DIRVOTE_OPTIONAL_FLAGS[]
extern

Space-separated list of all flags that we may or may not vote on, depending on our configuration.

Definition at line 4647 of file dirvote.c.

◆ DIRVOTE_UNIVERSAL_FLAGS

const char DIRVOTE_UNIVERSAL_FLAGS[]
extern

Space-separated list of all the flags that we will always vote on.

Definition at line 4634 of file dirvote.c.

Referenced by dirserv_generate_networkstatus_vote_obj().