shared_random_client.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Copyright (c) 2018, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. /**
  4. * \file shared_random_client.h
  5. * \brief Header file for shared_random_client.c.
  6. **/
  7. #ifndef TOR_SHARED_RANDOM_CLIENT_H
  8. #define TOR_SHARED_RANDOM_CLIENT_H
  9. /* Dirauth module. */
  10. #include "dirauth/shared_random.h"
  11. /* Helper functions. */
  12. void sr_srv_encode(char *dst, size_t dst_len, const sr_srv_t *srv);
  13. int get_voting_interval(void);
  14. /* Control port functions. */
  15. char *sr_get_current_for_control(void);
  16. char *sr_get_previous_for_control(void);
  17. /* SRV functions. */
  18. const sr_srv_t *sr_get_current(const networkstatus_t *ns);
  19. const sr_srv_t *sr_get_previous(const networkstatus_t *ns);
  20. sr_srv_t *sr_parse_srv(const smartlist_t *args);
  21. /*
  22. * Shared Random State API
  23. */
  24. /* Each protocol phase has 12 rounds */
  25. #define SHARED_RANDOM_N_ROUNDS 12
  26. /* Number of phase we have in a protocol. */
  27. #define SHARED_RANDOM_N_PHASES 2
  28. time_t sr_state_get_start_time_of_current_protocol_run(time_t now);
  29. unsigned int sr_state_get_phase_duration(void);
  30. unsigned int sr_state_get_protocol_run_duration(void);
  31. time_t get_start_time_of_current_round(void);
  32. #ifdef TOR_UNIT_TESTS
  33. #endif /* TOR_UNIT_TESTS */
  34. #endif /* TOR_SHARED_RANDOM_CLIENT_H */