Tor  0.4.7.0-alpha-dev
shared_random_client.h
Go to the documentation of this file.
1 /* Copyright (c) 2018-2021, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
4 /**
5  * \file shared_random_client.h
6  * \brief Header file for shared_random_client.c.
7  **/
8 
9 #ifndef TOR_SHARED_RANDOM_CLIENT_H
10 #define TOR_SHARED_RANDOM_CLIENT_H
11 
12 /* Dirauth module. */
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 
42 #ifdef TOR_UNIT_TESTS
43 
44 #endif /* TOR_UNIT_TESTS */
45 
46 #endif /* !defined(TOR_SHARED_RANDOM_CLIENT_H) */
This file contains ABI/API of the shared random protocol defined in proposal #250....
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)
unsigned int sr_state_get_phase_duration(void)
const sr_srv_t * sr_get_current(const networkstatus_t *ns)