prop289: Move SENDME cell processing in a separate function
[tor.git] / src / feature / hs_common / shared_random_client.h
blob95fe2c65abcaf546f8c1449f084a7c0b728b5f78
1 /* Copyright (c) 2018-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
4 /**
5 * \file shared_random_client.h
6 * \brief Header file for shared_random_client.c.
7 **/
9 #ifndef TOR_SHARED_RANDOM_CLIENT_H
10 #define TOR_SHARED_RANDOM_CLIENT_H
12 /* Dirauth module. */
13 #include "feature/dirauth/shared_random.h"
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);
19 /* Control port functions. */
20 char *sr_get_current_for_control(void);
21 char *sr_get_previous_for_control(void);
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);
29 * Shared Random State API
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
37 time_t sr_state_get_start_time_of_current_protocol_run(void);
38 time_t sr_state_get_start_time_of_previous_protocol_run(void);
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);
43 #ifdef TOR_UNIT_TESTS
45 #endif /* TOR_UNIT_TESTS */
47 #endif /* TOR_SHARED_RANDOM_CLIENT_H */