31 sr_srv_encode(srv_hash_encoded,
sizeof(srv_hash_encoded), srv);
40 #define DEFAULT_NETWORK_VOTING_INTERVAL (3600)
41 #define TESTING_DEFAULT_NETWORK_VOTING_INTERVAL (20)
48 #define ASSUME_AUTHORITY_SCHEDULING 1
50 #define ASSUME_AUTHORITY_SCHEDULING 0
77 interval = TESTING_DEFAULT_NETWORK_VOTING_INTERVAL;
104 sizeof(srv->
value), 0);
108 strlcpy(dst, buf, dst_len);
119 if (c && c->
sr_info.current_srv) {
122 srv_str = tor_strdup(
"");
135 if (c && c->
sr_info.previous_srv) {
138 srv_str = tor_strdup(
"");
159 tor_assert_nonfatal(consensus);
162 return consensus->
sr_info.current_srv;
183 tor_assert_nonfatal(consensus);
186 return consensus->
sr_info.previous_srv;
203 uint64_t num_reveals;
208 if (smartlist_len(args) < 2) {
214 10, 0, UINT64_MAX, &ok, NULL);
219 value = smartlist_get(args, 1);
224 srv = tor_malloc_zero(
sizeof(*srv));
231 if (ret !=
sizeof(srv->
value)) {
247 int total_rounds = SHARED_RANDOM_N_ROUNDS * SHARED_RANDOM_N_PHASES;
249 time_t beginning_of_curr_round;
278 curr_round_slot = (beginning_of_curr_round / voting_interval) % total_rounds;
282 time_t time_elapsed_since_start_of_run = curr_round_slot * voting_interval;
284 return beginning_of_curr_round - time_elapsed_since_start_of_run;
292 time_t start_time_of_current_run =
312 int total_protocol_rounds = SHARED_RANDOM_N_ROUNDS * SHARED_RANDOM_N_PHASES;
int authdir_mode(const or_options_t *options)
Header file for directory authority mode.
int base64_decode(char *dest, size_t destlen, const char *src, size_t srclen)
int base64_encode(char *dest, size_t destlen, const char *src, size_t srclen, int flags)
const or_options_t * get_options(void)
Header file for config.c.
int usable_consensus_flavor(void)
Header file for microdesc.c.
time_t voting_sched_get_start_of_interval_after(time_t now, int interval, int offset)
networkstatus_t * networkstatus_get_reasonably_live_consensus(time_t now, int flavor)
networkstatus_t * networkstatus_get_latest_consensus(void)
Header file for networkstatus.c.
Networkstatus consensus/vote structure.
uint64_t tor_parse_uint64(const char *s, int base, uint64_t min, uint64_t max, int *ok, char **next)
int tor_asprintf(char **strp, const char *fmt,...)
#define SR_SRV_VALUE_BASE64_LEN
char * sr_get_previous_for_control(void)
sr_srv_t * sr_parse_srv(const smartlist_t *args)
int get_voting_interval(void)
const sr_srv_t * sr_get_previous(const networkstatus_t *ns)
time_t sr_state_get_start_time_of_previous_protocol_run(void)
unsigned int sr_state_get_protocol_run_duration(void)
void sr_srv_encode(char *dst, size_t dst_len, const sr_srv_t *srv)
char * sr_get_current_for_control(void)
time_t sr_state_get_start_time_of_current_protocol_run(void)
#define DEFAULT_NETWORK_VOTING_INTERVAL
unsigned int sr_state_get_phase_duration(void)
static char * srv_to_control_string(const sr_srv_t *srv)
const sr_srv_t * sr_get_current(const networkstatus_t *ns)
Header file for shared_random_client.c.
networkstatus_sr_info_t sr_info
uint8_t value[DIGEST256_LEN]
int dirauth_sched_get_configured_interval(void)
time_t dirauth_sched_get_cur_valid_after_time(void)
Header file for voting_schedule.c.