Tor
0.4.7.0-alpha-dev
|
Header file for dircollate.c. More...
Go to the source code of this file.
Macros | |
#define | dircollator_free(c) FREE_AND_NULL(dircollator_t, dircollator_free_, (c)) |
Typedefs | |
typedef struct dircollator_t | dircollator_t |
Functions | |
dircollator_t * | dircollator_new (int n_votes, int n_authorities) |
void | dircollator_free_ (dircollator_t *obj) |
void | dircollator_add_vote (dircollator_t *dc, networkstatus_t *v) |
void | dircollator_collate (dircollator_t *dc, int consensus_method) |
int | dircollator_n_routers (dircollator_t *dc) |
vote_routerstatus_t ** | dircollator_get_votes_for_router (dircollator_t *dc, int idx) |
Header file for dircollate.c.
Definition in file dircollate.h.
void dircollator_add_vote | ( | dircollator_t * | dc, |
networkstatus_t * | v | ||
) |
Add a single vote v to a dircollator dc. This function must be called exactly once for each vote to be used in the consensus. It may only be called before dircollator_collate().
Definition at line 194 of file dircollate.c.
void dircollator_collate | ( | dircollator_t * | dc, |
int | consensus_method | ||
) |
Sort the entries in dc according to consensus_method, so that the consensus process can iterate over them with dircollator_n_routers() and dircollator_get_votes_for_router().
Definition at line 211 of file dircollate.c.
void dircollator_free_ | ( | dircollator_t * | dc | ) |
Release all storage held by dc.
Definition at line 166 of file dircollate.c.
vote_routerstatus_t** dircollator_get_votes_for_router | ( | dircollator_t * | dc, |
int | idx | ||
) |
Return an array of vote_routerstatus_t entries for the idxth router in the collation order. Each array contains n_votes elements, where the nth element of the array is the vote_routerstatus_t from the nth voter for this identity (or NULL if there is no such entry).
The maximum value for idx is dircollator_n_routers().
This function may only be called after dircollator_collate.
Definition at line 320 of file dircollate.c.
int dircollator_n_routers | ( | dircollator_t * | dc | ) |
Return the total number of collated router entries. This function may only be called after dircollator_collate.
Definition at line 305 of file dircollate.c.
dircollator_t* dircollator_new | ( | int | n_votes, |
int | n_authorities | ||
) |
Create and return a new dircollator object to use when collating n_votes out of a total of n_authorities.
Definition at line 149 of file dircollate.c.