Tor  0.4.7.0-alpha-dev
Macros | Functions
shared_random_client.h File Reference

Header file for shared_random_client.c. More...

#include "feature/dirauth/shared_random.h"

Go to the source code of this file.

Macros

#define SHARED_RANDOM_N_ROUNDS   12
 
#define SHARED_RANDOM_N_PHASES   2
 

Functions

void sr_srv_encode (char *dst, size_t dst_len, const sr_srv_t *srv)
 
int get_voting_interval (void)
 
char * sr_get_current_for_control (void)
 
char * sr_get_previous_for_control (void)
 
const sr_srv_tsr_get_current (const networkstatus_t *ns)
 
const sr_srv_tsr_get_previous (const networkstatus_t *ns)
 
sr_srv_tsr_parse_srv (const smartlist_t *args)
 
time_t sr_state_get_start_time_of_current_protocol_run (void)
 
time_t sr_state_get_start_time_of_previous_protocol_run (void)
 
unsigned int sr_state_get_phase_duration (void)
 
unsigned int sr_state_get_protocol_run_duration (void)
 

Detailed Description

Header file for shared_random_client.c.

Definition in file shared_random_client.h.

Function Documentation

◆ get_voting_interval()

int get_voting_interval ( void  )

Return the voting interval of the tor vote subsystem.

Definition at line 55 of file shared_random_client.c.

◆ sr_get_current()

const sr_srv_t* sr_get_current ( const networkstatus_t ns)

Return current shared random value from the latest consensus. Caller can NOT keep a reference to the returned pointer. Return NULL if none.

Definition at line 146 of file shared_random_client.c.

◆ sr_get_current_for_control()

char* sr_get_current_for_control ( void  )

Return the current SRV string representation for the control port. Return a newly allocated string on success containing the value else "" if not found or if we don't have a valid consensus yet.

Definition at line 115 of file shared_random_client.c.

Referenced by getinfo_helper_sr().

◆ sr_get_previous()

const sr_srv_t* sr_get_previous ( const networkstatus_t ns)

Return previous shared random value from the latest consensus. Caller can NOT keep a reference to the returned pointer. Return NULL if none.

Definition at line 170 of file shared_random_client.c.

◆ sr_get_previous_for_control()

char* sr_get_previous_for_control ( void  )

Return the previous SRV string representation for the control port. Return a newly allocated string on success containing the value else "" if not found or if we don't have a valid consensus yet.

Definition at line 131 of file shared_random_client.c.

Referenced by getinfo_helper_sr().

◆ sr_parse_srv()

sr_srv_t* sr_parse_srv ( const smartlist_t args)

Parse a list of arguments from a SRV value either from a vote, consensus or from our disk state and return a newly allocated srv object. NULL is returned on error.

The arguments' order: num_reveals, value

Definition at line 199 of file shared_random_client.c.

◆ sr_srv_encode()

void sr_srv_encode ( char *  dst,
size_t  dst_len,
const sr_srv_t srv 
)

Encode the given shared random value and put it in dst. Destination buffer must be at least SR_SRV_VALUE_BASE64_LEN plus the NULL byte.

Definition at line 93 of file shared_random_client.c.

Referenced by disk_state_put_srv_line(), srv_to_control_string(), and srv_to_ns_string().

◆ sr_state_get_phase_duration()

unsigned int sr_state_get_phase_duration ( void  )

Return the time (in seconds) it takes to complete a full SR protocol phase (e.g. the commit phase).

Definition at line 303 of file shared_random_client.c.

Referenced by hs_get_start_time_of_next_time_period(), and hs_get_time_period_num().

◆ sr_state_get_protocol_run_duration()

unsigned int sr_state_get_protocol_run_duration ( void  )

Return the time (in seconds) it takes to complete a full SR protocol run

Definition at line 310 of file shared_random_client.c.

Referenced by get_time_period_length(), set_rotation_time(), and sr_state_get_start_time_of_previous_protocol_run().

◆ sr_state_get_start_time_of_current_protocol_run()

time_t sr_state_get_start_time_of_current_protocol_run ( void  )

Return the start time of the current SR protocol run using the times from the current consensus. For example, if the latest consensus valid-after is 23/06/2017 23:00:00 and a full SR protocol run is 24 hours, this function returns 23/06/2017 00:00:00.

Definition at line 245 of file shared_random_client.c.

Referenced by hs_in_period_between_tp_and_srv(), set_descriptor_revision_counter(), set_rotation_time(), and sr_state_get_start_time_of_previous_protocol_run().

◆ sr_state_get_start_time_of_previous_protocol_run()

time_t sr_state_get_start_time_of_previous_protocol_run ( void  )

Return the start time of the previous SR protocol run. See sr_state_get_start_time_of_current_protocol_run() for more details.

Definition at line 290 of file shared_random_client.c.

Referenced by set_descriptor_revision_counter().