Tor
0.4.7.0-alpha-dev
|
Header file for bwauth.c. More...
Go to the source code of this file.
Macros | |
#define | MAX_BW_FILE_HEADER_COUNT_IN_VOTE 50 |
#define | BW_FILE_HEADERS_TERMINATOR "=====\n" |
Functions | |
int | dirserv_read_measured_bandwidths (const char *from_file, smartlist_t *routerstatuses, smartlist_t *bw_file_headers, uint8_t *digest_out) |
int | dirserv_query_measured_bw_cache_kb (const char *node_id, long *bw_out, time_t *as_of_out) |
void | dirserv_clear_measured_bw_cache (void) |
int | dirserv_has_measured_bw (const char *node_id) |
int | dirserv_get_measured_bw_cache_size (void) |
void | dirserv_count_measured_bws (const smartlist_t *routers) |
int | dirserv_get_last_n_measured_bws (void) |
uint32_t | dirserv_get_credible_bandwidth_kb (const routerinfo_t *ri) |
#define BW_FILE_HEADERS_TERMINATOR "=====\n" |
#define MAX_BW_FILE_HEADER_COUNT_IN_VOTE 50 |
void dirserv_clear_measured_bw_cache | ( | void | ) |
void dirserv_count_measured_bws | ( | const smartlist_t * | routers | ) |
uint32_t dirserv_get_credible_bandwidth_kb | ( | const routerinfo_t * | ri | ) |
Return the bandwidth we believe for assigning flags; prefer measured over advertised, and if we have above a threshold quantity of measured bandwidths, we don't want to ever give flags to unmeasured routers, so return 0.
Definition at line 177 of file bwauth.c.
Referenced by dirauth_set_routerstatus_from_routerinfo(), and dirserv_thinks_router_is_unreliable().
int dirserv_get_last_n_measured_bws | ( | void | ) |
int dirserv_get_measured_bw_cache_size | ( | void | ) |
int dirserv_has_measured_bw | ( | const char * | node_id | ) |
Predicate wrapper for dirserv_query_measured_bw_cache()
Definition at line 159 of file bwauth.c.
Referenced by dirserv_count_measured_bws(), and router_counts_toward_thresholds().
int dirserv_query_measured_bw_cache_kb | ( | const char * | node_id, |
long * | bw_kb_out, | ||
time_t * | as_of_out | ||
) |
Query the cache by identity digest, return value indicates whether we found it. The bw_out and as_of_out pointers receive the cached bandwidth value and the time it was cached if not NULL.
Definition at line 138 of file bwauth.c.
Referenced by dirserv_get_bandwidth_for_router_kb(), dirserv_get_credible_bandwidth_kb(), and dirserv_has_measured_bw().
int dirserv_read_measured_bandwidths | ( | const char * | from_file, |
smartlist_t * | routerstatuses, | ||
smartlist_t * | bw_file_headers, | ||
uint8_t * | digest_out | ||
) |
Read the measured bandwidth list from_file:
Returns -1 on error, 0 otherwise.
If the file can't be read, or is empty:
Otherwise, if there is an error later in the file: