tor  0.4.2.0-alpha-dev
shared_random_client.h
Go to the documentation of this file.
1 /* Copyright (c) 2018-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
9 #ifndef TOR_SHARED_RANDOM_CLIENT_H
10 #define TOR_SHARED_RANDOM_CLIENT_H
11 
12 /* Dirauth module. */
13 #include "feature/dirauth/shared_random.h"
14 
15 /* Helper functions. */
16 void sr_srv_encode(char *dst, size_t dst_len, const sr_srv_t *srv);
17 int get_voting_interval(void);
18 
19 /* Control port functions. */
20 char *sr_get_current_for_control(void);
21 char *sr_get_previous_for_control(void);
22 
23 /* SRV functions. */
24 const sr_srv_t *sr_get_current(const networkstatus_t *ns);
25 const sr_srv_t *sr_get_previous(const networkstatus_t *ns);
26 sr_srv_t *sr_parse_srv(const smartlist_t *args);
27 
28 /*
29  * Shared Random State API
30  */
31 
32 /* Each protocol phase has 12 rounds */
33 #define SHARED_RANDOM_N_ROUNDS 12
34 /* Number of phase we have in a protocol. */
35 #define SHARED_RANDOM_N_PHASES 2
36 
39 unsigned int sr_state_get_phase_duration(void);
40 unsigned int sr_state_get_protocol_run_duration(void);
41 time_t get_start_time_of_current_round(void);
42 
43 #ifdef TOR_UNIT_TESTS
44 
45 #endif /* TOR_UNIT_TESTS */
46 
47 #endif /* !defined(TOR_SHARED_RANDOM_CLIENT_H) */
48 
time_t sr_state_get_start_time_of_previous_protocol_run(void)
unsigned int sr_state_get_phase_duration(void)
time_t sr_state_get_start_time_of_current_protocol_run(void)
unsigned int sr_state_get_protocol_run_duration(void)