tor
master
|
Header file for microdesc.c. More...
Go to the source code of this file.
Macros | |
#define | microdesc_free(md) |
Header file for microdesc.c.
#define microdesc_free | ( | md | ) |
microdesc_cache_t* get_microdesc_cache | ( | void | ) |
Return a pointer to the microdescriptor cache, loading it if necessary.
void microdesc_cache_clean | ( | microdesc_cache_t * | cache, |
time_t | cutoff, | ||
int | force | ||
) |
Remove all microdescriptors from cache that haven't been listed for a long time. Does not rebuild the cache on disk. If cutoff is positive, specifically remove microdescriptors that have been unlisted since cutoff. If force is true, remove microdescriptors even if we have no current live microdescriptor consensus.
void microdesc_cache_clear | ( | microdesc_cache_t * | cache | ) |
Remove every microdescriptor in cache.
microdesc_t* microdesc_cache_lookup_by_digest256 | ( | microdesc_cache_t * | cache, |
const char * | d | ||
) |
If there is a microdescriptor in cache whose sha256 digest is d, return it. Otherwise return NULL.
int microdesc_cache_rebuild | ( | microdesc_cache_t * | cache, |
int | force | ||
) |
Regenerate the main cache file for cache, clear the journal file, and update every microdesc_t in the cache with pointers to its new location. If force is true, do this unconditionally. If force is false, do it only if we expect to save space on disk.
int microdesc_cache_reload | ( | microdesc_cache_t * | cache | ) |
Reload the contents of cache from disk. If it is empty, load it for the first time. Return 0 on success, -1 on failure.
void microdesc_check_counts | ( | void | ) |
Make sure that the reference count of every microdescriptor in cache is accurate.
void microdesc_free_ | ( | microdesc_t * | md, |
const char * | fname, | ||
int | lineno | ||
) |
Deallocate a single microdescriptor. Note: the microdescriptor MUST have previously been removed from the cache if it had ever been inserted.
void microdesc_free_all | ( | void | ) |
Free all storage held in the microdesc.c module.
smartlist_t* microdesc_list_missing_digest256 | ( | networkstatus_t * | ns, |
microdesc_cache_t * | cache, | ||
int | downloadable_only, | ||
digest256map_t * | skip | ||
) |
Return a smartlist of all the sha256 digest of the microdescriptors that are listed in ns but not present in cache. Returns pointers to internals of ns; you should not free the members of the resulting smartlist. Omit all microdescriptors whose digest appear in skip.
int microdesc_relay_is_outdated_dirserver | ( | const char * | relay_digest | ) |
Return True if the relay with relay_digest (size DIGEST_LEN) is an outdated dirserver
void microdesc_reset_outdated_dirservers_list | ( | void | ) |
Reset the list of outdated dirservers.
smartlist_t* microdescs_add_list_to_cache | ( | microdesc_cache_t * | cache, |
smartlist_t * | descriptors, | ||
saved_location_t | where, | ||
int | no_save | ||
) |
As microdescs_add_to_cache, but takes a list of microdescriptors instead of a string to decode. Frees any members of descriptors that it does not add.
smartlist_t* microdescs_add_to_cache | ( | microdesc_cache_t * | cache, |
const char * | s, | ||
const char * | eos, | ||
saved_location_t | where, | ||
int | no_save, | ||
time_t | listed_at, | ||
smartlist_t * | requested_digests256 | ||
) |
Decode the microdescriptors from the string starting at s and ending at eos, and store them in cache. If no_save, mark them as non-writable to disk. If where is SAVED_IN_CACHE, leave their bodies as pointers to the mmap'd cache. If where is SAVED_NOWHERE, do not allow annotations. If listed_at is not -1, set the last_listed field of every microdesc to listed_at. If requested_digests is non-null, then it contains a list of digests we mean to allow, so we should reject any non-requested microdesc with a different digest, and alter the list to contain only the digests of those microdescs we didn't find. Return a newly allocated list of the added microdescriptors, or NULL
void update_microdesc_downloads | ( | time_t | now | ) |
Launch download requests for microdescriptors as appropriate.
Specifically, we should launch download requests if we are configured to download mirodescriptors, and there are some microdescriptors listed in the current microdesc consensus that we don't have, and either we never asked for them, or we failed to download them but we're willing to retry.
void update_microdescs_from_networkstatus | ( | time_t | now | ) |
For every microdescriptor listed in the current microdescriptor consensus, update its last_listed field to be at least as recent as the publication time of the current microdescriptor consensus.
int we_fetch_microdescriptors | ( | const or_options_t * | options | ) |
Return true iff we should try to download microdescriptors at all.
int we_fetch_router_descriptors | ( | const or_options_t * | options | ) |
Return true iff we should try to download router descriptors at all.
int we_use_microdescriptors_for_circuits | ( | const or_options_t * | options | ) |
Return true iff we should prefer to use microdescriptors rather than routerdescs for building circuits.