consdiffmgr.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* Copyright (c) 2017, The Tor Project, Inc. */
  2. /* See LICENSE for licensing information */
  3. #ifndef TOR_CONSDIFFMGR_H
  4. #define TOR_CONSDIFFMGR_H
  5. /**
  6. * Possible outcomes from trying to look up a given consensus diff.
  7. */
  8. typedef enum consdiff_status_t {
  9. CONSDIFF_AVAILABLE,
  10. CONSDIFF_NOT_FOUND,
  11. CONSDIFF_IN_PROGRESS,
  12. } consdiff_status_t;
  13. typedef struct consdiff_cfg_t {
  14. uint32_t cache_max_age_hours;
  15. uint32_t cache_max_num;
  16. } consdiff_cfg_t;
  17. struct consensus_cache_entry_t; // from conscache.h
  18. int consdiffmgr_add_consensus(const char *consensus,
  19. const networkstatus_t *as_parsed);
  20. consdiff_status_t consdiffmgr_find_diff_from(
  21. struct consensus_cache_entry_t **entry_out,
  22. consensus_flavor_t flavor,
  23. int digest_type,
  24. const uint8_t *digest,
  25. size_t digestlen);
  26. void consdiffmgr_rescan(void);
  27. int consdiffmgr_cleanup(void);
  28. void consdiffmgr_configure(const consdiff_cfg_t *cfg);
  29. void consdiffmgr_free_all(void);
  30. #endif