tor  master
shared_random_client.h
Go to the documentation of this file.
1 /* Copyright (c) 2018, 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 "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 
38 unsigned int sr_state_get_phase_duration(void);
39 unsigned int sr_state_get_protocol_run_duration(void);
40 time_t get_start_time_of_current_round(void);
41 
42 #ifdef TOR_UNIT_TESTS
43 
44 #endif /* TOR_UNIT_TESTS */
45 
46 #endif /* TOR_SHARED_RANDOM_CLIENT_H */
47 
unsigned int sr_state_get_phase_duration(void)
Definition: shared_random_client.c:247
Definition: container.h:18
Definition: or.h:2687
Definition: shared_random.h:60
time_t sr_state_get_start_time_of_current_protocol_run(time_t now)
Definition: shared_random_client.c:228
unsigned int sr_state_get_protocol_run_duration(void)
Definition: shared_random_client.c:254